]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/turrets
authorMario <zacjardine@y7mail.com>
Tue, 14 Apr 2015 22:22:35 +0000 (08:22 +1000)
committerMario <zacjardine@y7mail.com>
Tue, 14 Apr 2015 22:22:35 +0000 (08:22 +1000)
Conflicts:
qcsrc/client/progs.src
qcsrc/client/tturrets.qh
qcsrc/server/mutators/gamemode_onslaught.qc
qcsrc/server/progs.src
qcsrc/server/tturrets/include/turrets.qh
qcsrc/server/tturrets/include/turrets_early.qh
qcsrc/server/tturrets/system/system_aimprocs.qc
qcsrc/server/tturrets/system/system_damage.qc
qcsrc/server/tturrets/system/system_misc.qc
qcsrc/server/tturrets/units/unit_hellion.qc
qcsrc/server/tturrets/units/unit_hk.qc
qcsrc/server/tturrets/units/unit_mlrs.qc
qcsrc/server/tturrets/units/unit_phaser.qc

1229 files changed:
_hud_descriptions.cfg
bal-wep-xonotic.cfg
bal-wep-xpm.cfg
balance-xonotic.cfg
balance-xpm.cfg
binds-default.cfg [deleted file]
binds-xonotic.cfg [new file with mode: 0644]
crosshairs.cfg
defaultXonotic.cfg
gfx/crosshair31.tga [new file with mode: 0644]
gfx/crosshair32.tga [new file with mode: 0644]
gfx/crosshair33.tga [new file with mode: 0644]
gfx/crosshair34.tga [new file with mode: 0644]
gfx/crosshair35.tga [new file with mode: 0644]
gfx/crosshair36.tga [new file with mode: 0644]
gfx/crosshair37.tga [new file with mode: 0644]
gfx/crosshair38.tga [new file with mode: 0644]
gfx/crosshair39.tga [new file with mode: 0644]
gfx/crosshair40.tga [new file with mode: 0644]
gfx/crosshair41.tga [new file with mode: 0644]
gfx/crosshair42.tga [new file with mode: 0644]
gfx/crosshair43.tga [new file with mode: 0644]
gfx/crosshair44.tga [new file with mode: 0644]
gfx/crosshair45.tga [new file with mode: 0644]
gfx/crosshair46.tga [new file with mode: 0644]
gfx/crosshair47.tga [new file with mode: 0644]
gfx/crosshair48.tga [new file with mode: 0644]
gfx/crosshair49.tga [new file with mode: 0644]
gfx/crosshair50.tga [new file with mode: 0644]
gfx/crosshair51.tga [new file with mode: 0644]
gfx/crosshair52.tga [new file with mode: 0644]
gfx/crosshair53.tga [new file with mode: 0644]
gfx/crosshair54.tga [new file with mode: 0644]
gfx/crosshair55.tga [new file with mode: 0644]
gfx/crosshair56.tga [new file with mode: 0644]
gfx/crosshair57.tga [new file with mode: 0644]
gfx/crosshair58.tga [new file with mode: 0644]
gfx/crosshair59.tga [new file with mode: 0644]
gfx/crosshair60.tga [new file with mode: 0644]
gfx/crosshair61.tga [new file with mode: 0644]
gfx/crosshair62.tga [new file with mode: 0644]
gfx/crosshair63.tga [new file with mode: 0644]
gfx/crosshair64.tga [new file with mode: 0644]
gfx/crosshair65.tga [new file with mode: 0644]
gfx/crosshair66.tga [new file with mode: 0644]
gfx/crosshaircalibrate.tga [new file with mode: 0644]
gfx/crosshairdot.tga
gfx/crosshairmoustache.tga [new file with mode: 0644]
gfx/crosshairtuba.tga
gfx/hud/default/kh_blue.tga [deleted file]
gfx/hud/default/kh_blue_carrying.tga [new file with mode: 0644]
gfx/hud/default/kh_blue_taken.tga [new file with mode: 0644]
gfx/hud/default/kh_bluearrow.tga [deleted file]
gfx/hud/default/kh_dropped.tga [new file with mode: 0644]
gfx/hud/default/kh_pink.tga [deleted file]
gfx/hud/default/kh_pink_carrying.tga [new file with mode: 0644]
gfx/hud/default/kh_pink_taken.tga [new file with mode: 0644]
gfx/hud/default/kh_pinkarrow.tga [deleted file]
gfx/hud/default/kh_red.tga [deleted file]
gfx/hud/default/kh_red_carrying.tga [new file with mode: 0644]
gfx/hud/default/kh_red_taken.tga [new file with mode: 0644]
gfx/hud/default/kh_redarrow.tga [deleted file]
gfx/hud/default/kh_yellow.tga [deleted file]
gfx/hud/default/kh_yellow_carrying.tga [new file with mode: 0644]
gfx/hud/default/kh_yellow_taken.tga [new file with mode: 0644]
gfx/hud/default/kh_yellowarrow.tga [deleted file]
gfx/hud/luma/accelbar.tga [new file with mode: 0644]
gfx/hud/luma/ammo_bullets.tga [new file with mode: 0644]
gfx/hud/luma/ammo_cells.tga [new file with mode: 0644]
gfx/hud/luma/ammo_current_bg.tga [new file with mode: 0644]
gfx/hud/luma/ammo_fuel.tga [new file with mode: 0644]
gfx/hud/luma/ammo_plasma.tga [new file with mode: 0644]
gfx/hud/luma/ammo_rockets.tga [new file with mode: 0644]
gfx/hud/luma/ammo_shells.tga [new file with mode: 0644]
gfx/hud/luma/ammo_supercells.tga [new file with mode: 0644]
gfx/hud/luma/armor.tga [new file with mode: 0644]
gfx/hud/luma/border_corner_northeast.tga [new file with mode: 0644]
gfx/hud/luma/border_corner_northwest.tga [new file with mode: 0644]
gfx/hud/luma/border_corner_southeast.tga [new file with mode: 0644]
gfx/hud/luma/border_corner_southwest.tga [new file with mode: 0644]
gfx/hud/luma/border_default.tga [new file with mode: 0644]
gfx/hud/luma/border_default_east.tga [new file with mode: 0644]
gfx/hud/luma/border_default_north.tga [new file with mode: 0644]
gfx/hud/luma/border_default_south.tga [new file with mode: 0644]
gfx/hud/luma/border_default_west.tga [new file with mode: 0644]
gfx/hud/luma/border_fading_east.tga [new file with mode: 0644]
gfx/hud/luma/border_fading_north.tga [new file with mode: 0644]
gfx/hud/luma/border_fading_south.tga [new file with mode: 0644]
gfx/hud/luma/border_fading_west.tga [new file with mode: 0644]
gfx/hud/luma/border_highlighted.tga [new file with mode: 0644]
gfx/hud/luma/border_highlighted2.tga [new file with mode: 0644]
gfx/hud/luma/border_plain.tga [new file with mode: 0644]
gfx/hud/luma/border_plain_east.tga [new file with mode: 0644]
gfx/hud/luma/border_plain_north.tga [new file with mode: 0644]
gfx/hud/luma/border_plain_south.tga [new file with mode: 0644]
gfx/hud/luma/border_plain_west.tga [new file with mode: 0644]
gfx/hud/luma/border_tab_east.tga [new file with mode: 0644]
gfx/hud/luma/border_tab_north.tga [new file with mode: 0644]
gfx/hud/luma/border_tab_south.tga [new file with mode: 0644]
gfx/hud/luma/border_tab_west.tga [new file with mode: 0644]
gfx/hud/luma/dom_icon_blue-highlighted.tga [new file with mode: 0644]
gfx/hud/luma/dom_icon_blue.tga [new file with mode: 0644]
gfx/hud/luma/dom_icon_pink-highlighted.tga [new file with mode: 0644]
gfx/hud/luma/dom_icon_pink.tga [new file with mode: 0644]
gfx/hud/luma/dom_icon_red-highlighted.tga [new file with mode: 0644]
gfx/hud/luma/dom_icon_red.tga [new file with mode: 0644]
gfx/hud/luma/dom_icon_yellow-highlighted.tga [new file with mode: 0644]
gfx/hud/luma/dom_icon_yellow.tga [new file with mode: 0644]
gfx/hud/luma/flag_blue_carrying.tga [new file with mode: 0644]
gfx/hud/luma/flag_blue_lost.tga [new file with mode: 0644]
gfx/hud/luma/flag_blue_shielded.tga [new file with mode: 0644]
gfx/hud/luma/flag_blue_taken.tga [new file with mode: 0644]
gfx/hud/luma/flag_neutral_carrying.tga [new file with mode: 0644]
gfx/hud/luma/flag_neutral_lost.tga [new file with mode: 0644]
gfx/hud/luma/flag_neutral_shielded.tga [new file with mode: 0644]
gfx/hud/luma/flag_neutral_taken.tga [new file with mode: 0644]
gfx/hud/luma/flag_pink_carrying.tga [new file with mode: 0644]
gfx/hud/luma/flag_pink_lost.tga [new file with mode: 0644]
gfx/hud/luma/flag_pink_shielded.tga [new file with mode: 0644]
gfx/hud/luma/flag_pink_taken.tga [new file with mode: 0644]
gfx/hud/luma/flag_red_carrying.tga [new file with mode: 0644]
gfx/hud/luma/flag_red_lost.tga [new file with mode: 0644]
gfx/hud/luma/flag_red_shielded.tga [new file with mode: 0644]
gfx/hud/luma/flag_red_taken.tga [new file with mode: 0644]
gfx/hud/luma/flag_yellow_carrying.tga [new file with mode: 0644]
gfx/hud/luma/flag_yellow_lost.tga [new file with mode: 0644]
gfx/hud/luma/flag_yellow_shielded.tga [new file with mode: 0644]
gfx/hud/luma/flag_yellow_taken.tga [new file with mode: 0644]
gfx/hud/luma/health.tga [new file with mode: 0644]
gfx/hud/luma/keepawayball_carrying.tga [new file with mode: 0644]
gfx/hud/luma/key_atck.tga [new file with mode: 0644]
gfx/hud/luma/key_atck2.tga [new file with mode: 0644]
gfx/hud/luma/key_atck2_inv.tga [new file with mode: 0644]
gfx/hud/luma/key_atck_inv.tga [new file with mode: 0644]
gfx/hud/luma/key_backward.tga [new file with mode: 0644]
gfx/hud/luma/key_backward_inv.tga [new file with mode: 0644]
gfx/hud/luma/key_crouch.tga [new file with mode: 0644]
gfx/hud/luma/key_crouch_inv.tga [new file with mode: 0644]
gfx/hud/luma/key_forward.tga [new file with mode: 0644]
gfx/hud/luma/key_forward_inv.tga [new file with mode: 0644]
gfx/hud/luma/key_jump.tga [new file with mode: 0644]
gfx/hud/luma/key_jump_inv.tga [new file with mode: 0644]
gfx/hud/luma/key_left.tga [new file with mode: 0644]
gfx/hud/luma/key_left_inv.tga [new file with mode: 0644]
gfx/hud/luma/key_right.tga [new file with mode: 0644]
gfx/hud/luma/key_right_inv.tga [new file with mode: 0644]
gfx/hud/luma/kh_blue_carrying.tga [new file with mode: 0644]
gfx/hud/luma/kh_blue_taken.tga [new file with mode: 0644]
gfx/hud/luma/kh_dropped.tga [new file with mode: 0644]
gfx/hud/luma/kh_pink_carrying.tga [new file with mode: 0644]
gfx/hud/luma/kh_pink_taken.tga [new file with mode: 0644]
gfx/hud/luma/kh_red_carrying.tga [new file with mode: 0644]
gfx/hud/luma/kh_red_taken.tga [new file with mode: 0644]
gfx/hud/luma/kh_yellow_carrying.tga [new file with mode: 0644]
gfx/hud/luma/kh_yellow_taken.tga [new file with mode: 0644]
gfx/hud/luma/nade_bg.tga [new file with mode: 0644]
gfx/hud/luma/nade_nbg.tga [new file with mode: 0644]
gfx/hud/luma/nexball_carrying.tga [new file with mode: 0644]
gfx/hud/luma/notify_balldropped.tga [new file with mode: 0644]
gfx/hud/luma/notify_ballpickedup.tga [new file with mode: 0644]
gfx/hud/luma/notify_blue_captured.tga [new file with mode: 0644]
gfx/hud/luma/notify_blue_carrying.tga [new file with mode: 0644]
gfx/hud/luma/notify_blue_lost.tga [new file with mode: 0644]
gfx/hud/luma/notify_blue_returned.tga [new file with mode: 0644]
gfx/hud/luma/notify_blue_shielded.tga [new file with mode: 0644]
gfx/hud/luma/notify_blue_taken.tga [new file with mode: 0644]
gfx/hud/luma/notify_camping.tga [new file with mode: 0644]
gfx/hud/luma/notify_death.tga [new file with mode: 0644]
gfx/hud/luma/notify_fall.tga [new file with mode: 0644]
gfx/hud/luma/notify_lava.tga [new file with mode: 0644]
gfx/hud/luma/notify_melee_shotgun.tga [new file with mode: 0644]
gfx/hud/luma/notify_nade.tga [new file with mode: 0644]
gfx/hud/luma/notify_nade_heal.tga [new file with mode: 0644]
gfx/hud/luma/notify_nade_ice.tga [new file with mode: 0644]
gfx/hud/luma/notify_nade_napalm.tga [new file with mode: 0644]
gfx/hud/luma/notify_neutral_carrying.tga [new file with mode: 0644]
gfx/hud/luma/notify_neutral_lost.tga [new file with mode: 0644]
gfx/hud/luma/notify_neutral_shielded.tga [new file with mode: 0644]
gfx/hud/luma/notify_neutral_taken.tga [new file with mode: 0644]
gfx/hud/luma/notify_outofammo.tga [new file with mode: 0644]
gfx/hud/luma/notify_pink_captured.tga [new file with mode: 0644]
gfx/hud/luma/notify_pink_carrying.tga [new file with mode: 0644]
gfx/hud/luma/notify_pink_lost.tga [new file with mode: 0644]
gfx/hud/luma/notify_pink_returned.tga [new file with mode: 0644]
gfx/hud/luma/notify_pink_shielded.tga [new file with mode: 0644]
gfx/hud/luma/notify_pink_taken.tga [new file with mode: 0644]
gfx/hud/luma/notify_red_captured.tga [new file with mode: 0644]
gfx/hud/luma/notify_red_carrying.tga [new file with mode: 0644]
gfx/hud/luma/notify_red_lost.tga [new file with mode: 0644]
gfx/hud/luma/notify_red_returned.tga [new file with mode: 0644]
gfx/hud/luma/notify_red_shielded.tga [new file with mode: 0644]
gfx/hud/luma/notify_red_taken.tga [new file with mode: 0644]
gfx/hud/luma/notify_selfkill.tga [new file with mode: 0644]
gfx/hud/luma/notify_shootingstar.tga [new file with mode: 0644]
gfx/hud/luma/notify_slime.tga [new file with mode: 0644]
gfx/hud/luma/notify_teamkill_blue.tga [new file with mode: 0644]
gfx/hud/luma/notify_teamkill_neutral.tga [new file with mode: 0644]
gfx/hud/luma/notify_teamkill_pink.tga [new file with mode: 0644]
gfx/hud/luma/notify_teamkill_red.tga [new file with mode: 0644]
gfx/hud/luma/notify_teamkill_yellow.tga [new file with mode: 0644]
gfx/hud/luma/notify_telefrag.tga [new file with mode: 0644]
gfx/hud/luma/notify_void.tga [new file with mode: 0644]
gfx/hud/luma/notify_water.tga [new file with mode: 0644]
gfx/hud/luma/notify_yellow_captured.tga [new file with mode: 0644]
gfx/hud/luma/notify_yellow_carrying.tga [new file with mode: 0644]
gfx/hud/luma/notify_yellow_lost.tga [new file with mode: 0644]
gfx/hud/luma/notify_yellow_returned.tga [new file with mode: 0644]
gfx/hud/luma/notify_yellow_shielded.tga [new file with mode: 0644]
gfx/hud/luma/notify_yellow_taken.tga [new file with mode: 0644]
gfx/hud/luma/num_leading.tga [new file with mode: 0644]
gfx/hud/luma/ok_weapon_rail.tga [new file with mode: 0644]
gfx/hud/luma/ok_weapon_shotgun.tga [new file with mode: 0644]
gfx/hud/luma/ok_weapon_smg.tga [new file with mode: 0644]
gfx/hud/luma/player_blue.tga [new file with mode: 0644]
gfx/hud/luma/player_neutral.tga [new file with mode: 0644]
gfx/hud/luma/player_pink.tga [new file with mode: 0644]
gfx/hud/luma/player_red.tga [new file with mode: 0644]
gfx/hud/luma/player_yellow.tga [new file with mode: 0644]
gfx/hud/luma/powerup_detonator.tga [new file with mode: 0644]
gfx/hud/luma/powerup_invisibility.tga [new file with mode: 0644]
gfx/hud/luma/powerup_resurrection.tga [new file with mode: 0644]
gfx/hud/luma/powerup_speed.tga [new file with mode: 0644]
gfx/hud/luma/powerup_ultrahealing.tga [new file with mode: 0644]
gfx/hud/luma/powerup_xray.tga [new file with mode: 0644]
gfx/hud/luma/progressbar.tga [new file with mode: 0644]
gfx/hud/luma/progressbar_vertical.tga [new file with mode: 0644]
gfx/hud/luma/race_newfail.tga [new file with mode: 0644]
gfx/hud/luma/race_newrankgreen.tga [new file with mode: 0644]
gfx/hud/luma/race_newrankyellow.tga [new file with mode: 0644]
gfx/hud/luma/race_newrecordserver.tga [new file with mode: 0644]
gfx/hud/luma/race_newtime.tga [new file with mode: 0644]
gfx/hud/luma/shield.tga [new file with mode: 0644]
gfx/hud/luma/strength.tga [new file with mode: 0644]
gfx/hud/luma/superweapons.tga [new file with mode: 0644]
gfx/hud/luma/voteprogress_back.tga [new file with mode: 0644]
gfx/hud/luma/voteprogress_prog.tga [new file with mode: 0644]
gfx/hud/luma/voteprogress_voted.tga [new file with mode: 0644]
gfx/hud/luma/weapon_accuracy.tga [new file with mode: 0644]
gfx/hud/luma/weapon_accuracy_north.tga [new file with mode: 0644]
gfx/hud/luma/weapon_accuracy_south.tga [new file with mode: 0644]
gfx/hud/luma/weapon_accuracy_west.tga [new file with mode: 0644]
gfx/hud/luma/weapon_ammo.tga [new file with mode: 0644]
gfx/hud/luma/weapon_complainbubble.tga [new file with mode: 0644]
gfx/hud/luma/weapon_current_bg.tga [new file with mode: 0644]
gfx/hud/luma/weapon_current_bg_north.tga [new file with mode: 0644]
gfx/hud/luma/weapon_current_bg_south.tga [new file with mode: 0644]
gfx/hud/luma/weapon_current_bg_west.tga [new file with mode: 0644]
gfx/hud/luma/weaponarc.tga [new file with mode: 0644]
gfx/hud/luma/weaponcrylink.tga [new file with mode: 0644]
gfx/hud/luma/weaponelectro.tga [new file with mode: 0644]
gfx/hud/luma/weaponfireball.tga [new file with mode: 0644]
gfx/hud/luma/weapongrenadelauncher.tga [new file with mode: 0644]
gfx/hud/luma/weaponhagar.tga [new file with mode: 0644]
gfx/hud/luma/weaponhlac.tga [new file with mode: 0644]
gfx/hud/luma/weaponhmg.tga [new file with mode: 0644]
gfx/hud/luma/weaponhook.tga [new file with mode: 0644]
gfx/hud/luma/weaponlaser.tga [new file with mode: 0644]
gfx/hud/luma/weaponminelayer.tga [new file with mode: 0644]
gfx/hud/luma/weaponminstanex.tga [new file with mode: 0644]
gfx/hud/luma/weaponnex.tga [new file with mode: 0644]
gfx/hud/luma/weaponporto.tga [new file with mode: 0644]
gfx/hud/luma/weaponrifle.tga [new file with mode: 0644]
gfx/hud/luma/weaponrocketlauncher.tga [new file with mode: 0644]
gfx/hud/luma/weaponrpc.tga [new file with mode: 0644]
gfx/hud/luma/weaponseeker.tga [new file with mode: 0644]
gfx/hud/luma/weaponshockwave.tga [new file with mode: 0644]
gfx/hud/luma/weaponshotgun.tga [new file with mode: 0644]
gfx/hud/luma/weapontuba.tga [new file with mode: 0644]
gfx/hud/luma/weaponuzi.tga [new file with mode: 0644]
gfx/hud/old/kh_blue.tga [deleted file]
gfx/hud/old/kh_bluearrow.tga [deleted file]
gfx/hud/old/kh_pink.tga [deleted file]
gfx/hud/old/kh_pinkarrow.tga [deleted file]
gfx/hud/old/kh_red.tga [deleted file]
gfx/hud/old/kh_redarrow.tga [deleted file]
gfx/hud/old/kh_yellow.tga [deleted file]
gfx/hud/old/kh_yellowarrow.tga [deleted file]
gfx/menu/luma/background.tga [new file with mode: 0644]
gfx/menu/luma/background_ingame.tga [new file with mode: 0644]
gfx/menu/luma/background_ingame_l2.tga [new file with mode: 0644]
gfx/menu/luma/background_l2.tga [new file with mode: 0644]
gfx/menu/luma/bigbutton_c.tga [new file with mode: 0644]
gfx/menu/luma/bigbutton_d.tga [new file with mode: 0644]
gfx/menu/luma/bigbutton_f.tga [new file with mode: 0644]
gfx/menu/luma/bigbutton_n.tga [new file with mode: 0644]
gfx/menu/luma/bigbuttongray_c.tga [new file with mode: 0644]
gfx/menu/luma/bigbuttongray_d.tga [new file with mode: 0644]
gfx/menu/luma/bigbuttongray_f.tga [new file with mode: 0644]
gfx/menu/luma/bigbuttongray_n.tga [new file with mode: 0644]
gfx/menu/luma/border.tga [new file with mode: 0644]
gfx/menu/luma/button_c.tga [new file with mode: 0644]
gfx/menu/luma/button_d.tga [new file with mode: 0644]
gfx/menu/luma/button_f.tga [new file with mode: 0644]
gfx/menu/luma/button_n.tga [new file with mode: 0644]
gfx/menu/luma/buttongray_c.tga [new file with mode: 0644]
gfx/menu/luma/buttongray_d.tga [new file with mode: 0644]
gfx/menu/luma/buttongray_f.tga [new file with mode: 0644]
gfx/menu/luma/buttongray_n.tga [new file with mode: 0644]
gfx/menu/luma/checkbox_c0.tga [new file with mode: 0644]
gfx/menu/luma/checkbox_c1.tga [new file with mode: 0644]
gfx/menu/luma/checkbox_d0.tga [new file with mode: 0644]
gfx/menu/luma/checkbox_d1.tga [new file with mode: 0644]
gfx/menu/luma/checkbox_f0.tga [new file with mode: 0644]
gfx/menu/luma/checkbox_f1.tga [new file with mode: 0644]
gfx/menu/luma/checkbox_n0.tga [new file with mode: 0644]
gfx/menu/luma/checkbox_n1.tga [new file with mode: 0644]
gfx/menu/luma/checkmark.tga [new file with mode: 0644]
gfx/menu/luma/clearbutton_c.tga [new file with mode: 0644]
gfx/menu/luma/clearbutton_f.tga [new file with mode: 0644]
gfx/menu/luma/clearbutton_n.tga [new file with mode: 0644]
gfx/menu/luma/closebutton_c.tga [new file with mode: 0644]
gfx/menu/luma/closebutton_f.tga [new file with mode: 0644]
gfx/menu/luma/closebutton_n.tga [new file with mode: 0644]
gfx/menu/luma/colorbutton_c.tga [new file with mode: 0644]
gfx/menu/luma/colorbutton_f.tga [new file with mode: 0644]
gfx/menu/luma/colorbutton_n.tga [new file with mode: 0644]
gfx/menu/luma/colorpicker.tga [new file with mode: 0755]
gfx/menu/luma/colorpicker_m.tga [new file with mode: 0644]
gfx/menu/luma/colorpicker_selected.tga [new file with mode: 0644]
gfx/menu/luma/crosshairbutton_c.tga [new file with mode: 0644]
gfx/menu/luma/crosshairbutton_d.tga [new file with mode: 0644]
gfx/menu/luma/crosshairbutton_f.tga [new file with mode: 0644]
gfx/menu/luma/crosshairbutton_n.tga [new file with mode: 0644]
gfx/menu/luma/cursor.tga [new file with mode: 0644]
gfx/menu/luma/cursor_move.tga [new file with mode: 0644]
gfx/menu/luma/cursor_resize.tga [new file with mode: 0644]
gfx/menu/luma/cursor_resize2.tga [new file with mode: 0644]
gfx/menu/luma/gametype_as.tga [new file with mode: 0644]
gfx/menu/luma/gametype_ca.tga [new file with mode: 0644]
gfx/menu/luma/gametype_ctf.tga [new file with mode: 0644]
gfx/menu/luma/gametype_cts.tga [new file with mode: 0644]
gfx/menu/luma/gametype_dm.tga [new file with mode: 0644]
gfx/menu/luma/gametype_dom.tga [new file with mode: 0644]
gfx/menu/luma/gametype_duel.tga [new file with mode: 0644]
gfx/menu/luma/gametype_ft.tga [new file with mode: 0644]
gfx/menu/luma/gametype_inf.tga [new file with mode: 0644]
gfx/menu/luma/gametype_inv.tga [new file with mode: 0644]
gfx/menu/luma/gametype_jb.tga [new file with mode: 0644]
gfx/menu/luma/gametype_ka.tga [new file with mode: 0644]
gfx/menu/luma/gametype_kh.tga [new file with mode: 0644]
gfx/menu/luma/gametype_lms.tga [new file with mode: 0644]
gfx/menu/luma/gametype_nb.tga [new file with mode: 0644]
gfx/menu/luma/gametype_ons.tga [new file with mode: 0644]
gfx/menu/luma/gametype_rc.tga [new file with mode: 0644]
gfx/menu/luma/gametype_tdm.tga [new file with mode: 0644]
gfx/menu/luma/gametype_vip.tga [new file with mode: 0644]
gfx/menu/luma/icon_aeslevel1.tga [new file with mode: 0644]
gfx/menu/luma/icon_aeslevel2.tga [new file with mode: 0644]
gfx/menu/luma/icon_aeslevel3.tga [new file with mode: 0644]
gfx/menu/luma/icon_aeslevel4.tga [new file with mode: 0644]
gfx/menu/luma/icon_aeslevel5.tga [new file with mode: 0644]
gfx/menu/luma/icon_mod_.tga [new file with mode: 0644]
gfx/menu/luma/icon_mod_MinstaGib.tga [new file with mode: 0644]
gfx/menu/luma/icon_mod_NewToys.tga [new file with mode: 0644]
gfx/menu/luma/icon_mod_Overkill.tga [new file with mode: 0644]
gfx/menu/luma/icon_mod_XDF.tga [new file with mode: 0644]
gfx/menu/luma/icon_pure1.tga [new file with mode: 0644]
gfx/menu/luma/icon_stats1.tga [new file with mode: 0644]
gfx/menu/luma/inputbox_f.tga [new file with mode: 0644]
gfx/menu/luma/inputbox_n.tga [new file with mode: 0644]
gfx/menu/luma/nopreview_map.tga [new file with mode: 0644]
gfx/menu/luma/nopreview_menuskin.tga [new file with mode: 0644]
gfx/menu/luma/nopreview_player.tga [new file with mode: 0644]
gfx/menu/luma/radiobutton_c0.tga [new file with mode: 0644]
gfx/menu/luma/radiobutton_c1.tga [new file with mode: 0644]
gfx/menu/luma/radiobutton_d0.tga [new file with mode: 0644]
gfx/menu/luma/radiobutton_d1.tga [new file with mode: 0644]
gfx/menu/luma/radiobutton_f0.tga [new file with mode: 0644]
gfx/menu/luma/radiobutton_f1.tga [new file with mode: 0644]
gfx/menu/luma/radiobutton_n0.tga [new file with mode: 0644]
gfx/menu/luma/radiobutton_n1.tga [new file with mode: 0644]
gfx/menu/luma/scrollbar_c.tga [new file with mode: 0644]
gfx/menu/luma/scrollbar_f.tga [new file with mode: 0644]
gfx/menu/luma/scrollbar_n.tga [new file with mode: 0644]
gfx/menu/luma/scrollbar_s.tga [new file with mode: 0644]
gfx/menu/luma/skinpreview.tga [new file with mode: 0644]
gfx/menu/luma/skinvalues.txt [new file with mode: 0644]
gfx/menu/luma/slider_c.tga [new file with mode: 0644]
gfx/menu/luma/slider_d.tga [new file with mode: 0644]
gfx/menu/luma/slider_f.tga [new file with mode: 0644]
gfx/menu/luma/slider_n.tga [new file with mode: 0644]
gfx/menu/luma/slider_s.tga [new file with mode: 0644]
gfx/menu/luma/tooltip.tga [new file with mode: 0644]
gfx/menu/luminos/icon_mod_instagib.tga [new file with mode: 0644]
gfx/menu/wickedx/icon_mod_instagib.tga [new file with mode: 0644]
gfx/menu/xaw/icon_mod_instagib.tga [new file with mode: 0644]
hud_luma.cfg [new file with mode: 0644]
hud_luminos.cfg
hud_luminos_minimal.cfg
hud_luminos_minimal_xhair.cfg
hud_luminos_old.cfg
hud_nexuiz.cfg
models/items/a_bullets_luma.iqm [new file with mode: 0644]
models/items/a_bullets_luma.iqm_0.skin [new file with mode: 0644]
models/items/a_bullets_luma.tga [new file with mode: 0644]
models/items/a_cells_luma.iqm [new file with mode: 0644]
models/items/a_cells_luma.iqm_0.skin [new file with mode: 0644]
models/items/a_cells_luma.tga [new file with mode: 0644]
models/items/a_plasma_luma.iqm [new file with mode: 0644]
models/items/a_plasma_luma.iqm_0.skin [new file with mode: 0644]
models/items/a_plasma_luma.tga [new file with mode: 0644]
models/items/a_rockets_luma.iqm [new file with mode: 0644]
models/items/a_rockets_luma.iqm_0.skin [new file with mode: 0644]
models/items/a_rockets_luma.tga [new file with mode: 0644]
models/items/a_shells_luma.iqm [new file with mode: 0644]
models/items/a_shells_luma.iqm_0.skin [new file with mode: 0644]
models/items/a_shells_luma.tga [new file with mode: 0644]
models/items/g_fuel_luma.iqm [new file with mode: 0644]
models/items/g_fuel_luma.iqm_0.skin [new file with mode: 0644]
models/items/g_fuel_luma.tga [new file with mode: 0644]
models/items/g_fuelregen_luma.iqm [new file with mode: 0644]
models/items/g_fuelregen_luma.iqm_0.skin [new file with mode: 0644]
models/items/g_fuelregen_luma.tga [new file with mode: 0644]
models/items/g_h100_luma.iqm [new file with mode: 0644]
models/items/g_h100_luma.iqm_0.skin [new file with mode: 0644]
models/items/g_h100_luma.tga [new file with mode: 0644]
models/items/g_h1_luma.iqm [new file with mode: 0644]
models/items/g_h1_luma.iqm_0.skin [new file with mode: 0644]
models/items/g_h1_luma.tga [new file with mode: 0644]
models/items/g_h25_luma.iqm [new file with mode: 0644]
models/items/g_h25_luma.iqm_0.skin [new file with mode: 0644]
models/items/g_h25_luma.tga [new file with mode: 0644]
models/items/g_h50_luma.iqm [new file with mode: 0644]
models/items/g_h50_luma.iqm_0.skin [new file with mode: 0644]
models/items/g_h50_luma.tga [new file with mode: 0644]
models/items/g_invincible_luma.iqm [new file with mode: 0644]
models/items/g_invincible_luma.iqm_0.skin [new file with mode: 0644]
models/items/g_invincible_luma.tga [new file with mode: 0644]
models/items/g_jetpack_luma.iqm [new file with mode: 0644]
models/items/g_jetpack_luma.iqm_0.skin [new file with mode: 0644]
models/items/g_jetpack_luma.tga [new file with mode: 0644]
models/items/g_strength_luma.iqm [new file with mode: 0644]
models/items/g_strength_luma.iqm_0.skin [new file with mode: 0644]
models/items/g_strength_luma.tga [new file with mode: 0644]
models/items/item_armor_big_luma.iqm [new file with mode: 0644]
models/items/item_armor_big_luma.iqm_0.skin [new file with mode: 0644]
models/items/item_armor_big_luma.tga [new file with mode: 0644]
models/items/item_armor_large_luma.iqm [new file with mode: 0644]
models/items/item_armor_large_luma.iqm_0.skin [new file with mode: 0644]
models/items/item_armor_large_luma.tga [new file with mode: 0644]
models/items/item_armor_medium_luma.iqm [new file with mode: 0644]
models/items/item_armor_medium_luma.iqm_0.skin [new file with mode: 0644]
models/items/item_armor_medium_luma.tga [new file with mode: 0644]
models/items/item_armor_small_luma.iqm [new file with mode: 0644]
models/items/item_armor_small_luma.iqm_0.skin [new file with mode: 0644]
models/items/item_armor_small_luma.tga [new file with mode: 0644]
models/items/powerup_detonator_luma.tga [new file with mode: 0644]
models/items/powerup_invisibility_luma.tga [new file with mode: 0644]
models/items/powerup_resurrection_luma.tga [new file with mode: 0644]
models/items/powerup_speed_luma.tga [new file with mode: 0644]
models/items/powerup_superweapon_luma.tga [new file with mode: 0644]
models/items/powerup_ultrahealing_luma.tga [new file with mode: 0644]
models/items/powerup_xray_luma.tga [new file with mode: 0644]
models/misc/chatbubble.spr_0.tga
models/misc/teambubble.spr_0.tga
models/weapons/g_arc_luma.iqm [new file with mode: 0644]
models/weapons/g_arc_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_arc_luma.tga [new file with mode: 0644]
models/weapons/g_campingrifle_luma.iqm [new file with mode: 0644]
models/weapons/g_campingrifle_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_campingrifle_luma.tga [new file with mode: 0644]
models/weapons/g_crylink_luma.iqm [new file with mode: 0644]
models/weapons/g_crylink_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_crylink_luma.tga [new file with mode: 0644]
models/weapons/g_electro_luma.iqm [new file with mode: 0644]
models/weapons/g_electro_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_electro_luma.tga [new file with mode: 0644]
models/weapons/g_fireball_luma.iqm [new file with mode: 0644]
models/weapons/g_fireball_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_fireball_luma.tga [new file with mode: 0644]
models/weapons/g_gl_luma.iqm [new file with mode: 0644]
models/weapons/g_gl_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_gl_luma.tga [new file with mode: 0644]
models/weapons/g_hagar_luma.iqm [new file with mode: 0644]
models/weapons/g_hagar_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_hagar_luma.tga [new file with mode: 0644]
models/weapons/g_hlac_luma.iqm [new file with mode: 0644]
models/weapons/g_hlac_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_hlac_luma.tga [new file with mode: 0644]
models/weapons/g_hookgun_luma.iqm [new file with mode: 0644]
models/weapons/g_hookgun_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_hookgun_luma.tga [new file with mode: 0644]
models/weapons/g_laser_luma.iqm [new file with mode: 0644]
models/weapons/g_laser_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_laser_luma.tga [new file with mode: 0644]
models/weapons/g_minelayer_luma.iqm [new file with mode: 0644]
models/weapons/g_minelayer_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_minelayer_luma.tga [new file with mode: 0644]
models/weapons/g_minstanex_luma.iqm [new file with mode: 0644]
models/weapons/g_minstanex_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_minstanex_luma.tga [new file with mode: 0644]
models/weapons/g_nex_luma.iqm [new file with mode: 0644]
models/weapons/g_nex_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_nex_luma.tga [new file with mode: 0644]
models/weapons/g_porto_luma.iqm [new file with mode: 0644]
models/weapons/g_porto_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_porto_luma.tga [new file with mode: 0644]
models/weapons/g_rl_luma.iqm [new file with mode: 0644]
models/weapons/g_rl_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_rl_luma.tga [new file with mode: 0644]
models/weapons/g_seeker_luma.iqm [new file with mode: 0644]
models/weapons/g_seeker_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_seeker_luma.tga [new file with mode: 0644]
models/weapons/g_shockwave_luma.iqm [new file with mode: 0644]
models/weapons/g_shockwave_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_shockwave_luma.tga [new file with mode: 0644]
models/weapons/g_shotgun_luma.iqm [new file with mode: 0644]
models/weapons/g_shotgun_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_shotgun_luma.tga [new file with mode: 0644]
models/weapons/g_tuba_luma.iqm [new file with mode: 0644]
models/weapons/g_tuba_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_tuba_luma.tga [new file with mode: 0644]
models/weapons/g_uzi_luma.iqm [new file with mode: 0644]
models/weapons/g_uzi_luma.iqm_0.skin [new file with mode: 0644]
models/weapons/g_uzi_luma.tga [new file with mode: 0644]
mutators.cfg
notifications.cfg
qcsrc/Makefile
qcsrc/client/Defs.qc [deleted file]
qcsrc/client/Main.qc [deleted file]
qcsrc/client/View.qc [deleted file]
qcsrc/client/announcer.qc
qcsrc/client/autocvars.qh
qcsrc/client/bgmscript.qc
qcsrc/client/bgmscript.qh
qcsrc/client/casings.qc
qcsrc/client/command/cl_cmd.qc
qcsrc/client/command/cl_cmd.qh
qcsrc/client/credit.txt
qcsrc/client/csqc_constants.qc
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/damage.qc
qcsrc/client/damage.qh
qcsrc/client/defs.qh [new file with mode: 0644]
qcsrc/client/effects.qc
qcsrc/client/gibs.qc
qcsrc/client/gibs.qh [new file with mode: 0644]
qcsrc/client/hook.qc
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/client/hud_config.qc
qcsrc/client/laser.qc
qcsrc/client/main.qc [new file with mode: 0644]
qcsrc/client/main.qh
qcsrc/client/mapvoting.qc
qcsrc/client/mapvoting.qh [new file with mode: 0644]
qcsrc/client/miscfunctions.qc
qcsrc/client/miscfunctions.qh [new file with mode: 0644]
qcsrc/client/modeleffects.qc
qcsrc/client/modeleffects.qh [new file with mode: 0644]
qcsrc/client/movetypes.qc
qcsrc/client/movetypes.qh
qcsrc/client/noise.qc
qcsrc/client/noise.qh
qcsrc/client/particles.qc
qcsrc/client/particles.qh [new file with mode: 0644]
qcsrc/client/player_skeleton.qc
qcsrc/client/player_skeleton.qh
qcsrc/client/prandom.qc
qcsrc/client/prandom.qh
qcsrc/client/progs.src
qcsrc/client/rubble.qc
qcsrc/client/rubble.qh [new file with mode: 0644]
qcsrc/client/scoreboard.qc
qcsrc/client/scoreboard.qh
qcsrc/client/shownames.qc
qcsrc/client/shownames.qh
qcsrc/client/sortlist.qc
qcsrc/client/sortlist.qh [new file with mode: 0644]
qcsrc/client/sys-post.qh [deleted file]
qcsrc/client/sys-pre.qh [deleted file]
qcsrc/client/target_music.qc
qcsrc/client/target_music.qh [new file with mode: 0644]
qcsrc/client/teamradar.qc
qcsrc/client/teamradar.qh
qcsrc/client/tturrets.qc [deleted file]
qcsrc/client/tuba.qc
qcsrc/client/tuba.qh [new file with mode: 0644]
qcsrc/client/vehicles/racer.qc [deleted file]
qcsrc/client/vehicles/raptor.qc [deleted file]
qcsrc/client/vehicles/spiderbot.qc [deleted file]
qcsrc/client/vehicles/vehicles.qc
qcsrc/client/vehicles/vehicles.qh
qcsrc/client/view.qc [new file with mode: 0644]
qcsrc/client/wall.qc
qcsrc/client/wall.qh [new file with mode: 0644]
qcsrc/client/waypointsprites.qc
qcsrc/client/waypointsprites.qh
qcsrc/client/weapons/projectile.qc
qcsrc/client/weapons/projectile.qh
qcsrc/common/animdecide.qc
qcsrc/common/animdecide.qh
qcsrc/common/buffs.qc
qcsrc/common/buffs.qh
qcsrc/common/campaign_common.qh
qcsrc/common/campaign_file.qc
qcsrc/common/campaign_setup.qc
qcsrc/common/command/generic.qc
qcsrc/common/command/generic.qh
qcsrc/common/command/markup.qc
qcsrc/common/command/markup.qh
qcsrc/common/command/rpn.qc
qcsrc/common/command/rpn.qh
qcsrc/common/command/shared_defs.qh
qcsrc/common/constants.qh
qcsrc/common/counting.qh
qcsrc/common/csqcmodel_settings.qh
qcsrc/common/deathtypes.qh
qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh
qcsrc/common/monsters/all.qh
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/zombie.qc
qcsrc/common/monsters/monsters.qc
qcsrc/common/monsters/monsters.qh
qcsrc/common/monsters/spawn.qc
qcsrc/common/monsters/spawn.qh
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/monsters/sv_monsters.qh
qcsrc/common/nades.qc
qcsrc/common/nades.qh
qcsrc/common/net_notice.qc
qcsrc/common/net_notice.qh
qcsrc/common/notifications.qc
qcsrc/common/notifications.qh
qcsrc/common/playerstats.qc
qcsrc/common/playerstats.qh
qcsrc/common/stats.qh
qcsrc/common/teams.qh
qcsrc/common/test.qc
qcsrc/common/test.qh
qcsrc/common/turrets/cl_turrets.qc
qcsrc/common/turrets/cl_turrets.qh
qcsrc/common/turrets/config.qh
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/sv_turrets.qh
qcsrc/common/turrets/turrets.qh
qcsrc/common/turrets/unit/ewheel.qc
qcsrc/common/turrets/unit/flac.qc
qcsrc/common/turrets/unit/fusionreactor.qc
qcsrc/common/turrets/unit/hellion.qc
qcsrc/common/turrets/unit/hk.qc
qcsrc/common/turrets/unit/machinegun.qc
qcsrc/common/turrets/unit/mlrs.qc
qcsrc/common/turrets/unit/phaser.qc
qcsrc/common/turrets/unit/plasma.qc
qcsrc/common/turrets/unit/plasma_dual.qc
qcsrc/common/turrets/unit/tesla.qc
qcsrc/common/turrets/unit/walker.qc
qcsrc/common/turrets/util.qc
qcsrc/common/turrets/util.qh [new file with mode: 0644]
qcsrc/common/urllib.qc
qcsrc/common/urllib.qh
qcsrc/common/util-pre.qh
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/calculations.qc
qcsrc/common/weapons/calculations.qh
qcsrc/common/weapons/config.qc
qcsrc/common/weapons/config.qh
qcsrc/common/weapons/w_arc.qc
qcsrc/common/weapons/w_blaster.qc
qcsrc/common/weapons/w_crylink.qc
qcsrc/common/weapons/w_devastator.qc
qcsrc/common/weapons/w_electro.qc
qcsrc/common/weapons/w_fireball.qc
qcsrc/common/weapons/w_hagar.qc
qcsrc/common/weapons/w_hlac.qc
qcsrc/common/weapons/w_hmg.qc
qcsrc/common/weapons/w_hook.qc
qcsrc/common/weapons/w_machinegun.qc
qcsrc/common/weapons/w_minelayer.qc
qcsrc/common/weapons/w_mortar.qc
qcsrc/common/weapons/w_porto.qc
qcsrc/common/weapons/w_rifle.qc
qcsrc/common/weapons/w_rpc.qc
qcsrc/common/weapons/w_seeker.qc
qcsrc/common/weapons/w_shockwave.qc
qcsrc/common/weapons/w_shotgun.qc
qcsrc/common/weapons/w_tuba.qc
qcsrc/common/weapons/w_vaporizer.qc
qcsrc/common/weapons/w_vortex.qc
qcsrc/common/weapons/weapons.qc
qcsrc/common/weapons/weapons.qh
qcsrc/csqcmodellib/cl_model.qc
qcsrc/csqcmodellib/cl_model.qh
qcsrc/csqcmodellib/cl_player.qc
qcsrc/csqcmodellib/cl_player.qh
qcsrc/csqcmodellib/common.qh
qcsrc/csqcmodellib/interpolate.qc
qcsrc/csqcmodellib/interpolate.qh
qcsrc/csqcmodellib/settings.qh
qcsrc/csqcmodellib/sv_model.qc
qcsrc/csqcmodellib/sv_model.qh
qcsrc/dpdefs/csprogsdefs.qc [deleted file]
qcsrc/dpdefs/csprogsdefs.qh [new file with mode: 0644]
qcsrc/dpdefs/dpextensions.qc [deleted file]
qcsrc/dpdefs/dpextensions.qh [new file with mode: 0644]
qcsrc/dpdefs/keycodes.qc [deleted file]
qcsrc/dpdefs/keycodes.qh [new file with mode: 0644]
qcsrc/dpdefs/menudefs.qc [deleted file]
qcsrc/dpdefs/menudefs.qh [new file with mode: 0644]
qcsrc/dpdefs/progsdefs.qc [deleted file]
qcsrc/dpdefs/progsdefs.qh [new file with mode: 0644]
qcsrc/menu/anim/animation.c [deleted file]
qcsrc/menu/anim/animation.qc [new file with mode: 0644]
qcsrc/menu/anim/animhost.c [deleted file]
qcsrc/menu/anim/animhost.qc [new file with mode: 0644]
qcsrc/menu/anim/easing.c [deleted file]
qcsrc/menu/anim/easing.qc [new file with mode: 0644]
qcsrc/menu/anim/keyframe.c [deleted file]
qcsrc/menu/anim/keyframe.qc [new file with mode: 0644]
qcsrc/menu/classes.c [deleted file]
qcsrc/menu/classes.qc [new file with mode: 0644]
qcsrc/menu/command/menu_cmd.qc
qcsrc/menu/command/menu_cmd.qh
qcsrc/menu/config.qh [deleted file]
qcsrc/menu/draw.qc
qcsrc/menu/draw.qh
qcsrc/menu/item.c [deleted file]
qcsrc/menu/item.qc [new file with mode: 0644]
qcsrc/menu/item/borderimage.c [deleted file]
qcsrc/menu/item/borderimage.qc [new file with mode: 0644]
qcsrc/menu/item/button.c [deleted file]
qcsrc/menu/item/button.qc [new file with mode: 0644]
qcsrc/menu/item/checkbox.c [deleted file]
qcsrc/menu/item/checkbox.qc [new file with mode: 0644]
qcsrc/menu/item/container.c [deleted file]
qcsrc/menu/item/container.qc [new file with mode: 0644]
qcsrc/menu/item/dialog.c [deleted file]
qcsrc/menu/item/dialog.qc [new file with mode: 0644]
qcsrc/menu/item/image.c [deleted file]
qcsrc/menu/item/image.qc [new file with mode: 0644]
qcsrc/menu/item/inputbox.c [deleted file]
qcsrc/menu/item/inputbox.qc [new file with mode: 0644]
qcsrc/menu/item/inputcontainer.c [deleted file]
qcsrc/menu/item/inputcontainer.qc [new file with mode: 0644]
qcsrc/menu/item/label.c [deleted file]
qcsrc/menu/item/label.qc [new file with mode: 0644]
qcsrc/menu/item/listbox.c [deleted file]
qcsrc/menu/item/listbox.qc [new file with mode: 0644]
qcsrc/menu/item/modalcontroller.c [deleted file]
qcsrc/menu/item/modalcontroller.qc [new file with mode: 0644]
qcsrc/menu/item/nexposee.c [deleted file]
qcsrc/menu/item/nexposee.qc [new file with mode: 0644]
qcsrc/menu/item/radiobutton.c [deleted file]
qcsrc/menu/item/radiobutton.qc [new file with mode: 0644]
qcsrc/menu/item/slider.c [deleted file]
qcsrc/menu/item/slider.qc [new file with mode: 0644]
qcsrc/menu/item/tab.c [deleted file]
qcsrc/menu/item/tab.qc [new file with mode: 0644]
qcsrc/menu/item/textslider.c [deleted file]
qcsrc/menu/item/textslider.qc [new file with mode: 0644]
qcsrc/menu/menu.qc
qcsrc/menu/menu.qh
qcsrc/menu/oo/base.h [deleted file]
qcsrc/menu/oo/base.qh [new file with mode: 0644]
qcsrc/menu/oo/implementation.h [deleted file]
qcsrc/menu/oo/implementation.qh [new file with mode: 0644]
qcsrc/menu/oo/interface.h [deleted file]
qcsrc/menu/oo/interface.qh [new file with mode: 0644]
qcsrc/menu/progs.src
qcsrc/menu/skin.qh
qcsrc/menu/sys-post.qh
qcsrc/menu/sys-pre.qh
qcsrc/menu/xonotic/bigbutton.c [deleted file]
qcsrc/menu/xonotic/bigbutton.qc [new file with mode: 0644]
qcsrc/menu/xonotic/bigcommandbutton.c [deleted file]
qcsrc/menu/xonotic/bigcommandbutton.qc [new file with mode: 0644]
qcsrc/menu/xonotic/button.c [deleted file]
qcsrc/menu/xonotic/button.qc [new file with mode: 0644]
qcsrc/menu/xonotic/campaign.c [deleted file]
qcsrc/menu/xonotic/campaign.qc [new file with mode: 0644]
qcsrc/menu/xonotic/charmap.c [deleted file]
qcsrc/menu/xonotic/charmap.qc [new file with mode: 0644]
qcsrc/menu/xonotic/checkbox.c [deleted file]
qcsrc/menu/xonotic/checkbox.qc [new file with mode: 0644]
qcsrc/menu/xonotic/checkbox_slider_invalid.c [deleted file]
qcsrc/menu/xonotic/checkbox_slider_invalid.qc [new file with mode: 0644]
qcsrc/menu/xonotic/checkbox_string.c [deleted file]
qcsrc/menu/xonotic/checkbox_string.qc [new file with mode: 0644]
qcsrc/menu/xonotic/colorbutton.c [deleted file]
qcsrc/menu/xonotic/colorbutton.qc [new file with mode: 0644]
qcsrc/menu/xonotic/colorpicker.c [deleted file]
qcsrc/menu/xonotic/colorpicker.qc [new file with mode: 0644]
qcsrc/menu/xonotic/colorpicker_string.c [deleted file]
qcsrc/menu/xonotic/colorpicker_string.qc [new file with mode: 0644]
qcsrc/menu/xonotic/commandbutton.c [deleted file]
qcsrc/menu/xonotic/commandbutton.qc [new file with mode: 0644]
qcsrc/menu/xonotic/credits.c [deleted file]
qcsrc/menu/xonotic/credits.qc [new file with mode: 0644]
qcsrc/menu/xonotic/crosshairbutton.c [deleted file]
qcsrc/menu/xonotic/crosshairbutton.qc [new file with mode: 0644]
qcsrc/menu/xonotic/cvarlist.c [deleted file]
qcsrc/menu/xonotic/cvarlist.qc [new file with mode: 0644]
qcsrc/menu/xonotic/demolist.c [deleted file]
qcsrc/menu/xonotic/demolist.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog.c [deleted file]
qcsrc/menu/xonotic/dialog.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_credits.c [deleted file]
qcsrc/menu/xonotic/dialog_credits.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_firstrun.c [deleted file]
qcsrc/menu/xonotic/dialog_firstrun.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_ammo.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_ammo.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_buffs.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_buffs.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_centerprint.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_chat.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_chat.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_infomessages.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_infomessages.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_modicons.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_modicons.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_notification.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_notification.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_physics.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_physics.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_powerups.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_powerups.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_racetimer.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_racetimer.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_radar.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_radar.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_score.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_score.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_timer.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_timer.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_vote.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_vote.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_weapons.c [deleted file]
qcsrc/menu/xonotic/dialog_hudpanel_weapons.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudsetup_exit.c [deleted file]
qcsrc/menu/xonotic/dialog_hudsetup_exit.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_monstertools.c [deleted file]
qcsrc/menu/xonotic/dialog_monstertools.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_create.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_create.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_join.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_join.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_media.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_demo.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_media_demo.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_demo_startconfirm.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_media_demo_startconfirm.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_demo_timeconfirm.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_media_demo_timeconfirm.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_musicplayer.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_media_musicplayer.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot_viewer.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot_viewer.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_multiplayer_profile.c [deleted file]
qcsrc/menu/xonotic/dialog_multiplayer_profile.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_quit.c [deleted file]
qcsrc/menu/xonotic/dialog_quit.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_sandboxtools.c [deleted file]
qcsrc/menu/xonotic/dialog_sandboxtools.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings.c [deleted file]
qcsrc/menu/xonotic/dialog_settings.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_audio.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_audio.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_effects.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_effects.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_game.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_crosshair.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_game_crosshair.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_hud.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_game_hud.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_hudconfirm.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_game_hudconfirm.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_messages.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_game_messages.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_model.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_game_model.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_view.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_game_view.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_game_weapons.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_game_weapons.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_input.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_input.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_input_userbind.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_input_userbind.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_misc.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_misc.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_misc_cvars.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_misc_cvars.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_misc_reset.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_misc_reset.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_user.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_user.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_user_languagewarning.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_user_languagewarning.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_video.c [deleted file]
qcsrc/menu/xonotic/dialog_settings_video.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_singleplayer.c [deleted file]
qcsrc/menu/xonotic/dialog_singleplayer.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_singleplayer_winner.c [deleted file]
qcsrc/menu/xonotic/dialog_singleplayer_winner.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_teamselect.c [deleted file]
qcsrc/menu/xonotic/dialog_teamselect.qc [new file with mode: 0644]
qcsrc/menu/xonotic/gametypebutton.c [deleted file]
qcsrc/menu/xonotic/gametypebutton.qc [new file with mode: 0644]
qcsrc/menu/xonotic/gametypelist.c [deleted file]
qcsrc/menu/xonotic/gametypelist.qc [new file with mode: 0644]
qcsrc/menu/xonotic/image.c [deleted file]
qcsrc/menu/xonotic/image.qc [new file with mode: 0644]
qcsrc/menu/xonotic/inputbox.c [deleted file]
qcsrc/menu/xonotic/inputbox.qc [new file with mode: 0644]
qcsrc/menu/xonotic/keybinder.c [deleted file]
qcsrc/menu/xonotic/keybinder.qc [new file with mode: 0644]
qcsrc/menu/xonotic/languagelist.c [deleted file]
qcsrc/menu/xonotic/languagelist.qc [new file with mode: 0644]
qcsrc/menu/xonotic/listbox.c [deleted file]
qcsrc/menu/xonotic/listbox.qc [new file with mode: 0644]
qcsrc/menu/xonotic/mainwindow.c [deleted file]
qcsrc/menu/xonotic/mainwindow.qc [new file with mode: 0644]
qcsrc/menu/xonotic/maplist.c [deleted file]
qcsrc/menu/xonotic/maplist.qc [new file with mode: 0644]
qcsrc/menu/xonotic/nexposee.c [deleted file]
qcsrc/menu/xonotic/nexposee.qc [new file with mode: 0644]
qcsrc/menu/xonotic/playerlist.c [deleted file]
qcsrc/menu/xonotic/playerlist.qc [new file with mode: 0644]
qcsrc/menu/xonotic/playermodel.c [deleted file]
qcsrc/menu/xonotic/playermodel.qc [new file with mode: 0644]
qcsrc/menu/xonotic/playlist.c [deleted file]
qcsrc/menu/xonotic/playlist.qc [new file with mode: 0644]
qcsrc/menu/xonotic/radiobutton.c [deleted file]
qcsrc/menu/xonotic/radiobutton.qc [new file with mode: 0644]
qcsrc/menu/xonotic/rootdialog.c [deleted file]
qcsrc/menu/xonotic/rootdialog.qc [new file with mode: 0644]
qcsrc/menu/xonotic/screenshotimage.c [deleted file]
qcsrc/menu/xonotic/screenshotimage.qc [new file with mode: 0644]
qcsrc/menu/xonotic/screenshotlist.c [deleted file]
qcsrc/menu/xonotic/screenshotlist.qc [new file with mode: 0644]
qcsrc/menu/xonotic/serverlist.c [deleted file]
qcsrc/menu/xonotic/serverlist.qc [new file with mode: 0644]
qcsrc/menu/xonotic/skinlist.c [deleted file]
qcsrc/menu/xonotic/skinlist.qc [new file with mode: 0644]
qcsrc/menu/xonotic/slider.c [deleted file]
qcsrc/menu/xonotic/slider.qc [new file with mode: 0644]
qcsrc/menu/xonotic/slider_decibels.c [deleted file]
qcsrc/menu/xonotic/slider_decibels.qc [new file with mode: 0644]
qcsrc/menu/xonotic/slider_particles.c [deleted file]
qcsrc/menu/xonotic/slider_particles.qc [new file with mode: 0644]
qcsrc/menu/xonotic/slider_picmip.c [deleted file]
qcsrc/menu/xonotic/slider_picmip.qc [new file with mode: 0644]
qcsrc/menu/xonotic/slider_resolution.c [deleted file]
qcsrc/menu/xonotic/slider_resolution.qc [new file with mode: 0644]
qcsrc/menu/xonotic/slider_sbfadetime.c [deleted file]
qcsrc/menu/xonotic/slider_sbfadetime.qc [new file with mode: 0644]
qcsrc/menu/xonotic/soundlist.c [deleted file]
qcsrc/menu/xonotic/soundlist.qc [new file with mode: 0644]
qcsrc/menu/xonotic/statslist.c [deleted file]
qcsrc/menu/xonotic/statslist.qc [new file with mode: 0644]
qcsrc/menu/xonotic/tab.c [deleted file]
qcsrc/menu/xonotic/tab.qc [new file with mode: 0644]
qcsrc/menu/xonotic/tabcontroller.c [deleted file]
qcsrc/menu/xonotic/tabcontroller.qc [new file with mode: 0644]
qcsrc/menu/xonotic/textlabel.c [deleted file]
qcsrc/menu/xonotic/textlabel.qc [new file with mode: 0644]
qcsrc/menu/xonotic/textslider.c [deleted file]
qcsrc/menu/xonotic/textslider.qc [new file with mode: 0644]
qcsrc/menu/xonotic/util.qc
qcsrc/menu/xonotic/util.qh
qcsrc/menu/xonotic/weaponarenacheckbox.c [deleted file]
qcsrc/menu/xonotic/weaponarenacheckbox.qc [new file with mode: 0644]
qcsrc/menu/xonotic/weaponslist.c [deleted file]
qcsrc/menu/xonotic/weaponslist.qc [new file with mode: 0644]
qcsrc/server/anticheat.qc
qcsrc/server/anticheat.qh
qcsrc/server/antilag.qc
qcsrc/server/antilag.qh
qcsrc/server/autocvars.qh
qcsrc/server/bot/aim.qc
qcsrc/server/bot/aim.qh
qcsrc/server/bot/bot.qc
qcsrc/server/bot/bot.qh
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/havocbot/havocbot.qh
qcsrc/server/bot/havocbot/role_onslaught.qc
qcsrc/server/bot/havocbot/roles.qc
qcsrc/server/bot/navigation.qc
qcsrc/server/bot/navigation.qh
qcsrc/server/bot/scripting.qc
qcsrc/server/bot/waypoints.qc
qcsrc/server/bot/waypoints.qh
qcsrc/server/campaign.qc
qcsrc/server/campaign.qh
qcsrc/server/cheats.qc
qcsrc/server/cheats.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/cl_impulse.qh [new file with mode: 0644]
qcsrc/server/cl_physics.qc
qcsrc/server/cl_player.qc
qcsrc/server/cl_player.qh [new file with mode: 0644]
qcsrc/server/command/banning.qc
qcsrc/server/command/banning.qh
qcsrc/server/command/cmd.qc
qcsrc/server/command/cmd.qh
qcsrc/server/command/common.qc
qcsrc/server/command/common.qh
qcsrc/server/command/getreplies.qc
qcsrc/server/command/getreplies.qh
qcsrc/server/command/radarmap.qc
qcsrc/server/command/radarmap.qh
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/sv_cmd.qh
qcsrc/server/command/vote.qc
qcsrc/server/command/vote.qh
qcsrc/server/constants.qh
qcsrc/server/csqceffects.qc
qcsrc/server/defs.qh
qcsrc/server/ent_cs.qc
qcsrc/server/ent_cs.qh [new file with mode: 0644]
qcsrc/server/func_breakable.qc
qcsrc/server/g_casings.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_damage.qh [new file with mode: 0644]
qcsrc/server/g_hook.qc
qcsrc/server/g_hook.qh
qcsrc/server/g_lights.qc
qcsrc/server/g_models.qc
qcsrc/server/g_subs.qc
qcsrc/server/g_subs.qh [new file with mode: 0644]
qcsrc/server/g_tetris.qc
qcsrc/server/g_triggers.qc
qcsrc/server/g_triggers.qh [new file with mode: 0644]
qcsrc/server/g_violence.qc
qcsrc/server/g_violence.qh [new file with mode: 0644]
qcsrc/server/g_world.qc
qcsrc/server/g_world.qh [new file with mode: 0644]
qcsrc/server/ipban.qc
qcsrc/server/ipban.qh
qcsrc/server/item_key.qc
qcsrc/server/item_key.qh
qcsrc/server/mapvoting.qc
qcsrc/server/mapvoting.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh [new file with mode: 0644]
qcsrc/server/movelib.qc
qcsrc/server/movelib.qh [new file with mode: 0644]
qcsrc/server/mutators/base.qc
qcsrc/server/mutators/base.qh
qcsrc/server/mutators/gamemode_assault.qc
qcsrc/server/mutators/gamemode_assault.qh
qcsrc/server/mutators/gamemode_ca.qc
qcsrc/server/mutators/gamemode_ca.qh
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_ctf.qh
qcsrc/server/mutators/gamemode_cts.qc
qcsrc/server/mutators/gamemode_cts.qh
qcsrc/server/mutators/gamemode_domination.qc
qcsrc/server/mutators/gamemode_domination.qh
qcsrc/server/mutators/gamemode_freezetag.qc
qcsrc/server/mutators/gamemode_invasion.qc
qcsrc/server/mutators/gamemode_invasion.qh
qcsrc/server/mutators/gamemode_keepaway.qc
qcsrc/server/mutators/gamemode_keepaway.qh
qcsrc/server/mutators/gamemode_keyhunt.qc
qcsrc/server/mutators/gamemode_keyhunt.qh
qcsrc/server/mutators/gamemode_lms.qc
qcsrc/server/mutators/gamemode_lms.qh
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/mutators/gamemode_nexball.qh
qcsrc/server/mutators/gamemode_onslaught.qc
qcsrc/server/mutators/gamemode_race.qc
qcsrc/server/mutators/gamemode_race.qh
qcsrc/server/mutators/gamemode_tdm.qc
qcsrc/server/mutators/mutator_bloodloss.qc
qcsrc/server/mutators/mutator_buffs.qc
qcsrc/server/mutators/mutator_buffs.qh
qcsrc/server/mutators/mutator_campcheck.qc
qcsrc/server/mutators/mutator_dodging.qc
qcsrc/server/mutators/mutator_dodging.qh
qcsrc/server/mutators/mutator_instagib.qc
qcsrc/server/mutators/mutator_melee_only.qc
qcsrc/server/mutators/mutator_midair.qc
qcsrc/server/mutators/mutator_multijump.qc
qcsrc/server/mutators/mutator_nades.qc
qcsrc/server/mutators/mutator_nades.qh
qcsrc/server/mutators/mutator_new_toys.qc
qcsrc/server/mutators/mutator_nix.qc
qcsrc/server/mutators/mutator_overkill.qc
qcsrc/server/mutators/mutator_overkill.qh
qcsrc/server/mutators/mutator_physical_items.qc
qcsrc/server/mutators/mutator_pinata.qc
qcsrc/server/mutators/mutator_random_gravity.qc
qcsrc/server/mutators/mutator_spawn_near_teammate.qc
qcsrc/server/mutators/mutator_superspec.qc
qcsrc/server/mutators/mutator_touchexplode.qc
qcsrc/server/mutators/mutator_vampire.qc
qcsrc/server/mutators/mutators.qc
qcsrc/server/mutators/mutators.qh
qcsrc/server/mutators/mutators_include.qc
qcsrc/server/mutators/mutators_include.qh
qcsrc/server/mutators/sandbox.qc
qcsrc/server/pathlib.qc
qcsrc/server/pathlib/costs.qc
qcsrc/server/pathlib/debug.qc
qcsrc/server/pathlib/expandnode.qc
qcsrc/server/pathlib/main.qc
qcsrc/server/pathlib/movenode.qc
qcsrc/server/pathlib/path_waypoint.qc
qcsrc/server/pathlib/pathlib.qh
qcsrc/server/pathlib/utility.qc
qcsrc/server/playerdemo.qc
qcsrc/server/playerdemo.qh
qcsrc/server/portals.qc
qcsrc/server/portals.qh
qcsrc/server/progs.src
qcsrc/server/race.qc
qcsrc/server/race.qh
qcsrc/server/round_handler.qc
qcsrc/server/round_handler.qh
qcsrc/server/scores.qc
qcsrc/server/scores.qh
qcsrc/server/scores_rules.qc
qcsrc/server/secret.qc
qcsrc/server/secret.qh
qcsrc/server/spawnpoints.qc
qcsrc/server/spawnpoints.qh
qcsrc/server/steerlib.qc
qcsrc/server/sv_main.qc
qcsrc/server/sys-post.qh
qcsrc/server/sys-pre.qh
qcsrc/server/t_halflife.qc
qcsrc/server/t_items.qc
qcsrc/server/t_items.qh
qcsrc/server/t_jumppads.qc
qcsrc/server/t_jumppads.qh [new file with mode: 0644]
qcsrc/server/t_plats.qc
qcsrc/server/t_quake.qc
qcsrc/server/t_quake3.qc
qcsrc/server/t_swamp.qc
qcsrc/server/t_teleporters.qc
qcsrc/server/t_teleporters.qh [new file with mode: 0644]
qcsrc/server/target_music.qc
qcsrc/server/target_spawn.qc
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh [new file with mode: 0644]
qcsrc/server/tturrets/system/system_main.qc [deleted file]
qcsrc/server/tturrets/units/unit_ewheel.qc [deleted file]
qcsrc/server/tturrets/units/unit_flac.qc [deleted file]
qcsrc/server/tturrets/units/unit_machinegun.qc [deleted file]
qcsrc/server/tturrets/units/unit_plasma.qc [deleted file]
qcsrc/server/tturrets/units/unit_walker.qc [deleted file]
qcsrc/server/vehicles/bumblebee.qc
qcsrc/server/vehicles/bumblebee.qh [new file with mode: 0644]
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/raptor.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/vehicles/vehicles.qc
qcsrc/server/vehicles/vehicles.qh
qcsrc/server/vehicles/vehicles_def.qh
qcsrc/server/waypointsprites.qc
qcsrc/server/waypointsprites.qh [new file with mode: 0644]
qcsrc/server/weapons/accuracy.qc
qcsrc/server/weapons/accuracy.qh
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/common.qh
qcsrc/server/weapons/csqcprojectile.qc
qcsrc/server/weapons/csqcprojectile.qh
qcsrc/server/weapons/hitplot.qc
qcsrc/server/weapons/hitplot.qh
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/selection.qh
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/spawning.qh
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/throwing.qh
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/tracing.qh
qcsrc/server/weapons/weaponstats.qc
qcsrc/server/weapons/weaponstats.qh
qcsrc/server/weapons/weaponsystem.qc
qcsrc/server/weapons/weaponsystem.qh
qcsrc/uncrustify.cfg
qcsrc/warpzonelib/anglestransform.qc
qcsrc/warpzonelib/anglestransform.qh
qcsrc/warpzonelib/client.qc
qcsrc/warpzonelib/client.qh
qcsrc/warpzonelib/common.qc
qcsrc/warpzonelib/common.qh
qcsrc/warpzonelib/mathlib.qc
qcsrc/warpzonelib/mathlib.qh
qcsrc/warpzonelib/server.qc
qcsrc/warpzonelib/server.qh
qcsrc/warpzonelib/util_server.qc
qcsrc/warpzonelib/util_server.qh
qcsrc/whitespace.sh [new file with mode: 0755]
scripts/luma.shader [new file with mode: 0644]
serverbench.cfg
sound/menu/README [new file with mode: 0644]
sound/menu/clear.wav [new file with mode: 0644]
sound/menu/close.wav [new file with mode: 0644]
sound/menu/execute.wav [new file with mode: 0644]
sound/menu/focus.wav [new file with mode: 0644]
sound/menu/open.wav [new file with mode: 0644]
sound/menu/select.wav [new file with mode: 0644]
sound/menu/slide.wav [new file with mode: 0644]
sound/menu/winner.ogg [new file with mode: 0644]
sound/misc/menu1.wav [deleted file]
sound/misc/menu2.wav [deleted file]
sound/misc/mouseclick.wav [deleted file]
xonotic-credits.txt

index 7d8b0ccf9f02356814b2fb14e3431f8c96dce665..a47884ef05f586d66da20ad330a33b864eb3d017 100644 (file)
@@ -58,6 +58,7 @@ seta hud_panel_weapons_timeout_fadefgmin "" "minimum alpha of the panel foregrou
 seta hud_panel_weapons_timeout_speed_in "" "speed that fading/moving onto the screen occurs"
 seta hud_panel_weapons_timeout_speed_out "" "speed that fading/moving off of the screen occurs"
 seta hud_panel_weapons_label "" "1 = show number of weapon, 2 = show bound key of weapon, 3 = show name of weapon"
+seta hud_panel_weapons_label_scale "" "scale of the weapon text label"
 seta hud_panel_weapons_accuracy "" "show accuracy color as the weapon icon background; colors can be configured with accuracy_color* cvars"
 seta hud_panel_weapons_ammo "" "show ammo as a status bar"
 seta hud_panel_weapons_onlyowned "" "show only owned weapons"
index 2e6d10e7b1d62b34202c7388d5c74979f0b051ad..1fa36d0c4985fbbb016e532453947a2a692e752c 100644 (file)
@@ -34,12 +34,12 @@ set g_balance_blaster_weaponthrowable 0
 // {{{ #2: Shotgun
 set g_balance_shotgun_primary_ammo 1
 set g_balance_shotgun_primary_animtime 0.2
-set g_balance_shotgun_primary_bullets 14
-set g_balance_shotgun_primary_damage 3.5
+set g_balance_shotgun_primary_bullets 12
+set g_balance_shotgun_primary_damage 4
 set g_balance_shotgun_primary_force 15
 set g_balance_shotgun_primary_refire 0.75
 set g_balance_shotgun_primary_solidpenetration 3.8
-set g_balance_shotgun_primary_spread 0.11
+set g_balance_shotgun_primary_spread 0.12
 set g_balance_shotgun_reload_ammo 0
 set g_balance_shotgun_reload_time 2
 set g_balance_shotgun_secondary 1
index 2e6d10e7b1d62b34202c7388d5c74979f0b051ad..1fa36d0c4985fbbb016e532453947a2a692e752c 100644 (file)
@@ -34,12 +34,12 @@ set g_balance_blaster_weaponthrowable 0
 // {{{ #2: Shotgun
 set g_balance_shotgun_primary_ammo 1
 set g_balance_shotgun_primary_animtime 0.2
-set g_balance_shotgun_primary_bullets 14
-set g_balance_shotgun_primary_damage 3.5
+set g_balance_shotgun_primary_bullets 12
+set g_balance_shotgun_primary_damage 4
 set g_balance_shotgun_primary_force 15
 set g_balance_shotgun_primary_refire 0.75
 set g_balance_shotgun_primary_solidpenetration 3.8
-set g_balance_shotgun_primary_spread 0.11
+set g_balance_shotgun_primary_spread 0.12
 set g_balance_shotgun_reload_ammo 0
 set g_balance_shotgun_reload_time 2
 set g_balance_shotgun_secondary 1
index 08ff39c0e700f843a9cc44e39c25829b9a5f625f..76ba515256438d98b65dbf5d694a78d121e64029 100644 (file)
@@ -155,7 +155,7 @@ set g_projectiles_damage -2
 // 0: only damage from contents (lava/slime) or exceptions
 // 1: only self damage or damage from contents or exceptions
 // 2: allow all damage to projectiles normally
-set g_projectiles_keep_owner 0
+set g_projectiles_keep_owner 1
 set g_projectiles_newton_style 0
 // possible values:
 // 0: absolute velocity projectiles (like Quake)
index c254bcdf8d5118efd4b5f1aec0d687c609c63388..e7855280edc2b2541c9895ecf5d6fd3a336279c7 100644 (file)
@@ -155,7 +155,7 @@ set g_projectiles_damage -2
 // 0: only damage from contents (lava/slime) or exceptions
 // 1: only self damage or damage from contents or exceptions
 // 2: allow all damage to projectiles normally
-set g_projectiles_keep_owner 0
+set g_projectiles_keep_owner 1
 set g_projectiles_newton_style 0
 // possible values:
 // 0: absolute velocity projectiles (like Quake)
diff --git a/binds-default.cfg b/binds-default.cfg
deleted file mode 100644 (file)
index f48842f..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-// alias for switching the teamselect menu
-bind f5 menu_showteamselect
-
-bind f6 team_auto
-
-bind f7 menu_showsandboxtools
-
-// movement
-bind w +forward
-bind a +moveleft
-bind s +back
-bind d +moveright
-bind UPARROW +forward
-bind LEFTARROW +moveleft
-bind DOWNARROW +back
-bind RIGHTARROW +moveright
-bind SHIFT +crouch
-bind ENTER +jump
-bind SPACE +jump
-
-// weapons
-bind 0 weapon_group_0
-bind 1 weapon_group_1
-bind 2 weapon_group_2
-bind 3 weapon_group_3
-bind 4 weapon_group_4
-bind 5 weapon_group_5
-bind 6 weapon_group_6
-bind 7 weapon_group_7
-bind 8 weapon_group_8
-bind 9 weapon_group_9
-bind q weaplast
-bind MOUSE1 +fire
-bind MOUSE2 +fire2
-bind MOUSE3 togglezoom
-bind MOUSE4 weaplast
-bind MOUSE5 +hook
-bind MWHEELUP weapnext
-bind MWHEELDOWN weapprev
-bind r reload
-bind BACKSPACE dropweapon
-bind g dropweapon
-bind f +use
-bind v +button8 // drag object
-
-// misc
-bind e +hook
-bind ` toggleconsole
-bind ~ toggleconsole
-bind TAB +showscores
-bind ESCAPE togglemenu
-bind t messagemode
-bind y messagemode2
-bind z messagemode2
-bind u "+con_chat_maximize"
-bind m +hud_panel_radar_maximized
-bind i +show_info
-bind PAUSE pause
-bind F10 menu_showquitdialog
-bind F11 disconnect
-bind F12 screenshot
-bind F4 ready
-bind ALT +showaccuracy
-
-// Gamepad defaults. Tested with Logitech Rumblepad 2, I hope similar ones works as well.
-bind JOY1 "+crouch"
-bind JOY2 "+jump"
-bind JOY3 "weapprev"
-bind JOY4 "weapnext"
-bind JOY5 "+fire2"
-bind JOY6 "+fire"
-bind JOY7 "+zoom"
-bind JOY8 "dropweapon"
-bind JOY9 "menu_showteamselect"
-bind JOY10 "+show_info"
-bind JOY11 "+showscores"
-bind JOY12 "+con_chat_maximize"
-seta joyadvanced "1"
-seta joyadvaxisr "2"
-seta joyadvaxisx "3"
-seta joyadvaxisy "1"
-seta joyadvaxisz "4"
-seta joysidesensitivity "1.0"
-seta joypitchsensitivity "0.9"
-seta joyyawsensitivity "-1.8"
-// SDL only
-seta joy_deadzoneforward "0.05"
-seta joy_deadzonepitch "0.05"
-seta joy_deadzoneside "0.05"
-seta joy_deadzoneup "0.05"
-seta joy_deadzoneyaw "0.05"
-seta joy_sensitivitypitch "0.9"
-seta joy_sensitivityyaw "-1.8"
-
-// team say
-bind kp_ins messagemode
-bind kp_del messagemode2
-bind kp_end "+userbind 1"
-bind kp_downarrow "+userbind 2"
-bind kp_pgdn "+userbind 3"
-bind kp_leftarrow "+userbind 4"
-bind kp_5 "+userbind 6"
-bind kp_rightarrow "+userbind 7"
-bind kp_home "+userbind 9"
-bind kp_uparrow "+userbind 10"
-bind kp_pgup "+userbind 11"
-bind kp_multiply "+userbind 12"
-bind kp_slash "+userbind 13"
-bind kp_enter "+userbind 16"
-bind kp_plus "+userbind 17"
-bind kp_minus "+userbind 18"
-
-bind F1 vyes
-bind F2 vno
-
-//used for spectate/observer mode
-bind F3 spec
-
-// usercommands. These can be edited and bound by the menu.
-seta "userbind1_press" "say_team quad soon";  seta "userbind1_release" "";  seta "userbind1_description" "team: quad soon"
-seta "userbind2_press" "say_team free item %x^7 (l:%y^7); g_waypointsprite_team_here_p";  seta "userbind2_release" "";  seta "userbind2_description" "team: free item, icon"
-seta "userbind3_press" "say_team took item (l:%l^7); g_waypointsprite_team_here";  seta "userbind3_release" "";  seta "userbind3_description" "team: took item, icon"
-seta "userbind4_press" "say_team negative";  seta "userbind4_release" "";  seta "userbind4_description" "team: negative"
-seta "userbind5_press" "say_team positive";  seta "userbind5_release" "";  seta "userbind5_description" "team: positive"
-seta "userbind6_press" "say_team need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_helpme; cmd voice needhelp";  seta "userbind6_release" "";  seta "userbind6_description" "team: need help, icon"
-seta "userbind7_press" "say_team enemy seen (l:%y^7); g_waypointsprite_team_danger_p; cmd voice incoming";  seta "userbind7_release" "";  seta "userbind7_description" "team: enemy seen, icon"
-seta "userbind8_press" "say_team flag seen (l:%y^7); g_waypointsprite_team_here_p; cmd voice seenflag";  seta "userbind8_release" "";  seta "userbind8_description" "team: flag seen, icon"
-seta "userbind9_press" "say_team defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_here";  seta "userbind9_release" "";  seta "userbind9_description" "team: defending, icon"
-seta "userbind10_press" "say_team roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_here";  seta "userbind10_release" "";  seta "userbind10_description" "team: roaming, icon"
-seta "userbind11_press" "say_team attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_here";  seta "userbind11_release" "";  seta "userbind11_description" "team: attacking, icon"
-seta "userbind12_press" "say_team killed flagcarrier (l:%y^7); g_waypointsprite_team_here_p"; seta "userbind12_release" ""; seta "userbind12_description" "team: killed flag, icon"
-seta "userbind13_press" "say_team dropped flag (l:%d^7); g_waypointsprite_team_here_d"; seta "userbind13_release" ""; seta "userbind13_description" "team: dropped flag, icon"
-seta "userbind14_press" "say_team dropped gun %w^7 (l:%l^7); g_waypointsprite_team_here; wait; dropweapon"; seta "userbind14_release" ""; seta "userbind14_description" "team: drop gun, icon"
-// TODO change this to "use" once we can
-seta "userbind15_press" "say_team dropped flag/key %w^7 (l:%l^7); g_waypointsprite_team_here; wait; +use"; seta "userbind15_release" "-use"; seta "userbind15_description" "team: drop flag/key, icon"
-seta "userbind16_press" "say :-) / nice one"; seta "userbind16_release" ""; seta "userbind16_description" "chat: nice one"
-seta "userbind17_press" "say good game"; seta "userbind17_release" ""; seta "userbind17_description" "chat: good game"
-seta "userbind18_press" "say hi / good luck and have fun"; seta "userbind18_release" ""; seta "userbind18_description" "chat: hi / good luck"
-seta "userbind19_press" "+showscores; +con_chat_maximize"; seta "userbind19_release" "-showscores; -con_chat_maximize"; seta "userbind19_description" "scoreboard / chat history"
-seta "userbind20_press" "toggle cl_capturevideo"; seta "userbind20_release" ""; seta "userbind20_description" "toggle recording .avi"
-seta "userbind21_press" "toggle vid_fullscreen; vid_restart"; seta "userbind21_release" ""; seta "userbind21_description" "toggle fullscreen"
-seta "userbind22_press" ""; seta "userbind22_release" ""; seta "userbind22_description" ""
-seta "userbind23_press" ""; seta "userbind23_release" ""; seta "userbind23_description" ""
-seta "userbind24_press" ""; seta "userbind24_release" ""; seta "userbind24_description" ""
-seta "userbind25_press" ""; seta "userbind25_release" ""; seta "userbind25_description" ""
-seta "userbind26_press" ""; seta "userbind26_release" ""; seta "userbind26_description" ""
-seta "userbind27_press" ""; seta "userbind27_release" ""; seta "userbind27_description" ""
-seta "userbind28_press" ""; seta "userbind28_release" ""; seta "userbind28_description" ""
-seta "userbind29_press" ""; seta "userbind29_release" ""; seta "userbind29_description" ""
-seta "userbind30_press" ""; seta "userbind30_release" ""; seta "userbind30_description" ""
-seta "userbind31_press" ""; seta "userbind31_release" ""; seta "userbind31_description" ""
-seta "userbind32_press" ""; seta "userbind32_release" ""; seta "userbind32_description" ""
-alias _userbind_call "${$1}"
-alias +userbind "_userbind_call userbind${1}_press"
-alias -userbind "_userbind_call userbind${1}_release"
\ No newline at end of file
diff --git a/binds-xonotic.cfg b/binds-xonotic.cfg
new file mode 100644 (file)
index 0000000..f48842f
--- /dev/null
@@ -0,0 +1,155 @@
+// alias for switching the teamselect menu
+bind f5 menu_showteamselect
+
+bind f6 team_auto
+
+bind f7 menu_showsandboxtools
+
+// movement
+bind w +forward
+bind a +moveleft
+bind s +back
+bind d +moveright
+bind UPARROW +forward
+bind LEFTARROW +moveleft
+bind DOWNARROW +back
+bind RIGHTARROW +moveright
+bind SHIFT +crouch
+bind ENTER +jump
+bind SPACE +jump
+
+// weapons
+bind 0 weapon_group_0
+bind 1 weapon_group_1
+bind 2 weapon_group_2
+bind 3 weapon_group_3
+bind 4 weapon_group_4
+bind 5 weapon_group_5
+bind 6 weapon_group_6
+bind 7 weapon_group_7
+bind 8 weapon_group_8
+bind 9 weapon_group_9
+bind q weaplast
+bind MOUSE1 +fire
+bind MOUSE2 +fire2
+bind MOUSE3 togglezoom
+bind MOUSE4 weaplast
+bind MOUSE5 +hook
+bind MWHEELUP weapnext
+bind MWHEELDOWN weapprev
+bind r reload
+bind BACKSPACE dropweapon
+bind g dropweapon
+bind f +use
+bind v +button8 // drag object
+
+// misc
+bind e +hook
+bind ` toggleconsole
+bind ~ toggleconsole
+bind TAB +showscores
+bind ESCAPE togglemenu
+bind t messagemode
+bind y messagemode2
+bind z messagemode2
+bind u "+con_chat_maximize"
+bind m +hud_panel_radar_maximized
+bind i +show_info
+bind PAUSE pause
+bind F10 menu_showquitdialog
+bind F11 disconnect
+bind F12 screenshot
+bind F4 ready
+bind ALT +showaccuracy
+
+// Gamepad defaults. Tested with Logitech Rumblepad 2, I hope similar ones works as well.
+bind JOY1 "+crouch"
+bind JOY2 "+jump"
+bind JOY3 "weapprev"
+bind JOY4 "weapnext"
+bind JOY5 "+fire2"
+bind JOY6 "+fire"
+bind JOY7 "+zoom"
+bind JOY8 "dropweapon"
+bind JOY9 "menu_showteamselect"
+bind JOY10 "+show_info"
+bind JOY11 "+showscores"
+bind JOY12 "+con_chat_maximize"
+seta joyadvanced "1"
+seta joyadvaxisr "2"
+seta joyadvaxisx "3"
+seta joyadvaxisy "1"
+seta joyadvaxisz "4"
+seta joysidesensitivity "1.0"
+seta joypitchsensitivity "0.9"
+seta joyyawsensitivity "-1.8"
+// SDL only
+seta joy_deadzoneforward "0.05"
+seta joy_deadzonepitch "0.05"
+seta joy_deadzoneside "0.05"
+seta joy_deadzoneup "0.05"
+seta joy_deadzoneyaw "0.05"
+seta joy_sensitivitypitch "0.9"
+seta joy_sensitivityyaw "-1.8"
+
+// team say
+bind kp_ins messagemode
+bind kp_del messagemode2
+bind kp_end "+userbind 1"
+bind kp_downarrow "+userbind 2"
+bind kp_pgdn "+userbind 3"
+bind kp_leftarrow "+userbind 4"
+bind kp_5 "+userbind 6"
+bind kp_rightarrow "+userbind 7"
+bind kp_home "+userbind 9"
+bind kp_uparrow "+userbind 10"
+bind kp_pgup "+userbind 11"
+bind kp_multiply "+userbind 12"
+bind kp_slash "+userbind 13"
+bind kp_enter "+userbind 16"
+bind kp_plus "+userbind 17"
+bind kp_minus "+userbind 18"
+
+bind F1 vyes
+bind F2 vno
+
+//used for spectate/observer mode
+bind F3 spec
+
+// usercommands. These can be edited and bound by the menu.
+seta "userbind1_press" "say_team quad soon";  seta "userbind1_release" "";  seta "userbind1_description" "team: quad soon"
+seta "userbind2_press" "say_team free item %x^7 (l:%y^7); g_waypointsprite_team_here_p";  seta "userbind2_release" "";  seta "userbind2_description" "team: free item, icon"
+seta "userbind3_press" "say_team took item (l:%l^7); g_waypointsprite_team_here";  seta "userbind3_release" "";  seta "userbind3_description" "team: took item, icon"
+seta "userbind4_press" "say_team negative";  seta "userbind4_release" "";  seta "userbind4_description" "team: negative"
+seta "userbind5_press" "say_team positive";  seta "userbind5_release" "";  seta "userbind5_description" "team: positive"
+seta "userbind6_press" "say_team need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_helpme; cmd voice needhelp";  seta "userbind6_release" "";  seta "userbind6_description" "team: need help, icon"
+seta "userbind7_press" "say_team enemy seen (l:%y^7); g_waypointsprite_team_danger_p; cmd voice incoming";  seta "userbind7_release" "";  seta "userbind7_description" "team: enemy seen, icon"
+seta "userbind8_press" "say_team flag seen (l:%y^7); g_waypointsprite_team_here_p; cmd voice seenflag";  seta "userbind8_release" "";  seta "userbind8_description" "team: flag seen, icon"
+seta "userbind9_press" "say_team defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_here";  seta "userbind9_release" "";  seta "userbind9_description" "team: defending, icon"
+seta "userbind10_press" "say_team roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_here";  seta "userbind10_release" "";  seta "userbind10_description" "team: roaming, icon"
+seta "userbind11_press" "say_team attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7); g_waypointsprite_team_here";  seta "userbind11_release" "";  seta "userbind11_description" "team: attacking, icon"
+seta "userbind12_press" "say_team killed flagcarrier (l:%y^7); g_waypointsprite_team_here_p"; seta "userbind12_release" ""; seta "userbind12_description" "team: killed flag, icon"
+seta "userbind13_press" "say_team dropped flag (l:%d^7); g_waypointsprite_team_here_d"; seta "userbind13_release" ""; seta "userbind13_description" "team: dropped flag, icon"
+seta "userbind14_press" "say_team dropped gun %w^7 (l:%l^7); g_waypointsprite_team_here; wait; dropweapon"; seta "userbind14_release" ""; seta "userbind14_description" "team: drop gun, icon"
+// TODO change this to "use" once we can
+seta "userbind15_press" "say_team dropped flag/key %w^7 (l:%l^7); g_waypointsprite_team_here; wait; +use"; seta "userbind15_release" "-use"; seta "userbind15_description" "team: drop flag/key, icon"
+seta "userbind16_press" "say :-) / nice one"; seta "userbind16_release" ""; seta "userbind16_description" "chat: nice one"
+seta "userbind17_press" "say good game"; seta "userbind17_release" ""; seta "userbind17_description" "chat: good game"
+seta "userbind18_press" "say hi / good luck and have fun"; seta "userbind18_release" ""; seta "userbind18_description" "chat: hi / good luck"
+seta "userbind19_press" "+showscores; +con_chat_maximize"; seta "userbind19_release" "-showscores; -con_chat_maximize"; seta "userbind19_description" "scoreboard / chat history"
+seta "userbind20_press" "toggle cl_capturevideo"; seta "userbind20_release" ""; seta "userbind20_description" "toggle recording .avi"
+seta "userbind21_press" "toggle vid_fullscreen; vid_restart"; seta "userbind21_release" ""; seta "userbind21_description" "toggle fullscreen"
+seta "userbind22_press" ""; seta "userbind22_release" ""; seta "userbind22_description" ""
+seta "userbind23_press" ""; seta "userbind23_release" ""; seta "userbind23_description" ""
+seta "userbind24_press" ""; seta "userbind24_release" ""; seta "userbind24_description" ""
+seta "userbind25_press" ""; seta "userbind25_release" ""; seta "userbind25_description" ""
+seta "userbind26_press" ""; seta "userbind26_release" ""; seta "userbind26_description" ""
+seta "userbind27_press" ""; seta "userbind27_release" ""; seta "userbind27_description" ""
+seta "userbind28_press" ""; seta "userbind28_release" ""; seta "userbind28_description" ""
+seta "userbind29_press" ""; seta "userbind29_release" ""; seta "userbind29_description" ""
+seta "userbind30_press" ""; seta "userbind30_release" ""; seta "userbind30_description" ""
+seta "userbind31_press" ""; seta "userbind31_release" ""; seta "userbind31_description" ""
+seta "userbind32_press" ""; seta "userbind32_release" ""; seta "userbind32_description" ""
+alias _userbind_call "${$1}"
+alias +userbind "_userbind_call userbind${1}_press"
+alias -userbind "_userbind_call userbind${1}_release"
\ No newline at end of file
index 52ae30cb5baaf085432fca0cfc6c5a3af41a2ed6..fb341c5b8537f37c492a2de2c7148ebd39b9b579 100644 (file)
@@ -6,13 +6,13 @@
 seta crosshair 16
 seta crosshair_enabled 1 // main toggle for enabling/disabling crosshair rendering, used mostly just for the menu... 1 = with per-weapon crosshairs, 2 = custom crosshair
 seta crosshair_color "0.6 0.8 1"
-seta crosshair_alpha 0.75
-seta crosshair_size 0.3
+seta crosshair_alpha 0.8
+seta crosshair_size 0.4
 
 // crosshair dot settings
 seta crosshair_dot 0
 seta crosshair_dot_alpha 1
-seta crosshair_dot_size 0.600000
+seta crosshair_dot_size 0.6
 seta crosshair_dot_color "1 0 0"
 seta crosshair_dot_color_custom 1 "use a custom color for the crosshair dot"
 
@@ -51,7 +51,7 @@ seta crosshair_per_weapon 1   "when 1, each gun will display a different crosshair
 // =========================
 
 // ring around crosshair, used for various purposes (such as indicating bullets left in clip, vortex charge)
-seta crosshair_ring 1 "main cvar to enable or disable normal crosshair rings"
+seta crosshair_ring 1 "enable normal crosshair rings"
 seta crosshair_ring_inner 0 "allow inner rings to be drawn too"
 seta crosshair_ring_size 2     "ring size"
 seta crosshair_ring_alpha 0.2  "ring alpha"
@@ -67,14 +67,20 @@ seta crosshair_ring_vortex_currentcharge_scale 30
 seta crosshair_ring_vortex_currentcharge_movingavg_rate 0.05
 
 // minelayer ring
-seta crosshair_ring_minelayer 1
+seta crosshair_ring_minelayer 1 "draw a ring showing the current amount of layed mines"
 seta crosshair_ring_minelayer_alpha 0.15
 
 // hagar ring
-seta crosshair_ring_hagar 1
+seta crosshair_ring_hagar 1 "draw a ring showing the current charge of the hagar"
 seta crosshair_ring_hagar_alpha 0.15
 
+// arc ring
+seta crosshair_ring_arc 1 "draw a ring showing arc's overheating"
+seta crosshair_ring_arc_hot_color "1 0 0"
+seta crosshair_ring_arc_cold_alpha 0.2
+seta crosshair_ring_arc_hot_alpha 0.5
+
 // reload ring
-seta crosshair_ring_reload 1 "main cvar to enable or disable ammo crosshair rings"
+seta crosshair_ring_reload 1 "enable ammo crosshair rings"
 seta crosshair_ring_reload_size 2.5    "reload ring size"
 seta crosshair_ring_reload_alpha 0.2   "reload ring alpha"
index df7044ce562a41c915e9d59d7dc9d7ba5996b683..4f02d145e0276f7d66ae0a9036c3b9d9d6191cd2 100644 (file)
@@ -52,13 +52,17 @@ mod_q3bsp_lightmapmergepower 4
 // player defaults
 _cl_color "112.211" // same effect as 112, but menuqc can detect this as the default and not intentionally set
 _cl_name ""
+seta _cl_gender 0 "storage cvar for current player gender (0 = undisclosed, 1 = male, 2 = female)"
 _cl_playermodel models/player/erebus.iqm
 _cl_playerskin 0
 
-seta cl_reticle 1 "control for toggling whether ANY zoom reticles are shown"
-seta cl_reticle_stretch 0 "whether to stretch reticles so they fit the screen (breaks image proportions)"
-seta cl_reticle_item_vortex 1 "draw aiming reticle for the vortex weapon's zoom, 0 disables and values between 0 and 1 change alpha"
-seta cl_reticle_item_normal 1 "draw reticle when zooming with the zoom button, 0 disables and values between 0 and 1 change alpha"
+seta cl_reticle 1 "enable zoom reticles"
+seta cl_reticle_stretch 0 "stretch reticles so they fit the screen (breaks image proportions)"
+seta cl_reticle_normal 1 "draw an aiminig reticle when zooming with the zoom button"
+seta cl_reticle_normal_alpha 1 "alpha of the normal reticle"
+seta cl_reticle_weapon 1 "draw custom aiming reticle when zooming with certain weapons"
+seta cl_reticle_weapon_alpha 1 "alpha of the custom reticle"
+
 fov 100
 seta cl_velocityzoom_enabled 0 "velocity based zooming of fov"
 seta cl_velocityzoom_factor 0 "factor of fov zooming (negative values zoom out)"
@@ -468,7 +472,7 @@ set g_botclip_collisions 1 "0 = disable collision testing against botclips, migh
 set g_grappling_hook 0 "let players spawn with the grappling hook which allows them to pull themselves up"
 
 set g_spawn_alloweffects 1 "allow clients to enable spawn point and event effects such as particles and sounds, see cl_spawn_ cvars for more info"
-set g_spawn_furthest 0.5 "this amount of the spawns shall be far away from any players"
+set g_spawn_furthest 1.0 "this amount of the spawns shall be far away from any players"
 set g_spawn_useallspawns 0 "use all spawns, e.g. also team spawns in non-teamplay, and all spawns, even enemy spawns, in teamplay"
 // respawn delay
 set g_respawn_delay_small 2 "small game number of seconds you have to wait before you can respawn again"
@@ -541,6 +545,7 @@ gl_picmip_other 1 // so, picmip -1 is best possible quality
 r_mipsprites 1
 r_mipskins 1
 r_shadow_realtime_world_lightmaps 1
+r_shadow_realtime_world_importlightentitiesfrommap 0 // Whether build process uses keepLights is nontransparent and may change, so better make keepLights not matter.
 cl_decals_fadetime 5
 cl_decals_time 1
 seta cl_gunalign 3 "Gun alignment; 1 = center (if allowed by g_shootfromclient) or right, 2 = center (if allowed by g_shootfromclient) or left, 3 = right only, 4 = left only"
@@ -783,12 +788,12 @@ set g_banned_list_idmode "1"      "when set, the IP banning system always uses the ID
 
 r_labelsprites_scale 0.40625 // labels sprites get displayed at 0.5x from 640x480 to 1280x1024, and at 1x from 1600x1200 onwards
 
-exec binds-default.cfg
+exec binds-xonotic.cfg
 
 // we must change its default from 1.0 to 1 to be consistent with menuqc
 set slowmo 1
 
-seta menu_skin "luminos"
+seta menu_skin "luma"
 set menu_slowmo 1
 seta menu_sounds 0 "enables menu sound effects. 1 enables click sounds, 2 also enables hover sounds"
 seta menu_tooltips 1 "menu tooltips: 0 disabled, 1 enabled, 2 also shows cvar or console command (when available) changed or executed by the item"
@@ -1403,7 +1408,7 @@ exec _hud_common.cfg
 exec _hud_descriptions.cfg
 // exec the default skin config
 // please add any new cvars into the hud_save script in qcsrc/client/hud_config.qc for consistency
-exec hud_luminos.cfg
+exec hud_luma.cfg
 
 
 // ... and now that everything is configured/aliased, we can do some things:
diff --git a/gfx/crosshair31.tga b/gfx/crosshair31.tga
new file mode 100644 (file)
index 0000000..d9779a1
Binary files /dev/null and b/gfx/crosshair31.tga differ
diff --git a/gfx/crosshair32.tga b/gfx/crosshair32.tga
new file mode 100644 (file)
index 0000000..c500554
Binary files /dev/null and b/gfx/crosshair32.tga differ
diff --git a/gfx/crosshair33.tga b/gfx/crosshair33.tga
new file mode 100644 (file)
index 0000000..39843b4
Binary files /dev/null and b/gfx/crosshair33.tga differ
diff --git a/gfx/crosshair34.tga b/gfx/crosshair34.tga
new file mode 100644 (file)
index 0000000..b8d7478
Binary files /dev/null and b/gfx/crosshair34.tga differ
diff --git a/gfx/crosshair35.tga b/gfx/crosshair35.tga
new file mode 100644 (file)
index 0000000..c88e560
Binary files /dev/null and b/gfx/crosshair35.tga differ
diff --git a/gfx/crosshair36.tga b/gfx/crosshair36.tga
new file mode 100644 (file)
index 0000000..dae534f
Binary files /dev/null and b/gfx/crosshair36.tga differ
diff --git a/gfx/crosshair37.tga b/gfx/crosshair37.tga
new file mode 100644 (file)
index 0000000..06eb4fc
Binary files /dev/null and b/gfx/crosshair37.tga differ
diff --git a/gfx/crosshair38.tga b/gfx/crosshair38.tga
new file mode 100644 (file)
index 0000000..68d2b54
Binary files /dev/null and b/gfx/crosshair38.tga differ
diff --git a/gfx/crosshair39.tga b/gfx/crosshair39.tga
new file mode 100644 (file)
index 0000000..ff1f4fb
Binary files /dev/null and b/gfx/crosshair39.tga differ
diff --git a/gfx/crosshair40.tga b/gfx/crosshair40.tga
new file mode 100644 (file)
index 0000000..96e11b0
Binary files /dev/null and b/gfx/crosshair40.tga differ
diff --git a/gfx/crosshair41.tga b/gfx/crosshair41.tga
new file mode 100644 (file)
index 0000000..0b610b2
Binary files /dev/null and b/gfx/crosshair41.tga differ
diff --git a/gfx/crosshair42.tga b/gfx/crosshair42.tga
new file mode 100644 (file)
index 0000000..9401c6a
Binary files /dev/null and b/gfx/crosshair42.tga differ
diff --git a/gfx/crosshair43.tga b/gfx/crosshair43.tga
new file mode 100644 (file)
index 0000000..183d257
Binary files /dev/null and b/gfx/crosshair43.tga differ
diff --git a/gfx/crosshair44.tga b/gfx/crosshair44.tga
new file mode 100644 (file)
index 0000000..83716cf
Binary files /dev/null and b/gfx/crosshair44.tga differ
diff --git a/gfx/crosshair45.tga b/gfx/crosshair45.tga
new file mode 100644 (file)
index 0000000..4142558
Binary files /dev/null and b/gfx/crosshair45.tga differ
diff --git a/gfx/crosshair46.tga b/gfx/crosshair46.tga
new file mode 100644 (file)
index 0000000..34f9ffd
Binary files /dev/null and b/gfx/crosshair46.tga differ
diff --git a/gfx/crosshair47.tga b/gfx/crosshair47.tga
new file mode 100644 (file)
index 0000000..2221887
Binary files /dev/null and b/gfx/crosshair47.tga differ
diff --git a/gfx/crosshair48.tga b/gfx/crosshair48.tga
new file mode 100644 (file)
index 0000000..31d58db
Binary files /dev/null and b/gfx/crosshair48.tga differ
diff --git a/gfx/crosshair49.tga b/gfx/crosshair49.tga
new file mode 100644 (file)
index 0000000..ee6b145
Binary files /dev/null and b/gfx/crosshair49.tga differ
diff --git a/gfx/crosshair50.tga b/gfx/crosshair50.tga
new file mode 100644 (file)
index 0000000..0785a4d
Binary files /dev/null and b/gfx/crosshair50.tga differ
diff --git a/gfx/crosshair51.tga b/gfx/crosshair51.tga
new file mode 100644 (file)
index 0000000..7da16bc
Binary files /dev/null and b/gfx/crosshair51.tga differ
diff --git a/gfx/crosshair52.tga b/gfx/crosshair52.tga
new file mode 100644 (file)
index 0000000..9449478
Binary files /dev/null and b/gfx/crosshair52.tga differ
diff --git a/gfx/crosshair53.tga b/gfx/crosshair53.tga
new file mode 100644 (file)
index 0000000..eb74110
Binary files /dev/null and b/gfx/crosshair53.tga differ
diff --git a/gfx/crosshair54.tga b/gfx/crosshair54.tga
new file mode 100644 (file)
index 0000000..46d0464
Binary files /dev/null and b/gfx/crosshair54.tga differ
diff --git a/gfx/crosshair55.tga b/gfx/crosshair55.tga
new file mode 100644 (file)
index 0000000..adf1950
Binary files /dev/null and b/gfx/crosshair55.tga differ
diff --git a/gfx/crosshair56.tga b/gfx/crosshair56.tga
new file mode 100644 (file)
index 0000000..61adf9a
Binary files /dev/null and b/gfx/crosshair56.tga differ
diff --git a/gfx/crosshair57.tga b/gfx/crosshair57.tga
new file mode 100644 (file)
index 0000000..d0d9220
Binary files /dev/null and b/gfx/crosshair57.tga differ
diff --git a/gfx/crosshair58.tga b/gfx/crosshair58.tga
new file mode 100644 (file)
index 0000000..0bdb7f9
Binary files /dev/null and b/gfx/crosshair58.tga differ
diff --git a/gfx/crosshair59.tga b/gfx/crosshair59.tga
new file mode 100644 (file)
index 0000000..8e48aa2
Binary files /dev/null and b/gfx/crosshair59.tga differ
diff --git a/gfx/crosshair60.tga b/gfx/crosshair60.tga
new file mode 100644 (file)
index 0000000..c03e19d
Binary files /dev/null and b/gfx/crosshair60.tga differ
diff --git a/gfx/crosshair61.tga b/gfx/crosshair61.tga
new file mode 100644 (file)
index 0000000..507853f
Binary files /dev/null and b/gfx/crosshair61.tga differ
diff --git a/gfx/crosshair62.tga b/gfx/crosshair62.tga
new file mode 100644 (file)
index 0000000..54031b1
Binary files /dev/null and b/gfx/crosshair62.tga differ
diff --git a/gfx/crosshair63.tga b/gfx/crosshair63.tga
new file mode 100644 (file)
index 0000000..1aa5d55
Binary files /dev/null and b/gfx/crosshair63.tga differ
diff --git a/gfx/crosshair64.tga b/gfx/crosshair64.tga
new file mode 100644 (file)
index 0000000..06893f8
Binary files /dev/null and b/gfx/crosshair64.tga differ
diff --git a/gfx/crosshair65.tga b/gfx/crosshair65.tga
new file mode 100644 (file)
index 0000000..ebf77c3
Binary files /dev/null and b/gfx/crosshair65.tga differ
diff --git a/gfx/crosshair66.tga b/gfx/crosshair66.tga
new file mode 100644 (file)
index 0000000..ccba58d
Binary files /dev/null and b/gfx/crosshair66.tga differ
diff --git a/gfx/crosshaircalibrate.tga b/gfx/crosshaircalibrate.tga
new file mode 100644 (file)
index 0000000..3abd29e
Binary files /dev/null and b/gfx/crosshaircalibrate.tga differ
index 143a372f8c4ea9dec113759d80f93147d577f518..eef0af18d7f3e2b791faf141b129c5e01a83bff2 100644 (file)
Binary files a/gfx/crosshairdot.tga and b/gfx/crosshairdot.tga differ
diff --git a/gfx/crosshairmoustache.tga b/gfx/crosshairmoustache.tga
new file mode 100644 (file)
index 0000000..0d2129f
Binary files /dev/null and b/gfx/crosshairmoustache.tga differ
index 6386052d5ebd1a2dd98f5e112528564eecd20a6c..fcd0337ce9e913cd773bf92fb4efb2b6dd7b4b91 100644 (file)
Binary files a/gfx/crosshairtuba.tga and b/gfx/crosshairtuba.tga differ
diff --git a/gfx/hud/default/kh_blue.tga b/gfx/hud/default/kh_blue.tga
deleted file mode 100644 (file)
index 467b229..0000000
Binary files a/gfx/hud/default/kh_blue.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_blue_carrying.tga b/gfx/hud/default/kh_blue_carrying.tga
new file mode 100644 (file)
index 0000000..a1ad7ae
Binary files /dev/null and b/gfx/hud/default/kh_blue_carrying.tga differ
diff --git a/gfx/hud/default/kh_blue_taken.tga b/gfx/hud/default/kh_blue_taken.tga
new file mode 100644 (file)
index 0000000..bb855cc
Binary files /dev/null and b/gfx/hud/default/kh_blue_taken.tga differ
diff --git a/gfx/hud/default/kh_bluearrow.tga b/gfx/hud/default/kh_bluearrow.tga
deleted file mode 100644 (file)
index b686d1b..0000000
Binary files a/gfx/hud/default/kh_bluearrow.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_dropped.tga b/gfx/hud/default/kh_dropped.tga
new file mode 100644 (file)
index 0000000..a6df016
Binary files /dev/null and b/gfx/hud/default/kh_dropped.tga differ
diff --git a/gfx/hud/default/kh_pink.tga b/gfx/hud/default/kh_pink.tga
deleted file mode 100644 (file)
index b40967a..0000000
Binary files a/gfx/hud/default/kh_pink.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_pink_carrying.tga b/gfx/hud/default/kh_pink_carrying.tga
new file mode 100644 (file)
index 0000000..61053a5
Binary files /dev/null and b/gfx/hud/default/kh_pink_carrying.tga differ
diff --git a/gfx/hud/default/kh_pink_taken.tga b/gfx/hud/default/kh_pink_taken.tga
new file mode 100644 (file)
index 0000000..e7c642f
Binary files /dev/null and b/gfx/hud/default/kh_pink_taken.tga differ
diff --git a/gfx/hud/default/kh_pinkarrow.tga b/gfx/hud/default/kh_pinkarrow.tga
deleted file mode 100644 (file)
index 17427e5..0000000
Binary files a/gfx/hud/default/kh_pinkarrow.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_red.tga b/gfx/hud/default/kh_red.tga
deleted file mode 100644 (file)
index 3201f8a..0000000
Binary files a/gfx/hud/default/kh_red.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_red_carrying.tga b/gfx/hud/default/kh_red_carrying.tga
new file mode 100644 (file)
index 0000000..e52d33d
Binary files /dev/null and b/gfx/hud/default/kh_red_carrying.tga differ
diff --git a/gfx/hud/default/kh_red_taken.tga b/gfx/hud/default/kh_red_taken.tga
new file mode 100644 (file)
index 0000000..66a96a3
Binary files /dev/null and b/gfx/hud/default/kh_red_taken.tga differ
diff --git a/gfx/hud/default/kh_redarrow.tga b/gfx/hud/default/kh_redarrow.tga
deleted file mode 100644 (file)
index edd1fab..0000000
Binary files a/gfx/hud/default/kh_redarrow.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_yellow.tga b/gfx/hud/default/kh_yellow.tga
deleted file mode 100644 (file)
index bb83475..0000000
Binary files a/gfx/hud/default/kh_yellow.tga and /dev/null differ
diff --git a/gfx/hud/default/kh_yellow_carrying.tga b/gfx/hud/default/kh_yellow_carrying.tga
new file mode 100644 (file)
index 0000000..17b051f
Binary files /dev/null and b/gfx/hud/default/kh_yellow_carrying.tga differ
diff --git a/gfx/hud/default/kh_yellow_taken.tga b/gfx/hud/default/kh_yellow_taken.tga
new file mode 100644 (file)
index 0000000..b4a3d32
Binary files /dev/null and b/gfx/hud/default/kh_yellow_taken.tga differ
diff --git a/gfx/hud/default/kh_yellowarrow.tga b/gfx/hud/default/kh_yellowarrow.tga
deleted file mode 100644 (file)
index 8e754cc..0000000
Binary files a/gfx/hud/default/kh_yellowarrow.tga and /dev/null differ
diff --git a/gfx/hud/luma/accelbar.tga b/gfx/hud/luma/accelbar.tga
new file mode 100644 (file)
index 0000000..f70f3a4
Binary files /dev/null and b/gfx/hud/luma/accelbar.tga differ
diff --git a/gfx/hud/luma/ammo_bullets.tga b/gfx/hud/luma/ammo_bullets.tga
new file mode 100644 (file)
index 0000000..4891734
Binary files /dev/null and b/gfx/hud/luma/ammo_bullets.tga differ
diff --git a/gfx/hud/luma/ammo_cells.tga b/gfx/hud/luma/ammo_cells.tga
new file mode 100644 (file)
index 0000000..a5a6178
Binary files /dev/null and b/gfx/hud/luma/ammo_cells.tga differ
diff --git a/gfx/hud/luma/ammo_current_bg.tga b/gfx/hud/luma/ammo_current_bg.tga
new file mode 100644 (file)
index 0000000..4e7901e
Binary files /dev/null and b/gfx/hud/luma/ammo_current_bg.tga differ
diff --git a/gfx/hud/luma/ammo_fuel.tga b/gfx/hud/luma/ammo_fuel.tga
new file mode 100644 (file)
index 0000000..8ff3cfe
Binary files /dev/null and b/gfx/hud/luma/ammo_fuel.tga differ
diff --git a/gfx/hud/luma/ammo_plasma.tga b/gfx/hud/luma/ammo_plasma.tga
new file mode 100644 (file)
index 0000000..c47bc6f
Binary files /dev/null and b/gfx/hud/luma/ammo_plasma.tga differ
diff --git a/gfx/hud/luma/ammo_rockets.tga b/gfx/hud/luma/ammo_rockets.tga
new file mode 100644 (file)
index 0000000..41e0914
Binary files /dev/null and b/gfx/hud/luma/ammo_rockets.tga differ
diff --git a/gfx/hud/luma/ammo_shells.tga b/gfx/hud/luma/ammo_shells.tga
new file mode 100644 (file)
index 0000000..fb77174
Binary files /dev/null and b/gfx/hud/luma/ammo_shells.tga differ
diff --git a/gfx/hud/luma/ammo_supercells.tga b/gfx/hud/luma/ammo_supercells.tga
new file mode 100644 (file)
index 0000000..fb6a46e
Binary files /dev/null and b/gfx/hud/luma/ammo_supercells.tga differ
diff --git a/gfx/hud/luma/armor.tga b/gfx/hud/luma/armor.tga
new file mode 100644 (file)
index 0000000..9c58105
Binary files /dev/null and b/gfx/hud/luma/armor.tga differ
diff --git a/gfx/hud/luma/border_corner_northeast.tga b/gfx/hud/luma/border_corner_northeast.tga
new file mode 100644 (file)
index 0000000..24437df
Binary files /dev/null and b/gfx/hud/luma/border_corner_northeast.tga differ
diff --git a/gfx/hud/luma/border_corner_northwest.tga b/gfx/hud/luma/border_corner_northwest.tga
new file mode 100644 (file)
index 0000000..c270d5a
Binary files /dev/null and b/gfx/hud/luma/border_corner_northwest.tga differ
diff --git a/gfx/hud/luma/border_corner_southeast.tga b/gfx/hud/luma/border_corner_southeast.tga
new file mode 100644 (file)
index 0000000..521aceb
Binary files /dev/null and b/gfx/hud/luma/border_corner_southeast.tga differ
diff --git a/gfx/hud/luma/border_corner_southwest.tga b/gfx/hud/luma/border_corner_southwest.tga
new file mode 100644 (file)
index 0000000..99ddc9d
Binary files /dev/null and b/gfx/hud/luma/border_corner_southwest.tga differ
diff --git a/gfx/hud/luma/border_default.tga b/gfx/hud/luma/border_default.tga
new file mode 100644 (file)
index 0000000..35dc0bb
Binary files /dev/null and b/gfx/hud/luma/border_default.tga differ
diff --git a/gfx/hud/luma/border_default_east.tga b/gfx/hud/luma/border_default_east.tga
new file mode 100644 (file)
index 0000000..e14fe26
Binary files /dev/null and b/gfx/hud/luma/border_default_east.tga differ
diff --git a/gfx/hud/luma/border_default_north.tga b/gfx/hud/luma/border_default_north.tga
new file mode 100644 (file)
index 0000000..dd4e7ea
Binary files /dev/null and b/gfx/hud/luma/border_default_north.tga differ
diff --git a/gfx/hud/luma/border_default_south.tga b/gfx/hud/luma/border_default_south.tga
new file mode 100644 (file)
index 0000000..365ae08
Binary files /dev/null and b/gfx/hud/luma/border_default_south.tga differ
diff --git a/gfx/hud/luma/border_default_west.tga b/gfx/hud/luma/border_default_west.tga
new file mode 100644 (file)
index 0000000..39ba91f
Binary files /dev/null and b/gfx/hud/luma/border_default_west.tga differ
diff --git a/gfx/hud/luma/border_fading_east.tga b/gfx/hud/luma/border_fading_east.tga
new file mode 100644 (file)
index 0000000..1e37f16
Binary files /dev/null and b/gfx/hud/luma/border_fading_east.tga differ
diff --git a/gfx/hud/luma/border_fading_north.tga b/gfx/hud/luma/border_fading_north.tga
new file mode 100644 (file)
index 0000000..fa46103
Binary files /dev/null and b/gfx/hud/luma/border_fading_north.tga differ
diff --git a/gfx/hud/luma/border_fading_south.tga b/gfx/hud/luma/border_fading_south.tga
new file mode 100644 (file)
index 0000000..b14ac69
Binary files /dev/null and b/gfx/hud/luma/border_fading_south.tga differ
diff --git a/gfx/hud/luma/border_fading_west.tga b/gfx/hud/luma/border_fading_west.tga
new file mode 100644 (file)
index 0000000..cbf0de1
Binary files /dev/null and b/gfx/hud/luma/border_fading_west.tga differ
diff --git a/gfx/hud/luma/border_highlighted.tga b/gfx/hud/luma/border_highlighted.tga
new file mode 100644 (file)
index 0000000..542f82a
Binary files /dev/null and b/gfx/hud/luma/border_highlighted.tga differ
diff --git a/gfx/hud/luma/border_highlighted2.tga b/gfx/hud/luma/border_highlighted2.tga
new file mode 100644 (file)
index 0000000..7e460e5
Binary files /dev/null and b/gfx/hud/luma/border_highlighted2.tga differ
diff --git a/gfx/hud/luma/border_plain.tga b/gfx/hud/luma/border_plain.tga
new file mode 100644 (file)
index 0000000..1b7b666
Binary files /dev/null and b/gfx/hud/luma/border_plain.tga differ
diff --git a/gfx/hud/luma/border_plain_east.tga b/gfx/hud/luma/border_plain_east.tga
new file mode 100644 (file)
index 0000000..7daf12c
Binary files /dev/null and b/gfx/hud/luma/border_plain_east.tga differ
diff --git a/gfx/hud/luma/border_plain_north.tga b/gfx/hud/luma/border_plain_north.tga
new file mode 100644 (file)
index 0000000..9aacb19
Binary files /dev/null and b/gfx/hud/luma/border_plain_north.tga differ
diff --git a/gfx/hud/luma/border_plain_south.tga b/gfx/hud/luma/border_plain_south.tga
new file mode 100644 (file)
index 0000000..342ee3b
Binary files /dev/null and b/gfx/hud/luma/border_plain_south.tga differ
diff --git a/gfx/hud/luma/border_plain_west.tga b/gfx/hud/luma/border_plain_west.tga
new file mode 100644 (file)
index 0000000..a413b39
Binary files /dev/null and b/gfx/hud/luma/border_plain_west.tga differ
diff --git a/gfx/hud/luma/border_tab_east.tga b/gfx/hud/luma/border_tab_east.tga
new file mode 100644 (file)
index 0000000..974fb6b
Binary files /dev/null and b/gfx/hud/luma/border_tab_east.tga differ
diff --git a/gfx/hud/luma/border_tab_north.tga b/gfx/hud/luma/border_tab_north.tga
new file mode 100644 (file)
index 0000000..62e3793
Binary files /dev/null and b/gfx/hud/luma/border_tab_north.tga differ
diff --git a/gfx/hud/luma/border_tab_south.tga b/gfx/hud/luma/border_tab_south.tga
new file mode 100644 (file)
index 0000000..c6212d5
Binary files /dev/null and b/gfx/hud/luma/border_tab_south.tga differ
diff --git a/gfx/hud/luma/border_tab_west.tga b/gfx/hud/luma/border_tab_west.tga
new file mode 100644 (file)
index 0000000..007efa8
Binary files /dev/null and b/gfx/hud/luma/border_tab_west.tga differ
diff --git a/gfx/hud/luma/dom_icon_blue-highlighted.tga b/gfx/hud/luma/dom_icon_blue-highlighted.tga
new file mode 100644 (file)
index 0000000..a445be4
Binary files /dev/null and b/gfx/hud/luma/dom_icon_blue-highlighted.tga differ
diff --git a/gfx/hud/luma/dom_icon_blue.tga b/gfx/hud/luma/dom_icon_blue.tga
new file mode 100644 (file)
index 0000000..8c9a2b3
Binary files /dev/null and b/gfx/hud/luma/dom_icon_blue.tga differ
diff --git a/gfx/hud/luma/dom_icon_pink-highlighted.tga b/gfx/hud/luma/dom_icon_pink-highlighted.tga
new file mode 100644 (file)
index 0000000..1f0da3c
Binary files /dev/null and b/gfx/hud/luma/dom_icon_pink-highlighted.tga differ
diff --git a/gfx/hud/luma/dom_icon_pink.tga b/gfx/hud/luma/dom_icon_pink.tga
new file mode 100644 (file)
index 0000000..c95a975
Binary files /dev/null and b/gfx/hud/luma/dom_icon_pink.tga differ
diff --git a/gfx/hud/luma/dom_icon_red-highlighted.tga b/gfx/hud/luma/dom_icon_red-highlighted.tga
new file mode 100644 (file)
index 0000000..8336431
Binary files /dev/null and b/gfx/hud/luma/dom_icon_red-highlighted.tga differ
diff --git a/gfx/hud/luma/dom_icon_red.tga b/gfx/hud/luma/dom_icon_red.tga
new file mode 100644 (file)
index 0000000..1cb65d6
Binary files /dev/null and b/gfx/hud/luma/dom_icon_red.tga differ
diff --git a/gfx/hud/luma/dom_icon_yellow-highlighted.tga b/gfx/hud/luma/dom_icon_yellow-highlighted.tga
new file mode 100644 (file)
index 0000000..790ef29
Binary files /dev/null and b/gfx/hud/luma/dom_icon_yellow-highlighted.tga differ
diff --git a/gfx/hud/luma/dom_icon_yellow.tga b/gfx/hud/luma/dom_icon_yellow.tga
new file mode 100644 (file)
index 0000000..87d2abe
Binary files /dev/null and b/gfx/hud/luma/dom_icon_yellow.tga differ
diff --git a/gfx/hud/luma/flag_blue_carrying.tga b/gfx/hud/luma/flag_blue_carrying.tga
new file mode 100644 (file)
index 0000000..4e4698d
Binary files /dev/null and b/gfx/hud/luma/flag_blue_carrying.tga differ
diff --git a/gfx/hud/luma/flag_blue_lost.tga b/gfx/hud/luma/flag_blue_lost.tga
new file mode 100644 (file)
index 0000000..2c5229a
Binary files /dev/null and b/gfx/hud/luma/flag_blue_lost.tga differ
diff --git a/gfx/hud/luma/flag_blue_shielded.tga b/gfx/hud/luma/flag_blue_shielded.tga
new file mode 100644 (file)
index 0000000..a797f11
Binary files /dev/null and b/gfx/hud/luma/flag_blue_shielded.tga differ
diff --git a/gfx/hud/luma/flag_blue_taken.tga b/gfx/hud/luma/flag_blue_taken.tga
new file mode 100644 (file)
index 0000000..a0e76f7
Binary files /dev/null and b/gfx/hud/luma/flag_blue_taken.tga differ
diff --git a/gfx/hud/luma/flag_neutral_carrying.tga b/gfx/hud/luma/flag_neutral_carrying.tga
new file mode 100644 (file)
index 0000000..8ab77dc
Binary files /dev/null and b/gfx/hud/luma/flag_neutral_carrying.tga differ
diff --git a/gfx/hud/luma/flag_neutral_lost.tga b/gfx/hud/luma/flag_neutral_lost.tga
new file mode 100644 (file)
index 0000000..e6fd5c5
Binary files /dev/null and b/gfx/hud/luma/flag_neutral_lost.tga differ
diff --git a/gfx/hud/luma/flag_neutral_shielded.tga b/gfx/hud/luma/flag_neutral_shielded.tga
new file mode 100644 (file)
index 0000000..5158912
Binary files /dev/null and b/gfx/hud/luma/flag_neutral_shielded.tga differ
diff --git a/gfx/hud/luma/flag_neutral_taken.tga b/gfx/hud/luma/flag_neutral_taken.tga
new file mode 100644 (file)
index 0000000..3a32bc5
Binary files /dev/null and b/gfx/hud/luma/flag_neutral_taken.tga differ
diff --git a/gfx/hud/luma/flag_pink_carrying.tga b/gfx/hud/luma/flag_pink_carrying.tga
new file mode 100644 (file)
index 0000000..cf36764
Binary files /dev/null and b/gfx/hud/luma/flag_pink_carrying.tga differ
diff --git a/gfx/hud/luma/flag_pink_lost.tga b/gfx/hud/luma/flag_pink_lost.tga
new file mode 100644 (file)
index 0000000..0cd5467
Binary files /dev/null and b/gfx/hud/luma/flag_pink_lost.tga differ
diff --git a/gfx/hud/luma/flag_pink_shielded.tga b/gfx/hud/luma/flag_pink_shielded.tga
new file mode 100644 (file)
index 0000000..6fe9719
Binary files /dev/null and b/gfx/hud/luma/flag_pink_shielded.tga differ
diff --git a/gfx/hud/luma/flag_pink_taken.tga b/gfx/hud/luma/flag_pink_taken.tga
new file mode 100644 (file)
index 0000000..51eb11c
Binary files /dev/null and b/gfx/hud/luma/flag_pink_taken.tga differ
diff --git a/gfx/hud/luma/flag_red_carrying.tga b/gfx/hud/luma/flag_red_carrying.tga
new file mode 100644 (file)
index 0000000..2eaa874
Binary files /dev/null and b/gfx/hud/luma/flag_red_carrying.tga differ
diff --git a/gfx/hud/luma/flag_red_lost.tga b/gfx/hud/luma/flag_red_lost.tga
new file mode 100644 (file)
index 0000000..014a416
Binary files /dev/null and b/gfx/hud/luma/flag_red_lost.tga differ
diff --git a/gfx/hud/luma/flag_red_shielded.tga b/gfx/hud/luma/flag_red_shielded.tga
new file mode 100644 (file)
index 0000000..12376d6
Binary files /dev/null and b/gfx/hud/luma/flag_red_shielded.tga differ
diff --git a/gfx/hud/luma/flag_red_taken.tga b/gfx/hud/luma/flag_red_taken.tga
new file mode 100644 (file)
index 0000000..739378c
Binary files /dev/null and b/gfx/hud/luma/flag_red_taken.tga differ
diff --git a/gfx/hud/luma/flag_yellow_carrying.tga b/gfx/hud/luma/flag_yellow_carrying.tga
new file mode 100644 (file)
index 0000000..00c3b09
Binary files /dev/null and b/gfx/hud/luma/flag_yellow_carrying.tga differ
diff --git a/gfx/hud/luma/flag_yellow_lost.tga b/gfx/hud/luma/flag_yellow_lost.tga
new file mode 100644 (file)
index 0000000..bd5f3de
Binary files /dev/null and b/gfx/hud/luma/flag_yellow_lost.tga differ
diff --git a/gfx/hud/luma/flag_yellow_shielded.tga b/gfx/hud/luma/flag_yellow_shielded.tga
new file mode 100644 (file)
index 0000000..a44f976
Binary files /dev/null and b/gfx/hud/luma/flag_yellow_shielded.tga differ
diff --git a/gfx/hud/luma/flag_yellow_taken.tga b/gfx/hud/luma/flag_yellow_taken.tga
new file mode 100644 (file)
index 0000000..cff764d
Binary files /dev/null and b/gfx/hud/luma/flag_yellow_taken.tga differ
diff --git a/gfx/hud/luma/health.tga b/gfx/hud/luma/health.tga
new file mode 100644 (file)
index 0000000..51fdf0b
Binary files /dev/null and b/gfx/hud/luma/health.tga differ
diff --git a/gfx/hud/luma/keepawayball_carrying.tga b/gfx/hud/luma/keepawayball_carrying.tga
new file mode 100644 (file)
index 0000000..71351c2
Binary files /dev/null and b/gfx/hud/luma/keepawayball_carrying.tga differ
diff --git a/gfx/hud/luma/key_atck.tga b/gfx/hud/luma/key_atck.tga
new file mode 100644 (file)
index 0000000..3a60639
Binary files /dev/null and b/gfx/hud/luma/key_atck.tga differ
diff --git a/gfx/hud/luma/key_atck2.tga b/gfx/hud/luma/key_atck2.tga
new file mode 100644 (file)
index 0000000..4e2cd4b
Binary files /dev/null and b/gfx/hud/luma/key_atck2.tga differ
diff --git a/gfx/hud/luma/key_atck2_inv.tga b/gfx/hud/luma/key_atck2_inv.tga
new file mode 100644 (file)
index 0000000..c879549
Binary files /dev/null and b/gfx/hud/luma/key_atck2_inv.tga differ
diff --git a/gfx/hud/luma/key_atck_inv.tga b/gfx/hud/luma/key_atck_inv.tga
new file mode 100644 (file)
index 0000000..8079107
Binary files /dev/null and b/gfx/hud/luma/key_atck_inv.tga differ
diff --git a/gfx/hud/luma/key_backward.tga b/gfx/hud/luma/key_backward.tga
new file mode 100644 (file)
index 0000000..1117288
Binary files /dev/null and b/gfx/hud/luma/key_backward.tga differ
diff --git a/gfx/hud/luma/key_backward_inv.tga b/gfx/hud/luma/key_backward_inv.tga
new file mode 100644 (file)
index 0000000..2d3c623
Binary files /dev/null and b/gfx/hud/luma/key_backward_inv.tga differ
diff --git a/gfx/hud/luma/key_crouch.tga b/gfx/hud/luma/key_crouch.tga
new file mode 100644 (file)
index 0000000..58bbf06
Binary files /dev/null and b/gfx/hud/luma/key_crouch.tga differ
diff --git a/gfx/hud/luma/key_crouch_inv.tga b/gfx/hud/luma/key_crouch_inv.tga
new file mode 100644 (file)
index 0000000..e94fc66
Binary files /dev/null and b/gfx/hud/luma/key_crouch_inv.tga differ
diff --git a/gfx/hud/luma/key_forward.tga b/gfx/hud/luma/key_forward.tga
new file mode 100644 (file)
index 0000000..69a365b
Binary files /dev/null and b/gfx/hud/luma/key_forward.tga differ
diff --git a/gfx/hud/luma/key_forward_inv.tga b/gfx/hud/luma/key_forward_inv.tga
new file mode 100644 (file)
index 0000000..b761dd8
Binary files /dev/null and b/gfx/hud/luma/key_forward_inv.tga differ
diff --git a/gfx/hud/luma/key_jump.tga b/gfx/hud/luma/key_jump.tga
new file mode 100644 (file)
index 0000000..c73f1ee
Binary files /dev/null and b/gfx/hud/luma/key_jump.tga differ
diff --git a/gfx/hud/luma/key_jump_inv.tga b/gfx/hud/luma/key_jump_inv.tga
new file mode 100644 (file)
index 0000000..87bf449
Binary files /dev/null and b/gfx/hud/luma/key_jump_inv.tga differ
diff --git a/gfx/hud/luma/key_left.tga b/gfx/hud/luma/key_left.tga
new file mode 100644 (file)
index 0000000..bef02a6
Binary files /dev/null and b/gfx/hud/luma/key_left.tga differ
diff --git a/gfx/hud/luma/key_left_inv.tga b/gfx/hud/luma/key_left_inv.tga
new file mode 100644 (file)
index 0000000..f1191a4
Binary files /dev/null and b/gfx/hud/luma/key_left_inv.tga differ
diff --git a/gfx/hud/luma/key_right.tga b/gfx/hud/luma/key_right.tga
new file mode 100644 (file)
index 0000000..a40b7e8
Binary files /dev/null and b/gfx/hud/luma/key_right.tga differ
diff --git a/gfx/hud/luma/key_right_inv.tga b/gfx/hud/luma/key_right_inv.tga
new file mode 100644 (file)
index 0000000..41ebbd6
Binary files /dev/null and b/gfx/hud/luma/key_right_inv.tga differ
diff --git a/gfx/hud/luma/kh_blue_carrying.tga b/gfx/hud/luma/kh_blue_carrying.tga
new file mode 100644 (file)
index 0000000..37eac47
Binary files /dev/null and b/gfx/hud/luma/kh_blue_carrying.tga differ
diff --git a/gfx/hud/luma/kh_blue_taken.tga b/gfx/hud/luma/kh_blue_taken.tga
new file mode 100644 (file)
index 0000000..e6ecb94
Binary files /dev/null and b/gfx/hud/luma/kh_blue_taken.tga differ
diff --git a/gfx/hud/luma/kh_dropped.tga b/gfx/hud/luma/kh_dropped.tga
new file mode 100644 (file)
index 0000000..7887734
Binary files /dev/null and b/gfx/hud/luma/kh_dropped.tga differ
diff --git a/gfx/hud/luma/kh_pink_carrying.tga b/gfx/hud/luma/kh_pink_carrying.tga
new file mode 100644 (file)
index 0000000..e9cd7c7
Binary files /dev/null and b/gfx/hud/luma/kh_pink_carrying.tga differ
diff --git a/gfx/hud/luma/kh_pink_taken.tga b/gfx/hud/luma/kh_pink_taken.tga
new file mode 100644 (file)
index 0000000..4cf9567
Binary files /dev/null and b/gfx/hud/luma/kh_pink_taken.tga differ
diff --git a/gfx/hud/luma/kh_red_carrying.tga b/gfx/hud/luma/kh_red_carrying.tga
new file mode 100644 (file)
index 0000000..6bd512d
Binary files /dev/null and b/gfx/hud/luma/kh_red_carrying.tga differ
diff --git a/gfx/hud/luma/kh_red_taken.tga b/gfx/hud/luma/kh_red_taken.tga
new file mode 100644 (file)
index 0000000..ee62e60
Binary files /dev/null and b/gfx/hud/luma/kh_red_taken.tga differ
diff --git a/gfx/hud/luma/kh_yellow_carrying.tga b/gfx/hud/luma/kh_yellow_carrying.tga
new file mode 100644 (file)
index 0000000..9b36772
Binary files /dev/null and b/gfx/hud/luma/kh_yellow_carrying.tga differ
diff --git a/gfx/hud/luma/kh_yellow_taken.tga b/gfx/hud/luma/kh_yellow_taken.tga
new file mode 100644 (file)
index 0000000..3370bd0
Binary files /dev/null and b/gfx/hud/luma/kh_yellow_taken.tga differ
diff --git a/gfx/hud/luma/nade_bg.tga b/gfx/hud/luma/nade_bg.tga
new file mode 100644 (file)
index 0000000..0aa0700
Binary files /dev/null and b/gfx/hud/luma/nade_bg.tga differ
diff --git a/gfx/hud/luma/nade_nbg.tga b/gfx/hud/luma/nade_nbg.tga
new file mode 100644 (file)
index 0000000..80f1986
Binary files /dev/null and b/gfx/hud/luma/nade_nbg.tga differ
diff --git a/gfx/hud/luma/nexball_carrying.tga b/gfx/hud/luma/nexball_carrying.tga
new file mode 100644 (file)
index 0000000..90ec767
Binary files /dev/null and b/gfx/hud/luma/nexball_carrying.tga differ
diff --git a/gfx/hud/luma/notify_balldropped.tga b/gfx/hud/luma/notify_balldropped.tga
new file mode 100644 (file)
index 0000000..96a2c0f
Binary files /dev/null and b/gfx/hud/luma/notify_balldropped.tga differ
diff --git a/gfx/hud/luma/notify_ballpickedup.tga b/gfx/hud/luma/notify_ballpickedup.tga
new file mode 100644 (file)
index 0000000..4539f28
Binary files /dev/null and b/gfx/hud/luma/notify_ballpickedup.tga differ
diff --git a/gfx/hud/luma/notify_blue_captured.tga b/gfx/hud/luma/notify_blue_captured.tga
new file mode 100644 (file)
index 0000000..d645a9d
Binary files /dev/null and b/gfx/hud/luma/notify_blue_captured.tga differ
diff --git a/gfx/hud/luma/notify_blue_carrying.tga b/gfx/hud/luma/notify_blue_carrying.tga
new file mode 100644 (file)
index 0000000..4e4698d
Binary files /dev/null and b/gfx/hud/luma/notify_blue_carrying.tga differ
diff --git a/gfx/hud/luma/notify_blue_lost.tga b/gfx/hud/luma/notify_blue_lost.tga
new file mode 100644 (file)
index 0000000..2c5229a
Binary files /dev/null and b/gfx/hud/luma/notify_blue_lost.tga differ
diff --git a/gfx/hud/luma/notify_blue_returned.tga b/gfx/hud/luma/notify_blue_returned.tga
new file mode 100644 (file)
index 0000000..45cfc1d
Binary files /dev/null and b/gfx/hud/luma/notify_blue_returned.tga differ
diff --git a/gfx/hud/luma/notify_blue_shielded.tga b/gfx/hud/luma/notify_blue_shielded.tga
new file mode 100644 (file)
index 0000000..a797f11
Binary files /dev/null and b/gfx/hud/luma/notify_blue_shielded.tga differ
diff --git a/gfx/hud/luma/notify_blue_taken.tga b/gfx/hud/luma/notify_blue_taken.tga
new file mode 100644 (file)
index 0000000..a0e76f7
Binary files /dev/null and b/gfx/hud/luma/notify_blue_taken.tga differ
diff --git a/gfx/hud/luma/notify_camping.tga b/gfx/hud/luma/notify_camping.tga
new file mode 100644 (file)
index 0000000..f86a41e
Binary files /dev/null and b/gfx/hud/luma/notify_camping.tga differ
diff --git a/gfx/hud/luma/notify_death.tga b/gfx/hud/luma/notify_death.tga
new file mode 100644 (file)
index 0000000..97f2fe2
Binary files /dev/null and b/gfx/hud/luma/notify_death.tga differ
diff --git a/gfx/hud/luma/notify_fall.tga b/gfx/hud/luma/notify_fall.tga
new file mode 100644 (file)
index 0000000..4842969
Binary files /dev/null and b/gfx/hud/luma/notify_fall.tga differ
diff --git a/gfx/hud/luma/notify_lava.tga b/gfx/hud/luma/notify_lava.tga
new file mode 100644 (file)
index 0000000..a074f86
Binary files /dev/null and b/gfx/hud/luma/notify_lava.tga differ
diff --git a/gfx/hud/luma/notify_melee_shotgun.tga b/gfx/hud/luma/notify_melee_shotgun.tga
new file mode 100644 (file)
index 0000000..591fdb9
Binary files /dev/null and b/gfx/hud/luma/notify_melee_shotgun.tga differ
diff --git a/gfx/hud/luma/notify_nade.tga b/gfx/hud/luma/notify_nade.tga
new file mode 100644 (file)
index 0000000..c163e50
Binary files /dev/null and b/gfx/hud/luma/notify_nade.tga differ
diff --git a/gfx/hud/luma/notify_nade_heal.tga b/gfx/hud/luma/notify_nade_heal.tga
new file mode 100644 (file)
index 0000000..4a46237
Binary files /dev/null and b/gfx/hud/luma/notify_nade_heal.tga differ
diff --git a/gfx/hud/luma/notify_nade_ice.tga b/gfx/hud/luma/notify_nade_ice.tga
new file mode 100644 (file)
index 0000000..24e31ac
Binary files /dev/null and b/gfx/hud/luma/notify_nade_ice.tga differ
diff --git a/gfx/hud/luma/notify_nade_napalm.tga b/gfx/hud/luma/notify_nade_napalm.tga
new file mode 100644 (file)
index 0000000..9fb16bc
Binary files /dev/null and b/gfx/hud/luma/notify_nade_napalm.tga differ
diff --git a/gfx/hud/luma/notify_neutral_carrying.tga b/gfx/hud/luma/notify_neutral_carrying.tga
new file mode 100644 (file)
index 0000000..8ab77dc
Binary files /dev/null and b/gfx/hud/luma/notify_neutral_carrying.tga differ
diff --git a/gfx/hud/luma/notify_neutral_lost.tga b/gfx/hud/luma/notify_neutral_lost.tga
new file mode 100644 (file)
index 0000000..e6fd5c5
Binary files /dev/null and b/gfx/hud/luma/notify_neutral_lost.tga differ
diff --git a/gfx/hud/luma/notify_neutral_shielded.tga b/gfx/hud/luma/notify_neutral_shielded.tga
new file mode 100644 (file)
index 0000000..5158912
Binary files /dev/null and b/gfx/hud/luma/notify_neutral_shielded.tga differ
diff --git a/gfx/hud/luma/notify_neutral_taken.tga b/gfx/hud/luma/notify_neutral_taken.tga
new file mode 100644 (file)
index 0000000..3a32bc5
Binary files /dev/null and b/gfx/hud/luma/notify_neutral_taken.tga differ
diff --git a/gfx/hud/luma/notify_outofammo.tga b/gfx/hud/luma/notify_outofammo.tga
new file mode 100644 (file)
index 0000000..f221d58
Binary files /dev/null and b/gfx/hud/luma/notify_outofammo.tga differ
diff --git a/gfx/hud/luma/notify_pink_captured.tga b/gfx/hud/luma/notify_pink_captured.tga
new file mode 100644 (file)
index 0000000..5c91fae
Binary files /dev/null and b/gfx/hud/luma/notify_pink_captured.tga differ
diff --git a/gfx/hud/luma/notify_pink_carrying.tga b/gfx/hud/luma/notify_pink_carrying.tga
new file mode 100644 (file)
index 0000000..cf36764
Binary files /dev/null and b/gfx/hud/luma/notify_pink_carrying.tga differ
diff --git a/gfx/hud/luma/notify_pink_lost.tga b/gfx/hud/luma/notify_pink_lost.tga
new file mode 100644 (file)
index 0000000..0cd5467
Binary files /dev/null and b/gfx/hud/luma/notify_pink_lost.tga differ
diff --git a/gfx/hud/luma/notify_pink_returned.tga b/gfx/hud/luma/notify_pink_returned.tga
new file mode 100644 (file)
index 0000000..120e757
Binary files /dev/null and b/gfx/hud/luma/notify_pink_returned.tga differ
diff --git a/gfx/hud/luma/notify_pink_shielded.tga b/gfx/hud/luma/notify_pink_shielded.tga
new file mode 100644 (file)
index 0000000..6fe9719
Binary files /dev/null and b/gfx/hud/luma/notify_pink_shielded.tga differ
diff --git a/gfx/hud/luma/notify_pink_taken.tga b/gfx/hud/luma/notify_pink_taken.tga
new file mode 100644 (file)
index 0000000..51eb11c
Binary files /dev/null and b/gfx/hud/luma/notify_pink_taken.tga differ
diff --git a/gfx/hud/luma/notify_red_captured.tga b/gfx/hud/luma/notify_red_captured.tga
new file mode 100644 (file)
index 0000000..1e17194
Binary files /dev/null and b/gfx/hud/luma/notify_red_captured.tga differ
diff --git a/gfx/hud/luma/notify_red_carrying.tga b/gfx/hud/luma/notify_red_carrying.tga
new file mode 100644 (file)
index 0000000..2eaa874
Binary files /dev/null and b/gfx/hud/luma/notify_red_carrying.tga differ
diff --git a/gfx/hud/luma/notify_red_lost.tga b/gfx/hud/luma/notify_red_lost.tga
new file mode 100644 (file)
index 0000000..014a416
Binary files /dev/null and b/gfx/hud/luma/notify_red_lost.tga differ
diff --git a/gfx/hud/luma/notify_red_returned.tga b/gfx/hud/luma/notify_red_returned.tga
new file mode 100644 (file)
index 0000000..31fbe07
Binary files /dev/null and b/gfx/hud/luma/notify_red_returned.tga differ
diff --git a/gfx/hud/luma/notify_red_shielded.tga b/gfx/hud/luma/notify_red_shielded.tga
new file mode 100644 (file)
index 0000000..12376d6
Binary files /dev/null and b/gfx/hud/luma/notify_red_shielded.tga differ
diff --git a/gfx/hud/luma/notify_red_taken.tga b/gfx/hud/luma/notify_red_taken.tga
new file mode 100644 (file)
index 0000000..739378c
Binary files /dev/null and b/gfx/hud/luma/notify_red_taken.tga differ
diff --git a/gfx/hud/luma/notify_selfkill.tga b/gfx/hud/luma/notify_selfkill.tga
new file mode 100644 (file)
index 0000000..ca2b4fc
Binary files /dev/null and b/gfx/hud/luma/notify_selfkill.tga differ
diff --git a/gfx/hud/luma/notify_shootingstar.tga b/gfx/hud/luma/notify_shootingstar.tga
new file mode 100644 (file)
index 0000000..74e2c0f
Binary files /dev/null and b/gfx/hud/luma/notify_shootingstar.tga differ
diff --git a/gfx/hud/luma/notify_slime.tga b/gfx/hud/luma/notify_slime.tga
new file mode 100644 (file)
index 0000000..b595e15
Binary files /dev/null and b/gfx/hud/luma/notify_slime.tga differ
diff --git a/gfx/hud/luma/notify_teamkill_blue.tga b/gfx/hud/luma/notify_teamkill_blue.tga
new file mode 100644 (file)
index 0000000..b6479dc
Binary files /dev/null and b/gfx/hud/luma/notify_teamkill_blue.tga differ
diff --git a/gfx/hud/luma/notify_teamkill_neutral.tga b/gfx/hud/luma/notify_teamkill_neutral.tga
new file mode 100644 (file)
index 0000000..c346fa9
Binary files /dev/null and b/gfx/hud/luma/notify_teamkill_neutral.tga differ
diff --git a/gfx/hud/luma/notify_teamkill_pink.tga b/gfx/hud/luma/notify_teamkill_pink.tga
new file mode 100644 (file)
index 0000000..9b4660c
Binary files /dev/null and b/gfx/hud/luma/notify_teamkill_pink.tga differ
diff --git a/gfx/hud/luma/notify_teamkill_red.tga b/gfx/hud/luma/notify_teamkill_red.tga
new file mode 100644 (file)
index 0000000..367b552
Binary files /dev/null and b/gfx/hud/luma/notify_teamkill_red.tga differ
diff --git a/gfx/hud/luma/notify_teamkill_yellow.tga b/gfx/hud/luma/notify_teamkill_yellow.tga
new file mode 100644 (file)
index 0000000..772bcaa
Binary files /dev/null and b/gfx/hud/luma/notify_teamkill_yellow.tga differ
diff --git a/gfx/hud/luma/notify_telefrag.tga b/gfx/hud/luma/notify_telefrag.tga
new file mode 100644 (file)
index 0000000..a72ff9c
Binary files /dev/null and b/gfx/hud/luma/notify_telefrag.tga differ
diff --git a/gfx/hud/luma/notify_void.tga b/gfx/hud/luma/notify_void.tga
new file mode 100644 (file)
index 0000000..ce32f81
Binary files /dev/null and b/gfx/hud/luma/notify_void.tga differ
diff --git a/gfx/hud/luma/notify_water.tga b/gfx/hud/luma/notify_water.tga
new file mode 100644 (file)
index 0000000..f7f0cda
Binary files /dev/null and b/gfx/hud/luma/notify_water.tga differ
diff --git a/gfx/hud/luma/notify_yellow_captured.tga b/gfx/hud/luma/notify_yellow_captured.tga
new file mode 100644 (file)
index 0000000..c2fcd01
Binary files /dev/null and b/gfx/hud/luma/notify_yellow_captured.tga differ
diff --git a/gfx/hud/luma/notify_yellow_carrying.tga b/gfx/hud/luma/notify_yellow_carrying.tga
new file mode 100644 (file)
index 0000000..00c3b09
Binary files /dev/null and b/gfx/hud/luma/notify_yellow_carrying.tga differ
diff --git a/gfx/hud/luma/notify_yellow_lost.tga b/gfx/hud/luma/notify_yellow_lost.tga
new file mode 100644 (file)
index 0000000..bd5f3de
Binary files /dev/null and b/gfx/hud/luma/notify_yellow_lost.tga differ
diff --git a/gfx/hud/luma/notify_yellow_returned.tga b/gfx/hud/luma/notify_yellow_returned.tga
new file mode 100644 (file)
index 0000000..cc7348a
Binary files /dev/null and b/gfx/hud/luma/notify_yellow_returned.tga differ
diff --git a/gfx/hud/luma/notify_yellow_shielded.tga b/gfx/hud/luma/notify_yellow_shielded.tga
new file mode 100644 (file)
index 0000000..a44f976
Binary files /dev/null and b/gfx/hud/luma/notify_yellow_shielded.tga differ
diff --git a/gfx/hud/luma/notify_yellow_taken.tga b/gfx/hud/luma/notify_yellow_taken.tga
new file mode 100644 (file)
index 0000000..cff764d
Binary files /dev/null and b/gfx/hud/luma/notify_yellow_taken.tga differ
diff --git a/gfx/hud/luma/num_leading.tga b/gfx/hud/luma/num_leading.tga
new file mode 100644 (file)
index 0000000..0aa0700
Binary files /dev/null and b/gfx/hud/luma/num_leading.tga differ
diff --git a/gfx/hud/luma/ok_weapon_rail.tga b/gfx/hud/luma/ok_weapon_rail.tga
new file mode 100644 (file)
index 0000000..e2e83ae
Binary files /dev/null and b/gfx/hud/luma/ok_weapon_rail.tga differ
diff --git a/gfx/hud/luma/ok_weapon_shotgun.tga b/gfx/hud/luma/ok_weapon_shotgun.tga
new file mode 100644 (file)
index 0000000..f5fb92e
Binary files /dev/null and b/gfx/hud/luma/ok_weapon_shotgun.tga differ
diff --git a/gfx/hud/luma/ok_weapon_smg.tga b/gfx/hud/luma/ok_weapon_smg.tga
new file mode 100644 (file)
index 0000000..5aee32a
Binary files /dev/null and b/gfx/hud/luma/ok_weapon_smg.tga differ
diff --git a/gfx/hud/luma/player_blue.tga b/gfx/hud/luma/player_blue.tga
new file mode 100644 (file)
index 0000000..028092e
Binary files /dev/null and b/gfx/hud/luma/player_blue.tga differ
diff --git a/gfx/hud/luma/player_neutral.tga b/gfx/hud/luma/player_neutral.tga
new file mode 100644 (file)
index 0000000..0880bc9
Binary files /dev/null and b/gfx/hud/luma/player_neutral.tga differ
diff --git a/gfx/hud/luma/player_pink.tga b/gfx/hud/luma/player_pink.tga
new file mode 100644 (file)
index 0000000..0e4cb7e
Binary files /dev/null and b/gfx/hud/luma/player_pink.tga differ
diff --git a/gfx/hud/luma/player_red.tga b/gfx/hud/luma/player_red.tga
new file mode 100644 (file)
index 0000000..7f0c4e5
Binary files /dev/null and b/gfx/hud/luma/player_red.tga differ
diff --git a/gfx/hud/luma/player_yellow.tga b/gfx/hud/luma/player_yellow.tga
new file mode 100644 (file)
index 0000000..283db51
Binary files /dev/null and b/gfx/hud/luma/player_yellow.tga differ
diff --git a/gfx/hud/luma/powerup_detonator.tga b/gfx/hud/luma/powerup_detonator.tga
new file mode 100644 (file)
index 0000000..e59955a
Binary files /dev/null and b/gfx/hud/luma/powerup_detonator.tga differ
diff --git a/gfx/hud/luma/powerup_invisibility.tga b/gfx/hud/luma/powerup_invisibility.tga
new file mode 100644 (file)
index 0000000..d1aa0c7
Binary files /dev/null and b/gfx/hud/luma/powerup_invisibility.tga differ
diff --git a/gfx/hud/luma/powerup_resurrection.tga b/gfx/hud/luma/powerup_resurrection.tga
new file mode 100644 (file)
index 0000000..47d09e7
Binary files /dev/null and b/gfx/hud/luma/powerup_resurrection.tga differ
diff --git a/gfx/hud/luma/powerup_speed.tga b/gfx/hud/luma/powerup_speed.tga
new file mode 100644 (file)
index 0000000..1a893d6
Binary files /dev/null and b/gfx/hud/luma/powerup_speed.tga differ
diff --git a/gfx/hud/luma/powerup_ultrahealing.tga b/gfx/hud/luma/powerup_ultrahealing.tga
new file mode 100644 (file)
index 0000000..ea9e00f
Binary files /dev/null and b/gfx/hud/luma/powerup_ultrahealing.tga differ
diff --git a/gfx/hud/luma/powerup_xray.tga b/gfx/hud/luma/powerup_xray.tga
new file mode 100644 (file)
index 0000000..bf81ff4
Binary files /dev/null and b/gfx/hud/luma/powerup_xray.tga differ
diff --git a/gfx/hud/luma/progressbar.tga b/gfx/hud/luma/progressbar.tga
new file mode 100644 (file)
index 0000000..f70f3a4
Binary files /dev/null and b/gfx/hud/luma/progressbar.tga differ
diff --git a/gfx/hud/luma/progressbar_vertical.tga b/gfx/hud/luma/progressbar_vertical.tga
new file mode 100644 (file)
index 0000000..9df8bd6
Binary files /dev/null and b/gfx/hud/luma/progressbar_vertical.tga differ
diff --git a/gfx/hud/luma/race_newfail.tga b/gfx/hud/luma/race_newfail.tga
new file mode 100644 (file)
index 0000000..19e6314
Binary files /dev/null and b/gfx/hud/luma/race_newfail.tga differ
diff --git a/gfx/hud/luma/race_newrankgreen.tga b/gfx/hud/luma/race_newrankgreen.tga
new file mode 100644 (file)
index 0000000..05feb73
Binary files /dev/null and b/gfx/hud/luma/race_newrankgreen.tga differ
diff --git a/gfx/hud/luma/race_newrankyellow.tga b/gfx/hud/luma/race_newrankyellow.tga
new file mode 100644 (file)
index 0000000..05feb73
Binary files /dev/null and b/gfx/hud/luma/race_newrankyellow.tga differ
diff --git a/gfx/hud/luma/race_newrecordserver.tga b/gfx/hud/luma/race_newrecordserver.tga
new file mode 100644 (file)
index 0000000..1141304
Binary files /dev/null and b/gfx/hud/luma/race_newrecordserver.tga differ
diff --git a/gfx/hud/luma/race_newtime.tga b/gfx/hud/luma/race_newtime.tga
new file mode 100644 (file)
index 0000000..8d21a41
Binary files /dev/null and b/gfx/hud/luma/race_newtime.tga differ
diff --git a/gfx/hud/luma/shield.tga b/gfx/hud/luma/shield.tga
new file mode 100644 (file)
index 0000000..3101dbb
Binary files /dev/null and b/gfx/hud/luma/shield.tga differ
diff --git a/gfx/hud/luma/strength.tga b/gfx/hud/luma/strength.tga
new file mode 100644 (file)
index 0000000..7a9910a
Binary files /dev/null and b/gfx/hud/luma/strength.tga differ
diff --git a/gfx/hud/luma/superweapons.tga b/gfx/hud/luma/superweapons.tga
new file mode 100644 (file)
index 0000000..fd873ac
Binary files /dev/null and b/gfx/hud/luma/superweapons.tga differ
diff --git a/gfx/hud/luma/voteprogress_back.tga b/gfx/hud/luma/voteprogress_back.tga
new file mode 100644 (file)
index 0000000..d1fd54a
Binary files /dev/null and b/gfx/hud/luma/voteprogress_back.tga differ
diff --git a/gfx/hud/luma/voteprogress_prog.tga b/gfx/hud/luma/voteprogress_prog.tga
new file mode 100644 (file)
index 0000000..50a15d6
Binary files /dev/null and b/gfx/hud/luma/voteprogress_prog.tga differ
diff --git a/gfx/hud/luma/voteprogress_voted.tga b/gfx/hud/luma/voteprogress_voted.tga
new file mode 100644 (file)
index 0000000..98b9b16
Binary files /dev/null and b/gfx/hud/luma/voteprogress_voted.tga differ
diff --git a/gfx/hud/luma/weapon_accuracy.tga b/gfx/hud/luma/weapon_accuracy.tga
new file mode 100644 (file)
index 0000000..1bdcdd5
Binary files /dev/null and b/gfx/hud/luma/weapon_accuracy.tga differ
diff --git a/gfx/hud/luma/weapon_accuracy_north.tga b/gfx/hud/luma/weapon_accuracy_north.tga
new file mode 100644 (file)
index 0000000..03cc0ff
Binary files /dev/null and b/gfx/hud/luma/weapon_accuracy_north.tga differ
diff --git a/gfx/hud/luma/weapon_accuracy_south.tga b/gfx/hud/luma/weapon_accuracy_south.tga
new file mode 100644 (file)
index 0000000..7aa8069
Binary files /dev/null and b/gfx/hud/luma/weapon_accuracy_south.tga differ
diff --git a/gfx/hud/luma/weapon_accuracy_west.tga b/gfx/hud/luma/weapon_accuracy_west.tga
new file mode 100644 (file)
index 0000000..965c9ad
Binary files /dev/null and b/gfx/hud/luma/weapon_accuracy_west.tga differ
diff --git a/gfx/hud/luma/weapon_ammo.tga b/gfx/hud/luma/weapon_ammo.tga
new file mode 100644 (file)
index 0000000..0a688f7
Binary files /dev/null and b/gfx/hud/luma/weapon_ammo.tga differ
diff --git a/gfx/hud/luma/weapon_complainbubble.tga b/gfx/hud/luma/weapon_complainbubble.tga
new file mode 100644 (file)
index 0000000..943178f
Binary files /dev/null and b/gfx/hud/luma/weapon_complainbubble.tga differ
diff --git a/gfx/hud/luma/weapon_current_bg.tga b/gfx/hud/luma/weapon_current_bg.tga
new file mode 100644 (file)
index 0000000..6d3efb9
Binary files /dev/null and b/gfx/hud/luma/weapon_current_bg.tga differ
diff --git a/gfx/hud/luma/weapon_current_bg_north.tga b/gfx/hud/luma/weapon_current_bg_north.tga
new file mode 100644 (file)
index 0000000..8ad7ec2
Binary files /dev/null and b/gfx/hud/luma/weapon_current_bg_north.tga differ
diff --git a/gfx/hud/luma/weapon_current_bg_south.tga b/gfx/hud/luma/weapon_current_bg_south.tga
new file mode 100644 (file)
index 0000000..a2b9bf7
Binary files /dev/null and b/gfx/hud/luma/weapon_current_bg_south.tga differ
diff --git a/gfx/hud/luma/weapon_current_bg_west.tga b/gfx/hud/luma/weapon_current_bg_west.tga
new file mode 100644 (file)
index 0000000..d40e2a4
Binary files /dev/null and b/gfx/hud/luma/weapon_current_bg_west.tga differ
diff --git a/gfx/hud/luma/weaponarc.tga b/gfx/hud/luma/weaponarc.tga
new file mode 100644 (file)
index 0000000..adaeff5
Binary files /dev/null and b/gfx/hud/luma/weaponarc.tga differ
diff --git a/gfx/hud/luma/weaponcrylink.tga b/gfx/hud/luma/weaponcrylink.tga
new file mode 100644 (file)
index 0000000..e6673be
Binary files /dev/null and b/gfx/hud/luma/weaponcrylink.tga differ
diff --git a/gfx/hud/luma/weaponelectro.tga b/gfx/hud/luma/weaponelectro.tga
new file mode 100644 (file)
index 0000000..f0cbdfe
Binary files /dev/null and b/gfx/hud/luma/weaponelectro.tga differ
diff --git a/gfx/hud/luma/weaponfireball.tga b/gfx/hud/luma/weaponfireball.tga
new file mode 100644 (file)
index 0000000..b794d76
Binary files /dev/null and b/gfx/hud/luma/weaponfireball.tga differ
diff --git a/gfx/hud/luma/weapongrenadelauncher.tga b/gfx/hud/luma/weapongrenadelauncher.tga
new file mode 100644 (file)
index 0000000..9cb3228
Binary files /dev/null and b/gfx/hud/luma/weapongrenadelauncher.tga differ
diff --git a/gfx/hud/luma/weaponhagar.tga b/gfx/hud/luma/weaponhagar.tga
new file mode 100644 (file)
index 0000000..63a8b60
Binary files /dev/null and b/gfx/hud/luma/weaponhagar.tga differ
diff --git a/gfx/hud/luma/weaponhlac.tga b/gfx/hud/luma/weaponhlac.tga
new file mode 100644 (file)
index 0000000..2208b83
Binary files /dev/null and b/gfx/hud/luma/weaponhlac.tga differ
diff --git a/gfx/hud/luma/weaponhmg.tga b/gfx/hud/luma/weaponhmg.tga
new file mode 100644 (file)
index 0000000..c36c3f5
Binary files /dev/null and b/gfx/hud/luma/weaponhmg.tga differ
diff --git a/gfx/hud/luma/weaponhook.tga b/gfx/hud/luma/weaponhook.tga
new file mode 100644 (file)
index 0000000..a3d2b88
Binary files /dev/null and b/gfx/hud/luma/weaponhook.tga differ
diff --git a/gfx/hud/luma/weaponlaser.tga b/gfx/hud/luma/weaponlaser.tga
new file mode 100644 (file)
index 0000000..2e77781
Binary files /dev/null and b/gfx/hud/luma/weaponlaser.tga differ
diff --git a/gfx/hud/luma/weaponminelayer.tga b/gfx/hud/luma/weaponminelayer.tga
new file mode 100644 (file)
index 0000000..0f0069d
Binary files /dev/null and b/gfx/hud/luma/weaponminelayer.tga differ
diff --git a/gfx/hud/luma/weaponminstanex.tga b/gfx/hud/luma/weaponminstanex.tga
new file mode 100644 (file)
index 0000000..81c37e8
Binary files /dev/null and b/gfx/hud/luma/weaponminstanex.tga differ
diff --git a/gfx/hud/luma/weaponnex.tga b/gfx/hud/luma/weaponnex.tga
new file mode 100644 (file)
index 0000000..e2e83ae
Binary files /dev/null and b/gfx/hud/luma/weaponnex.tga differ
diff --git a/gfx/hud/luma/weaponporto.tga b/gfx/hud/luma/weaponporto.tga
new file mode 100644 (file)
index 0000000..5ee8169
Binary files /dev/null and b/gfx/hud/luma/weaponporto.tga differ
diff --git a/gfx/hud/luma/weaponrifle.tga b/gfx/hud/luma/weaponrifle.tga
new file mode 100644 (file)
index 0000000..036845c
Binary files /dev/null and b/gfx/hud/luma/weaponrifle.tga differ
diff --git a/gfx/hud/luma/weaponrocketlauncher.tga b/gfx/hud/luma/weaponrocketlauncher.tga
new file mode 100644 (file)
index 0000000..174d86e
Binary files /dev/null and b/gfx/hud/luma/weaponrocketlauncher.tga differ
diff --git a/gfx/hud/luma/weaponrpc.tga b/gfx/hud/luma/weaponrpc.tga
new file mode 100644 (file)
index 0000000..643c5ca
Binary files /dev/null and b/gfx/hud/luma/weaponrpc.tga differ
diff --git a/gfx/hud/luma/weaponseeker.tga b/gfx/hud/luma/weaponseeker.tga
new file mode 100644 (file)
index 0000000..17645a6
Binary files /dev/null and b/gfx/hud/luma/weaponseeker.tga differ
diff --git a/gfx/hud/luma/weaponshockwave.tga b/gfx/hud/luma/weaponshockwave.tga
new file mode 100644 (file)
index 0000000..c37b837
Binary files /dev/null and b/gfx/hud/luma/weaponshockwave.tga differ
diff --git a/gfx/hud/luma/weaponshotgun.tga b/gfx/hud/luma/weaponshotgun.tga
new file mode 100644 (file)
index 0000000..f5fb92e
Binary files /dev/null and b/gfx/hud/luma/weaponshotgun.tga differ
diff --git a/gfx/hud/luma/weapontuba.tga b/gfx/hud/luma/weapontuba.tga
new file mode 100644 (file)
index 0000000..47acf24
Binary files /dev/null and b/gfx/hud/luma/weapontuba.tga differ
diff --git a/gfx/hud/luma/weaponuzi.tga b/gfx/hud/luma/weaponuzi.tga
new file mode 100644 (file)
index 0000000..5aee32a
Binary files /dev/null and b/gfx/hud/luma/weaponuzi.tga differ
diff --git a/gfx/hud/old/kh_blue.tga b/gfx/hud/old/kh_blue.tga
deleted file mode 100644 (file)
index 467b229..0000000
Binary files a/gfx/hud/old/kh_blue.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_bluearrow.tga b/gfx/hud/old/kh_bluearrow.tga
deleted file mode 100644 (file)
index b686d1b..0000000
Binary files a/gfx/hud/old/kh_bluearrow.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_pink.tga b/gfx/hud/old/kh_pink.tga
deleted file mode 100644 (file)
index b40967a..0000000
Binary files a/gfx/hud/old/kh_pink.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_pinkarrow.tga b/gfx/hud/old/kh_pinkarrow.tga
deleted file mode 100644 (file)
index 17427e5..0000000
Binary files a/gfx/hud/old/kh_pinkarrow.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_red.tga b/gfx/hud/old/kh_red.tga
deleted file mode 100644 (file)
index 3201f8a..0000000
Binary files a/gfx/hud/old/kh_red.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_redarrow.tga b/gfx/hud/old/kh_redarrow.tga
deleted file mode 100644 (file)
index edd1fab..0000000
Binary files a/gfx/hud/old/kh_redarrow.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_yellow.tga b/gfx/hud/old/kh_yellow.tga
deleted file mode 100644 (file)
index bb83475..0000000
Binary files a/gfx/hud/old/kh_yellow.tga and /dev/null differ
diff --git a/gfx/hud/old/kh_yellowarrow.tga b/gfx/hud/old/kh_yellowarrow.tga
deleted file mode 100644 (file)
index 8e754cc..0000000
Binary files a/gfx/hud/old/kh_yellowarrow.tga and /dev/null differ
diff --git a/gfx/menu/luma/background.tga b/gfx/menu/luma/background.tga
new file mode 100644 (file)
index 0000000..7497ddc
Binary files /dev/null and b/gfx/menu/luma/background.tga differ
diff --git a/gfx/menu/luma/background_ingame.tga b/gfx/menu/luma/background_ingame.tga
new file mode 100644 (file)
index 0000000..6ead934
Binary files /dev/null and b/gfx/menu/luma/background_ingame.tga differ
diff --git a/gfx/menu/luma/background_ingame_l2.tga b/gfx/menu/luma/background_ingame_l2.tga
new file mode 100644 (file)
index 0000000..6e34b47
Binary files /dev/null and b/gfx/menu/luma/background_ingame_l2.tga differ
diff --git a/gfx/menu/luma/background_l2.tga b/gfx/menu/luma/background_l2.tga
new file mode 100644 (file)
index 0000000..6e34b47
Binary files /dev/null and b/gfx/menu/luma/background_l2.tga differ
diff --git a/gfx/menu/luma/bigbutton_c.tga b/gfx/menu/luma/bigbutton_c.tga
new file mode 100644 (file)
index 0000000..3565f3c
Binary files /dev/null and b/gfx/menu/luma/bigbutton_c.tga differ
diff --git a/gfx/menu/luma/bigbutton_d.tga b/gfx/menu/luma/bigbutton_d.tga
new file mode 100644 (file)
index 0000000..0efae80
Binary files /dev/null and b/gfx/menu/luma/bigbutton_d.tga differ
diff --git a/gfx/menu/luma/bigbutton_f.tga b/gfx/menu/luma/bigbutton_f.tga
new file mode 100644 (file)
index 0000000..3edc7da
Binary files /dev/null and b/gfx/menu/luma/bigbutton_f.tga differ
diff --git a/gfx/menu/luma/bigbutton_n.tga b/gfx/menu/luma/bigbutton_n.tga
new file mode 100644 (file)
index 0000000..4f07b0c
Binary files /dev/null and b/gfx/menu/luma/bigbutton_n.tga differ
diff --git a/gfx/menu/luma/bigbuttongray_c.tga b/gfx/menu/luma/bigbuttongray_c.tga
new file mode 100644 (file)
index 0000000..e18e0f6
Binary files /dev/null and b/gfx/menu/luma/bigbuttongray_c.tga differ
diff --git a/gfx/menu/luma/bigbuttongray_d.tga b/gfx/menu/luma/bigbuttongray_d.tga
new file mode 100644 (file)
index 0000000..87b5dd5
Binary files /dev/null and b/gfx/menu/luma/bigbuttongray_d.tga differ
diff --git a/gfx/menu/luma/bigbuttongray_f.tga b/gfx/menu/luma/bigbuttongray_f.tga
new file mode 100644 (file)
index 0000000..3624987
Binary files /dev/null and b/gfx/menu/luma/bigbuttongray_f.tga differ
diff --git a/gfx/menu/luma/bigbuttongray_n.tga b/gfx/menu/luma/bigbuttongray_n.tga
new file mode 100644 (file)
index 0000000..e18e0f6
Binary files /dev/null and b/gfx/menu/luma/bigbuttongray_n.tga differ
diff --git a/gfx/menu/luma/border.tga b/gfx/menu/luma/border.tga
new file mode 100644 (file)
index 0000000..95bdc3c
Binary files /dev/null and b/gfx/menu/luma/border.tga differ
diff --git a/gfx/menu/luma/button_c.tga b/gfx/menu/luma/button_c.tga
new file mode 100644 (file)
index 0000000..b86b63a
Binary files /dev/null and b/gfx/menu/luma/button_c.tga differ
diff --git a/gfx/menu/luma/button_d.tga b/gfx/menu/luma/button_d.tga
new file mode 100644 (file)
index 0000000..f804330
Binary files /dev/null and b/gfx/menu/luma/button_d.tga differ
diff --git a/gfx/menu/luma/button_f.tga b/gfx/menu/luma/button_f.tga
new file mode 100644 (file)
index 0000000..0b54fee
Binary files /dev/null and b/gfx/menu/luma/button_f.tga differ
diff --git a/gfx/menu/luma/button_n.tga b/gfx/menu/luma/button_n.tga
new file mode 100644 (file)
index 0000000..0dc4fd6
Binary files /dev/null and b/gfx/menu/luma/button_n.tga differ
diff --git a/gfx/menu/luma/buttongray_c.tga b/gfx/menu/luma/buttongray_c.tga
new file mode 100644 (file)
index 0000000..4c1ae7c
Binary files /dev/null and b/gfx/menu/luma/buttongray_c.tga differ
diff --git a/gfx/menu/luma/buttongray_d.tga b/gfx/menu/luma/buttongray_d.tga
new file mode 100644 (file)
index 0000000..e0e8318
Binary files /dev/null and b/gfx/menu/luma/buttongray_d.tga differ
diff --git a/gfx/menu/luma/buttongray_f.tga b/gfx/menu/luma/buttongray_f.tga
new file mode 100644 (file)
index 0000000..cc604bc
Binary files /dev/null and b/gfx/menu/luma/buttongray_f.tga differ
diff --git a/gfx/menu/luma/buttongray_n.tga b/gfx/menu/luma/buttongray_n.tga
new file mode 100644 (file)
index 0000000..4c1ae7c
Binary files /dev/null and b/gfx/menu/luma/buttongray_n.tga differ
diff --git a/gfx/menu/luma/checkbox_c0.tga b/gfx/menu/luma/checkbox_c0.tga
new file mode 100644 (file)
index 0000000..f8e6960
Binary files /dev/null and b/gfx/menu/luma/checkbox_c0.tga differ
diff --git a/gfx/menu/luma/checkbox_c1.tga b/gfx/menu/luma/checkbox_c1.tga
new file mode 100644 (file)
index 0000000..32d2f6d
Binary files /dev/null and b/gfx/menu/luma/checkbox_c1.tga differ
diff --git a/gfx/menu/luma/checkbox_d0.tga b/gfx/menu/luma/checkbox_d0.tga
new file mode 100644 (file)
index 0000000..b059ab6
Binary files /dev/null and b/gfx/menu/luma/checkbox_d0.tga differ
diff --git a/gfx/menu/luma/checkbox_d1.tga b/gfx/menu/luma/checkbox_d1.tga
new file mode 100644 (file)
index 0000000..e38b962
Binary files /dev/null and b/gfx/menu/luma/checkbox_d1.tga differ
diff --git a/gfx/menu/luma/checkbox_f0.tga b/gfx/menu/luma/checkbox_f0.tga
new file mode 100644 (file)
index 0000000..5201675
Binary files /dev/null and b/gfx/menu/luma/checkbox_f0.tga differ
diff --git a/gfx/menu/luma/checkbox_f1.tga b/gfx/menu/luma/checkbox_f1.tga
new file mode 100644 (file)
index 0000000..116b29c
Binary files /dev/null and b/gfx/menu/luma/checkbox_f1.tga differ
diff --git a/gfx/menu/luma/checkbox_n0.tga b/gfx/menu/luma/checkbox_n0.tga
new file mode 100644 (file)
index 0000000..9786dc8
Binary files /dev/null and b/gfx/menu/luma/checkbox_n0.tga differ
diff --git a/gfx/menu/luma/checkbox_n1.tga b/gfx/menu/luma/checkbox_n1.tga
new file mode 100644 (file)
index 0000000..427d3ce
Binary files /dev/null and b/gfx/menu/luma/checkbox_n1.tga differ
diff --git a/gfx/menu/luma/checkmark.tga b/gfx/menu/luma/checkmark.tga
new file mode 100644 (file)
index 0000000..eb4b259
Binary files /dev/null and b/gfx/menu/luma/checkmark.tga differ
diff --git a/gfx/menu/luma/clearbutton_c.tga b/gfx/menu/luma/clearbutton_c.tga
new file mode 100644 (file)
index 0000000..36fc40b
Binary files /dev/null and b/gfx/menu/luma/clearbutton_c.tga differ
diff --git a/gfx/menu/luma/clearbutton_f.tga b/gfx/menu/luma/clearbutton_f.tga
new file mode 100644 (file)
index 0000000..c2418a4
Binary files /dev/null and b/gfx/menu/luma/clearbutton_f.tga differ
diff --git a/gfx/menu/luma/clearbutton_n.tga b/gfx/menu/luma/clearbutton_n.tga
new file mode 100644 (file)
index 0000000..3ac282b
Binary files /dev/null and b/gfx/menu/luma/clearbutton_n.tga differ
diff --git a/gfx/menu/luma/closebutton_c.tga b/gfx/menu/luma/closebutton_c.tga
new file mode 100644 (file)
index 0000000..3a8f46f
Binary files /dev/null and b/gfx/menu/luma/closebutton_c.tga differ
diff --git a/gfx/menu/luma/closebutton_f.tga b/gfx/menu/luma/closebutton_f.tga
new file mode 100644 (file)
index 0000000..0b3933b
Binary files /dev/null and b/gfx/menu/luma/closebutton_f.tga differ
diff --git a/gfx/menu/luma/closebutton_n.tga b/gfx/menu/luma/closebutton_n.tga
new file mode 100644 (file)
index 0000000..4ea4b1c
Binary files /dev/null and b/gfx/menu/luma/closebutton_n.tga differ
diff --git a/gfx/menu/luma/colorbutton_c.tga b/gfx/menu/luma/colorbutton_c.tga
new file mode 100644 (file)
index 0000000..0d8eef1
Binary files /dev/null and b/gfx/menu/luma/colorbutton_c.tga differ
diff --git a/gfx/menu/luma/colorbutton_f.tga b/gfx/menu/luma/colorbutton_f.tga
new file mode 100644 (file)
index 0000000..1a2fc86
Binary files /dev/null and b/gfx/menu/luma/colorbutton_f.tga differ
diff --git a/gfx/menu/luma/colorbutton_n.tga b/gfx/menu/luma/colorbutton_n.tga
new file mode 100644 (file)
index 0000000..3498ad5
Binary files /dev/null and b/gfx/menu/luma/colorbutton_n.tga differ
diff --git a/gfx/menu/luma/colorpicker.tga b/gfx/menu/luma/colorpicker.tga
new file mode 100755 (executable)
index 0000000..6f9845b
Binary files /dev/null and b/gfx/menu/luma/colorpicker.tga differ
diff --git a/gfx/menu/luma/colorpicker_m.tga b/gfx/menu/luma/colorpicker_m.tga
new file mode 100644 (file)
index 0000000..6775942
Binary files /dev/null and b/gfx/menu/luma/colorpicker_m.tga differ
diff --git a/gfx/menu/luma/colorpicker_selected.tga b/gfx/menu/luma/colorpicker_selected.tga
new file mode 100644 (file)
index 0000000..df79869
Binary files /dev/null and b/gfx/menu/luma/colorpicker_selected.tga differ
diff --git a/gfx/menu/luma/crosshairbutton_c.tga b/gfx/menu/luma/crosshairbutton_c.tga
new file mode 100644 (file)
index 0000000..ecfd0a8
Binary files /dev/null and b/gfx/menu/luma/crosshairbutton_c.tga differ
diff --git a/gfx/menu/luma/crosshairbutton_d.tga b/gfx/menu/luma/crosshairbutton_d.tga
new file mode 100644 (file)
index 0000000..4e7901e
Binary files /dev/null and b/gfx/menu/luma/crosshairbutton_d.tga differ
diff --git a/gfx/menu/luma/crosshairbutton_f.tga b/gfx/menu/luma/crosshairbutton_f.tga
new file mode 100644 (file)
index 0000000..604a935
Binary files /dev/null and b/gfx/menu/luma/crosshairbutton_f.tga differ
diff --git a/gfx/menu/luma/crosshairbutton_n.tga b/gfx/menu/luma/crosshairbutton_n.tga
new file mode 100644 (file)
index 0000000..4e7901e
Binary files /dev/null and b/gfx/menu/luma/crosshairbutton_n.tga differ
diff --git a/gfx/menu/luma/cursor.tga b/gfx/menu/luma/cursor.tga
new file mode 100644 (file)
index 0000000..b12436a
Binary files /dev/null and b/gfx/menu/luma/cursor.tga differ
diff --git a/gfx/menu/luma/cursor_move.tga b/gfx/menu/luma/cursor_move.tga
new file mode 100644 (file)
index 0000000..81e265d
Binary files /dev/null and b/gfx/menu/luma/cursor_move.tga differ
diff --git a/gfx/menu/luma/cursor_resize.tga b/gfx/menu/luma/cursor_resize.tga
new file mode 100644 (file)
index 0000000..617323e
Binary files /dev/null and b/gfx/menu/luma/cursor_resize.tga differ
diff --git a/gfx/menu/luma/cursor_resize2.tga b/gfx/menu/luma/cursor_resize2.tga
new file mode 100644 (file)
index 0000000..606015b
Binary files /dev/null and b/gfx/menu/luma/cursor_resize2.tga differ
diff --git a/gfx/menu/luma/gametype_as.tga b/gfx/menu/luma/gametype_as.tga
new file mode 100644 (file)
index 0000000..85eda57
Binary files /dev/null and b/gfx/menu/luma/gametype_as.tga differ
diff --git a/gfx/menu/luma/gametype_ca.tga b/gfx/menu/luma/gametype_ca.tga
new file mode 100644 (file)
index 0000000..668b57e
Binary files /dev/null and b/gfx/menu/luma/gametype_ca.tga differ
diff --git a/gfx/menu/luma/gametype_ctf.tga b/gfx/menu/luma/gametype_ctf.tga
new file mode 100644 (file)
index 0000000..7eb0c8e
Binary files /dev/null and b/gfx/menu/luma/gametype_ctf.tga differ
diff --git a/gfx/menu/luma/gametype_cts.tga b/gfx/menu/luma/gametype_cts.tga
new file mode 100644 (file)
index 0000000..235da2f
Binary files /dev/null and b/gfx/menu/luma/gametype_cts.tga differ
diff --git a/gfx/menu/luma/gametype_dm.tga b/gfx/menu/luma/gametype_dm.tga
new file mode 100644 (file)
index 0000000..0ce1d16
Binary files /dev/null and b/gfx/menu/luma/gametype_dm.tga differ
diff --git a/gfx/menu/luma/gametype_dom.tga b/gfx/menu/luma/gametype_dom.tga
new file mode 100644 (file)
index 0000000..fcaa2f3
Binary files /dev/null and b/gfx/menu/luma/gametype_dom.tga differ
diff --git a/gfx/menu/luma/gametype_duel.tga b/gfx/menu/luma/gametype_duel.tga
new file mode 100644 (file)
index 0000000..8816316
Binary files /dev/null and b/gfx/menu/luma/gametype_duel.tga differ
diff --git a/gfx/menu/luma/gametype_ft.tga b/gfx/menu/luma/gametype_ft.tga
new file mode 100644 (file)
index 0000000..515a3f8
Binary files /dev/null and b/gfx/menu/luma/gametype_ft.tga differ
diff --git a/gfx/menu/luma/gametype_inf.tga b/gfx/menu/luma/gametype_inf.tga
new file mode 100644 (file)
index 0000000..bcbbd6c
Binary files /dev/null and b/gfx/menu/luma/gametype_inf.tga differ
diff --git a/gfx/menu/luma/gametype_inv.tga b/gfx/menu/luma/gametype_inv.tga
new file mode 100644 (file)
index 0000000..bc114f9
Binary files /dev/null and b/gfx/menu/luma/gametype_inv.tga differ
diff --git a/gfx/menu/luma/gametype_jb.tga b/gfx/menu/luma/gametype_jb.tga
new file mode 100644 (file)
index 0000000..7971be3
Binary files /dev/null and b/gfx/menu/luma/gametype_jb.tga differ
diff --git a/gfx/menu/luma/gametype_ka.tga b/gfx/menu/luma/gametype_ka.tga
new file mode 100644 (file)
index 0000000..3370b5e
Binary files /dev/null and b/gfx/menu/luma/gametype_ka.tga differ
diff --git a/gfx/menu/luma/gametype_kh.tga b/gfx/menu/luma/gametype_kh.tga
new file mode 100644 (file)
index 0000000..bdca280
Binary files /dev/null and b/gfx/menu/luma/gametype_kh.tga differ
diff --git a/gfx/menu/luma/gametype_lms.tga b/gfx/menu/luma/gametype_lms.tga
new file mode 100644 (file)
index 0000000..33e2be7
Binary files /dev/null and b/gfx/menu/luma/gametype_lms.tga differ
diff --git a/gfx/menu/luma/gametype_nb.tga b/gfx/menu/luma/gametype_nb.tga
new file mode 100644 (file)
index 0000000..9bfb5ad
Binary files /dev/null and b/gfx/menu/luma/gametype_nb.tga differ
diff --git a/gfx/menu/luma/gametype_ons.tga b/gfx/menu/luma/gametype_ons.tga
new file mode 100644 (file)
index 0000000..a9a0f17
Binary files /dev/null and b/gfx/menu/luma/gametype_ons.tga differ
diff --git a/gfx/menu/luma/gametype_rc.tga b/gfx/menu/luma/gametype_rc.tga
new file mode 100644 (file)
index 0000000..10d7e41
Binary files /dev/null and b/gfx/menu/luma/gametype_rc.tga differ
diff --git a/gfx/menu/luma/gametype_tdm.tga b/gfx/menu/luma/gametype_tdm.tga
new file mode 100644 (file)
index 0000000..289641e
Binary files /dev/null and b/gfx/menu/luma/gametype_tdm.tga differ
diff --git a/gfx/menu/luma/gametype_vip.tga b/gfx/menu/luma/gametype_vip.tga
new file mode 100644 (file)
index 0000000..2c9eccc
Binary files /dev/null and b/gfx/menu/luma/gametype_vip.tga differ
diff --git a/gfx/menu/luma/icon_aeslevel1.tga b/gfx/menu/luma/icon_aeslevel1.tga
new file mode 100644 (file)
index 0000000..22aa0ff
Binary files /dev/null and b/gfx/menu/luma/icon_aeslevel1.tga differ
diff --git a/gfx/menu/luma/icon_aeslevel2.tga b/gfx/menu/luma/icon_aeslevel2.tga
new file mode 100644 (file)
index 0000000..22aa0ff
Binary files /dev/null and b/gfx/menu/luma/icon_aeslevel2.tga differ
diff --git a/gfx/menu/luma/icon_aeslevel3.tga b/gfx/menu/luma/icon_aeslevel3.tga
new file mode 100644 (file)
index 0000000..c90efa8
Binary files /dev/null and b/gfx/menu/luma/icon_aeslevel3.tga differ
diff --git a/gfx/menu/luma/icon_aeslevel4.tga b/gfx/menu/luma/icon_aeslevel4.tga
new file mode 100644 (file)
index 0000000..c90efa8
Binary files /dev/null and b/gfx/menu/luma/icon_aeslevel4.tga differ
diff --git a/gfx/menu/luma/icon_aeslevel5.tga b/gfx/menu/luma/icon_aeslevel5.tga
new file mode 100644 (file)
index 0000000..c90efa8
Binary files /dev/null and b/gfx/menu/luma/icon_aeslevel5.tga differ
diff --git a/gfx/menu/luma/icon_mod_.tga b/gfx/menu/luma/icon_mod_.tga
new file mode 100644 (file)
index 0000000..79a1f24
Binary files /dev/null and b/gfx/menu/luma/icon_mod_.tga differ
diff --git a/gfx/menu/luma/icon_mod_MinstaGib.tga b/gfx/menu/luma/icon_mod_MinstaGib.tga
new file mode 100644 (file)
index 0000000..ce8c2d5
Binary files /dev/null and b/gfx/menu/luma/icon_mod_MinstaGib.tga differ
diff --git a/gfx/menu/luma/icon_mod_NewToys.tga b/gfx/menu/luma/icon_mod_NewToys.tga
new file mode 100644 (file)
index 0000000..c5f212c
Binary files /dev/null and b/gfx/menu/luma/icon_mod_NewToys.tga differ
diff --git a/gfx/menu/luma/icon_mod_Overkill.tga b/gfx/menu/luma/icon_mod_Overkill.tga
new file mode 100644 (file)
index 0000000..aeeaeb8
Binary files /dev/null and b/gfx/menu/luma/icon_mod_Overkill.tga differ
diff --git a/gfx/menu/luma/icon_mod_XDF.tga b/gfx/menu/luma/icon_mod_XDF.tga
new file mode 100644 (file)
index 0000000..c0b4e6d
Binary files /dev/null and b/gfx/menu/luma/icon_mod_XDF.tga differ
diff --git a/gfx/menu/luma/icon_pure1.tga b/gfx/menu/luma/icon_pure1.tga
new file mode 100644 (file)
index 0000000..fbe4dc9
Binary files /dev/null and b/gfx/menu/luma/icon_pure1.tga differ
diff --git a/gfx/menu/luma/icon_stats1.tga b/gfx/menu/luma/icon_stats1.tga
new file mode 100644 (file)
index 0000000..841dde6
Binary files /dev/null and b/gfx/menu/luma/icon_stats1.tga differ
diff --git a/gfx/menu/luma/inputbox_f.tga b/gfx/menu/luma/inputbox_f.tga
new file mode 100644 (file)
index 0000000..c31aa43
Binary files /dev/null and b/gfx/menu/luma/inputbox_f.tga differ
diff --git a/gfx/menu/luma/inputbox_n.tga b/gfx/menu/luma/inputbox_n.tga
new file mode 100644 (file)
index 0000000..621f50d
Binary files /dev/null and b/gfx/menu/luma/inputbox_n.tga differ
diff --git a/gfx/menu/luma/nopreview_map.tga b/gfx/menu/luma/nopreview_map.tga
new file mode 100644 (file)
index 0000000..5fedc94
Binary files /dev/null and b/gfx/menu/luma/nopreview_map.tga differ
diff --git a/gfx/menu/luma/nopreview_menuskin.tga b/gfx/menu/luma/nopreview_menuskin.tga
new file mode 100644 (file)
index 0000000..c332b63
Binary files /dev/null and b/gfx/menu/luma/nopreview_menuskin.tga differ
diff --git a/gfx/menu/luma/nopreview_player.tga b/gfx/menu/luma/nopreview_player.tga
new file mode 100644 (file)
index 0000000..e1fa52c
Binary files /dev/null and b/gfx/menu/luma/nopreview_player.tga differ
diff --git a/gfx/menu/luma/radiobutton_c0.tga b/gfx/menu/luma/radiobutton_c0.tga
new file mode 100644 (file)
index 0000000..8b60a1b
Binary files /dev/null and b/gfx/menu/luma/radiobutton_c0.tga differ
diff --git a/gfx/menu/luma/radiobutton_c1.tga b/gfx/menu/luma/radiobutton_c1.tga
new file mode 100644 (file)
index 0000000..d23f9df
Binary files /dev/null and b/gfx/menu/luma/radiobutton_c1.tga differ
diff --git a/gfx/menu/luma/radiobutton_d0.tga b/gfx/menu/luma/radiobutton_d0.tga
new file mode 100644 (file)
index 0000000..16a4ff8
Binary files /dev/null and b/gfx/menu/luma/radiobutton_d0.tga differ
diff --git a/gfx/menu/luma/radiobutton_d1.tga b/gfx/menu/luma/radiobutton_d1.tga
new file mode 100644 (file)
index 0000000..b4eacff
Binary files /dev/null and b/gfx/menu/luma/radiobutton_d1.tga differ
diff --git a/gfx/menu/luma/radiobutton_f0.tga b/gfx/menu/luma/radiobutton_f0.tga
new file mode 100644 (file)
index 0000000..59ecc08
Binary files /dev/null and b/gfx/menu/luma/radiobutton_f0.tga differ
diff --git a/gfx/menu/luma/radiobutton_f1.tga b/gfx/menu/luma/radiobutton_f1.tga
new file mode 100644 (file)
index 0000000..396e277
Binary files /dev/null and b/gfx/menu/luma/radiobutton_f1.tga differ
diff --git a/gfx/menu/luma/radiobutton_n0.tga b/gfx/menu/luma/radiobutton_n0.tga
new file mode 100644 (file)
index 0000000..13a96e9
Binary files /dev/null and b/gfx/menu/luma/radiobutton_n0.tga differ
diff --git a/gfx/menu/luma/radiobutton_n1.tga b/gfx/menu/luma/radiobutton_n1.tga
new file mode 100644 (file)
index 0000000..a64b50c
Binary files /dev/null and b/gfx/menu/luma/radiobutton_n1.tga differ
diff --git a/gfx/menu/luma/scrollbar_c.tga b/gfx/menu/luma/scrollbar_c.tga
new file mode 100644 (file)
index 0000000..09333d1
Binary files /dev/null and b/gfx/menu/luma/scrollbar_c.tga differ
diff --git a/gfx/menu/luma/scrollbar_f.tga b/gfx/menu/luma/scrollbar_f.tga
new file mode 100644 (file)
index 0000000..109278c
Binary files /dev/null and b/gfx/menu/luma/scrollbar_f.tga differ
diff --git a/gfx/menu/luma/scrollbar_n.tga b/gfx/menu/luma/scrollbar_n.tga
new file mode 100644 (file)
index 0000000..b8a01d1
Binary files /dev/null and b/gfx/menu/luma/scrollbar_n.tga differ
diff --git a/gfx/menu/luma/scrollbar_s.tga b/gfx/menu/luma/scrollbar_s.tga
new file mode 100644 (file)
index 0000000..699e11c
Binary files /dev/null and b/gfx/menu/luma/scrollbar_s.tga differ
diff --git a/gfx/menu/luma/skinpreview.tga b/gfx/menu/luma/skinpreview.tga
new file mode 100644 (file)
index 0000000..f89a2e6
Binary files /dev/null and b/gfx/menu/luma/skinpreview.tga differ
diff --git a/gfx/menu/luma/skinvalues.txt b/gfx/menu/luma/skinvalues.txt
new file mode 100644 (file)
index 0000000..1e87e88
--- /dev/null
@@ -0,0 +1,209 @@
+title Luma
+author sev
+
+// Image suffixes: c(licked), d(isabled), f(ocused), n(ormal), s(eektrack)
+// Background scaling: c(rop), h(eight), l(etterbox), s(tretch), w(idth)
+// Background positioning:
+//   7 8 9
+//   4 5 6
+//   1 2 3
+
+// background
+ALIGN_BACKGROUND              c5h5
+ALIGN_BACKGROUND_INGAME       c5h5
+ALPHA_BACKGROUND_INGAME       1
+ALPHA_DISABLED                0.2
+ALPHA_BEHIND                  0.5
+
+// button
+COLOR_BUTTON_C                '1 1 1'
+COLOR_BUTTON_D                '1 1 1'
+COLOR_BUTTON_F                '1 1 1'
+COLOR_BUTTON_N                '1 1 1'
+
+// campaign
+ALPHA_CAMPAIGN_CURRENT        1
+COLOR_CAMPAIGN_CURRENT        '0.96 0.99 1'
+ALPHA_CAMPAIGN_DESCRIPTION    0.8
+ALPHA_CAMPAIGN_FUTURE         0.2
+COLOR_CAMPAIGN_FUTURE         '0.96 0.99 1'
+ALPHA_CAMPAIGN_SELECTABLE     0.6
+COLOR_CAMPAIGN_SELECTABLE     '0.96 0.99 1'
+
+// charmap
+ALPHA_CHARMAP_CHAR            0.85
+COLOR_CHARMAP_CHAR            '1 1 1'
+ALPHA_CHARMAP_FOCUS           0.85
+COLOR_CHARMAP_FOCUS           '0.09 0.42 0.69'
+
+// checkbox
+COLOR_CHECKBOX_C              '1 1 1'
+COLOR_CHECKBOX_D              '1 1 1'
+COLOR_CHECKBOX_F              '1 1 1'
+COLOR_CHECKBOX_N              '1 1 1'
+
+// clearbutton
+COLOR_CLEARBUTTON_C           '1 1 1'
+COLOR_CLEARBUTTON_F           '1 1 1'
+COLOR_CLEARBUTTON_N           '1 1 1'
+OFFSET_CLEARBUTTON            0
+
+// colorpicker
+MARGIN_COLORPICKER            '0 0 0'
+
+// credits
+ALPHA_CREDITS_FUNCTION        1
+COLOR_CREDITS_FUNCTION        '0.03 0.25 0.49'
+ALPHA_CREDITS_PERSON          0.8
+COLOR_CREDITS_PERSON          '0.96 0.99 1'
+ALPHA_CREDITS_TITLE           1
+COLOR_CREDITS_TITLE           '0.94 0.45 0.11'
+ROWS_CREDITS                  20
+WIDTH_CREDITS                 0.5
+
+// cursor
+SIZE_CURSOR                   '32 32 0'
+OFFSET_CURSOR                 '0.25 0.125 0'
+ALPHA_CURSOR_INTRO            0
+
+// cvarlist
+COLOR_CVARLIST_CHANGED        '0.95 0.05 0.05'
+COLOR_CVARLIST_CONTROLS       '1 0.2 0.15'
+COLOR_CVARLIST_UNCHANGED      '1 1 1'
+ALPHA_CVARLIST_SAVED          0.85
+ALPHA_CVARLIST_TEMPORARY      0.55
+
+// dialog color
+COLOR_DIALOG_MULTIPLAYER      '1 1 1'
+COLOR_DIALOG_SETTINGS         '1 1 1'
+COLOR_DIALOG_TEAMSELECT       '1 1 1'
+COLOR_DIALOG_SANDBOXTOOLS     '1 1 1'
+COLOR_DIALOG_QUIT             '1 1 1'
+COLOR_DIALOG_ADVANCED         '1 1 1'
+COLOR_DIALOG_MUTATORS         '1 1 1'
+COLOR_DIALOG_MAPINFO          '1 1 1'
+COLOR_DIALOG_USERBIND         '1 1 1'
+COLOR_DIALOG_SINGLEPLAYER     '1 1 1'
+COLOR_DIALOG_CREDITS          '1 1 1'
+COLOR_DIALOG_WEAPONS          '1 1 1'
+COLOR_DIALOG_VIEW             '1 1 1'
+COLOR_DIALOG_MODEL            '1 1 1'
+COLOR_DIALOG_CROSSHAIR        '1 1 1'
+COLOR_DIALOG_HUD              '1 1 1'
+COLOR_DIALOG_SCREENSHOTVIEWER '1 1 1'
+COLOR_DIALOG_SERVERINFO       '1 1 1'
+COLOR_DIALOG_FIRSTRUN         '1 1 1'
+COLOR_DIALOG_CVARS            '1 0.2 0.15'
+COLOR_DIALOG_HUDCONFIRM       '1 0.2 0.15'
+
+// dialog margins
+HEIGHT_DIALOGBORDER           1
+MARGIN_TOP                    8
+MARGIN_BOTTOM                 12
+MARGIN_LEFT                   16
+MARGIN_RIGHT                  16
+MARGIN_COLUMNS                4
+MARGIN_ROWS                   4
+
+// dialog scale transformation centers (NOT the actual positions)
+POSITION_DIALOG_MULTIPLAYER   '0.9 0.4 0'
+POSITION_DIALOG_SINGLEPLAYER  '0.15 0.4 0'
+POSITION_DIALOG_SETTINGS      '0.5 1 0'
+POSITION_DIALOG_CREDITS       '-0.05 1.2 0'
+POSITION_DIALOG_QUIT          '1.05 1.2 0'
+
+// font
+ALPHA_TEXT                    0.8
+COLOR_TEXT                    '0.96 0.99 1'
+ALPHA_HEADER                  0.5
+COLOR_HEADER                  '0.96 0.99 1'
+FONTSIZE_NORMAL               12
+FONTSIZE_TITLE                16
+FONTSIZE_TOOLTIP              12
+HEIGHT_NORMAL                 1.5
+HEIGHT_TITLE                  1.5
+HEIGHT_ZOOMEDTITLE            -1
+
+// inputbox
+COLOR_INPUTBOX_F              '1 1 1'
+COLOR_INPUTBOX_N              '1 1 1'
+MARGIN_INPUTBOX_CHARS         1
+
+// keygrabber
+ALPHA_KEYGRABBER_KEYS         0.8
+COLOR_KEYGRABBER_KEYS         '0.96 0.99 1'
+ALPHA_KEYGRABBER_TITLES       1
+COLOR_KEYGRABBER_TITLES       '0.03 0.25 0.49'
+
+// listbox
+ALPHA_LISTBOX_BACKGROUND      0.5
+COLOR_LISTBOX_BACKGROUND      '0 0 0'
+ALPHA_LISTBOX_SELECTED        1
+COLOR_LISTBOX_SELECTED        '0.97 0.56 0.27'
+ALPHA_LISTBOX_WAITING         0.8
+COLOR_LISTBOX_WAITING         '0.73 0.82 0.9'
+
+// mainmenu
+ALPHAS_MAINMENU               '0.8 0.9 1'
+
+// maplist
+COLOR_MAPLIST_AUTHOR          '0.56 0.72 0.86'
+ALPHA_MAPLIST_INCLUDEDBG      0.3
+COLOR_MAPLIST_INCLUDEDBG      '0.03 0.25 0.49'
+ALPHA_MAPLIST_INCLUDEDFG      1
+ALPHA_MAPLIST_NOTINCLUDEDFG   0.25
+COLOR_MAPLIST_TITLE           '0.96 0.99 1'
+
+// modeltitle
+ALPHA_MODELTITLE              0.8
+COLOR_MODELTITLE              '0.96 0.99 1'
+
+// radiobutton
+COLOR_RADIOBUTTON_C           '1 1 1'
+COLOR_RADIOBUTTON_D           '1 1 1'
+COLOR_RADIOBUTTON_F           '1 1 1'
+COLOR_RADIOBUTTON_N           '1 1 1'
+
+// serverinfo
+COLOR_SERVERINFO_IP           '0.96 0.99 1'
+COLOR_SERVERINFO_NAME         '0.94 0.45 0.11'
+
+// serverlist
+ALPHA_SERVERLIST_CATEGORY     1
+COLOR_SERVERLIST_CATEGORY     '0.03 0.25 0.49'
+ALPHA_SERVERLIST_EMPTY        0.65
+ALPHA_SERVERLIST_FAVORITE     0.8
+COLOR_SERVERLIST_FAVORITE     '1 1 1'
+ALPHA_SERVERLIST_FULL         0.4
+ALPHA_SERVERLIST_HIGHPING     0.4
+COLOR_SERVERLIST_HIGHPING     '0.98 0.08 0.08'
+COLOR_SERVERLIST_LOWPING      '0.08 0.98 0.08'
+COLOR_SERVERLIST_MEDPING      '0.98 0.76 0.08'
+
+// skinlist
+COLOR_SKINLIST_AUTHOR         '0.56 0.72 0.86'
+COLOR_SKINLIST_TITLE          '0.96 0.99 1'
+
+// scrollbar
+COLOR_SCROLLBAR_C             '1 1 1'
+COLOR_SCROLLBAR_F             '1 1 1'
+COLOR_SCROLLBAR_N             '1 1 1'
+COLOR_SCROLLBAR_S             '1 1 1'
+WIDTH_SCROLLBAR               16
+
+// slider
+COLOR_SLIDER_C                '1 1 1'
+COLOR_SLIDER_D                '1 1 1'
+COLOR_SLIDER_F                '1 1 1'
+COLOR_SLIDER_N                '1 1 1'
+COLOR_SLIDER_S                '1 1 1'
+TOLERANCE_SLIDER              '0.2 2 0'
+WIDTH_SLIDERTEXT              0.333333333333
+
+// tooltip
+ALPHA_TOOLTIP                 0.8
+COLOR_TOOLTIP                 '1 0.97 0.94'
+AVOID_TOOLTIP                 '8 8 0'
+BORDER_TOOLTIP                '16 16 0'
+MARGIN_TOOLTIP                '10 8 0'
+WIDTH_TOOLTIP                 0.3
diff --git a/gfx/menu/luma/slider_c.tga b/gfx/menu/luma/slider_c.tga
new file mode 100644 (file)
index 0000000..8471b32
Binary files /dev/null and b/gfx/menu/luma/slider_c.tga differ
diff --git a/gfx/menu/luma/slider_d.tga b/gfx/menu/luma/slider_d.tga
new file mode 100644 (file)
index 0000000..c264fee
Binary files /dev/null and b/gfx/menu/luma/slider_d.tga differ
diff --git a/gfx/menu/luma/slider_f.tga b/gfx/menu/luma/slider_f.tga
new file mode 100644 (file)
index 0000000..6ff2687
Binary files /dev/null and b/gfx/menu/luma/slider_f.tga differ
diff --git a/gfx/menu/luma/slider_n.tga b/gfx/menu/luma/slider_n.tga
new file mode 100644 (file)
index 0000000..2ee36af
Binary files /dev/null and b/gfx/menu/luma/slider_n.tga differ
diff --git a/gfx/menu/luma/slider_s.tga b/gfx/menu/luma/slider_s.tga
new file mode 100644 (file)
index 0000000..e5b7141
Binary files /dev/null and b/gfx/menu/luma/slider_s.tga differ
diff --git a/gfx/menu/luma/tooltip.tga b/gfx/menu/luma/tooltip.tga
new file mode 100644 (file)
index 0000000..32ea27c
Binary files /dev/null and b/gfx/menu/luma/tooltip.tga differ
diff --git a/gfx/menu/luminos/icon_mod_instagib.tga b/gfx/menu/luminos/icon_mod_instagib.tga
new file mode 100644 (file)
index 0000000..518fd79
Binary files /dev/null and b/gfx/menu/luminos/icon_mod_instagib.tga differ
diff --git a/gfx/menu/wickedx/icon_mod_instagib.tga b/gfx/menu/wickedx/icon_mod_instagib.tga
new file mode 100644 (file)
index 0000000..518fd79
Binary files /dev/null and b/gfx/menu/wickedx/icon_mod_instagib.tga differ
diff --git a/gfx/menu/xaw/icon_mod_instagib.tga b/gfx/menu/xaw/icon_mod_instagib.tga
new file mode 100644 (file)
index 0000000..518fd79
Binary files /dev/null and b/gfx/menu/xaw/icon_mod_instagib.tga differ
diff --git a/hud_luma.cfg b/hud_luma.cfg
new file mode 100644 (file)
index 0000000..4f80150
--- /dev/null
@@ -0,0 +1,312 @@
+seta hud_skin "luma"
+seta hud_panel_bg "0"
+seta hud_panel_bg_color "0 0.14 0.25"
+seta hud_panel_bg_color_team "1"
+seta hud_panel_bg_alpha "1"
+seta hud_panel_bg_border "2"
+seta hud_panel_bg_padding "3"
+seta hud_panel_fg_alpha "1"
+
+seta hud_dock "0"
+seta hud_dock_color "0 0 0"
+seta hud_dock_color_team "1"
+seta hud_dock_alpha "1"
+
+seta hud_progressbar_alpha "0.600000"
+seta hud_progressbar_health_color "0.83 0.12 0"
+seta hud_progressbar_armor_color "0.28 0.8 0"
+seta hud_progressbar_fuel_color "0.77 0.67 0"
+seta hud_progressbar_strength_color "0.86 0.35 0"
+seta hud_progressbar_shield_color "0.28 0.8 0"
+seta hud_progressbar_superweapons_color "0.77 0.67 0"
+seta hud_progressbar_nexball_color "0.2 0.65 0.93"
+seta hud_progressbar_speed_color "0.77 0.67 0"
+seta hud_progressbar_acceleration_color "0.2 0.65 0.93"
+seta hud_progressbar_acceleration_neg_color "0.86 0.35 0"
+
+seta _hud_panelorder "15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 "
+
+seta hud_configure_grid "1"
+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.120000"
+seta hud_panel_weapons_size "0.035000 0.770000"
+seta hud_panel_weapons_bg "border_default_east"
+seta hud_panel_weapons_bg_color ""
+seta hud_panel_weapons_bg_color_team ""
+seta hud_panel_weapons_bg_alpha ""
+seta hud_panel_weapons_bg_border ""
+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.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_complainbubble_fadetime "1"
+seta hud_panel_weapons_complainbubble_color_outofammo "0.8 0.11 0"
+seta hud_panel_weapons_complainbubble_color_donthave "0.88 0.75 0"
+seta hud_panel_weapons_complainbubble_color_unavailable "0 0.71 1"
+seta hud_panel_weapons_ammo "0"
+seta hud_panel_weapons_ammo_color "0.58 1 0.04"
+seta hud_panel_weapons_ammo_alpha "1"
+seta hud_panel_weapons_aspect "1"
+seta hud_panel_weapons_timeout "1"
+seta hud_panel_weapons_timeout_effect "1"
+seta hud_panel_weapons_timeout_fadebgmin "0.4"
+seta hud_panel_weapons_timeout_fadefgmin "0.4"
+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_ammo 1
+seta hud_panel_ammo_pos "0.330000 0.865000"
+seta hud_panel_ammo_size "0.340000 0.060000"
+seta hud_panel_ammo_bg "border_tab_south"
+seta hud_panel_ammo_bg_color ""
+seta hud_panel_ammo_bg_color_team ""
+seta hud_panel_ammo_bg_alpha ""
+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.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 0.270000"
+seta hud_panel_powerups_size "0.040000 0.415000"
+seta hud_panel_powerups_bg "border_default_west"
+seta hud_panel_powerups_bg_color ""
+seta hud_panel_powerups_bg_color_team ""
+seta hud_panel_powerups_bg_alpha ""
+seta hud_panel_powerups_bg_border ""
+seta hud_panel_powerups_bg_padding "2"
+seta hud_panel_powerups_flip "1"
+seta hud_panel_powerups_iconalign "1"
+seta hud_panel_powerups_baralign "1"
+seta hud_panel_powerups_progressbar "1"
+seta hud_panel_powerups_progressbar_strength "progressbar"
+seta hud_panel_powerups_progressbar_shield "progressbar"
+seta hud_panel_powerups_progressbar_superweapons "progressbar"
+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_color ""
+seta hud_panel_healtharmor_bg_color_team ""
+seta hud_panel_healtharmor_bg_alpha ""
+seta hud_panel_healtharmor_bg_border "4"
+seta hud_panel_healtharmor_bg_padding ""
+seta hud_panel_healtharmor_flip "0"
+seta hud_panel_healtharmor_iconalign "3"
+seta hud_panel_healtharmor_baralign "3"
+seta hud_panel_healtharmor_progressbar "1"
+seta hud_panel_healtharmor_progressbar_health "progressbar"
+seta hud_panel_healtharmor_progressbar_armor "progressbar"
+seta hud_panel_healtharmor_progressbar_gfx "1"
+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_bg_color ""
+seta hud_panel_notify_bg_color_team ""
+seta hud_panel_notify_bg_alpha ""
+seta hud_panel_notify_bg_border ""
+seta hud_panel_notify_bg_padding ""
+seta hud_panel_notify_flip "0"
+seta hud_panel_notify_fontsize "0.8"
+seta hud_panel_notify_time "10"
+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_color ""
+seta hud_panel_timer_bg_color_team ""
+seta hud_panel_timer_bg_alpha ""
+seta hud_panel_timer_bg_border ""
+seta hud_panel_timer_bg_padding "0"
+seta hud_panel_timer_increment "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_bg_color ""
+seta hud_panel_radar_bg_color_team ""
+seta hud_panel_radar_bg_alpha ""
+seta hud_panel_radar_bg_border ""
+seta hud_panel_radar_bg_padding "1"
+seta hud_panel_radar_foreground_alpha "1"
+seta hud_panel_radar_rotation "0"
+seta hud_panel_radar_zoommode "0"
+seta hud_panel_radar_scale "8192"
+seta hud_panel_radar_maximized_scale "5120"
+seta hud_panel_radar_maximized_size "0.5 0.5"
+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_color ""
+seta hud_panel_score_bg_color_team ""
+seta hud_panel_score_bg_alpha ""
+seta hud_panel_score_bg_border ""
+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_color ""
+seta hud_panel_racetimer_bg_color_team ""
+seta hud_panel_racetimer_bg_alpha ""
+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_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.700000"
+
+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_bg_color ""
+seta hud_panel_modicons_bg_color_team ""
+seta hud_panel_modicons_bg_alpha ""
+seta hud_panel_modicons_bg_border "4"
+seta hud_panel_modicons_bg_padding "0"
+seta hud_panel_modicons_ca_layout "1"
+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.730000"
+seta hud_panel_pressedkeys_size "0.110000 0.090000"
+seta hud_panel_pressedkeys_bg " "
+seta hud_panel_pressedkeys_bg_color ""
+seta hud_panel_pressedkeys_bg_color_team ""
+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_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_color ""
+seta hud_panel_chat_bg_color_team ""
+seta hud_panel_chat_bg_alpha ""
+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_bg_color ""
+seta hud_panel_engineinfo_bg_color_team ""
+seta hud_panel_engineinfo_bg_alpha ""
+seta hud_panel_engineinfo_bg_border ""
+seta hud_panel_engineinfo_bg_padding ""
+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_color ""
+seta hud_panel_infomessages_bg_color_team ""
+seta hud_panel_infomessages_bg_alpha ""
+seta hud_panel_infomessages_bg_border ""
+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.630000"
+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_border ""
+seta hud_panel_physics_bg_padding ""
+seta hud_panel_physics_speed_unit "1"
+seta hud_panel_physics_speed_unit_show "1"
+seta hud_panel_physics_speed_max "1800"
+seta hud_panel_physics_speed_vertical "0"
+seta hud_panel_physics_topspeed "1"
+seta hud_panel_physics_topspeed_time "4"
+seta hud_panel_physics_acceleration_max "1.5"
+seta hud_panel_physics_acceleration_vertical "0"
+seta hud_panel_physics_flip "0"
+seta hud_panel_physics_baralign "0"
+seta hud_panel_physics_progressbar "1"
+seta hud_panel_physics_acceleration_progressbar_mode "0"
+seta hud_panel_physics_acceleration_progressbar_scale "1"
+seta hud_panel_physics_acceleration_progressbar_nonlinear "0"
+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_bg_color ""
+seta hud_panel_centerprint_bg_color_team ""
+seta hud_panel_centerprint_bg_alpha ""
+seta hud_panel_centerprint_bg_border ""
+seta hud_panel_centerprint_bg_padding ""
+seta hud_panel_centerprint_align "0.5"
+seta hud_panel_centerprint_flip "0"
+seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_time "3"
+seta hud_panel_centerprint_fade_in "0.2"
+seta hud_panel_centerprint_fade_out "0.5"
+seta hud_panel_centerprint_fade_subsequent "1"
+seta hud_panel_centerprint_fade_subsequent_passone "3"
+seta hud_panel_centerprint_fade_subsequent_passone_minalpha "0.5"
+seta hud_panel_centerprint_fade_subsequent_passtwo "10"
+seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "0.5"
+seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
+seta hud_panel_centerprint_fade_minfontsize "0"
+
+seta hud_panel_buffs 1
+seta hud_panel_buffs_pos "0.435000 0.840000"
+seta hud_panel_buffs_size "0.125000 0.035000"
+seta hud_panel_buffs_bg "0"
+seta hud_panel_buffs_bg_color ""
+seta hud_panel_buffs_bg_color_team ""
+seta hud_panel_buffs_bg_alpha ""
+seta hud_panel_buffs_bg_border ""
+seta hud_panel_buffs_bg_padding ""
+
+menu_sync
index a37447783d6009448e095c0bfc26a9d894aae7fe..34db2beb663e7cdf118e8cdb3814575a18529ef1 100644 (file)
@@ -41,6 +41,7 @@ seta hud_panel_weapons_bg_border ""
 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.5"
 seta hud_panel_weapons_complainbubble "1"
 seta hud_panel_weapons_complainbubble_padding "-1"
 seta hud_panel_weapons_complainbubble_time "0"
index 3128aff4f15c84140e961f7976c3d47e182a18f1..39a6fd2eddbcb8547c9be24ca5cc983ad6ac0c7c 100644 (file)
@@ -41,6 +41,7 @@ seta hud_panel_weapons_bg_border ""
 seta hud_panel_weapons_bg_padding ""
 seta hud_panel_weapons_accuracy "1"
 seta hud_panel_weapons_label "1"
+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"
index 0f424c6f06547e643c6b26f629321f00b00d6553..4b6b7e4a74288362ce8761363045f4d2e8767042 100644 (file)
@@ -41,6 +41,7 @@ seta hud_panel_weapons_bg_border ""
 seta hud_panel_weapons_bg_padding ""
 seta hud_panel_weapons_accuracy "1"
 seta hud_panel_weapons_label "1"
+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"
index 3ee6b927758b0c567ce856a0fb3019f580bc00b8..20650899e77de25e7e1e33d485fbeb5beb2e243f 100644 (file)
@@ -41,6 +41,7 @@ seta hud_panel_weapons_bg_border ""
 seta hud_panel_weapons_bg_padding ""
 seta hud_panel_weapons_accuracy "1"
 seta hud_panel_weapons_label "1"
+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"
index c4aebab73900a22d3bd034984dbd58659cdc5d47..2d86881f5fa81c7827cf133718987757fd0da4df 100644 (file)
@@ -41,6 +41,7 @@ seta hud_panel_weapons_bg_border ""
 seta hud_panel_weapons_bg_padding "-5"
 seta hud_panel_weapons_accuracy "1"
 seta hud_panel_weapons_label "1"
+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"
diff --git a/models/items/a_bullets_luma.iqm b/models/items/a_bullets_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/a_bullets_luma.iqm differ
diff --git a/models/items/a_bullets_luma.iqm_0.skin b/models/items/a_bullets_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..b7b9d5b
--- /dev/null
@@ -0,0 +1 @@
+Plane,a_bullets_luma
diff --git a/models/items/a_bullets_luma.tga b/models/items/a_bullets_luma.tga
new file mode 100644 (file)
index 0000000..e853857
Binary files /dev/null and b/models/items/a_bullets_luma.tga differ
diff --git a/models/items/a_cells_luma.iqm b/models/items/a_cells_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/a_cells_luma.iqm differ
diff --git a/models/items/a_cells_luma.iqm_0.skin b/models/items/a_cells_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..f7ca324
--- /dev/null
@@ -0,0 +1 @@
+Plane,a_cells_luma
diff --git a/models/items/a_cells_luma.tga b/models/items/a_cells_luma.tga
new file mode 100644 (file)
index 0000000..2ada7fd
Binary files /dev/null and b/models/items/a_cells_luma.tga differ
diff --git a/models/items/a_plasma_luma.iqm b/models/items/a_plasma_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/a_plasma_luma.iqm differ
diff --git a/models/items/a_plasma_luma.iqm_0.skin b/models/items/a_plasma_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..f7ca324
--- /dev/null
@@ -0,0 +1 @@
+Plane,a_cells_luma
diff --git a/models/items/a_plasma_luma.tga b/models/items/a_plasma_luma.tga
new file mode 100644 (file)
index 0000000..d21484c
Binary files /dev/null and b/models/items/a_plasma_luma.tga differ
diff --git a/models/items/a_rockets_luma.iqm b/models/items/a_rockets_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/a_rockets_luma.iqm differ
diff --git a/models/items/a_rockets_luma.iqm_0.skin b/models/items/a_rockets_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..8e6e85b
--- /dev/null
@@ -0,0 +1 @@
+Plane,a_rockets_luma
diff --git a/models/items/a_rockets_luma.tga b/models/items/a_rockets_luma.tga
new file mode 100644 (file)
index 0000000..dc666cc
Binary files /dev/null and b/models/items/a_rockets_luma.tga differ
diff --git a/models/items/a_shells_luma.iqm b/models/items/a_shells_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/a_shells_luma.iqm differ
diff --git a/models/items/a_shells_luma.iqm_0.skin b/models/items/a_shells_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..e320eda
--- /dev/null
@@ -0,0 +1 @@
+Plane,a_shells_luma
diff --git a/models/items/a_shells_luma.tga b/models/items/a_shells_luma.tga
new file mode 100644 (file)
index 0000000..51db9dc
Binary files /dev/null and b/models/items/a_shells_luma.tga differ
diff --git a/models/items/g_fuel_luma.iqm b/models/items/g_fuel_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/g_fuel_luma.iqm differ
diff --git a/models/items/g_fuel_luma.iqm_0.skin b/models/items/g_fuel_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..bbb3c6c
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_fuel_luma
diff --git a/models/items/g_fuel_luma.tga b/models/items/g_fuel_luma.tga
new file mode 100644 (file)
index 0000000..8fd4481
Binary files /dev/null and b/models/items/g_fuel_luma.tga differ
diff --git a/models/items/g_fuelregen_luma.iqm b/models/items/g_fuelregen_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/g_fuelregen_luma.iqm differ
diff --git a/models/items/g_fuelregen_luma.iqm_0.skin b/models/items/g_fuelregen_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..cb4ed6d
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_fuelregen_luma
diff --git a/models/items/g_fuelregen_luma.tga b/models/items/g_fuelregen_luma.tga
new file mode 100644 (file)
index 0000000..1edef47
Binary files /dev/null and b/models/items/g_fuelregen_luma.tga differ
diff --git a/models/items/g_h100_luma.iqm b/models/items/g_h100_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/g_h100_luma.iqm differ
diff --git a/models/items/g_h100_luma.iqm_0.skin b/models/items/g_h100_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..1d7ba82
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_h100_luma
diff --git a/models/items/g_h100_luma.tga b/models/items/g_h100_luma.tga
new file mode 100644 (file)
index 0000000..ff245d3
Binary files /dev/null and b/models/items/g_h100_luma.tga differ
diff --git a/models/items/g_h1_luma.iqm b/models/items/g_h1_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/g_h1_luma.iqm differ
diff --git a/models/items/g_h1_luma.iqm_0.skin b/models/items/g_h1_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..1bbdfde
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_h1_luma
diff --git a/models/items/g_h1_luma.tga b/models/items/g_h1_luma.tga
new file mode 100644 (file)
index 0000000..a058638
Binary files /dev/null and b/models/items/g_h1_luma.tga differ
diff --git a/models/items/g_h25_luma.iqm b/models/items/g_h25_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/g_h25_luma.iqm differ
diff --git a/models/items/g_h25_luma.iqm_0.skin b/models/items/g_h25_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..71d484e
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_h25_luma
diff --git a/models/items/g_h25_luma.tga b/models/items/g_h25_luma.tga
new file mode 100644 (file)
index 0000000..3c272d9
Binary files /dev/null and b/models/items/g_h25_luma.tga differ
diff --git a/models/items/g_h50_luma.iqm b/models/items/g_h50_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/g_h50_luma.iqm differ
diff --git a/models/items/g_h50_luma.iqm_0.skin b/models/items/g_h50_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..c7ab67e
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_h50_luma
diff --git a/models/items/g_h50_luma.tga b/models/items/g_h50_luma.tga
new file mode 100644 (file)
index 0000000..392a968
Binary files /dev/null and b/models/items/g_h50_luma.tga differ
diff --git a/models/items/g_invincible_luma.iqm b/models/items/g_invincible_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/g_invincible_luma.iqm differ
diff --git a/models/items/g_invincible_luma.iqm_0.skin b/models/items/g_invincible_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..dd336bd
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_invincible_luma
diff --git a/models/items/g_invincible_luma.tga b/models/items/g_invincible_luma.tga
new file mode 100644 (file)
index 0000000..caa1938
Binary files /dev/null and b/models/items/g_invincible_luma.tga differ
diff --git a/models/items/g_jetpack_luma.iqm b/models/items/g_jetpack_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/g_jetpack_luma.iqm differ
diff --git a/models/items/g_jetpack_luma.iqm_0.skin b/models/items/g_jetpack_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..7e6336b
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_jetpack_luma
diff --git a/models/items/g_jetpack_luma.tga b/models/items/g_jetpack_luma.tga
new file mode 100644 (file)
index 0000000..11d6613
Binary files /dev/null and b/models/items/g_jetpack_luma.tga differ
diff --git a/models/items/g_strength_luma.iqm b/models/items/g_strength_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/g_strength_luma.iqm differ
diff --git a/models/items/g_strength_luma.iqm_0.skin b/models/items/g_strength_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..94d2ebd
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_strength_luma
diff --git a/models/items/g_strength_luma.tga b/models/items/g_strength_luma.tga
new file mode 100644 (file)
index 0000000..938bd60
Binary files /dev/null and b/models/items/g_strength_luma.tga differ
diff --git a/models/items/item_armor_big_luma.iqm b/models/items/item_armor_big_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/item_armor_big_luma.iqm differ
diff --git a/models/items/item_armor_big_luma.iqm_0.skin b/models/items/item_armor_big_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..83eb086
--- /dev/null
@@ -0,0 +1 @@
+Plane,item_armor_big_luma
diff --git a/models/items/item_armor_big_luma.tga b/models/items/item_armor_big_luma.tga
new file mode 100644 (file)
index 0000000..73fc8af
Binary files /dev/null and b/models/items/item_armor_big_luma.tga differ
diff --git a/models/items/item_armor_large_luma.iqm b/models/items/item_armor_large_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/item_armor_large_luma.iqm differ
diff --git a/models/items/item_armor_large_luma.iqm_0.skin b/models/items/item_armor_large_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..b66a83f
--- /dev/null
@@ -0,0 +1 @@
+Plane,item_armor_large_luma
diff --git a/models/items/item_armor_large_luma.tga b/models/items/item_armor_large_luma.tga
new file mode 100644 (file)
index 0000000..10c189b
Binary files /dev/null and b/models/items/item_armor_large_luma.tga differ
diff --git a/models/items/item_armor_medium_luma.iqm b/models/items/item_armor_medium_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/item_armor_medium_luma.iqm differ
diff --git a/models/items/item_armor_medium_luma.iqm_0.skin b/models/items/item_armor_medium_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..6394bd6
--- /dev/null
@@ -0,0 +1 @@
+Plane,item_armor_medium_luma
diff --git a/models/items/item_armor_medium_luma.tga b/models/items/item_armor_medium_luma.tga
new file mode 100644 (file)
index 0000000..d39696d
Binary files /dev/null and b/models/items/item_armor_medium_luma.tga differ
diff --git a/models/items/item_armor_small_luma.iqm b/models/items/item_armor_small_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/items/item_armor_small_luma.iqm differ
diff --git a/models/items/item_armor_small_luma.iqm_0.skin b/models/items/item_armor_small_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..097d764
--- /dev/null
@@ -0,0 +1 @@
+Plane,item_armor_small_luma
diff --git a/models/items/item_armor_small_luma.tga b/models/items/item_armor_small_luma.tga
new file mode 100644 (file)
index 0000000..4cb8c16
Binary files /dev/null and b/models/items/item_armor_small_luma.tga differ
diff --git a/models/items/powerup_detonator_luma.tga b/models/items/powerup_detonator_luma.tga
new file mode 100644 (file)
index 0000000..3f1f7b0
Binary files /dev/null and b/models/items/powerup_detonator_luma.tga differ
diff --git a/models/items/powerup_invisibility_luma.tga b/models/items/powerup_invisibility_luma.tga
new file mode 100644 (file)
index 0000000..8b1e8ed
Binary files /dev/null and b/models/items/powerup_invisibility_luma.tga differ
diff --git a/models/items/powerup_resurrection_luma.tga b/models/items/powerup_resurrection_luma.tga
new file mode 100644 (file)
index 0000000..d62e5f3
Binary files /dev/null and b/models/items/powerup_resurrection_luma.tga differ
diff --git a/models/items/powerup_speed_luma.tga b/models/items/powerup_speed_luma.tga
new file mode 100644 (file)
index 0000000..fb9c59b
Binary files /dev/null and b/models/items/powerup_speed_luma.tga differ
diff --git a/models/items/powerup_superweapon_luma.tga b/models/items/powerup_superweapon_luma.tga
new file mode 100644 (file)
index 0000000..35ce8fe
Binary files /dev/null and b/models/items/powerup_superweapon_luma.tga differ
diff --git a/models/items/powerup_ultrahealing_luma.tga b/models/items/powerup_ultrahealing_luma.tga
new file mode 100644 (file)
index 0000000..06bff58
Binary files /dev/null and b/models/items/powerup_ultrahealing_luma.tga differ
diff --git a/models/items/powerup_xray_luma.tga b/models/items/powerup_xray_luma.tga
new file mode 100644 (file)
index 0000000..13029fd
Binary files /dev/null and b/models/items/powerup_xray_luma.tga differ
index d30980ad7090d01676022e58ecad853ebc3953fb..ae23918faeeb36277319bc46c5c71887754873a3 100644 (file)
Binary files a/models/misc/chatbubble.spr_0.tga and b/models/misc/chatbubble.spr_0.tga differ
index 9c6af1e955777e1afde0c255da53fce39ea371b5..03921003f343c6b643a9471ed781451b979c0e66 100644 (file)
Binary files a/models/misc/teambubble.spr_0.tga and b/models/misc/teambubble.spr_0.tga differ
diff --git a/models/weapons/g_arc_luma.iqm b/models/weapons/g_arc_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_arc_luma.iqm differ
diff --git a/models/weapons/g_arc_luma.iqm_0.skin b/models/weapons/g_arc_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..8ca81c1
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_arc_luma
diff --git a/models/weapons/g_arc_luma.tga b/models/weapons/g_arc_luma.tga
new file mode 100644 (file)
index 0000000..b899eda
Binary files /dev/null and b/models/weapons/g_arc_luma.tga differ
diff --git a/models/weapons/g_campingrifle_luma.iqm b/models/weapons/g_campingrifle_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_campingrifle_luma.iqm differ
diff --git a/models/weapons/g_campingrifle_luma.iqm_0.skin b/models/weapons/g_campingrifle_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..3900fba
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_campingrifle_luma
diff --git a/models/weapons/g_campingrifle_luma.tga b/models/weapons/g_campingrifle_luma.tga
new file mode 100644 (file)
index 0000000..5f8e135
Binary files /dev/null and b/models/weapons/g_campingrifle_luma.tga differ
diff --git a/models/weapons/g_crylink_luma.iqm b/models/weapons/g_crylink_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_crylink_luma.iqm differ
diff --git a/models/weapons/g_crylink_luma.iqm_0.skin b/models/weapons/g_crylink_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..21c15c9
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_crylink_luma
diff --git a/models/weapons/g_crylink_luma.tga b/models/weapons/g_crylink_luma.tga
new file mode 100644 (file)
index 0000000..fa69694
Binary files /dev/null and b/models/weapons/g_crylink_luma.tga differ
diff --git a/models/weapons/g_electro_luma.iqm b/models/weapons/g_electro_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_electro_luma.iqm differ
diff --git a/models/weapons/g_electro_luma.iqm_0.skin b/models/weapons/g_electro_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..7aff393
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_electro_luma
diff --git a/models/weapons/g_electro_luma.tga b/models/weapons/g_electro_luma.tga
new file mode 100644 (file)
index 0000000..c25186b
Binary files /dev/null and b/models/weapons/g_electro_luma.tga differ
diff --git a/models/weapons/g_fireball_luma.iqm b/models/weapons/g_fireball_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_fireball_luma.iqm differ
diff --git a/models/weapons/g_fireball_luma.iqm_0.skin b/models/weapons/g_fireball_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..070c2c8
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_fireball_luma
diff --git a/models/weapons/g_fireball_luma.tga b/models/weapons/g_fireball_luma.tga
new file mode 100644 (file)
index 0000000..a7f94a3
Binary files /dev/null and b/models/weapons/g_fireball_luma.tga differ
diff --git a/models/weapons/g_gl_luma.iqm b/models/weapons/g_gl_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_gl_luma.iqm differ
diff --git a/models/weapons/g_gl_luma.iqm_0.skin b/models/weapons/g_gl_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..2356bb6
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_gl_luma
diff --git a/models/weapons/g_gl_luma.tga b/models/weapons/g_gl_luma.tga
new file mode 100644 (file)
index 0000000..4e0ac91
Binary files /dev/null and b/models/weapons/g_gl_luma.tga differ
diff --git a/models/weapons/g_hagar_luma.iqm b/models/weapons/g_hagar_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_hagar_luma.iqm differ
diff --git a/models/weapons/g_hagar_luma.iqm_0.skin b/models/weapons/g_hagar_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..5b413ba
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_hagar_luma
diff --git a/models/weapons/g_hagar_luma.tga b/models/weapons/g_hagar_luma.tga
new file mode 100644 (file)
index 0000000..1a98060
Binary files /dev/null and b/models/weapons/g_hagar_luma.tga differ
diff --git a/models/weapons/g_hlac_luma.iqm b/models/weapons/g_hlac_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_hlac_luma.iqm differ
diff --git a/models/weapons/g_hlac_luma.iqm_0.skin b/models/weapons/g_hlac_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..13be3f2
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_hlac_luma
diff --git a/models/weapons/g_hlac_luma.tga b/models/weapons/g_hlac_luma.tga
new file mode 100644 (file)
index 0000000..0e938ad
Binary files /dev/null and b/models/weapons/g_hlac_luma.tga differ
diff --git a/models/weapons/g_hookgun_luma.iqm b/models/weapons/g_hookgun_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_hookgun_luma.iqm differ
diff --git a/models/weapons/g_hookgun_luma.iqm_0.skin b/models/weapons/g_hookgun_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..76f5a36
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_hookgun_luma
diff --git a/models/weapons/g_hookgun_luma.tga b/models/weapons/g_hookgun_luma.tga
new file mode 100644 (file)
index 0000000..4ce22fb
Binary files /dev/null and b/models/weapons/g_hookgun_luma.tga differ
diff --git a/models/weapons/g_laser_luma.iqm b/models/weapons/g_laser_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_laser_luma.iqm differ
diff --git a/models/weapons/g_laser_luma.iqm_0.skin b/models/weapons/g_laser_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..7f433fb
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_laser_luma
diff --git a/models/weapons/g_laser_luma.tga b/models/weapons/g_laser_luma.tga
new file mode 100644 (file)
index 0000000..6c9d426
Binary files /dev/null and b/models/weapons/g_laser_luma.tga differ
diff --git a/models/weapons/g_minelayer_luma.iqm b/models/weapons/g_minelayer_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_minelayer_luma.iqm differ
diff --git a/models/weapons/g_minelayer_luma.iqm_0.skin b/models/weapons/g_minelayer_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..899a087
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_minelayer_luma
diff --git a/models/weapons/g_minelayer_luma.tga b/models/weapons/g_minelayer_luma.tga
new file mode 100644 (file)
index 0000000..ff1e667
Binary files /dev/null and b/models/weapons/g_minelayer_luma.tga differ
diff --git a/models/weapons/g_minstanex_luma.iqm b/models/weapons/g_minstanex_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_minstanex_luma.iqm differ
diff --git a/models/weapons/g_minstanex_luma.iqm_0.skin b/models/weapons/g_minstanex_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..7085d26
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_minstanex_luma
diff --git a/models/weapons/g_minstanex_luma.tga b/models/weapons/g_minstanex_luma.tga
new file mode 100644 (file)
index 0000000..3134a16
Binary files /dev/null and b/models/weapons/g_minstanex_luma.tga differ
diff --git a/models/weapons/g_nex_luma.iqm b/models/weapons/g_nex_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_nex_luma.iqm differ
diff --git a/models/weapons/g_nex_luma.iqm_0.skin b/models/weapons/g_nex_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..c1b5ac5
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_nex_luma
diff --git a/models/weapons/g_nex_luma.tga b/models/weapons/g_nex_luma.tga
new file mode 100644 (file)
index 0000000..a116aaa
Binary files /dev/null and b/models/weapons/g_nex_luma.tga differ
diff --git a/models/weapons/g_porto_luma.iqm b/models/weapons/g_porto_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_porto_luma.iqm differ
diff --git a/models/weapons/g_porto_luma.iqm_0.skin b/models/weapons/g_porto_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..56e7858
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_porto_luma
diff --git a/models/weapons/g_porto_luma.tga b/models/weapons/g_porto_luma.tga
new file mode 100644 (file)
index 0000000..93bef14
Binary files /dev/null and b/models/weapons/g_porto_luma.tga differ
diff --git a/models/weapons/g_rl_luma.iqm b/models/weapons/g_rl_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_rl_luma.iqm differ
diff --git a/models/weapons/g_rl_luma.iqm_0.skin b/models/weapons/g_rl_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..5be56db
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_rl_luma
diff --git a/models/weapons/g_rl_luma.tga b/models/weapons/g_rl_luma.tga
new file mode 100644 (file)
index 0000000..16bd442
Binary files /dev/null and b/models/weapons/g_rl_luma.tga differ
diff --git a/models/weapons/g_seeker_luma.iqm b/models/weapons/g_seeker_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_seeker_luma.iqm differ
diff --git a/models/weapons/g_seeker_luma.iqm_0.skin b/models/weapons/g_seeker_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..74d6fc4
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_seeker_luma
diff --git a/models/weapons/g_seeker_luma.tga b/models/weapons/g_seeker_luma.tga
new file mode 100644 (file)
index 0000000..12405ee
Binary files /dev/null and b/models/weapons/g_seeker_luma.tga differ
diff --git a/models/weapons/g_shockwave_luma.iqm b/models/weapons/g_shockwave_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_shockwave_luma.iqm differ
diff --git a/models/weapons/g_shockwave_luma.iqm_0.skin b/models/weapons/g_shockwave_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..5a243ff
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_shockwave_luma
diff --git a/models/weapons/g_shockwave_luma.tga b/models/weapons/g_shockwave_luma.tga
new file mode 100644 (file)
index 0000000..74eb94e
Binary files /dev/null and b/models/weapons/g_shockwave_luma.tga differ
diff --git a/models/weapons/g_shotgun_luma.iqm b/models/weapons/g_shotgun_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_shotgun_luma.iqm differ
diff --git a/models/weapons/g_shotgun_luma.iqm_0.skin b/models/weapons/g_shotgun_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..976bca7
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_shotgun_luma
diff --git a/models/weapons/g_shotgun_luma.tga b/models/weapons/g_shotgun_luma.tga
new file mode 100644 (file)
index 0000000..2dd5e09
Binary files /dev/null and b/models/weapons/g_shotgun_luma.tga differ
diff --git a/models/weapons/g_tuba_luma.iqm b/models/weapons/g_tuba_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_tuba_luma.iqm differ
diff --git a/models/weapons/g_tuba_luma.iqm_0.skin b/models/weapons/g_tuba_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..59b0cd4
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_tuba_luma
diff --git a/models/weapons/g_tuba_luma.tga b/models/weapons/g_tuba_luma.tga
new file mode 100644 (file)
index 0000000..82785e6
Binary files /dev/null and b/models/weapons/g_tuba_luma.tga differ
diff --git a/models/weapons/g_uzi_luma.iqm b/models/weapons/g_uzi_luma.iqm
new file mode 100644 (file)
index 0000000..a5cc3e6
Binary files /dev/null and b/models/weapons/g_uzi_luma.iqm differ
diff --git a/models/weapons/g_uzi_luma.iqm_0.skin b/models/weapons/g_uzi_luma.iqm_0.skin
new file mode 100644 (file)
index 0000000..fb808bd
--- /dev/null
@@ -0,0 +1 @@
+Plane,g_uzi_luma
diff --git a/models/weapons/g_uzi_luma.tga b/models/weapons/g_uzi_luma.tga
new file mode 100644 (file)
index 0000000..8a05499
Binary files /dev/null and b/models/weapons/g_uzi_luma.tga differ
index be5af23f9c1ad9f6e2950369c28f5275abab9447..2960588ff692a2d12c23cf4476b0af4756043a52 100644 (file)
@@ -41,9 +41,9 @@ set g_overkill 0 "enable overkill"
 set g_overkill_100a_anyway 1
 set g_overkill_100h_anyway 1
 set g_overkill_powerups_replace 1
-set g_overkill_superguns_respawn_time 20
+set g_overkill_superguns_respawn_time 120
 
-set g_overkill_ammo_charge 1
+set g_overkill_ammo_charge 0
 set g_overkill_ammo_charge_notice 1
 set g_overkill_ammo_charge_limit 1
 set g_overkill_ammo_charge_rate 0.5
@@ -175,6 +175,7 @@ set g_random_gravity_negative 1000 "negative gravity multiplier"
 //  Nades
 // =======
 set g_nades 0 "enable off-hand grenades"
+set g_nades_throw_offset "0 0 0" "nade throwing offset"
 set g_nades_spawn 1 "give nades right away when player spawns rather than delaying entire refire"
 set g_nades_client_select 0 "allow client side selection of nade type"
 set g_nades_nade_lifetime 3.5
index ddcf855af58d8738480f5d12cdfb6b5f4fc085bb..78e57f58b5c73e861c0e82688dd2c1c914373600 100644 (file)
@@ -102,8 +102,13 @@ seta notification_ANNCE_VOTE_ACCEPT "2" "0 = disabled, 1 = enabled if gentle mod
 seta notification_ANNCE_VOTE_CALL "2" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled"
 seta notification_ANNCE_VOTE_FAIL "2" "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled"
 
-// MSG_INFO notifications (count = 244):
+// MSG_INFO notifications (count = 259):
 seta notification_INFO_CHAT_NOSPECTATORS "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_COINTOSS "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_JETPACK_NOFUEL "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_SUPERSPEC_MISSING_UID "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_CA_JOIN_LATE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_CA_LEAVE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_CTF_CAPTURE_RED "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_CTF_CAPTURE_BLUE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_CTF_CAPTURE_BROKEN_RED "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
@@ -301,8 +306,14 @@ seta notification_INFO_VERSION_OUTDATED "2" "0 = off, 1 = print to console, 2 =
 seta notification_INFO_WATERMARK "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_ACCORDEON_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_ACCORDEON_SUICIDE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_ARC_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_BLASTER_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_BLASTER_SUICIDE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_CRYLINK_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_CRYLINK_SUICIDE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_DEVASTATOR_MURDER_DIRECT "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_DEVASTATOR_MURDER_SPLASH "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_DEVASTATOR_SUICIDE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_ELECTRO_MURDER_BOLT "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_ELECTRO_MURDER_COMBO "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_ELECTRO_MURDER_ORBS "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
@@ -317,38 +328,43 @@ seta notification_INFO_WEAPON_HAGAR_MURDER_SPRAY "1" "0 = off, 1 = print to cons
 seta notification_INFO_WEAPON_HAGAR_SUICIDE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_HLAC_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_HLAC_SUICIDE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_HMG_MURDER_SNIPE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_HMG_MURDER_SPRAY "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_HOOK_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_KLEINBOTTLE_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_KLEINBOTTLE_SUICIDE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
-seta notification_INFO_WEAPON_LASER_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
-seta notification_INFO_WEAPON_LASER_SUICIDE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_MACHINEGUN_MURDER_SNIPE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_MACHINEGUN_MURDER_SPRAY "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_MINELAYER_LIMIT "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_MINELAYER_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_MINELAYER_SUICIDE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
-seta notification_INFO_WEAPON_MINSTANEX_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_MORTAR_MURDER_BOUNCE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_MORTAR_MURDER_EXPLODE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_MORTAR_SUICIDE_BOUNCE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_MORTAR_SUICIDE_EXPLODE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
-seta notification_INFO_WEAPON_NEX_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_RIFLE_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_RIFLE_MURDER_HAIL "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_RIFLE_MURDER_HAIL_PIERCING "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_RIFLE_MURDER_PIERCING "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
-seta notification_INFO_WEAPON_ROCKETLAUNCHER_MURDER_DIRECT "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
-seta notification_INFO_WEAPON_ROCKETLAUNCHER_MURDER_SPLASH "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
-seta notification_INFO_WEAPON_ROCKETLAUNCHER_SUICIDE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_RPC_MURDER_DIRECT "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_RPC_MURDER_SPLASH "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_RPC_SUICIDE_DIRECT "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_RPC_SUICIDE_SPLASH "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_SEEKER_MURDER_SPRAY "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_SEEKER_MURDER_TAG "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_SEEKER_SUICIDE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_SHOCKWAVE_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_SHOCKWAVE_MURDER_SLAP "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_SHOTGUN_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_SHOTGUN_MURDER_SLAP "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_THINKING_WITH_PORTALS "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_TUBA_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_TUBA_SUICIDE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
-seta notification_INFO_WEAPON_UZI_MURDER_SNIPE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
-seta notification_INFO_WEAPON_UZI_MURDER_SPRAY "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_VAPORIZER_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
+seta notification_INFO_WEAPON_VORTEX_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 
-// MSG_CENTER notifications (count = 161):
+// MSG_CENTER notifications (count = 170):
+seta notification_CENTER_ALONE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ASSAULT_ATTACKING "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ASSAULT_DEFENDING "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_COUNTDOWN_BEGIN "1" "0 = off, 1 = centerprint"
@@ -358,6 +374,7 @@ seta notification_CENTER_COUNTDOWN_ROUNDSTOP "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ROUND_TIED "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ROUND_OVER "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_CAMPCHECK "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_COINTOSS "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_CTF_CAPTURESHIELD_FREE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_CTF_CAPTURESHIELD_SHIELDED "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_CTF_CAPTURE_RED "1" "0 = off, 1 = centerprint"
@@ -474,18 +491,23 @@ seta notification_CENTER_KEYHUNT_START_BLUE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_KEYHUNT_START_YELLOW "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_KEYHUNT_START_PINK "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_KEYHUNT_WAIT "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_LMS_NOLIVES "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_MISSING_TEAMS "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_MISSING_PLAYERS "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_INSTAGIB_FINDAMMO "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_INSTAGIB_FINDAMMO_FIRST "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_INSTAGIB_LIVES_REMAINING "1" "0 = off, 1 = centerprint"
-seta notification_CENTER_INSTAGIB_SECONDARY "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_MOTD "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_NIX_COUNTDOWN "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_NIX_NEWWEAPON "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_NADE "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_ONS_NOTSHIELDED "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_OVERTIME_FRAG "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_OVERTIME_CONTROLPOINT "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_OVERTIME_TIME "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_PORTO_CREATED_IN "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_PORTO_CREATED_OUT "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_PORTO_FAILED "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_POWERDOWN_INVISIBILITY "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_POWERDOWN_SHIELD "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_POWERDOWN_SPEED "1" "0 = off, 1 = centerprint"
@@ -495,6 +517,7 @@ seta notification_CENTER_POWERUP_SHIELD "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_POWERUP_SPEED "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_POWERUP_STRENGTH "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_RACE_FINISHLAP "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_SECONDARY_NODAMAGE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_SEQUENCE_COMPLETED "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_SEQUENCE_COUNTER "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_SEQUENCE_COUNTER_FEWMORE "1" "0 = off, 1 = centerprint"
@@ -510,8 +533,9 @@ seta notification_CENTER_TEAMCHANGE_SPECTATE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_TEAMCHANGE_SUICIDE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_TIMEOUT_BEGINNING "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_TIMEOUT_ENDING "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_WEAPON_MINELAYER_LIMIT "1" "0 = off, 1 = centerprint"
 
-// MSG_MULTI notifications (count = 141):
+// MSG_MULTI notifications (count = 152):
 seta notification_DEATH_MURDER_CHEAT "1" "Enable this multiple notification"
 seta notification_DEATH_MURDER_DROWN "1" "Enable this multiple notification"
 seta notification_DEATH_MURDER_FALL "1" "Enable this multiple notification"
@@ -603,12 +627,19 @@ seta notification_ITEM_WEAPON_GOT "1" "Enable this multiple notification"
 seta notification_ITEM_WEAPON_NOAMMO "1" "Enable this multiple notification"
 seta notification_ITEM_WEAPON_PRIMORSEC "1" "Enable this multiple notification"
 seta notification_ITEM_WEAPON_UNAVAILABLE "1" "Enable this multiple notification"
+seta notification_MULTI_COINTOSS "1" "Enable this multiple notification"
 seta notification_MULTI_COUNTDOWN_BEGIN "1" "Enable this multiple notification"
 seta notification_MULTI_INSTAGIB_FINDAMMO "1" "Enable this multiple notification"
 seta notification_WEAPON_ACCORDEON_MURDER "1" "Enable this multiple notification"
 seta notification_WEAPON_ACCORDEON_SUICIDE "1" "Enable this multiple notification"
+seta notification_WEAPON_ARC_MURDER "1" "Enable this multiple notification"
+seta notification_WEAPON_BLASTER_MURDER "1" "Enable this multiple notification"
+seta notification_WEAPON_BLASTER_SUICIDE "1" "Enable this multiple notification"
 seta notification_WEAPON_CRYLINK_MURDER "1" "Enable this multiple notification"
 seta notification_WEAPON_CRYLINK_SUICIDE "1" "Enable this multiple notification"
+seta notification_WEAPON_DEVASTATOR_MURDER_DIRECT "1" "Enable this multiple notification"
+seta notification_WEAPON_DEVASTATOR_MURDER_SPLASH "1" "Enable this multiple notification"
+seta notification_WEAPON_DEVASTATOR_SUICIDE "1" "Enable this multiple notification"
 seta notification_WEAPON_ELECTRO_MURDER_BOLT "1" "Enable this multiple notification"
 seta notification_WEAPON_ELECTRO_MURDER_COMBO "1" "Enable this multiple notification"
 seta notification_WEAPON_ELECTRO_MURDER_ORBS "1" "Enable this multiple notification"
@@ -623,36 +654,40 @@ seta notification_WEAPON_HAGAR_MURDER_SPRAY "1" "Enable this multiple notificati
 seta notification_WEAPON_HAGAR_SUICIDE "1" "Enable this multiple notification"
 seta notification_WEAPON_HLAC_MURDER "1" "Enable this multiple notification"
 seta notification_WEAPON_HLAC_SUICIDE "1" "Enable this multiple notification"
+seta notification_WEAPON_HMG_MURDER_SNIPE "1" "Enable this multiple notification"
+seta notification_WEAPON_HMG_MURDER_SPRAY "1" "Enable this multiple notification"
 seta notification_WEAPON_HOOK_MURDER "1" "Enable this multiple notification"
 seta notification_WEAPON_KLEINBOTTLE_MURDER "1" "Enable this multiple notification"
 seta notification_WEAPON_KLEINBOTTLE_SUICIDE "1" "Enable this multiple notification"
-seta notification_WEAPON_LASER_MURDER "1" "Enable this multiple notification"
-seta notification_WEAPON_LASER_SUICIDE "1" "Enable this multiple notification"
+seta notification_WEAPON_MACHINEGUN_MURDER_SNIPE "1" "Enable this multiple notification"
+seta notification_WEAPON_MACHINEGUN_MURDER_SPRAY "1" "Enable this multiple notification"
+seta notification_WEAPON_MINELAYER_LIMIT "1" "Enable this multiple notification"
 seta notification_WEAPON_MINELAYER_MURDER "1" "Enable this multiple notification"
 seta notification_WEAPON_MINELAYER_SUICIDE "1" "Enable this multiple notification"
-seta notification_WEAPON_MINSTANEX_MURDER "1" "Enable this multiple notification"
 seta notification_WEAPON_MORTAR_MURDER_BOUNCE "1" "Enable this multiple notification"
 seta notification_WEAPON_MORTAR_MURDER_EXPLODE "1" "Enable this multiple notification"
 seta notification_WEAPON_MORTAR_SUICIDE_BOUNCE "1" "Enable this multiple notification"
 seta notification_WEAPON_MORTAR_SUICIDE_EXPLODE "1" "Enable this multiple notification"
-seta notification_WEAPON_NEX_MURDER "1" "Enable this multiple notification"
 seta notification_WEAPON_RIFLE_MURDER "1" "Enable this multiple notification"
 seta notification_WEAPON_RIFLE_MURDER_HAIL "1" "Enable this multiple notification"
 seta notification_WEAPON_RIFLE_MURDER_HAIL_PIERCING "1" "Enable this multiple notification"
 seta notification_WEAPON_RIFLE_MURDER_PIERCING "1" "Enable this multiple notification"
-seta notification_WEAPON_ROCKETLAUNCHER_MURDER_DIRECT "1" "Enable this multiple notification"
-seta notification_WEAPON_ROCKETLAUNCHER_MURDER_SPLASH "1" "Enable this multiple notification"
-seta notification_WEAPON_ROCKETLAUNCHER_SUICIDE "1" "Enable this multiple notification"
+seta notification_WEAPON_RPC_MURDER_DIRECT "1" "Enable this multiple notification"
+seta notification_WEAPON_RPC_MURDER_SPLASH "1" "Enable this multiple notification"
+seta notification_WEAPON_RPC_SUICIDE_DIRECT "1" "Enable this multiple notification"
+seta notification_WEAPON_RPC_SUICIDE_SPLASH "1" "Enable this multiple notification"
 seta notification_WEAPON_SEEKER_MURDER_SPRAY "1" "Enable this multiple notification"
 seta notification_WEAPON_SEEKER_MURDER_TAG "1" "Enable this multiple notification"
 seta notification_WEAPON_SEEKER_SUICIDE "1" "Enable this multiple notification"
+seta notification_WEAPON_SHOCKWAVE_MURDER "1" "Enable this multiple notification"
+seta notification_WEAPON_SHOCKWAVE_MURDER_SLAP "1" "Enable this multiple notification"
 seta notification_WEAPON_SHOTGUN_MURDER "1" "Enable this multiple notification"
 seta notification_WEAPON_SHOTGUN_MURDER_SLAP "1" "Enable this multiple notification"
 seta notification_WEAPON_THINKING_WITH_PORTALS "1" "Enable this multiple notification"
 seta notification_WEAPON_TUBA_MURDER "1" "Enable this multiple notification"
 seta notification_WEAPON_TUBA_SUICIDE "1" "Enable this multiple notification"
-seta notification_WEAPON_UZI_MURDER_SNIPE "1" "Enable this multiple notification"
-seta notification_WEAPON_UZI_MURDER_SPRAY "1" "Enable this multiple notification"
+seta notification_WEAPON_VAPORIZER_MURDER "1" "Enable this multiple notification"
+seta notification_WEAPON_VORTEX_MURDER "1" "Enable this multiple notification"
 
 // MSG_CHOICE notifications (count = 12):
 seta notification_CHOICE_CTF_CAPTURE_BROKEN_RED "1" "Choice for this notification 0 = off, 1 = default message, 2 = verbose message"
@@ -697,4 +732,4 @@ seta notification_show_sprees_info "3" "Show spree information in MSG_INFO messa
 seta notification_show_sprees_info_newline "1" "Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself"
 seta notification_show_sprees_info_specialonly "1" "Don't show attacker spree information in MSG_INFO messages if it isn't an achievement"
 
-// Notification counts (total = 647): MSG_ANNCE = 89, MSG_INFO = 244, MSG_CENTER = 161, MSG_MULTI = 141, MSG_CHOICE = 12
+// Notification counts (total = 682): MSG_ANNCE = 89, MSG_INFO = 259, MSG_CENTER = 170, MSG_MULTI = 152, MSG_CHOICE = 12
index 9fde71e103e2bdeb1030c1c06545d60ee9aac231..abbd25ffd8ba40041322b62fee2577aafe85a286 100644 (file)
@@ -7,8 +7,7 @@ QCCVERSIONFILE := qccversion.$(shell (cd server && $(QCC) --version) > qccversio
 
 # We eventually need to get rid of these.
 QCCFLAGS_WTFS ?= \
-       -Wno-field-redeclared \
-       -Wno-double-declaration \
+       -Wno-field-redeclared
 
 QCCFLAGS ?= \
        -std=gmqcc \
@@ -38,7 +37,7 @@ $(QCCVERSIONFILE):
 FILES_CSPROGS = $(shell find client common warpzonelib csqcmodellib -type f -not -name fteqcc.log -not -name qc.asm)
 ../csprogs.dat: $(FILES_CSPROGS) $(QCCVERSIONFILE)
        @echo make[1]: Entering directory \`$(PWD)/client\'
-       cd client && $(QCC) $(QCCFLAGS)
+       cd client && $(QCC) $(QCCFLAGS) -DCSQC
 
 server/precache-for-csqc.inc: $(FILES_CSPROGS)
        sh collect-precache.sh
@@ -46,12 +45,12 @@ server/precache-for-csqc.inc: $(FILES_CSPROGS)
 FILES_PROGS = $(shell find server common warpzonelib csqcmodellib -type f -not -name fteqcc.log -not -name qc.asm)
 ../progs.dat: $(FILES_PROGS) $(QCCVERSIONFILE) server/precache-for-csqc.inc
        @echo make[1]: Entering directory \`$(PWD)/server\'
-       cd server && $(QCC) $(QCCFLAGS)
+       cd server && $(QCC) $(QCCFLAGS) -DSVQC
 
 FILES_MENU = $(shell find menu common warpzonelib -type f -not -name fteqcc.log -not -name qc.asm)
 ../menu.dat: $(FILES_MENU) $(QCCVERSIONFILE)
        @echo make[1]: Entering directory \`$(PWD)/menu\'
-       cd menu && $(QCC) $(QCCFLAGS)
+       cd menu && $(QCC) $(QCCFLAGS) -DMENUQC
 
 .PHONY: testcase
 testcase:
diff --git a/qcsrc/client/Defs.qc b/qcsrc/client/Defs.qc
deleted file mode 100644 (file)
index 24a5fbf..0000000
+++ /dev/null
@@ -1,275 +0,0 @@
-//NOTE: THIS IS AN INTERFACE FILE. DO NOT EDIT.
-//MODIFYING THIS FILE CAN RESULT IN CRC ERRORS.
-//YOU HAVE BEEN WARNED.
-
-//feel free to look though. :)
-
-
-
-
-
-/*
-==============================================================================
-
-                       SOURCE FOR GLOBALVARS_T C STRUCTURE
-
-==============================================================================
-*/
-
-//
-// system globals
-//
-entity         self;
-entity         other;
-entity         world;
-float          time;
-float          frametime;
-
-float          player_localentnum;     //the entnum of the VIEW entity
-float          player_localnum;        //the playernum
-float          maxclients;     //a constant filled in by the engine. gah, portability eh?
-
-float          clientcommandframe;     //player movement
-float          servercommandframe;     //clientframe echoed off the server
-
-string         mapname;
-
-//
-// global variables set by built in functions
-//
-vector         v_forward, v_up, v_right;       // set by makevectors()
-
-// set by traceline / tracebox
-float          trace_allsolid;
-float          trace_startsolid;
-float          trace_fraction;
-vector         trace_endpos;
-vector         trace_plane_normal;
-float          trace_plane_dist;
-entity         trace_ent;
-float          trace_inopen;
-float          trace_inwater;
-
-//
-// required prog functions
-//
-void()         CSQC_Init;
-void()         CSQC_Shutdown;
-float(float f, float t, float n)       CSQC_InputEvent;
-void(float w, float h)         CSQC_UpdateView;
-float(string s)        CSQC_ConsoleCommand;
-
-//these fields are read and set by the default player physics
-vector         pmove_org;
-vector         pmove_vel;
-vector         pmove_mins;
-vector         pmove_maxs;
-//retrieved from the current movement commands (read by player physics)
-float          input_timelength;
-vector         input_angles;
-vector         input_movevalues;       //forwards, right, up.
-float          input_buttons;          //attack, use, jump (default physics only uses jump)
-
-float          movevar_gravity;
-float          movevar_stopspeed;
-float          movevar_maxspeed;
-float          movevar_spectatormaxspeed;      //used by NOCLIP movetypes.
-float          movevar_accelerate;
-float          movevar_airaccelerate;
-float          movevar_wateraccelerate;
-float          movevar_friction;
-float          movevar_waterfriction;
-float          movevar_entgravity;     //the local player's gravity field. Is a multiple (1 is the normal value)
-
-//================================================
-void           end_sys_globals;                // flag for structure dumping
-//================================================
-
-/*
-==============================================================================
-
-                       SOURCE FOR ENTVARS_T C STRUCTURE
-
-==============================================================================
-*/
-
-//
-// system fields (*** = do not set in prog code, maintained by C code)
-//
-.float         modelindex;             // *** model index in the precached list
-.vector                absmin, absmax; // *** origin + mins / maxs
-
-.float         entnum; // *** the ent number as on the server
-.float         drawmask;
-.void()                predraw;
-
-.float         movetype;
-.float         solid;
-
-.vector                origin;                 // ***
-.vector                oldorigin;              // ***
-.vector                velocity;
-.vector                angles;
-.vector                avelocity;
-
-.string                classname;              // spawn function
-.string                model;
-.float         frame;
-.float         skin;
-.float         effects;
-
-.vector                mins, maxs;             // bounding box extents reletive to origin
-.vector                size;                   // maxs - mins
-
-.void()                touch;
-.void()                use;
-.void()                think;
-.void()                blocked;                // for doors or plats, called when can't push other
-
-.float         nextthink;
-
-.entity                chain;
-
-.string                netname;
-
-.entity        enemy;
-
-.float         flags;
-
-.float         colormap;
-
-.entity                owner;          // who launched a missile
-
-//================================================
-void           end_sys_fields;                 // flag for structure dumping
-//================================================
-
-// Additional OPTIONAL Fields and Globals
-float          intermission;
-float          scoreboard_showscores;
-float          scoreboard_showaccuracy;
-.string                message;
-.float renderflags;
-// float               coop;
-// float               deathmatch;
-
-float          dmg_take;
-// float               dmg_save;
-// vector              dmg_origin;
-
-// Darkplaces Render Modifications
-#if 0
-.float alpha;
-.float renderflags;
-.vector colormod;
-.float scale;
-#endif
-
-// Basic variables
-.float enttype; // entity type sent from server
-.float sv_entnum; // entity number sent from server
-.float team;
-.float team_size;
-
-float vid_conwidth, vid_conheight;
-float binddb;
-
-// QUALIFYING
-float race_checkpoint;
-float race_time;
-float race_laptime;
-float race_checkpointtime;
-float race_previousbesttime;
-string race_previousbestname;
-float race_nextcheckpoint;
-float race_nextbesttime;
-string race_nextbestname;
-float race_penaltyaccumulator; // qualifying: total penalty time in tenths
-float race_penaltyeventtime; // time when the player got the penalty
-float race_penaltytime; // duration of penalty time, in tenths
-string race_penaltyreason; // reason for penalty
-float race_server_record; // server record
-float race_speedaward;
-string race_speedaward_holder;
-float race_speedaward_alltimebest;
-string race_speedaward_alltimebest_holder;
-
-// RACE
-float race_mycheckpoint;
-float race_mycheckpointtime;
-float race_mycheckpointdelta;
-float race_mycheckpointlapsdelta;
-string race_mycheckpointenemy;
-float race_othercheckpoint;
-float race_othercheckpointtime;
-float race_othercheckpointdelta;
-float race_othercheckpointlapsdelta;
-string race_othercheckpointenemy;
-float scoreboard_showscores_force;
-float race_status;
-string race_status_name;
-float race_myrank;
-
-// Nexball
-float nb_pb_period;
-
-// Spectating
-float spectatee_status;
-
-// short mapname
-string shortmapname;
-
-// database for misc stuff
-float tempdb;
-float ClientProgsDB;
-vector hook_shotorigin[4];
-vector lightning_shotorigin[4];
-
-
-#ifdef BLURTEST
-float blurtest_time0, blurtest_time1, blurtest_radius, blurtest_power;
-#endif
-
-float servertime, serverprevtime, serverdeltatime;
-
-float ticrate;
-
-.float damageforcescale;
-#define MIN_DAMAGEEXTRARADIUS 2
-#define MAX_DAMAGEEXTRARADIUS 16
-.float damageextraradius;
-.void(float thisdmg, float hittype, vector org, vector thisforce) event_damage;
-
-// only for Porto
-float angles_held_status;
-vector angles_held;
-
-// weapons
-.float silent;
-
-float w_deathtype, w_issilent, w_random;
-vector w_org, w_backoff;
-
-float rifle_scope;
-float vortex_scope;
-
-float minelayer_maxmines;
-
-float hagar_maxrockets;
-
-float bgmtime;
-
-string weaponorder_byimpulse;
-string weaponorder_bypriority;
-
-float vortex_charge_movingavg;
-
-float serverflags;
-
-float uid2name_dialog;
-
-.float csqcmodel_isdead; // used by shownames and miscfunctions (float getplayerisdead(float) {}) to know when a player is dead
-
-#define player_currententnum (spectatee_status > 0 ? spectatee_status : player_localnum + 1)
-
-float g_balance_porto_secondary;
diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc
deleted file mode 100644 (file)
index 9eb1e51..0000000
+++ /dev/null
@@ -1,1303 +0,0 @@
-// --------------------------------------------------------------------------
-// BEGIN REQUIRED CSQC FUNCTIONS
-//include "main.qh"
-
-entity clearentity_ent;
-void clearentity(entity e)
-{
-       if (!clearentity_ent)
-       {
-               clearentity_ent = spawn();
-               clearentity_ent.classname = "clearentity";
-       }
-       float n = e.entnum;
-       copyentity(clearentity_ent, e);
-       e.entnum = n;
-}
-
-#define DP_CSQC_ENTITY_REMOVE_IS_B0RKED
-void menu_show_error()
-{
-       drawstring('0 200 0', _("ERROR - MENU IS VISIBLE BUT NO MENU WAS DEFINED!"), '8 8 0', '1 0 0', 1, 0);
-}
-
-// CSQC_Init : Called every time the CSQC code is initialized (essentially at map load)
-// Useful for precaching things
-
-void menu_sub_null()
-{
-}
-
-string forcefog;
-void WaypointSprite_Load();
-void ConsoleCommand_macro_init();
-void CSQC_Init(void)
-{
-       prvm_language = cvar_string("prvm_language");
-
-#ifdef WATERMARK
-       dprintf("^4CSQC Build information: ^1%s\n", WATERMARK);
-#endif
-
-       float i;
-
-       binddb = db_create();
-       tempdb = db_create();
-       ClientProgsDB = db_load("client.db");
-       compressShortVector_init();
-
-       draw_endBoldFont();
-       menu_visible = FALSE;
-       menu_show = menu_show_error;
-       menu_action = func_null;
-
-       for(i = 0; i < 255; ++i)
-               if(getplayerkeyvalue(i, "viewentity") == "")
-                       break;
-       maxclients = i;
-
-       //registercommand("hud_configure");
-       //registercommand("hud_save");
-       //registercommand("menu_action");
-
-       ConsoleCommand_macro_init();
-
-       registercvar("hud_usecsqc", "1");
-       registercvar("scoreboard_columns", "default");
-
-       registercvar("cl_nade_type", "3");
-       registercvar("cl_pokenade_type", "zombie");
-
-       gametype = 0;
-
-       // hud_fields uses strunzone on the titles!
-       for(i = 0; i < MAX_HUD_FIELDS; ++i)
-               hud_title[i] = strzone("(null)");
-
-       Cmd_HUD_SetFields(0);
-
-       postinit = false;
-
-       calledhooks = 0;
-
-       teams = Sort_Spawn();
-       players = Sort_Spawn();
-
-       GetTeam(NUM_SPECTATOR, true); // add specs first
-
-       // needs to be done so early because of the constants they create
-       CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
-       CALL_ACCUMULATED_FUNCTION(RegisterTurrets);
-       CALL_ACCUMULATED_FUNCTION(RegisterMonsters);
-       CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
-       CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
-       CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
-       CALL_ACCUMULATED_FUNCTION(RegisterHUD_Panels);
-       CALL_ACCUMULATED_FUNCTION(RegisterBuffs);
-
-       WaypointSprite_Load();
-
-       // precaches
-       precache_model("null");
-       precache_sound("misc/hit.wav");
-       precache_sound("misc/typehit.wav");
-
-       Projectile_Precache();
-       Hook_Precache();
-       GibSplash_Precache();
-       Casings_Precache();
-       Vehicles_Precache();
-       Tuba_Precache();
-       CSQCPlayer_Precache();
-
-       if(autocvar_cl_reticle)
-       {
-               precache_pic("gfx/reticle_normal");
-               // weapon reticles are precached in weapon files
-       }
-
-       get_mi_min_max_texcoords(1); // try the CLEVER way first
-       minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
-       shortmapname = mi_shortname;
-
-       if(precache_pic(minimapname) == "")
-       {
-               // but maybe we have a non-clever minimap
-               minimapname = strcat("gfx/", mi_shortname, "_mini.tga");
-               if(precache_pic(minimapname) == "")
-                       minimapname = ""; // FAIL
-               else
-                       get_mi_min_max_texcoords(0); // load new texcoords
-       }
-
-       mi_center = (mi_min + mi_max) * 0.5;
-       mi_scale = mi_max - mi_min;
-       minimapname = strzone(minimapname);
-
-       WarpZone_Init();
-
-       hud_skin_path = strzone(strcat("gfx/hud/", autocvar_hud_skin));
-       hud_configure_prev = -1;
-
-       draw_currentSkin = strzone(strcat("gfx/menu/", cvar_string("menu_skin")));
-}
-
-// CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
-void Shutdown(void)
-{
-       WarpZone_Shutdown();
-
-       remove(teams);
-       remove(players);
-       db_close(binddb);
-       db_close(tempdb);
-       if(autocvar_cl_db_saveasdump)
-               db_dump(ClientProgsDB, "client.db");
-       else
-               db_save(ClientProgsDB, "client.db");
-       db_close(ClientProgsDB);
-
-       if(camera_active)
-               cvar_set("chase_active",ftos(chase_active_backup));
-
-       // unset the event chasecam's chase_active
-       if(autocvar_chase_active < 0)
-               cvar_set("chase_active", "0");
-
-       if (!isdemo())
-       {
-               if (!(calledhooks & HOOK_START))
-                       localcmd("\n_cl_hook_gamestart nop\n");
-               if (!(calledhooks & HOOK_END))
-                       localcmd("\ncl_hook_gameend\n");
-       }
-}
-
-.float has_team;
-float SetTeam(entity o, float Team)
-{
-       entity tm;
-       if(teamplay)
-       {
-               switch(Team)
-               {
-                       case -1:
-                       case NUM_TEAM_1:
-                       case NUM_TEAM_2:
-                       case NUM_TEAM_3:
-                       case NUM_TEAM_4:
-                               break;
-                       default:
-                               if(GetTeam(Team, false) == world)
-                               {
-                                       dprintf("trying to switch to unsupported team %d\n", Team);
-                                       Team = NUM_SPECTATOR;
-                               }
-                               break;
-               }
-       }
-       else
-       {
-               switch(Team)
-               {
-                       case -1:
-                       case 0:
-                               break;
-                       default:
-                               if(GetTeam(Team, false) == world)
-                               {
-                                       dprintf("trying to switch to unsupported team %d\n", Team);
-                                       Team = NUM_SPECTATOR;
-                               }
-                               break;
-               }
-       }
-       if(Team == -1) // leave
-       {
-               if(o.has_team)
-               {
-                       tm = GetTeam(o.team, false);
-                       tm.team_size -= 1;
-                       o.has_team = 0;
-                       return TRUE;
-               }
-       }
-       else
-       {
-               if (!o.has_team)
-               {
-                       o.team = Team;
-                       tm = GetTeam(Team, true);
-                       tm.team_size += 1;
-                       o.has_team = 1;
-                       return TRUE;
-               }
-               else if(Team != o.team)
-               {
-                       tm = GetTeam(o.team, false);
-                       tm.team_size -= 1;
-                       o.team = Team;
-                       tm = GetTeam(Team, true);
-                       tm.team_size += 1;
-                       return TRUE;
-               }
-       }
-       return FALSE;
-}
-
-void Playerchecker_Think()
-{
-       float i;
-       entity e;
-       for(i = 0; i < maxclients; ++i)
-       {
-               e = playerslots[i];
-               if(GetPlayerName(i) == "")
-               {
-                       if(e.sort_prev)
-                       {
-                               // player disconnected
-                               SetTeam(e, -1);
-                               RemovePlayer(e);
-                               e.sort_prev = world;
-                               //e.gotscores = 0;
-                       }
-               }
-               else
-               {
-                       if (!e.sort_prev)
-                       {
-                               // player connected
-                               if (!e)
-                                       playerslots[i] = e = spawn();
-                               e.sv_entnum = i;
-                               e.ping = 0;
-                               e.ping_packetloss = 0;
-                               e.ping_movementloss = 0;
-                               //e.gotscores = 0; // we might already have the scores...
-                               SetTeam(e, GetPlayerColor(i)); // will not hurt; later updates come with HUD_UpdatePlayerTeams
-                               RegisterPlayer(e);
-                               HUD_UpdatePlayerPos(e);
-                       }
-               }
-       }
-       self.nextthink = time + 0.2;
-}
-
-void Porto_Init();
-void TrueAim_Init();
-void PostInit(void)
-{
-       entity playerchecker;
-       playerchecker = spawn();
-       playerchecker.think = Playerchecker_Think;
-       playerchecker.nextthink = time + 0.2;
-
-       Porto_Init();
-       TrueAim_Init();
-
-       postinit = true;
-}
-
-float button_zoom;
-
-// CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
-// Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
-// All keys are in ascii.
-// bInputType = 0 is key pressed, 1 is key released, 2 and 3 are mouse input.
-// In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
-// In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
-// In the case of mouse input after a setcursormode(1) call, nPrimary is xpos, nSecondary is ypos.
-float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
-{
-       float bSkipKey;
-       bSkipKey = false;
-
-       if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
-               return true;
-
-       if (MapVote_InputEvent(bInputType, nPrimary, nSecondary))
-               return true;
-
-       if(menu_visible && menu_action)
-               if(menu_action(bInputType, nPrimary, nSecondary))
-                       return TRUE;
-
-       return bSkipKey;
-}
-
-// END REQUIRED CSQC FUNCTIONS
-// --------------------------------------------------------------------------
-
-// --------------------------------------------------------------------------
-// BEGIN OPTIONAL CSQC FUNCTIONS
-void Ent_RemoveEntCS()
-{
-       entcs_receiver[self.sv_entnum] = world;
-}
-void Ent_ReadEntCS()
-{
-       float sf;
-       InterpolateOrigin_Undo();
-
-       self.classname = "entcs_receiver";
-       sf = ReadByte();
-
-       if(sf & 1)
-               self.sv_entnum = ReadByte();
-       if(sf & 2)
-       {
-               self.origin_x = ReadShort();
-               self.origin_y = ReadShort();
-               self.origin_z = ReadShort();
-               setorigin(self, self.origin);
-       }
-       if(sf & 4)
-       {
-               self.angles_y = ReadByte() * 360.0 / 256;
-               self.angles_x = self.angles_z = 0;
-       }
-       if(sf & 8)
-               self.healthvalue = ReadByte() * 10;
-       if(sf & 16)
-               self.armorvalue = ReadByte() * 10;
-
-       entcs_receiver[self.sv_entnum] = self;
-       self.entremove = Ent_RemoveEntCS;
-       self.iflags |= IFLAG_ORIGIN;
-
-       InterpolateOrigin_Note();
-}
-
-void Ent_Remove();
-
-void Ent_RemovePlayerScore()
-{
-       float i;
-
-       if(self.owner)
-       {
-               SetTeam(self.owner, -1);
-               self.owner.gotscores = 0;
-               for(i = 0; i < MAX_SCORE; ++i)
-                       self.owner.(scores[i]) = 0; // clear all scores
-       }
-}
-
-void Ent_ReadPlayerScore()
-{
-       float i, n;
-       float isNew;
-       entity o;
-
-       // damnit -.- don't want to go change every single .sv_entnum in hud.qc AGAIN
-       // (no I've never heard of M-x replace-string, sed, or anything like that)
-       isNew = !self.owner; // workaround for DP bug
-       n = ReadByte()-1;
-
-#ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
-       if(!isNew && n != self.sv_entnum)
-       {
-               //print("A CSQC entity changed its owner!\n");
-               printf("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", num_for_edict(self), self.classname);
-               isNew = true;
-               Ent_Remove();
-               self.enttype = ENT_CLIENT_SCORES;
-       }
-#endif
-
-       self.sv_entnum = n;
-
-       if (!(playerslots[self.sv_entnum]))
-               playerslots[self.sv_entnum] = spawn();
-       o = self.owner = playerslots[self.sv_entnum];
-       o.sv_entnum = self.sv_entnum;
-       o.gotscores = 1;
-
-       //if (!o.sort_prev)
-       //      RegisterPlayer(o);
-       //playerchecker will do this for us later, if it has not already done so
-
-       float sf, lf;
-#if MAX_SCORE <= 8
-       sf = ReadByte();
-       lf = ReadByte();
-#else
-       sf = ReadShort();
-       lf = ReadShort();
-#endif
-       float p;
-       for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
-               if(sf & p)
-               {
-                       if(lf & p)
-                               o.(scores[i]) = ReadInt24_t();
-                       else
-                               o.(scores[i]) = ReadChar();
-               }
-
-       if(o.sort_prev)
-               HUD_UpdatePlayerPos(o); // if not registered, we cannot do this yet!
-
-       self.entremove = Ent_RemovePlayerScore;
-}
-
-void Ent_ReadTeamScore()
-{
-       float i;
-       entity o;
-
-       self.team = ReadByte();
-       o = self.owner = GetTeam(self.team, true); // these team numbers can always be trusted
-
-       float sf, lf;
-#if MAX_TEAMSCORE <= 8
-       sf = ReadByte();
-       lf = ReadByte();
-#else
-       sf = ReadShort();
-       lf = ReadShort();
-#endif
-       float p;
-       for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
-               if(sf & p)
-               {
-                       if(lf & p)
-                               o.(teamscores[i]) = ReadInt24_t();
-                       else
-                               o.(teamscores[i]) = ReadChar();
-               }
-
-       HUD_UpdateTeamPos(o);
-}
-
-void Ent_ClientData()
-{
-       float f;
-       float newspectatee_status;
-
-       f = ReadByte();
-
-       scoreboard_showscores_force = (f & 1);
-
-       if(f & 2)
-       {
-               newspectatee_status = ReadByte();
-               if(newspectatee_status == player_localnum + 1)
-                       newspectatee_status = -1; // observing
-       }
-       else
-               newspectatee_status = 0;
-
-       spectatorbutton_zoom = (f & 4);
-
-       if(f & 8)
-       {
-               angles_held_status = 1;
-               angles_held_x = ReadAngle();
-               angles_held_y = ReadAngle();
-               angles_held_z = 0;
-       }
-       else
-               angles_held_status = 0;
-
-       if(newspectatee_status != spectatee_status)
-       {
-               // clear race stuff
-               race_laptime = 0;
-               race_checkpointtime = 0;
-       }
-       if (autocvar_hud_panel_healtharmor_progressbar_gfx)
-       {
-               if ( (spectatee_status == -1 && newspectatee_status > 0) //before observing, now spectating
-                 || (spectatee_status > 0 && newspectatee_status > 0 && spectatee_status != newspectatee_status) //changed spectated player
-               )
-                       prev_p_health = -1;
-               else if(spectatee_status && !newspectatee_status) //before observing/spectating, now playing
-                       prev_health = -1;
-       }
-       spectatee_status = newspectatee_status;
-
-       // we could get rid of spectatee_status, and derive it from player_localentnum and player_localnum
-}
-
-void Ent_Nagger()
-{
-       float nags, i, j, b, f;
-
-       nags = ReadByte(); // NAGS NAGS NAGS NAGS NAGS NAGS NADZ NAGS NAGS NAGS
-
-       if(!(nags & 4))
-       {
-               if(vote_called_vote)
-                       strunzone(vote_called_vote);
-               vote_called_vote = string_null;
-               vote_active = 0;
-       }
-       else
-       {
-               vote_active = 1;
-       }
-
-       if(nags & 64)
-       {
-               vote_yescount = ReadByte();
-               vote_nocount = ReadByte();
-               vote_needed = ReadByte();
-               vote_highlighted = ReadChar();
-       }
-
-       if(nags & 128)
-       {
-               if(vote_called_vote)
-                       strunzone(vote_called_vote);
-               vote_called_vote = strzone(ColorTranslateRGB(ReadString()));
-       }
-
-       if(nags & 1)
-       {
-               for(j = 0; j < maxclients; ++j)
-                       if(playerslots[j])
-                               playerslots[j].ready = 1;
-               for(i = 1; i <= maxclients; i += 8)
-               {
-                       f = ReadByte();
-                       for(j = i-1, b = 1; b < 256; b *= 2, ++j)
-                               if (!(f & b))
-                                       if(playerslots[j])
-                                               playerslots[j].ready = 0;
-               }
-       }
-
-       ready_waiting = (nags & 1);
-       ready_waiting_for_me = (nags & 2);
-       vote_waiting = (nags & 4);
-       vote_waiting_for_me = (nags & 8);
-       warmup_stage = (nags & 16);
-}
-
-void Ent_EliminatedPlayers()
-{
-       float sf, i, j, b, f;
-
-       sf = ReadByte();
-       if(sf & 1)
-       {
-               for(j = 0; j < maxclients; ++j)
-                       if(playerslots[j])
-                               playerslots[j].eliminated = 1;
-               for(i = 1; i <= maxclients; i += 8)
-               {
-                       f = ReadByte();
-                       for(j = i-1, b = 1; b < 256; b *= 2, ++j)
-                               if (!(f & b))
-                                       if(playerslots[j])
-                                               playerslots[j].eliminated = 0;
-               }
-       }
-}
-
-void Ent_RandomSeed()
-{
-       float s;
-       prandom_debug();
-       s = ReadShort();
-       psrandom(s);
-}
-
-void Ent_ReadAccuracy(void)
-{
-       float sf, f, w, b;
-       sf = ReadInt24_t();
-       if(sf == 0)
-       {
-               for(w = 0; w <= WEP_LAST - WEP_FIRST; ++w)
-                       weapon_accuracy[w] = -1;
-               return;
-       }
-
-       for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w)
-       {
-               if(sf & f)
-               {
-                       b = ReadByte();
-                       if(b == 0)
-                               weapon_accuracy[w] = -1;
-                       else if(b == 255)
-                               weapon_accuracy[w] = 1.0; // no better error handling yet, sorry
-                       else
-                               weapon_accuracy[w] = (b - 1.0) / 100.0;
-               }
-               if(f == 0x800000)
-                       f = 1;
-               else
-                       f *= 2;
-       }
-}
-
-void Spawn_Draw(void)
-{
-       pointparticles(self.cnt, self.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
-}
-
-void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint
-{
-       float teamnum = (ReadByte() - 1);
-       vector spn_origin;
-       spn_origin_x = ReadShort();
-       spn_origin_y = ReadShort();
-       spn_origin_z = ReadShort();
-
-       if(is_new)
-       {
-               self.origin = spn_origin;
-               setsize(self, PL_MIN, PL_MAX);
-               droptofloor();
-
-               /*if(autocvar_cl_spawn_point_model) // needs a model first
-               {
-                       self.mdl = "models/spawnpoint.md3";
-                       self.colormod = Team_ColorRGB(teamnum);
-                       precache_model(self.mdl);
-                       setmodel(self, self.mdl);
-                       self.drawmask = MASK_NORMAL;
-                       //self.movetype = MOVETYPE_NOCLIP;
-                       //self.draw = Spawn_Draw;
-               }*/
-               if(autocvar_cl_spawn_point_particles)
-               {
-                       if((serverflags & SERVERFLAG_TEAMPLAY))
-                       {
-                               switch(teamnum)
-                               {
-                                       case NUM_TEAM_1: self.cnt = particleeffectnum("spawn_point_red"); break;
-                                       case NUM_TEAM_2: self.cnt = particleeffectnum("spawn_point_blue"); break;
-                                       case NUM_TEAM_3: self.cnt = particleeffectnum("spawn_point_yellow"); break;
-                                       case NUM_TEAM_4: self.cnt = particleeffectnum("spawn_point_pink"); break;
-                                       default: self.cnt = particleeffectnum("spawn_point_neutral"); break;
-                               }
-                       }
-                       else { self.cnt = particleeffectnum("spawn_point_neutral"); }
-
-                       self.draw = Spawn_Draw;
-               }
-       }
-
-       //printf("Ent_ReadSpawnPoint(is_new = %d); origin = %s, team = %d, effect = %d\n", is_new, vtos(self.origin), teamnum, self.cnt);
-}
-
-void Ent_ReadSpawnEvent(float is_new)
-{
-       // If entnum is 0, ONLY do the local spawn actions
-       // this way the server can disable the sending of
-       // spawn origin or such to clients if wanted.
-       float entnum = ReadByte();
-
-       if(entnum)
-       {
-               self.origin_x = ReadShort();
-               self.origin_y = ReadShort();
-               self.origin_z = ReadShort();
-
-               if(is_new)
-               {
-                       float teamnum = GetPlayerColor(entnum - 1);
-
-                       if(autocvar_cl_spawn_event_particles)
-                       {
-                               switch(teamnum)
-                               {
-                                       case NUM_TEAM_1: pointparticles(particleeffectnum("spawn_event_red"), self.origin, '0 0 0', 1); break;
-                                       case NUM_TEAM_2: pointparticles(particleeffectnum("spawn_event_blue"), self.origin, '0 0 0', 1); break;
-                                       case NUM_TEAM_3: pointparticles(particleeffectnum("spawn_event_yellow"), self.origin, '0 0 0', 1); break;
-                                       case NUM_TEAM_4: pointparticles(particleeffectnum("spawn_event_pink"), self.origin, '0 0 0', 1); break;
-                                       default: pointparticles(particleeffectnum("spawn_event_neutral"), self.origin, '0 0 0', 1); break;
-                               }
-                       }
-                       if(autocvar_cl_spawn_event_sound)
-                       {
-                               sound(self, CH_TRIGGER, "misc/spawn.wav", VOL_BASE, ATTEN_NORM);
-                       }
-               }
-       }
-
-       // local spawn actions
-       if(is_new && (!entnum || (entnum == player_localentnum)))
-       {
-               zoomin_effect = 1;
-               current_viewzoom = (1 / bound(1, autocvar_cl_spawnzoom_factor, 16));
-
-               if(autocvar_cl_unpress_zoom_on_spawn)
-               {
-                       localcmd("-zoom\n");
-                       button_zoom = FALSE;
-               }
-       }
-
-       //printf("Ent_ReadSpawnEvent(is_new = %d); origin = %s, entnum = %d, localentnum = %d\n", is_new, vtos(self.origin), entnum, player_localentnum);
-}
-
-// CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
-// The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
-void Ent_RadarLink();
-void Ent_Init();
-void Ent_ScoresInfo();
-void CSQC_Ent_Update(float bIsNewEntity)
-{
-       float t;
-       float savetime;
-       t = ReadByte();
-
-       if(autocvar_developer_csqcentities)
-               printf("CSQC_Ent_Update(%d) with self=%i self.entnum=%d self.enttype=%d t=%d\n", bIsNewEntity, self, self.entnum, self.enttype, t);
-
-       // set up the "time" global for received entities to be correct for interpolation purposes
-       savetime = time;
-       if(servertime)
-       {
-               time = servertime;
-       }
-       else
-       {
-               serverprevtime = time;
-               serverdeltatime = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
-               time = serverprevtime + serverdeltatime;
-       }
-
-#ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
-       if(self.enttype)
-       {
-               if(t != self.enttype || bIsNewEntity)
-               {
-                       //print("A CSQC entity changed its type!\n");
-                       printf("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", num_for_edict(self), self.entnum, self.enttype, t);
-                       Ent_Remove();
-                       clearentity(self);
-                       bIsNewEntity = 1;
-               }
-       }
-       else
-       {
-               if(!bIsNewEntity)
-               {
-                       printf("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", num_for_edict(self), self.entnum, t);
-                       bIsNewEntity = 1;
-               }
-       }
-#endif
-       self.enttype = t;
-       switch(t)
-       {
-               case ENT_CLIENT_ENTCS: Ent_ReadEntCS(); break;
-               case ENT_CLIENT_SCORES: Ent_ReadPlayerScore(); break;
-               case ENT_CLIENT_TEAMSCORES: Ent_ReadTeamScore(); break;
-               case ENT_CLIENT_POINTPARTICLES: Ent_PointParticles(); break;
-               case ENT_CLIENT_RAINSNOW: Ent_RainOrSnow(); break;
-               case ENT_CLIENT_LASER: Ent_Laser(); break;
-               case ENT_CLIENT_NAGGER: Ent_Nagger(); break;
-               case ENT_CLIENT_ELIMINATEDPLAYERS: Ent_EliminatedPlayers(); break;
-               case ENT_CLIENT_WAYPOINT: Ent_WaypointSprite(); break;
-               case ENT_CLIENT_RADARLINK: Ent_RadarLink(); break;
-               case ENT_CLIENT_PROJECTILE: Ent_Projectile(); break;
-               case ENT_CLIENT_GIBSPLASH: Ent_GibSplash(bIsNewEntity); break;
-               case ENT_CLIENT_DAMAGEINFO: Ent_DamageInfo(bIsNewEntity); break;
-               case ENT_CLIENT_CASING: Ent_Casing(bIsNewEntity); break;
-               case ENT_CLIENT_INIT: Ent_Init(); break;
-               case ENT_CLIENT_SCORES_INFO: Ent_ScoresInfo(); break;
-               case ENT_CLIENT_MAPVOTE: Ent_MapVote(); break;
-               case ENT_CLIENT_CLIENTDATA: Ent_ClientData(); break;
-               case ENT_CLIENT_RANDOMSEED: Ent_RandomSeed(); break;
-               case ENT_CLIENT_WALL: Ent_Wall(); break;
-               case ENT_CLIENT_MODELEFFECT: Ent_ModelEffect(bIsNewEntity); break;
-               case ENT_CLIENT_TUBANOTE: Ent_TubaNote(bIsNewEntity); break;
-               case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;
-               case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;
-               case ENT_CLIENT_WARPZONE_TELEPORTED: WarpZone_Teleported_Read(bIsNewEntity); break;
-               case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;
-               case ENT_CLIENT_HOOK: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break;
-               case ENT_CLIENT_ARC_BEAM: Ent_ReadArcBeam(bIsNewEntity); break;
-               case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
-               case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
-               case ENT_CLIENT_TURRET: ent_turret(); break;
-               case ENT_CLIENT_MODEL: CSQCModel_Read(bIsNewEntity); break;
-               case ENT_CLIENT_ITEM: ItemRead(bIsNewEntity); break;
-               case ENT_CLIENT_BUMBLE_RAYGUN: bumble_raygun_read(bIsNewEntity); break;
-               case ENT_CLIENT_SPAWNPOINT: Ent_ReadSpawnPoint(bIsNewEntity); break;
-               case ENT_CLIENT_SPAWNEVENT: Ent_ReadSpawnEvent(bIsNewEntity); break;
-               case ENT_CLIENT_NOTIFICATION: Read_Notification(bIsNewEntity); break;
-               case ENT_CLIENT_HEALING_ORB: ent_healer(); break;
-
-               default:
-                       //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
-                       error(sprintf("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n", self.enttype, num_for_edict(self), self.classname));
-                       break;
-       }
-
-       time = savetime;
-}
-// Destructor, but does NOT deallocate the entity by calling remove(). Also
-// used when an entity changes its type. For an entity that someone interacts
-// with others, make sure it can no longer do so.
-void Ent_Remove()
-{
-       if(self.entremove)
-               self.entremove();
-
-       if(self.skeletonindex)
-       {
-               skel_delete(self.skeletonindex);
-               self.skeletonindex = 0;
-       }
-
-       if(self.snd_looping > 0)
-       {
-               sound(self, self.snd_looping, "misc/null.wav", VOL_BASE, autocvar_g_jetpack_attenuation);
-               self.snd_looping = 0;
-       }
-
-       self.enttype = 0;
-       self.classname = "";
-       self.draw = menu_sub_null;
-       self.entremove = menu_sub_null;
-       // TODO possibly set more stuff to defaults
-}
-// CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed.  Essentially call remove(self) as well.
-void CSQC_Ent_Remove()
-{
-       if(autocvar_developer_csqcentities)
-               printf("CSQC_Ent_Remove() with self=%i self.entnum=%d self.enttype=%d\n", self, self.entnum, self.enttype);
-
-       if(wasfreed(self))
-       {
-               print("WARNING: CSQC_Ent_Remove called for already removed entity. Packet loss?\n");
-               return;
-       }
-       if(self.enttype)
-               Ent_Remove();
-       remove(self);
-}
-
-void Gamemode_Init()
-{
-       if (!isdemo())
-       {
-               if(!(calledhooks & HOOK_START))
-                       localcmd("\n_cl_hook_gamestart ", MapInfo_Type_ToString(gametype), "\n");
-               calledhooks |= HOOK_START;
-       }
-}
-// CSQC_Parse_StuffCmd : Provides the stuffcmd string in the first parameter that the server provided.  To execute standard behavior, simply execute localcmd with the string.
-void CSQC_Parse_StuffCmd(string strMessage)
-{
-       if(autocvar_developer_csqcentities)
-               printf("CSQC_Parse_StuffCmd(\"%s\")\n", strMessage);
-
-       localcmd(strMessage);
-}
-// CSQC_Parse_Print : Provides the print string in the first parameter that the server provided.  To execute standard behavior, simply execute print with the string.
-void CSQC_Parse_Print(string strMessage)
-{
-       if(autocvar_developer_csqcentities)
-               printf("CSQC_Parse_Print(\"%s\")\n", strMessage);
-
-       print(ColorTranslateRGB(strMessage));
-}
-
-// CSQC_Parse_CenterPrint : Provides the centerprint_hud string in the first parameter that the server provided.
-void CSQC_Parse_CenterPrint(string strMessage)
-{
-       if(autocvar_developer_csqcentities)
-               printf("CSQC_Parse_CenterPrint(\"%s\")\n", strMessage);
-
-       centerprint_hud(strMessage);
-}
-
-string notranslate_fogcmd1 = "\nfog ";
-string notranslate_fogcmd2 = "\nr_fog_exp2 0\nr_drawfog 1\n";
-void Fog_Force()
-{
-       // TODO somehow thwart prvm_globalset client ...
-
-       if(autocvar_cl_orthoview && autocvar_cl_orthoview_nofog)
-               { localcmd("\nr_drawfog 0\n"); }
-       else if(forcefog != "")
-               { localcmd(strcat(notranslate_fogcmd1, forcefog, notranslate_fogcmd2)); }
-}
-
-void Gamemode_Init();
-void Ent_ScoresInfo()
-{
-       float i;
-       self.classname = "ent_client_scores_info";
-       gametype = ReadInt24_t();
-       HUD_ModIcons_SetFunc();
-       for(i = 0; i < MAX_SCORE; ++i)
-       {
-               if(scores_label[i])
-                       strunzone(scores_label[i]);
-               scores_label[i] = strzone(ReadString());
-               scores_flags[i] = ReadByte();
-       }
-       for(i = 0; i < MAX_TEAMSCORE; ++i)
-       {
-               if(teamscores_label[i])
-                       strunzone(teamscores_label[i]);
-               teamscores_label[i] = strzone(ReadString());
-               teamscores_flags[i] = ReadByte();
-       }
-       HUD_InitScores();
-       Gamemode_Init();
-}
-
-void Ent_Init()
-{
-       self.classname = "ent_client_init";
-
-       nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
-
-       hook_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
-       hook_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
-       hook_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
-       hook_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
-       arc_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
-       arc_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
-       arc_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
-       arc_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
-
-       if(forcefog)
-               strunzone(forcefog);
-       forcefog = strzone(ReadString());
-
-       armorblockpercent = ReadByte() / 255.0;
-
-       g_balance_mortar_bouncefactor = ReadCoord();
-       g_balance_mortar_bouncestop = ReadCoord();
-       g_balance_electro_secondary_bouncefactor = ReadCoord();
-       g_balance_electro_secondary_bouncestop = ReadCoord();
-
-       vortex_scope = !ReadByte();
-       rifle_scope = !ReadByte();
-
-       serverflags = ReadByte();
-
-       minelayer_maxmines = ReadByte();
-
-       hagar_maxrockets = ReadByte();
-
-       g_trueaim_minrange = ReadCoord();
-       g_balance_porto_secondary = ReadByte();
-
-       if(!postinit)
-               PostInit();
-}
-
-void Net_ReadRace()
-{
-       float b;
-
-       b = ReadByte();
-
-       switch(b)
-       {
-               case RACE_NET_CHECKPOINT_HIT_QUALIFYING:
-                       race_checkpoint = ReadByte();
-                       race_time = ReadInt24_t();
-                       race_previousbesttime = ReadInt24_t();
-                       if(race_previousbestname)
-                               strunzone(race_previousbestname);
-                       race_previousbestname = strzone(ColorTranslateRGB(ReadString()));
-
-                       race_checkpointtime = time;
-
-                       if(race_checkpoint == 0 || race_checkpoint == 254)
-                       {
-                               race_penaltyaccumulator = 0;
-                               race_laptime = time; // valid
-                       }
-
-                       break;
-
-               case RACE_NET_CHECKPOINT_CLEAR:
-                       race_laptime = 0;
-                       race_checkpointtime = 0;
-                       break;
-
-               case RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING:
-                       race_laptime = ReadCoord();
-                       race_checkpointtime = -99999;
-                       // fall through
-               case RACE_NET_CHECKPOINT_NEXT_QUALIFYING:
-                       race_nextcheckpoint = ReadByte();
-
-                       race_nextbesttime = ReadInt24_t();
-                       if(race_nextbestname)
-                               strunzone(race_nextbestname);
-                       race_nextbestname = strzone(ColorTranslateRGB(ReadString()));
-                       break;
-
-               case RACE_NET_CHECKPOINT_HIT_RACE:
-                       race_mycheckpoint = ReadByte();
-                       race_mycheckpointtime = time;
-                       race_mycheckpointdelta = ReadInt24_t();
-                       race_mycheckpointlapsdelta = ReadByte();
-                       if(race_mycheckpointlapsdelta >= 128)
-                               race_mycheckpointlapsdelta -= 256;
-                       if(race_mycheckpointenemy)
-                               strunzone(race_mycheckpointenemy);
-                       race_mycheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
-                       break;
-
-               case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:
-                       race_othercheckpoint = ReadByte();
-                       race_othercheckpointtime = time;
-                       race_othercheckpointdelta = ReadInt24_t();
-                       race_othercheckpointlapsdelta = ReadByte();
-                       if(race_othercheckpointlapsdelta >= 128)
-                               race_othercheckpointlapsdelta -= 256;
-                       if(race_othercheckpointenemy)
-                               strunzone(race_othercheckpointenemy);
-                       race_othercheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
-                       break;
-
-               case RACE_NET_PENALTY_RACE:
-                       race_penaltyeventtime = time;
-                       race_penaltytime = ReadShort();
-                       //race_penaltyaccumulator += race_penaltytime;
-                       if(race_penaltyreason)
-                               strunzone(race_penaltyreason);
-                       race_penaltyreason = strzone(ReadString());
-                       break;
-
-               case RACE_NET_PENALTY_QUALIFYING:
-                       race_penaltyeventtime = time;
-                       race_penaltytime = ReadShort();
-                       race_penaltyaccumulator += race_penaltytime;
-                       if(race_penaltyreason)
-                               strunzone(race_penaltyreason);
-                       race_penaltyreason = strzone(ReadString());
-                       break;
-
-               case RACE_NET_SERVER_RECORD:
-                       race_server_record = ReadInt24_t();
-                       break;
-               case RACE_NET_SPEED_AWARD:
-                       race_speedaward = ReadInt24_t();
-                       if(race_speedaward_holder)
-                               strunzone(race_speedaward_holder);
-                       race_speedaward_holder = strzone(ReadString());
-                       break;
-               case RACE_NET_SPEED_AWARD_BEST:
-                       race_speedaward_alltimebest = ReadInt24_t();
-                       if(race_speedaward_alltimebest_holder)
-                               strunzone(race_speedaward_alltimebest_holder);
-                       race_speedaward_alltimebest_holder = strzone(ReadString());
-                       break;
-               case RACE_NET_SERVER_RANKINGS:
-                       float pos, prevpos, del;
-                       pos = ReadShort();
-                       prevpos = ReadShort();
-                       del = ReadShort();
-
-                       // move other rankings out of the way
-                       float i;
-                       if (prevpos) {
-                               for (i=prevpos-1;i>pos-1;--i) {
-                                       grecordtime[i] = grecordtime[i-1];
-                                       if(grecordholder[i])
-                                               strunzone(grecordholder[i]);
-                                       grecordholder[i] = strzone(grecordholder[i-1]);
-                               }
-                       } else if (del) { // a record has been deleted by the admin
-                               for (i=pos-1; i<= RANKINGS_CNT-1; ++i) {
-                                       if (i == RANKINGS_CNT-1) { // clear out last record
-                                               grecordtime[i] = 0;
-                                               if (grecordholder[i])
-                                                       strunzone(grecordholder[i]);
-                                               grecordholder[i] = string_null;
-                                       }
-                                       else {
-                                               grecordtime[i] = grecordtime[i+1];
-                                               if (grecordholder[i])
-                                                       strunzone(grecordholder[i]);
-                                               grecordholder[i] = strzone(grecordholder[i+1]);
-                                       }
-                               }
-                       } else { // player has no ranked record yet
-                               for (i=RANKINGS_CNT-1;i>pos-1;--i) {
-                                       grecordtime[i] = grecordtime[i-1];
-                                       if(grecordholder[i])
-                                               strunzone(grecordholder[i]);
-                                       grecordholder[i] = strzone(grecordholder[i-1]);
-                               }
-                       }
-
-                       // store new ranking
-                       if(grecordholder[pos-1] != "")
-                               strunzone(grecordholder[pos-1]);
-                       grecordholder[pos-1] = strzone(ReadString());
-                       grecordtime[pos-1] = ReadInt24_t();
-                       if(grecordholder[pos-1] == GetPlayerName(player_localnum))
-                               race_myrank = pos;
-                       break;
-               case RACE_NET_SERVER_STATUS:
-                       race_status = ReadShort();
-                       if(race_status_name)
-                               strunzone(race_status_name);
-                       race_status_name = strzone(ReadString());
-       }
-}
-
-void Net_TeamNagger()
-{
-       teamnagger = 1;
-}
-
-void Net_ReadPingPLReport()
-{
-       float e, pi, pl, ml;
-       e = ReadByte();
-       pi = ReadShort();
-       pl = ReadByte();
-       ml = ReadByte();
-       if (!(playerslots[e]))
-               return;
-       playerslots[e].ping = pi;
-       playerslots[e].ping_packetloss = pl / 255.0;
-       playerslots[e].ping_movementloss = ml / 255.0;
-}
-
-void Net_WeaponComplain()
-{
-       complain_weapon = ReadByte();
-
-       if(complain_weapon_name)
-               strunzone(complain_weapon_name);
-       complain_weapon_name = strzone(WEP_NAME(complain_weapon));
-
-       complain_weapon_type = ReadByte();
-
-       complain_weapon_time = time;
-       weapontime = time; // ping the weapon panel
-
-       switch(complain_weapon_type)
-       {
-               case 0: Local_Notification(MSG_MULTI, ITEM_WEAPON_NOAMMO, complain_weapon); break;
-               case 1: Local_Notification(MSG_MULTI, ITEM_WEAPON_DONTHAVE, complain_weapon); break;
-               default: Local_Notification(MSG_MULTI, ITEM_WEAPON_UNAVAILABLE, complain_weapon); break;
-       }
-}
-
-// CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
-// You must ALWAYS first acquire the temporary ID, which is sent as a byte.
-// Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
-float CSQC_Parse_TempEntity()
-{
-       float bHandled;
-               bHandled  = true;
-       // Acquire TE ID
-       float nTEID;
-               nTEID = ReadByte();
-
-       if(autocvar_developer_csqcentities)
-               printf("CSQC_Parse_TempEntity() with nTEID=%d\n", nTEID);
-
-               // NOTE: Could just do return instead of break...
-       switch(nTEID)
-       {
-               case TE_CSQC_TARGET_MUSIC:
-                       Net_TargetMusic();
-                       bHandled = true;
-                       break;
-               case TE_CSQC_PICTURE:
-                       Net_MapVote_Picture();
-                       bHandled = true;
-                       break;
-               case TE_CSQC_RACE:
-                       Net_ReadRace();
-                       bHandled = true;
-                       break;
-               case TE_CSQC_VORTEXBEAMPARTICLE:
-                       Net_ReadVortexBeamParticle();
-                       bHandled = true;
-                       break;
-               case TE_CSQC_TEAMNAGGER:
-                       Net_TeamNagger();
-                       bHandled = true;
-                       break;
-               case TE_CSQC_ARC:
-                       Net_ReadArc();
-                       bHandled = true;
-                       break;
-               case TE_CSQC_PINGPLREPORT:
-                       Net_ReadPingPLReport();
-                       bHandled = true;
-                       break;
-               case TE_CSQC_WEAPONCOMPLAIN:
-                       Net_WeaponComplain();
-                       bHandled = true;
-                       break;
-               case TE_CSQC_VEHICLESETUP:
-                       Net_VehicleSetup();
-                       bHandled = true;
-                       break;
-               case TE_CSQC_SVNOTICE:
-                       cl_notice_read();
-                       bHandled = true;
-                       break;
-               case TE_CSQC_SHOCKWAVEPARTICLE:
-                       Net_ReadShockwaveParticle();
-                       bHandled = true;
-                       break;
-               default:
-                       // No special logic for this temporary entity; return 0 so the engine can handle it
-                       bHandled = false;
-                       break;
-       }
-
-       return bHandled;
-}
-
-string getcommandkey(string text, string command)
-{
-       string keys;
-       float n, j, k, l = 0;
-
-       if (!autocvar_hud_showbinds)
-               return text;
-
-       keys = db_get(binddb, command);
-       if (keys == "")
-       {
-               n = tokenize(findkeysforcommand(command, 0)); // uses '...' strings
-               for(j = 0; j < n; ++j)
-               {
-                       k = stof(argv(j));
-                       if(k != -1)
-                       {
-                               if ("" == keys)
-                                       keys = keynumtostring(k);
-                               else
-                                       keys = strcat(keys, ", ", keynumtostring(k));
-
-                               ++l;
-                               if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit <= l)
-                                       break;
-                       }
-
-               }
-               if (keys == "")
-                       keys = "NO_KEY";
-               db_put(binddb, command, keys);
-       }
-
-       if (keys == "NO_KEY") {
-               if (autocvar_hud_showbinds > 1)
-                       return sprintf(_("%s (not bound)"), text);
-               else
-                       return text;
-       }
-       else if (autocvar_hud_showbinds > 1)
-               return sprintf("%s (%s)", text, keys);
-       else
-               return keys;
-}
diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc
deleted file mode 100644 (file)
index 8a72577..0000000
+++ /dev/null
@@ -1,1928 +0,0 @@
-entity porto;
-vector polyline[16];
-void Porto_Draw()
-{
-       vector p, dir, ang, q, nextdir;
-       float idx, portal_number, portal1_idx;
-
-       if(activeweapon != WEP_PORTO || spectatee_status || gametype == MAPINFO_TYPE_NEXBALL)
-               return;
-       if(g_balance_porto_secondary)
-               return;
-       if(intermission == 1)
-               return;
-       if(intermission == 2)
-               return;
-       if (getstati(STAT_HEALTH) <= 0)
-               return;
-
-       dir = view_forward;
-
-       if(angles_held_status)
-       {
-               makevectors(angles_held);
-               dir = v_forward;
-       }
-
-       p = view_origin;
-
-       polyline[0] = p;
-       idx = 1;
-       portal_number = 0;
-       nextdir = dir;
-
-       for(;;)
-       {
-               dir = nextdir;
-               traceline(p, p + 65536 * dir, TRUE, porto);
-               if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
-                       return;
-               nextdir = dir - 2 * (dir * trace_plane_normal) * trace_plane_normal; // mirror dir at trace_plane_normal
-               p = trace_endpos;
-               polyline[idx] = p;
-               ++idx;
-               if(idx >= 16)
-                       return;
-               if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP)
-                       continue;
-               ++portal_number;
-               ang = vectoangles2(trace_plane_normal, dir);
-               ang_x = -ang_x;
-               makevectors(ang);
-               if(!CheckWireframeBox(porto, p - 48 * v_right - 48 * v_up + 16 * v_forward, 96 * v_right, 96 * v_up, 96 * v_forward))
-                       return;
-               if(portal_number == 1)
-               {
-                       portal1_idx = idx;
-                       if(portal_number >= 2)
-                               break;
-               }
-       }
-
-       while(idx >= 2)
-       {
-               p = polyline[idx-2];
-               q = polyline[idx-1];
-               if(idx == 2)
-                       p = p - view_up * 16;
-               if(idx-1 >= portal1_idx)
-               {
-                       Draw_CylindricLine(p, q, 4, "", 1, 0, '0 0 1', 0.5, DRAWFLAG_NORMAL, view_origin);
-               }
-               else
-               {
-                       Draw_CylindricLine(p, q, 4, "", 1, 0, '1 0 0', 0.5, DRAWFLAG_NORMAL, view_origin);
-               }
-               --idx;
-       }
-}
-
-void Porto_Init()
-{
-       porto = spawn();
-       porto.classname = "porto";
-       porto.draw = Porto_Draw;
-       porto.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;
-}
-
-float drawtime;
-float avgspeed;
-vector GetCurrentFov(float fov)
-{
-       float zoomsensitivity, zoomspeed, zoomfactor, zoomdir;
-       float velocityzoom, curspeed;
-       vector v;
-
-       zoomsensitivity = autocvar_cl_zoomsensitivity;
-       zoomfactor = autocvar_cl_zoomfactor;
-       if(zoomfactor < 1 || zoomfactor > 16)
-               zoomfactor = 2.5;
-       zoomspeed = autocvar_cl_zoomspeed;
-       if(zoomspeed >= 0)
-       if(zoomspeed < 0.5 || zoomspeed > 16)
-                       zoomspeed = 3.5;
-
-       zoomdir = button_zoom;
-       if(hud == HUD_NORMAL)
-       if((activeweapon == WEP_VORTEX && vortex_scope) || (activeweapon == WEP_RIFLE && rifle_scope)) // do NOT use switchweapon here
-               zoomdir += button_attack2;
-       if(spectatee_status > 0 || isdemo())
-       {
-               if(spectatorbutton_zoom)
-               {
-                       if(zoomdir)
-                               zoomdir = 0;
-                       else
-                               zoomdir = 1;
-               }
-               // fteqcc failed twice here already, don't optimize this
-       }
-
-       if(zoomdir) { zoomin_effect = 0; }
-
-       if(camera_active)
-       {
-               current_viewzoom = min(1, current_viewzoom + drawframetime);
-       }
-       else if(autocvar_cl_spawnzoom && zoomin_effect)
-       {
-               float spawnzoomfactor = bound(1, autocvar_cl_spawnzoom_factor, 16);
-
-               current_viewzoom += (autocvar_cl_spawnzoom_speed * (spawnzoomfactor - current_viewzoom) * drawframetime);
-               current_viewzoom = bound(1 / spawnzoomfactor, current_viewzoom, 1);
-               if(current_viewzoom == 1) { zoomin_effect = 0; }
-       }
-       else
-       {
-               if(zoomspeed < 0) // instant zoom
-               {
-                       if(zoomdir)
-                               current_viewzoom = 1 / zoomfactor;
-                       else
-                               current_viewzoom = 1;
-               }
-               else
-               {
-                       if(zoomdir)
-                               current_viewzoom = 1 / bound(1, 1 / current_viewzoom + drawframetime * zoomspeed * (zoomfactor - 1), zoomfactor);
-                       else
-                               current_viewzoom = bound(1 / zoomfactor, current_viewzoom + drawframetime * zoomspeed * (1 - 1 / zoomfactor), 1);
-               }
-       }
-
-       if(almost_equals(current_viewzoom, 1))
-               current_zoomfraction = 0;
-       else if(almost_equals(current_viewzoom, 1/zoomfactor))
-               current_zoomfraction = 1;
-       else
-               current_zoomfraction = (current_viewzoom - 1) / (1/zoomfactor - 1);
-
-       if(zoomsensitivity < 1)
-               setsensitivityscale(pow(current_viewzoom, 1 - zoomsensitivity));
-       else
-               setsensitivityscale(1);
-
-       if(autocvar_cl_velocityzoom_enabled && autocvar_cl_velocityzoom_type) // _type = 0 disables velocity zoom too
-       {
-               if(intermission) { curspeed = 0; }
-               else
-               {
-
-                       makevectors(view_angles);
-                       v = pmove_vel;
-                       if(csqcplayer)
-                               v = csqcplayer.velocity;
-
-                       switch(autocvar_cl_velocityzoom_type)
-                       {
-                               case 3: curspeed = max(0, v_forward * v); break;
-                               case 2: curspeed = (v_forward * v); break;
-                               case 1: default: curspeed = vlen(v); break;
-                       }
-               }
-
-               velocityzoom = bound(0, drawframetime / max(0.000000001, autocvar_cl_velocityzoom_time), 1); // speed at which the zoom adapts to player velocity
-               avgspeed = avgspeed * (1 - velocityzoom) + (curspeed / autocvar_cl_velocityzoom_speed) * velocityzoom;
-               velocityzoom = exp(float2range11(avgspeed * -autocvar_cl_velocityzoom_factor / 1) * 1);
-
-               //print(ftos(avgspeed), " avgspeed, ", ftos(curspeed), " curspeed, ", ftos(velocityzoom), " return\n"); // for debugging
-       }
-       else
-               velocityzoom = 1;
-
-       float frustumx, frustumy, fovx, fovy;
-       frustumy = tan(fov * M_PI / 360.0) * 0.75 * current_viewzoom * velocityzoom;
-       frustumx = frustumy * vid_width / vid_height / vid_pixelheight;
-       fovx = atan2(frustumx, 1) / M_PI * 360.0;
-       fovy = atan2(frustumy, 1) / M_PI * 360.0;
-
-       return '1 0 0' * fovx + '0 1 0' * fovy;
-}
-
-vector GetOrthoviewFOV(vector ov_worldmin, vector ov_worldmax, vector ov_mid, vector ov_org)
-{
-       float fovx, fovy;
-       float width = (ov_worldmax_x - ov_worldmin_x);
-       float height = (ov_worldmax_y - ov_worldmin_y);
-       float distance_to_middle_of_world = vlen(ov_mid - ov_org);
-       fovx = atan2(width/2, distance_to_middle_of_world) / M_PI * 360.0;
-       fovy = atan2(height/2, distance_to_middle_of_world) / M_PI * 360.0;
-       return '1 0 0' * fovx + '0 1 0' * fovy;
-}
-
-// this function must match W_SetupShot!
-float zoomscript_caught;
-
-vector wcross_origin;
-float wcross_scale_prev, wcross_alpha_prev;
-vector wcross_color_prev;
-float wcross_scale_goal_prev, wcross_alpha_goal_prev;
-vector wcross_color_goal_prev;
-float wcross_changedonetime;
-
-string wcross_name_goal_prev, wcross_name_goal_prev_prev;
-float wcross_resolution_goal_prev, wcross_resolution_goal_prev_prev;
-float wcross_name_changestarttime, wcross_name_changedonetime;
-float wcross_name_alpha_goal_prev, wcross_name_alpha_goal_prev_prev;
-
-float wcross_ring_prev;
-
-entity trueaim;
-entity trueaim_rifle;
-
-#define SHOTTYPE_HITTEAM 1
-#define SHOTTYPE_HITOBSTRUCTION 2
-#define SHOTTYPE_HITWORLD 3
-#define SHOTTYPE_HITENEMY 4
-
-void TrueAim_Init()
-{
-       trueaim = spawn();
-       trueaim.classname = "trueaim";
-       trueaim.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
-       trueaim_rifle = spawn();
-       trueaim_rifle.classname = "trueaim_rifle";
-       trueaim_rifle.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_CORPSE;
-}
-
-float EnemyHitCheck()
-{
-       float t, n;
-       wcross_origin = project_3d_to_2d(trace_endpos);
-       wcross_origin_z = 0;
-       if(trace_ent)
-               n = trace_ent.entnum;
-       else
-               n = trace_networkentity;
-       if(n < 1)
-               return SHOTTYPE_HITWORLD;
-       if(n > maxclients)
-               return SHOTTYPE_HITWORLD;
-       t = GetPlayerColor(n - 1);
-       if(teamplay)
-               if(t == myteam)
-                       return SHOTTYPE_HITTEAM;
-       if(t == NUM_SPECTATOR)
-               return SHOTTYPE_HITWORLD;
-       return SHOTTYPE_HITENEMY;
-}
-
-float TrueAimCheck()
-{
-       float nudge = 1; // added to traceline target and subtracted from result TOOD(divVerent): do we still need this? Doesn't the engine do this now for us?
-       vector vecs, trueaimpoint, w_shotorg;
-       vector mi, ma, dv;
-       float shottype;
-       entity ta;
-       float mv;
-
-       mi = ma = '0 0 0';
-       ta = trueaim;
-       mv = MOVE_NOMONSTERS;
-
-       switch(activeweapon) // WEAPONTODO
-       {
-               case WEP_TUBA: // no aim
-               case WEP_PORTO: // shoots from eye
-               case WEP_HOOK: // no trueaim
-               case WEP_MORTAR: // toss curve
-                       return SHOTTYPE_HITWORLD;
-               case WEP_VORTEX:
-               case WEP_VAPORIZER:
-                       mv = MOVE_NORMAL;
-                       break;
-               case WEP_RIFLE:
-                       ta = trueaim_rifle;
-                       mv = MOVE_NORMAL;
-                       if(zoomscript_caught)
-                       {
-                               tracebox(view_origin, '0 0 0', '0 0 0', view_origin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
-                               return EnemyHitCheck();
-                       }
-                       break;
-               case WEP_DEVASTATOR: // projectile has a size!
-                       mi = '-3 -3 -3';
-                       ma = '3 3 3';
-                       break;
-               case WEP_FIREBALL: // projectile has a size!
-                       mi = '-16 -16 -16';
-                       ma = '16 16 16';
-                       break;
-               case WEP_SEEKER: // projectile has a size!
-                       mi = '-2 -2 -2';
-                       ma = '2 2 2';
-                       break;
-               case WEP_ELECTRO: // projectile has a size!
-                       mi = '0 0 -3';
-                       ma = '0 0 -3';
-                       break;
-       }
-
-       vector traceorigin = getplayerorigin(player_localentnum-1) + (eZ * getstati(STAT_VIEWHEIGHT));
-
-       vecs = decompressShotOrigin(getstati(STAT_SHOTORG));
-
-       traceline(traceorigin, traceorigin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
-       trueaimpoint = trace_endpos;
-
-       if(vlen(trueaimpoint - traceorigin) < g_trueaim_minrange)
-               trueaimpoint = traceorigin + view_forward * g_trueaim_minrange;
-
-       if(vecs_x > 0)
-               vecs_y = -vecs_y;
-       else
-               vecs = '0 0 0';
-
-       dv = view_right * vecs_y + view_up * vecs_z;
-       w_shotorg = traceorigin + dv;
-
-       // now move the vecs forward as much as requested if possible
-       tracebox(w_shotorg, mi, ma, w_shotorg + view_forward * (vecs_x + nudge), MOVE_NORMAL, ta); // FIXME this MOVE_NORMAL part will misbehave a little in csqc
-       w_shotorg = trace_endpos - view_forward * nudge;
-
-       tracebox(w_shotorg, mi, ma, trueaimpoint, MOVE_NORMAL, ta);
-       shottype = EnemyHitCheck();
-       if(shottype != SHOTTYPE_HITWORLD)
-               return shottype;
-
-#if 0
-       // FIXME WHY DOES THIS NOT WORK FOR THE ROCKET LAUNCHER?
-       // or rather, I know why, but see no fix
-       if(vlen(trace_endpos - trueaimpoint) > vlen(ma) + vlen(mi) + 1)
-               // yes, this is an ugly hack... but it seems good enough to find out whether the test hits the same place as the initial trace
-               return SHOTTYPE_HITOBSTRUCTION;
-#endif
-
-       return SHOTTYPE_HITWORLD;
-}
-
-void CSQC_common_hud(void);
-
-void PostInit(void);
-void CSQC_Demo_Camera();
-float HUD_WouldDrawScoreboard();
-float camera_mode;
-const float CAMERA_FREE = 1;
-const float CAMERA_CHASE = 2;
-float reticle_type;
-string reticle_image;
-string NextFrameCommand;
-void CSQC_SPIDER_HUD();
-void CSQC_RAPTOR_HUD();
-
-vector freeze_org, freeze_ang;
-entity nightvision_noise, nightvision_noise2;
-
-#define MAX_TIME_DIFF 5
-float pickup_crosshair_time, pickup_crosshair_size;
-float hitindication_crosshair_size;
-float use_vortex_chargepool;
-
-float myhealth, myhealth_prev;
-float myhealth_flash;
-
-float old_blurradius, old_bluralpha;
-float old_sharpen_intensity;
-
-vector myhealth_gentlergb;
-
-float contentavgalpha, liquidalpha_prev;
-vector liquidcolor_prev;
-
-float eventchase_current_distance;
-float eventchase_running;
-float WantEventchase()
-{
-       if(autocvar_cl_orthoview)
-               return FALSE;
-       if(intermission)
-               return TRUE;
-       if(spectatee_status >= 0)
-       {
-               if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WepSet_FromWeapon(WEP_PORTO)))
-                       return TRUE;
-               if(autocvar_cl_eventchase_death && (getstati(STAT_HEALTH) <= 0))
-               {
-                       if(autocvar_cl_eventchase_death == 2)
-                       {
-                               // don't stop eventchase once it's started (even if velocity changes afterwards)
-                               if(self.velocity == '0 0 0' || eventchase_running)
-                                       return TRUE;
-                       }
-                       else return TRUE;
-               }
-       }
-       return FALSE;
-}
-
-vector damage_blurpostprocess, content_blurpostprocess;
-
-float checkfail[16];
-
-float unaccounted_damage = 0;
-void UpdateDamage()
-{
-       // accumulate damage with each stat update
-       static float damage_total_prev = 0;
-       float damage_total = getstati(STAT_DAMAGE_DEALT_TOTAL);
-       float unaccounted_damage_new = COMPARE_INCREASING(damage_total, damage_total_prev);
-       damage_total_prev = damage_total;
-
-       static float damage_dealt_time_prev = 0;
-       float damage_dealt_time = getstatf(STAT_HIT_TIME);
-       if (damage_dealt_time != damage_dealt_time_prev)
-       {
-               unaccounted_damage += unaccounted_damage_new;
-               dprint("dmg total: ", ftos(unaccounted_damage), " (+", ftos(unaccounted_damage_new), ")", "\n");
-       }
-       damage_dealt_time_prev = damage_dealt_time;
-
-       // prevent hitsound when switching spectatee
-       static float spectatee_status_prev = 0;
-       if (spectatee_status != spectatee_status_prev)
-               unaccounted_damage = 0;
-       spectatee_status_prev = spectatee_status;
-}
-
-void UpdateHitsound()
-{
-       // varying sound pitch
-
-       static float hitsound_time_prev = 0;
-       // HACK: the only way to get the arc to sound consistent with pitch shift is to ignore cl_hitsound_antispam_time
-       float arc_hack = activeweapon == WEP_ARC && autocvar_cl_hitsound >= 2;
-       if (arc_hack || COMPARE_INCREASING(time, hitsound_time_prev) > autocvar_cl_hitsound_antispam_time)
-       {
-               if (autocvar_cl_hitsound && unaccounted_damage)
-               {
-                       // customizable gradient function that crosses (0,a), (c,1) and asymptotically approaches b
-                       float a = autocvar_cl_hitsound_max_pitch;
-                       float b = autocvar_cl_hitsound_min_pitch;
-                       float c = autocvar_cl_hitsound_nom_damage;
-                       float x = unaccounted_damage;
-                       float pitch_shift = (b*x*(a-1) + a*c*(1-b)) / (x*(a-1) + c*(1-b));
-
-                       // if sound variation is disabled, set pitch_shift to 1
-                       if (autocvar_cl_hitsound == 1)
-                               pitch_shift = 1;
-
-                       // if pitch shift is reversed, mirror in (max-min)/2 + min
-                       if (autocvar_cl_hitsound == 3)
-                       {
-                               float mirror_value = (a-b)/2 + b;
-                               pitch_shift = mirror_value + (mirror_value - pitch_shift);
-                       }
-
-                       dprint("dmg total (dmg): ", ftos(unaccounted_damage), " , pitch shift: ", ftos(pitch_shift), "\n");
-
-                       // todo: avoid very long and very short sounds from wave stretching using different sound files? seems unnecessary
-                       // todo: normalize sound pressure levels? seems unnecessary
-
-                       sound7(world, CH_INFO, "misc/hit.wav", VOL_BASE, ATTN_NONE, pitch_shift * 100, 0);
-               }
-               unaccounted_damage = 0;
-               hitsound_time_prev = time;
-       }
-
-       static float typehit_time_prev = 0;
-       float typehit_time = getstatf(STAT_TYPEHIT_TIME);
-       if (COMPARE_INCREASING(typehit_time, typehit_time_prev) > autocvar_cl_hitsound_antispam_time)
-       {
-               sound(world, CH_INFO, "misc/typehit.wav", VOL_BASE, ATTN_NONE);
-               typehit_time_prev = typehit_time;
-       }
-}
-
-void UpdateCrosshair()
-{
-       static float rainbow_last_flicker;
-    static vector rainbow_prev_color;
-       entity e = self;
-       float f, i, j;
-       vector v;
-       if(getstati(STAT_FROZEN))
-               drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, ((getstatf(STAT_REVIVE_PROGRESS)) ? ('0.25 0.90 1' + ('1 0 0' * getstatf(STAT_REVIVE_PROGRESS)) + ('0 1 1' * getstatf(STAT_REVIVE_PROGRESS) * -1)) : '0.25 0.90 1'), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
-       else if (getstatf(STAT_HEALING_ORB)>time)
-               drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, Nade_Color(NADE_TYPE_HEAL), autocvar_hud_colorflash_alpha*getstatf(STAT_HEALING_ORB_ALPHA), DRAWFLAG_ADDITIVE);
-       if(!intermission)
-       if(getstatf(STAT_NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death
-       {
-               DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_NADE_TIMER), '0.25 0.90 1' + ('1 0 0' * getstatf(STAT_NADE_TIMER)) - ('0 1 1' * getstatf(STAT_NADE_TIMER)), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
-               drawstring_aspect(eY * 0.64 * vid_conheight, ((autocvar_cl_nade_timer == 2) ? _("Nade timer") : ""), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
-       }
-       else if(getstatf(STAT_REVIVE_PROGRESS))
-       {
-               DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
-               drawstring_aspect(eY * 0.64 * vid_conheight, _("Revival progress"), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
-       }
-
-       if(autocvar_r_letterbox == 0)
-               if(autocvar_viewsize < 120)
-                       CSQC_common_hud();
-
-       // crosshair goes VERY LAST
-       if(!scoreboard_active && !camera_active && intermission != 2 && spectatee_status != -1 && hud == HUD_NORMAL)
-       {
-               if (!autocvar_crosshair_enabled) // main toggle for crosshair rendering
-                       return;
-
-               string wcross_style;
-               float wcross_alpha, wcross_resolution;
-               wcross_style = autocvar_crosshair;
-               if (wcross_style == "0")
-                       return;
-               wcross_resolution = autocvar_crosshair_size;
-               if (wcross_resolution == 0)
-                       return;
-               wcross_alpha = autocvar_crosshair_alpha;
-               if (wcross_alpha == 0)
-                       return;
-
-               // TrueAim check
-               float shottype;
-
-               // wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
-               wcross_origin = project_3d_to_2d(view_origin + MAX_SHOT_DISTANCE * view_forward);
-               wcross_origin_z = 0;
-               if(autocvar_crosshair_hittest)
-               {
-                       vector wcross_oldorigin;
-                       wcross_oldorigin = wcross_origin;
-                       shottype = TrueAimCheck();
-                       if(shottype == SHOTTYPE_HITWORLD)
-                       {
-                               v = wcross_origin - wcross_oldorigin;
-                               v_x /= vid_conwidth;
-                               v_y /= vid_conheight;
-                               if(vlen(v) > 0.01)
-                                       shottype = SHOTTYPE_HITOBSTRUCTION;
-                       }
-                       if(!autocvar_crosshair_hittest_showimpact)
-                               wcross_origin = wcross_oldorigin;
-               }
-               else
-                       shottype = SHOTTYPE_HITWORLD;
-
-               vector wcross_color = '0 0 0', wcross_size = '0 0 0';
-               string wcross_name = "";
-               float wcross_scale, wcross_blur;
-
-               if(autocvar_crosshair_per_weapon || (autocvar_crosshair_color_special == 1))
-               {
-                       e = get_weaponinfo(switchingweapon);
-                       if(e)
-                       {
-                               if(autocvar_crosshair_per_weapon)
-                               {
-                                       // WEAPONTODO: access these through some general settings (with non-balance config settings)
-                                       //wcross_resolution *= cvar(strcat("crosshair_", wcross_wep, "_size"));
-                                       //if (wcross_resolution == 0)
-                                               //return;
-
-                                       //wcross_style = cvar_string(strcat("crosshair_", wcross_wep));
-                                       wcross_resolution *= e.w_crosshair_size;
-                                       wcross_name = e.w_crosshair;
-                               }
-                       }
-               }
-
-               if(wcross_name == "")
-                       wcross_name = strcat("gfx/crosshair", wcross_style);
-
-               // MAIN CROSSHAIR COLOR DECISION
-               switch(autocvar_crosshair_color_special)
-               {
-                       case 1: // crosshair_color_per_weapon
-                       {
-                               if(e)
-                               {
-                                       wcross_color = e.wpcolor;
-                                       break;
-                               }
-                               else { goto normalcolor; }
-                       }
-
-                       case 2: // crosshair_color_by_health
-                       {
-                               float x = getstati(STAT_HEALTH);
-
-                               //x = red
-                               //y = green
-                               //z = blue
-
-                               wcross_color_z = 0;
-
-                               if(x > 200)
-                               {
-                                       wcross_color_x = 0;
-                                       wcross_color_y = 1;
-                               }
-                               else if(x > 150)
-                               {
-                                       wcross_color_x = 0.4 - (x-150)*0.02 * 0.4;
-                                       wcross_color_y = 0.9 + (x-150)*0.02 * 0.1;
-                               }
-                               else if(x > 100)
-                               {
-                                       wcross_color_x = 1 - (x-100)*0.02 * 0.6;
-                                       wcross_color_y = 1 - (x-100)*0.02 * 0.1;
-                                       wcross_color_z = 1 - (x-100)*0.02;
-                               }
-                               else if(x > 50)
-                               {
-                                       wcross_color_x = 1;
-                                       wcross_color_y = 1;
-                                       wcross_color_z = 0.2 + (x-50)*0.02 * 0.8;
-                               }
-                               else if(x > 20)
-                               {
-                                       wcross_color_x = 1;
-                                       wcross_color_y = (x-20)*90/27/100;
-                                       wcross_color_z = (x-20)*90/27/100 * 0.2;
-                               }
-                               else
-                               {
-                                       wcross_color_x = 1;
-                                       wcross_color_y = 0;
-                               }
-                               break;
-                       }
-
-                       case 3: // crosshair_color_rainbow
-                       {
-                               if(time >= rainbow_last_flicker)
-                               {
-                                       rainbow_prev_color = randomvec() * autocvar_crosshair_color_special_rainbow_brightness;
-                                       rainbow_last_flicker = time + autocvar_crosshair_color_special_rainbow_delay;
-                               }
-                               wcross_color = rainbow_prev_color;
-                               break;
-                       }
-                       :normalcolor
-                       default: { wcross_color = stov(autocvar_crosshair_color); break; }
-               }
-
-               if(autocvar_crosshair_effect_scalefade)
-               {
-                       wcross_scale = wcross_resolution;
-                       wcross_resolution = 1;
-               }
-               else
-               {
-                       wcross_scale = 1;
-               }
-
-               if(autocvar_crosshair_pickup)
-               {
-                       float stat_pickup_time = getstatf(STAT_LAST_PICKUP);
-
-                       if(pickup_crosshair_time < stat_pickup_time)
-                       {
-                               if(time - stat_pickup_time < MAX_TIME_DIFF) // don't trigger the animation if it's too old
-                                       pickup_crosshair_size = 1;
-
-                               pickup_crosshair_time = stat_pickup_time;
-                       }
-
-                       if(pickup_crosshair_size > 0)
-                               pickup_crosshair_size -= autocvar_crosshair_pickup_speed * frametime;
-                       else
-                               pickup_crosshair_size = 0;
-
-                       wcross_scale += sin(pickup_crosshair_size) * autocvar_crosshair_pickup;
-               }
-
-               // todo: make crosshair hit indication dependent on damage dealt
-               if(autocvar_crosshair_hitindication)
-               {
-                       vector hitindication_color = ((autocvar_crosshair_color_special == 1) ? stov(autocvar_crosshair_hitindication_per_weapon_color) : stov(autocvar_crosshair_hitindication_color));
-
-                       if(unaccounted_damage)
-                       {
-                               hitindication_crosshair_size = 1;
-                       }
-
-                       if(hitindication_crosshair_size > 0)
-                               hitindication_crosshair_size -= autocvar_crosshair_hitindication_speed * frametime;
-                       else
-                               hitindication_crosshair_size = 0;
-
-                       wcross_scale += sin(hitindication_crosshair_size) * autocvar_crosshair_hitindication;
-                       wcross_color_x += sin(hitindication_crosshair_size) * hitindication_color_x;
-                       wcross_color_y += sin(hitindication_crosshair_size) * hitindication_color_y;
-                       wcross_color_z += sin(hitindication_crosshair_size) * hitindication_color_z;
-               }
-
-               if(shottype == SHOTTYPE_HITENEMY)
-                       wcross_scale *= autocvar_crosshair_hittest; // is not queried if hittest is 0
-               if(shottype == SHOTTYPE_HITTEAM)
-                       wcross_scale /= autocvar_crosshair_hittest; // is not queried if hittest is 0
-
-               f = fabs(autocvar_crosshair_effect_time);
-               if(wcross_scale != wcross_scale_goal_prev || wcross_alpha != wcross_alpha_goal_prev || wcross_color != wcross_color_goal_prev)
-               {
-                       wcross_changedonetime = time + f;
-               }
-               if(wcross_name != wcross_name_goal_prev || wcross_resolution != wcross_resolution_goal_prev)
-               {
-                       wcross_name_changestarttime = time;
-                       wcross_name_changedonetime = time + f;
-                       if(wcross_name_goal_prev_prev)
-                               strunzone(wcross_name_goal_prev_prev);
-                       wcross_name_goal_prev_prev = wcross_name_goal_prev;
-                       wcross_name_goal_prev = strzone(wcross_name);
-                       wcross_name_alpha_goal_prev_prev = wcross_name_alpha_goal_prev;
-                       wcross_resolution_goal_prev_prev = wcross_resolution_goal_prev;
-                       wcross_resolution_goal_prev = wcross_resolution;
-               }
-
-               wcross_scale_goal_prev = wcross_scale;
-               wcross_alpha_goal_prev = wcross_alpha;
-               wcross_color_goal_prev = wcross_color;
-
-               if(shottype == SHOTTYPE_HITTEAM || (shottype == SHOTTYPE_HITOBSTRUCTION && autocvar_crosshair_hittest_blur && !autocvar_chase_active))
-               {
-                       wcross_blur = 1;
-                       wcross_alpha *= 0.75;
-               }
-               else
-                       wcross_blur = 0;
-               // *_prev is at time-frametime
-               // * is at wcross_changedonetime+f
-               // what do we have at time?
-               if(time < wcross_changedonetime)
-               {
-                       f = frametime / (wcross_changedonetime - time + frametime);
-                       wcross_scale = f * wcross_scale + (1 - f) * wcross_scale_prev;
-                       wcross_alpha = f * wcross_alpha + (1 - f) * wcross_alpha_prev;
-                       wcross_color = f * wcross_color + (1 - f) * wcross_color_prev;
-               }
-
-               wcross_scale_prev = wcross_scale;
-               wcross_alpha_prev = wcross_alpha;
-               wcross_color_prev = wcross_color;
-
-               wcross_scale *= 1 - autocvar__menu_alpha;
-               wcross_alpha *= 1 - autocvar__menu_alpha;
-               wcross_size = draw_getimagesize(wcross_name) * wcross_scale;
-
-               if(wcross_scale >= 0.001 && wcross_alpha >= 0.001)
-               {
-                       // crosshair rings for weapon stats
-                       if (autocvar_crosshair_ring || autocvar_crosshair_ring_reload)
-                       {
-                               // declarations and stats
-                               float ring_value = 0, ring_scale = 0, ring_alpha = 0, ring_inner_value = 0, ring_inner_alpha = 0;
-                               string ring_image = string_null, ring_inner_image = string_null;
-                               vector ring_rgb = '0 0 0', ring_inner_rgb = '0 0 0';
-
-                               ring_scale = autocvar_crosshair_ring_size;
-
-                               float weapon_clipload, weapon_clipsize;
-                               weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD);
-                               weapon_clipsize = getstati(STAT_WEAPON_CLIPSIZE);
-
-                               float ok_ammo_charge, ok_ammo_chargepool;
-                               ok_ammo_charge = getstatf(STAT_OK_AMMO_CHARGE);
-                               ok_ammo_chargepool = getstatf(STAT_OK_AMMO_CHARGEPOOl);
-
-                               float vortex_charge, vortex_chargepool;
-                               vortex_charge = getstatf(STAT_VORTEX_CHARGE);
-                               vortex_chargepool = getstatf(STAT_VORTEX_CHARGEPOOL);
-
-                               float arc_heat = getstatf(STAT_ARC_HEAT);
-
-                               if(vortex_charge_movingavg == 0) // this should only happen if we have just loaded up the game
-                                       vortex_charge_movingavg = vortex_charge;
-
-
-                               // handle the values
-                               if (autocvar_crosshair_ring && activeweapon == WEP_VORTEX && vortex_charge && autocvar_crosshair_ring_vortex) // ring around crosshair representing velocity-dependent damage for the vortex
-                               {
-                                       if (vortex_chargepool || use_vortex_chargepool) {
-                                               use_vortex_chargepool = 1;
-                                               ring_inner_value = vortex_chargepool;
-                                       } else {
-                                               vortex_charge_movingavg = (1 - autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate) * vortex_charge_movingavg + autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate * vortex_charge;
-                                               ring_inner_value = bound(0, autocvar_crosshair_ring_vortex_currentcharge_scale * (vortex_charge - vortex_charge_movingavg), 1);
-                                       }
-
-                                       ring_inner_alpha = autocvar_crosshair_ring_vortex_inner_alpha;
-                                       ring_inner_rgb = eX * autocvar_crosshair_ring_vortex_inner_color_red + eY * autocvar_crosshair_ring_vortex_inner_color_green + eZ * autocvar_crosshair_ring_vortex_inner_color_blue;
-                                       ring_inner_image = "gfx/crosshair_ring_inner.tga";
-
-                                       // draw the outer ring to show the current charge of the weapon
-                                       ring_value = vortex_charge;
-                                       ring_alpha = autocvar_crosshair_ring_vortex_alpha;
-                                       ring_rgb = wcross_color;
-                                       ring_image = "gfx/crosshair_ring_nexgun.tga";
-                               }
-                               else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER && minelayer_maxmines && autocvar_crosshair_ring_minelayer)
-                               {
-                                       ring_value = bound(0, getstati(STAT_LAYED_MINES) / minelayer_maxmines, 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
-                                       ring_alpha = autocvar_crosshair_ring_minelayer_alpha;
-                                       ring_rgb = wcross_color;
-                                       ring_image = "gfx/crosshair_ring.tga";
-                               }
-                               else if (activeweapon == WEP_HAGAR && getstati(STAT_HAGAR_LOAD) && autocvar_crosshair_ring_hagar)
-                               {
-                                       ring_value = bound(0, getstati(STAT_HAGAR_LOAD) / hagar_maxrockets, 1);
-                                       ring_alpha = autocvar_crosshair_ring_hagar_alpha;
-                                       ring_rgb = wcross_color;
-                                       ring_image = "gfx/crosshair_ring.tga";
-                               }
-                               else if (ok_ammo_charge)
-                               {
-                                       ring_value = ok_ammo_chargepool;
-                                       ring_alpha = autocvar_crosshair_ring_reload_alpha;
-                                       ring_rgb = wcross_color;
-                                       ring_image = "gfx/crosshair_ring.tga";
-                               }
-                               else if(autocvar_crosshair_ring_reload && weapon_clipsize) // forces there to be only an ammo ring
-                               {
-                                       ring_value = bound(0, weapon_clipload / weapon_clipsize, 1);
-                                       ring_scale = autocvar_crosshair_ring_reload_size;
-                                       ring_alpha = autocvar_crosshair_ring_reload_alpha;
-                                       ring_rgb = wcross_color;
-
-                                       // Note: This is to stop Taoki from complaining that the image doesn't match all potential balances.
-                                       // if a new image for another weapon is added, add the code (and its respective file/value) here
-                                       if ((activeweapon == WEP_RIFLE) && (weapon_clipsize == 80))
-                                               ring_image = "gfx/crosshair_ring_rifle.tga";
-                                       else
-                                               ring_image = "gfx/crosshair_ring.tga";
-                               }
-                               else if ( autocvar_crosshair_ring && autocvar_crosshair_ring_arc && arc_heat && activeweapon == WEP_ARC )
-                               {
-                                       ring_value = arc_heat;
-                                       ring_alpha = (1-arc_heat)*autocvar_crosshair_ring_arc_cold_alpha +
-                                               arc_heat*autocvar_crosshair_ring_arc_hot_alpha;
-                                       ring_rgb = (1-arc_heat)*wcross_color + arc_heat*autocvar_crosshair_ring_arc_hot_color;
-                                       ring_image = "gfx/crosshair_ring.tga";
-                               }
-
-                               // if in weapon switch animation, fade ring out/in
-                               if(autocvar_crosshair_effect_time > 0)
-                               {
-                                       f = (time - wcross_name_changestarttime) / autocvar_crosshair_effect_time;
-                                       if (!(f < 1))
-                                       {
-                                               wcross_ring_prev = ((ring_image) ? TRUE : FALSE);
-                                       }
-
-                                       if(wcross_ring_prev)
-                                       {
-                                               if(f < 1)
-                                                       ring_alpha *= fabs(1 - bound(0, f, 1));
-                                       }
-                                       else
-                                       {
-                                               if(f < 1)
-                                                       ring_alpha *= bound(0, f, 1);
-                                       }
-                               }
-
-                               if (autocvar_crosshair_ring_inner && ring_inner_value) // lets draw a ring inside a ring so you can ring while you ring
-                                       DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, ring_inner_image, ring_inner_value, ring_inner_rgb, wcross_alpha * ring_inner_alpha, DRAWFLAG_ADDITIVE);
-
-                               if (ring_value)
-                                       DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, ring_image, ring_value, ring_rgb, wcross_alpha * ring_alpha, DRAWFLAG_ADDITIVE);
-                       }
-
-#define CROSSHAIR_DO_BLUR(M,sz,wcross_name,wcross_alpha) \
-                       do \
-                       { \
-                               if(wcross_blur > 0) \
-                               { \
-                                       for(i = -2; i <= 2; ++i) \
-                                       for(j = -2; j <= 2; ++j) \
-                                       M(i,j,sz,wcross_name,wcross_alpha*0.04); \
-                               } \
-                               else \
-                               { \
-                                       M(0,0,sz,wcross_name,wcross_alpha); \
-                               } \
-                       } \
-                       while(0)
-
-#define CROSSHAIR_DRAW_SINGLE(i,j,sz,wcross_name,wcross_alpha) \
-                       drawpic(wcross_origin - ('0.5 0 0' * (sz * wcross_size_x + i * wcross_blur) + '0 0.5 0' * (sz * wcross_size_y + j * wcross_blur)), wcross_name, sz * wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL)
-
-#define CROSSHAIR_DRAW(sz,wcross_name,wcross_alpha) \
-                       CROSSHAIR_DO_BLUR(CROSSHAIR_DRAW_SINGLE,sz,wcross_name,wcross_alpha)
-
-                       if(time < wcross_name_changedonetime && wcross_name != wcross_name_goal_prev_prev && wcross_name_goal_prev_prev)
-                       {
-                               f = (wcross_name_changedonetime - time) / (wcross_name_changedonetime - wcross_name_changestarttime);
-                               wcross_size = draw_getimagesize(wcross_name_goal_prev_prev) * wcross_scale;
-                               CROSSHAIR_DRAW(wcross_resolution_goal_prev_prev, wcross_name_goal_prev_prev, wcross_alpha * f * wcross_name_alpha_goal_prev_prev);
-                               f = 1 - f;
-                       }
-                       else
-                       {
-                               f = 1;
-                       }
-                       wcross_name_alpha_goal_prev = f;
-
-                       wcross_size = draw_getimagesize(wcross_name) * wcross_scale;
-                       CROSSHAIR_DRAW(wcross_resolution, wcross_name, wcross_alpha * f);
-
-                       if(autocvar_crosshair_dot)
-                       {
-                               vector wcross_color_old;
-                               wcross_color_old = wcross_color;
-
-                               if((autocvar_crosshair_dot_color_custom) && (autocvar_crosshair_dot_color != "0"))
-                                       wcross_color = stov(autocvar_crosshair_dot_color);
-
-                               CROSSHAIR_DRAW(wcross_resolution * autocvar_crosshair_dot_size, "gfx/crosshairdot.tga", f * autocvar_crosshair_dot_alpha);
-                               // FIXME why don't we use wcross_alpha here?cl_notice_run();
-                               wcross_color = wcross_color_old;
-                       }
-               }
-       }
-       else
-       {
-               wcross_scale_prev = 0;
-               wcross_alpha_prev = 0;
-               wcross_scale_goal_prev = 0;
-               wcross_alpha_goal_prev = 0;
-               wcross_changedonetime = 0;
-               if(wcross_name_goal_prev)
-                       strunzone(wcross_name_goal_prev);
-               wcross_name_goal_prev = string_null;
-               if(wcross_name_goal_prev_prev)
-                       strunzone(wcross_name_goal_prev_prev);
-               wcross_name_goal_prev_prev = string_null;
-               wcross_name_changestarttime = 0;
-               wcross_name_changedonetime = 0;
-               wcross_name_alpha_goal_prev = 0;
-               wcross_name_alpha_goal_prev_prev = 0;
-               wcross_resolution_goal_prev = 0;
-               wcross_resolution_goal_prev_prev = 0;
-       }
-}
-
-#define BUTTON_3 4
-#define BUTTON_4 8
-float cl_notice_run();
-float prev_myteam;
-void CSQC_UpdateView(float w, float h)
-{
-       entity e;
-       float fov;
-       float f, i;
-       vector vf_size, vf_min;
-       float a;
-
-       execute_next_frame();
-
-       ++framecount;
-
-       hud = getstati(STAT_HUD);
-
-       if(autocvar__hud_showbinds_reload) // menu can set this one
-       {
-               db_close(binddb);
-               binddb = db_create();
-               cvar_set("_hud_showbinds_reload", "0");
-       }
-
-       if(checkextension("DP_CSQC_MINFPS_QUALITY"))
-               view_quality = getproperty(VF_MINFPS_QUALITY);
-       else
-               view_quality = 1;
-
-       button_attack2 = (input_buttons & BUTTON_3);
-       button_zoom = (input_buttons & BUTTON_4);
-
-#define CHECKFAIL_ASSERT(flag,func,parm,val) { float checkfailv; checkfailv = (func)(parm); if(checkfailv != (val)) { if(!checkfail[(flag)]) localcmd(sprintf("\ncmd checkfail %s %s %d %d\n", #func, parm, val, checkfailv)); checkfail[(flag)] = 1; } } ENDS_WITH_CURLY_BRACE
-       CHECKFAIL_ASSERT(0, cvar_type, "\{100}\{105}\{118}\{48}\{95}\{101}\{118}\{97}\{100}\{101}", 0);
-       CHECKFAIL_ASSERT(1, cvar_type, "\{97}\{97}\{95}\{101}\{110}\{97}\{98}\{108}\{101}", 0);
-       CHECKFAIL_ASSERT(2, cvar, "\{114}\{95}\{115}\{104}\{111}\{119}\{100}\{105}\{115}\{97}\{98}\{108}\{101}\{100}\{101}\{112}\{116}\{104}\{116}\{101}\{115}\{116}", 0);
-       CHECKFAIL_ASSERT(3, cvar, "\{114}\{95}\{115}\{104}\{111}\{119}\{111}\{118}\{101}\{114}\{100}\{114}\{97}\{119}", 0);
-       CHECKFAIL_ASSERT(4, cvar, "\{114}\{95}\{115}\{104}\{111}\{119}\{108}\{105}\{103}\{104}\{116}", 0);
-       CHECKFAIL_ASSERT(5, cvar, "\{114}\{95}\{115}\{104}\{111}\{119}\{115}\{104}\{97}\{100}\{111}\{119}\{118}\{111}\{108}\{117}\{109}\{101}\{115}", 0);
-       CHECKFAIL_ASSERT(6, cvar, "\{114}\{95}\{115}\{104}\{111}\{119}\{111}\{118}\{101}\{114}\{100}\{114}\{97}\{119}", 0);
-
-       vf_size = getpropertyvec(VF_SIZE);
-       vf_min = getpropertyvec(VF_MIN);
-       vid_width = vf_size_x;
-       vid_height = vf_size_y;
-
-       vector reticle_pos = '0 0 0', reticle_size = '0 0 0';
-       vector splash_pos = '0 0 0', splash_size = '0 0 0';
-
-       WaypointSprite_Load();
-
-       CSQCPlayer_SetCamera();
-
-       myteam = GetPlayerColor(player_localentnum - 1);
-
-       if(myteam != prev_myteam)
-       {
-               myteamcolors = colormapPaletteColor(myteam, 1);
-               for(i = 0; i < HUD_PANEL_NUM; ++i)
-                       hud_panel[i].update_time = time;
-               prev_myteam = myteam;
-       }
-
-       ticrate = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
-
-       float is_dead = (getstati(STAT_HEALTH) <= 0);
-
-       // FIXME do we need this hack?
-       if(isdemo())
-       {
-               // in demos, input_buttons do not work
-               button_zoom = (autocvar__togglezoom == "-");
-       }
-       else if(button_zoom
-               && autocvar_cl_unpress_zoom_on_death
-               && (spectatee_status >= 0)
-               && (is_dead || intermission))
-       {
-               // no zoom while dead or in intermission please
-               localcmd("-zoom\n");
-               button_zoom = FALSE;
-       }
-
-       // event chase camera
-       if(autocvar_chase_active <= 0) // greater than 0 means it's enabled manually, and this code is skipped
-       {
-               if(WantEventchase())
-               {
-                       eventchase_running = TRUE;
-
-                       // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
-                       vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
-
-                       // detect maximum viewoffset and use it
-                       if(autocvar_cl_eventchase_viewoffset)
-                       {
-                               WarpZone_TraceLine(current_view_origin, current_view_origin + autocvar_cl_eventchase_viewoffset + ('0 0 1' * autocvar_cl_eventchase_maxs_z), MOVE_WORLDONLY, self);
-                               if(trace_fraction == 1) { current_view_origin += autocvar_cl_eventchase_viewoffset; }
-                               else { current_view_origin_z += max(0, (trace_endpos_z - current_view_origin_z) - autocvar_cl_eventchase_maxs_z); }
-                       }
-
-                       // We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing).
-                       // Ideally, there should be another way to enable third person cameras, such as through setproperty()
-                       // -1 enables chase_active while marking it as set by this code, and not by the user (which would be 1)
-                       if(!autocvar_chase_active) { cvar_set("chase_active", "-1"); }
-
-                       // make the camera smooth back
-                       if(autocvar_cl_eventchase_speed && eventchase_current_distance < autocvar_cl_eventchase_distance)
-                               eventchase_current_distance += autocvar_cl_eventchase_speed * (autocvar_cl_eventchase_distance - eventchase_current_distance) * frametime; // slow down the further we get
-                       else if(eventchase_current_distance != autocvar_cl_eventchase_distance)
-                               eventchase_current_distance = autocvar_cl_eventchase_distance;
-
-                       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);
-
-                       // If the boxtrace fails, revert back to line tracing.
-                       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);
-                               setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_cl_eventchase_mins_z)));
-                       }
-                       else { setproperty(VF_ORIGIN, trace_endpos); }
-
-                       setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles));
-               }
-               else if(autocvar_chase_active < 0) // time to disable chase_active if it was set by this code
-               {
-                       eventchase_running = FALSE;
-                       cvar_set("chase_active", "0");
-                       eventchase_current_distance = 0; // start from 0 next time
-               }
-       }
-       // workaround for camera stuck between player's legs when using chase_active 1
-       // because the engine stops updating the chase_active camera when the game ends
-       else if(intermission)
-       {
-               cvar_settemp("chase_active", "-1");
-               eventchase_current_distance = 0;
-       }
-
-       // do lockview after event chase camera so that it still applies whenever necessary.
-       if(autocvar_cl_lockview || (!autocvar_hud_cursormode && (autocvar__hud_configure && spectatee_status <= 0 || intermission > 1)))
-       {
-               setproperty(VF_ORIGIN, freeze_org);
-               setproperty(VF_ANGLES, freeze_ang);
-       }
-       else
-       {
-               freeze_org = getpropertyvec(VF_ORIGIN);
-               freeze_ang = getpropertyvec(VF_ANGLES);
-       }
-
-       WarpZone_FixView();
-       //WarpZone_FixPMove();
-
-       vector ov_org = '0 0 0';
-       vector ov_mid = '0 0 0';
-       vector ov_worldmin = '0 0 0';
-       vector ov_worldmax = '0 0 0';
-       if(autocvar_cl_orthoview)
-       {
-               ov_worldmin = mi_picmin;
-               ov_worldmax = mi_picmax;
-
-               float ov_width = (ov_worldmax_x - ov_worldmin_x);
-               float ov_height = (ov_worldmax_y - ov_worldmin_y);
-               float ov_distance = (max(vid_width, vid_height) * max(ov_width, ov_height));
-
-               ov_mid = ((ov_worldmax + ov_worldmin) * 0.5);
-               ov_org = vec3(ov_mid_x, ov_mid_y, (ov_mid_z + ov_distance));
-
-               float ov_nearest = vlen(ov_org - vec3(
-                       bound(ov_worldmin_x, ov_org_x, ov_worldmax_x),
-                       bound(ov_worldmin_y, ov_org_y, ov_worldmax_y),
-                       bound(ov_worldmin_z, ov_org_z, ov_worldmax_z)
-               ));
-
-               float ov_furthest = 0;
-               float dist = 0;
-
-               if((dist = vlen(vec3(ov_worldmin_x, ov_worldmin_y, ov_worldmin_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
-               if((dist = vlen(vec3(ov_worldmax_x, ov_worldmin_y, ov_worldmin_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
-               if((dist = vlen(vec3(ov_worldmin_x, ov_worldmax_y, ov_worldmin_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
-               if((dist = vlen(vec3(ov_worldmin_x, ov_worldmin_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
-               if((dist = vlen(vec3(ov_worldmax_x, ov_worldmax_y, ov_worldmin_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
-               if((dist = vlen(vec3(ov_worldmin_x, ov_worldmax_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
-               if((dist = vlen(vec3(ov_worldmax_x, ov_worldmin_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
-               if((dist = vlen(vec3(ov_worldmax_x, ov_worldmax_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
-
-               cvar_settemp("r_nearclip", ftos(ov_nearest));
-               cvar_settemp("r_farclip_base", ftos(ov_furthest));
-               cvar_settemp("r_farclip_world", "0");
-               cvar_settemp("r_novis", "1");
-               cvar_settemp("r_useportalculling", "0");
-               cvar_settemp("r_useinfinitefarclip", "0");
-
-               setproperty(VF_ORIGIN, ov_org);
-               setproperty(VF_ANGLES, '90 0 0');
-
-               #if 0
-               printf("OrthoView: org = %s, angles = %s, distance = %f, nearest = %f, furthest = %f\n",
-                       vtos(ov_org),
-                       vtos(getpropertyvec(VF_ANGLES)),
-                       ov_distance,
-                       ov_nearest,
-                       ov_furthest);
-               #endif
-       }
-
-       // Render the Scene
-       view_origin = getpropertyvec(VF_ORIGIN);
-       view_angles = getpropertyvec(VF_ANGLES);
-       makevectors(view_angles);
-       view_forward = v_forward;
-       view_right = v_right;
-       view_up = v_up;
-
-#ifdef BLURTEST
-       if(time > blurtest_time0 && time < blurtest_time1)
-       {
-               float r, t;
-
-               t = (time - blurtest_time0) / (blurtest_time1 - blurtest_time0);
-               r = t * blurtest_radius;
-               f = 1 / pow(t, blurtest_power) - 1;
-
-               cvar_set("r_glsl_postprocess", "1");
-               cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(r), " ", ftos(f), " 0 0"));
-       }
-       else
-       {
-               cvar_set("r_glsl_postprocess", "0");
-               cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");
-       }
-#endif
-
-       TargetMusic_Advance();
-       Fog_Force();
-
-       if(drawtime == 0)
-               drawframetime = 0.01666667; // when we don't know fps yet, we assume 60fps
-       else
-               drawframetime = bound(0.000001, time - drawtime, 1);
-       drawtime = time;
-
-       // watch for gametype changes here...
-       // in ParseStuffCMD the cmd isn't executed yet :/
-       // might even be better to add the gametype to TE_CSQC_INIT...?
-       if(!postinit)
-               PostInit();
-
-       if(intermission && !isdemo() && !(calledhooks & HOOK_END))
-       {
-               if(calledhooks & HOOK_START)
-               {
-                       localcmd("\ncl_hook_gameend\n");
-                       calledhooks |= HOOK_END;
-               }
-       }
-
-       Announcer();
-
-       fov = autocvar_fov;
-       if(fov <= 59.5)
-       {
-               if(!zoomscript_caught)
-               {
-                       localcmd("+button9\n");
-                       zoomscript_caught = 1;
-               }
-       }
-       else
-       {
-               if(zoomscript_caught)
-               {
-                       localcmd("-button9\n");
-                       zoomscript_caught = 0;
-               }
-       }
-
-       ColorTranslateMode = autocvar_cl_stripcolorcodes;
-
-       // next WANTED weapon (for HUD)
-       switchweapon = getstati(STAT_SWITCHWEAPON);
-
-       // currently switching-to weapon (for crosshair)
-       switchingweapon = getstati(STAT_SWITCHINGWEAPON);
-
-       // actually active weapon (for zoom)
-       activeweapon = getstati(STAT_ACTIVEWEAPON);
-
-       f = (serverflags & SERVERFLAG_TEAMPLAY);
-       if(f != teamplay)
-       {
-               teamplay = f;
-               HUD_InitScores();
-       }
-
-       if(last_switchweapon != switchweapon)
-       {
-               weapontime = time;
-               last_switchweapon = switchweapon;
-               if(button_zoom && autocvar_cl_unpress_zoom_on_weapon_switch)
-               {
-                       localcmd("-zoom\n");
-                       button_zoom = FALSE;
-               }
-               if(autocvar_cl_unpress_attack_on_weapon_switch)
-               {
-                       localcmd("-fire\n");
-                       localcmd("-fire2\n");
-                       button_attack2 = FALSE;
-               }
-       }
-       if(last_activeweapon != activeweapon)
-       {
-               last_activeweapon = activeweapon;
-
-               e = get_weaponinfo(activeweapon);
-               if(e.netname != "")
-                       localcmd(strcat("\ncl_hook_activeweapon ", e.netname), "\n");
-               else
-                       localcmd("\ncl_hook_activeweapon none\n");
-       }
-
-       // ALWAYS Clear Current Scene First
-       clearscene();
-
-       setproperty(VF_ORIGIN, view_origin);
-       setproperty(VF_ANGLES, view_angles);
-
-       // FIXME engine bug? VF_SIZE and VF_MIN are not restored to sensible values by this
-       setproperty(VF_SIZE, vf_size);
-       setproperty(VF_MIN, vf_min);
-
-       // Assign Standard Viewflags
-       // Draw the World (and sky)
-       setproperty(VF_DRAWWORLD, 1);
-
-       // Set the console size vars
-       vid_conwidth = autocvar_vid_conwidth;
-       vid_conheight = autocvar_vid_conheight;
-       vid_pixelheight = autocvar_vid_pixelheight;
-
-       if(autocvar_cl_orthoview) { setproperty(VF_FOV, GetOrthoviewFOV(ov_worldmin, ov_worldmax, ov_mid, ov_org)); }
-       else { setproperty(VF_FOV, GetCurrentFov(fov)); }
-
-       // Camera for demo playback
-       if(camera_active)
-       {
-               if(autocvar_camera_enable)
-                       CSQC_Demo_Camera();
-               else
-               {
-                       cvar_set("chase_active", ftos(chase_active_backup));
-                       cvar_set("cl_demo_mousegrab", "0");
-                       camera_active = FALSE;
-               }
-       }
-#ifdef CAMERATEST
-       else if(autocvar_camera_enable)
-#else
-       else if(autocvar_camera_enable && isdemo())
-#endif
-       {
-               // Enable required Darkplaces cvars
-               chase_active_backup = autocvar_chase_active;
-               cvar_set("chase_active", "2");
-               cvar_set("cl_demo_mousegrab", "1");
-               camera_active = TRUE;
-               camera_mode = FALSE;
-       }
-
-       // Draw the Crosshair
-       setproperty(VF_DRAWCROSSHAIR, 0); //Make sure engine crosshairs are always hidden
-
-       // Draw the Engine Status Bar (the default Quake HUD)
-       setproperty(VF_DRAWENGINESBAR, 0);
-
-       // Update the mouse position
-       /*
-          mousepos_x = vid_conwidth;
-          mousepos_y = vid_conheight;
-          mousepos = mousepos*0.5 + getmousepos();
-        */
-
-       e = self;
-       for(self = world; (self = nextent(self)); )
-               if(self.draw)
-                       self.draw();
-       self = e;
-
-       addentities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS);
-       renderscene();
-
-       // now switch to 2D drawing mode by calling a 2D drawing function
-       // then polygon drawing will draw as 2D stuff, and NOT get queued until the
-       // next R_RenderScene call
-       drawstring('0 0 0', "", '1 1 0', '1 1 1', 0, 0);
-
-       if(autocvar_r_fakelight >= 2 || autocvar_r_fullbright)
-       if (!(serverflags & SERVERFLAG_ALLOW_FULLBRIGHT))
-       {
-               // apply night vision effect
-               vector tc_00, tc_01, tc_10, tc_11;
-               vector rgb = '0 0 0';
-
-               if(!nightvision_noise)
-               {
-                       nightvision_noise = spawn();
-                       nightvision_noise.classname = "nightvision_noise";
-               }
-               if(!nightvision_noise2)
-               {
-                       nightvision_noise2 = spawn();
-                       nightvision_noise2.classname = "nightvision_noise2";
-               }
-
-               // color tint in yellow
-               drawfill('0 0 0', autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', '0.5 1 0.3', 1, DRAWFLAG_MODULATE);
-
-               // draw BG
-               a = Noise_Pink(nightvision_noise, frametime * 1.5) * 0.05 + 0.15;
-               rgb = '1 1 1';
-               tc_00 = '0 0 0' + '0.2 0 0' * sin(time * 0.3) + '0 0.3 0' * cos(time * 0.7);
-               tc_01 = '0 2.25 0' + '0.6 0 0' * cos(time * 1.2) - '0 0.3 0' * sin(time * 2.2);
-               tc_10 = '1.5 0 0' - '0.2 0 0' * sin(time * 0.5) + '0 0.5 0' * cos(time * 1.7);
-               //tc_11 = '1 1 0' + '0.6 0 0' * sin(time * 0.6) + '0 0.3 0' * cos(time * 0.1);
-               tc_11 = tc_01 + tc_10 - tc_00;
-               R_BeginPolygon("gfx/nightvision-bg.tga", DRAWFLAG_ADDITIVE);
-               R_PolygonVertex('0 0 0', tc_00, rgb, a);
-               R_PolygonVertex(autocvar_vid_conwidth * '1 0 0', tc_10, rgb, a);
-               R_PolygonVertex(autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', tc_11, rgb, a);
-               R_PolygonVertex(autocvar_vid_conheight * '0 1 0', tc_01, rgb, a);
-               R_EndPolygon();
-
-               // draw FG
-               a = Noise_Pink(nightvision_noise2, frametime * 0.1) * 0.05 + 0.12;
-               rgb = '0.3 0.6 0.4' + '0.1 0.4 0.2' * Noise_White(nightvision_noise2, frametime);
-               tc_00 = '0 0 0' + '1 0 0' * Noise_White(nightvision_noise2, frametime) + '0 1 0' * Noise_White(nightvision_noise2, frametime);
-               tc_01 = tc_00 + '0 3 0' * (1 + Noise_White(nightvision_noise2, frametime) * 0.2);
-               tc_10 = tc_00 + '2 0 0' * (1 + Noise_White(nightvision_noise2, frametime) * 0.3);
-               tc_11 = tc_01 + tc_10 - tc_00;
-               R_BeginPolygon("gfx/nightvision-fg.tga", DRAWFLAG_ADDITIVE);
-               R_PolygonVertex('0 0 0', tc_00, rgb, a);
-               R_PolygonVertex(autocvar_vid_conwidth * '1 0 0', tc_10, rgb, a);
-               R_PolygonVertex(autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', tc_11, rgb, a);
-               R_PolygonVertex(autocvar_vid_conheight * '0 1 0', tc_01, rgb, a);
-               R_EndPolygon();
-       }
-
-       if(autocvar_cl_reticle)
-       {
-               // Draw the aiming reticle for weapons that use it
-               // reticle_type is changed to the item we are zooming / aiming with, to decide which reticle to use
-               // It must be a persisted float for fading out to work properly (you let go of the zoom button for
-               // the view to go back to normal, so reticle_type would become 0 as we fade out)
-               if(spectatee_status || is_dead || hud != HUD_NORMAL)
-               {
-                       // no zoom reticle while dead
-                       reticle_type = 0;
-               }
-               else if(WEP_ACTION(activeweapon, WR_ZOOMRETICLE) && autocvar_cl_reticle_weapon)
-               {
-                       if(reticle_image != "") { reticle_type = 2; }
-                       else { reticle_type = 0; }
-               }
-               else if(button_zoom || zoomscript_caught)
-               {
-                       // normal zoom
-                       reticle_type = 1;
-               }
-
-               if(reticle_type)
-               {
-                       if(autocvar_cl_reticle_stretch)
-                       {
-                               reticle_size_x = vid_conwidth;
-                               reticle_size_y = vid_conheight;
-                               reticle_pos_x = 0;
-                               reticle_pos_y = 0;
-                       }
-                       else
-                       {
-                               reticle_size_x = max(vid_conwidth, vid_conheight);
-                               reticle_size_y = max(vid_conwidth, vid_conheight);
-                               reticle_pos_x = (vid_conwidth - reticle_size_x) / 2;
-                               reticle_pos_y = (vid_conheight - reticle_size_y) / 2;
-                       }
-
-                       if(zoomscript_caught)
-                               f = 1;
-                       else 
-                               f = current_zoomfraction;
-
-                       if(f)
-                       {
-                               switch(reticle_type)
-                               {
-                                       case 1: drawpic(reticle_pos, "gfx/reticle_normal", reticle_size, '1 1 1', f * autocvar_cl_reticle_normal_alpha, DRAWFLAG_NORMAL); break;
-                                       case 2: drawpic(reticle_pos, reticle_image, reticle_size, '1 1 1', f * autocvar_cl_reticle_weapon_alpha, DRAWFLAG_NORMAL); break;
-                               }
-                       }
-               }
-       }
-       else
-       {
-               if(reticle_type != 0) { reticle_type = 0; }
-       }
-
-
-       // improved polyblend
-       if(autocvar_hud_contents)
-       {
-               float contentalpha_temp, incontent, liquidalpha, contentfadetime;
-               vector liquidcolor;
-
-               switch(pointcontents(view_origin))
-               {
-                       case CONTENT_WATER:
-                               liquidalpha = autocvar_hud_contents_water_alpha;
-                               liquidcolor = stov(autocvar_hud_contents_water_color);
-                               incontent = 1;
-                               break;
-
-                       case CONTENT_LAVA:
-                               liquidalpha = autocvar_hud_contents_lava_alpha;
-                               liquidcolor = stov(autocvar_hud_contents_lava_color);
-                               incontent = 1;
-                               break;
-
-                       case CONTENT_SLIME:
-                               liquidalpha = autocvar_hud_contents_slime_alpha;
-                               liquidcolor = stov(autocvar_hud_contents_slime_color);
-                               incontent = 1;
-                               break;
-
-                       default:
-                               liquidalpha = 0;
-                               liquidcolor = '0 0 0';
-                               incontent = 0;
-                               break;
-               }
-
-               if(incontent) // fade in/out at different speeds so you can do e.g. instant fade when entering water and slow when leaving it.
-               { // also lets delcare previous values for blending properties, this way it isn't reset until after you have entered a different content
-                       contentfadetime = autocvar_hud_contents_fadeintime;
-                       liquidalpha_prev = liquidalpha;
-                       liquidcolor_prev = liquidcolor;
-               }
-               else
-                       contentfadetime = autocvar_hud_contents_fadeouttime;
-
-               contentalpha_temp = bound(0, drawframetime / max(0.0001, contentfadetime), 1);
-               contentavgalpha = contentavgalpha * (1 - contentalpha_temp) + incontent * contentalpha_temp;
-
-               if(contentavgalpha)
-                       drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, liquidcolor_prev, contentavgalpha * liquidalpha_prev, DRAWFLAG_NORMAL);
-
-               if(autocvar_hud_postprocessing)
-               {
-                       if(autocvar_hud_contents_blur && contentavgalpha)
-                       {
-                               content_blurpostprocess_x = 1;
-                               content_blurpostprocess_y = contentavgalpha * autocvar_hud_contents_blur;
-                               content_blurpostprocess_z = contentavgalpha * autocvar_hud_contents_blur_alpha;
-                       }
-                       else
-                       {
-                               content_blurpostprocess_x = 0;
-                               content_blurpostprocess_y = 0;
-                               content_blurpostprocess_z = 0;
-                       }
-               }
-       }
-
-       if(autocvar_hud_damage && !getstati(STAT_FROZEN))
-       {
-               splash_size_x = max(vid_conwidth, vid_conheight);
-               splash_size_y = max(vid_conwidth, vid_conheight);
-               splash_pos_x = (vid_conwidth - splash_size_x) / 2;
-               splash_pos_y = (vid_conheight - splash_size_y) / 2;
-
-               float myhealth_flash_temp;
-               myhealth = getstati(STAT_HEALTH);
-
-               // fade out
-               myhealth_flash = max(0, myhealth_flash - autocvar_hud_damage_fade_rate * frametime);
-               // add new damage
-               myhealth_flash = bound(0, myhealth_flash + dmg_take * autocvar_hud_damage_factor, autocvar_hud_damage_maxalpha);
-
-               float pain_threshold, pain_threshold_lower, pain_threshold_lower_health;
-               pain_threshold = autocvar_hud_damage_pain_threshold;
-               pain_threshold_lower = autocvar_hud_damage_pain_threshold_lower;
-               pain_threshold_lower_health = autocvar_hud_damage_pain_threshold_lower_health;
-
-               if(pain_threshold_lower && myhealth < pain_threshold_lower_health)
-               {
-                       pain_threshold = pain_threshold - max(autocvar_hud_damage_pain_threshold_pulsating_min, fabs(sin(M_PI * time / autocvar_hud_damage_pain_threshold_pulsating_period))) * pain_threshold_lower * (1 - max(0, myhealth)/pain_threshold_lower_health);
-               }
-
-               myhealth_flash_temp = bound(0, myhealth_flash - pain_threshold, 1);
-
-               if(myhealth_prev < 1)
-               {
-                       if(myhealth >= 1)
-                       {
-                               myhealth_flash = 0; // just spawned, clear the flash immediately
-                               myhealth_flash_temp = 0;
-                       }
-                       else
-                       {
-                               myhealth_flash += autocvar_hud_damage_fade_rate * frametime; // dead
-                       }
-               }
-
-               if(spectatee_status == -1 || intermission)
-               {
-                       myhealth_flash = 0; // observing, or match ended
-                       myhealth_flash_temp = 0;
-               }
-
-               myhealth_prev = myhealth;
-
-               // IDEA: change damage color/picture based on player model for robot/alien species?
-               // pro: matches model better
-               // contra: it's not red because blood is red, but because red is an alarming color, so red should stay
-               // maybe different reddish pics?
-               if(autocvar_cl_gentle_damage || autocvar_cl_gentle)
-               {
-                       if(autocvar_cl_gentle_damage == 2)
-                       {
-                               if(myhealth_flash < pain_threshold) // only randomize when the flash is gone
-                               {
-                                       myhealth_gentlergb = eX * random() + eY * random() + eZ * random();
-                               }
-                       }
-                       else
-                               myhealth_gentlergb = stov(autocvar_hud_damage_gentle_color);
-
-                       drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, myhealth_gentlergb, autocvar_hud_damage_gentle_alpha_multiplier * bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
-               }
-               else
-                       drawpic(splash_pos, "gfx/blood", splash_size, stov(autocvar_hud_damage_color), bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
-
-               if(autocvar_hud_postprocessing) // we still need to set this anyway even when chase_active is set, this way it doesn't get stuck on.
-               {
-                       if(autocvar_hud_damage_blur && myhealth_flash_temp)
-                       {
-                               damage_blurpostprocess_x = 1;
-                               damage_blurpostprocess_y = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur;
-                               damage_blurpostprocess_z = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur_alpha;
-                       }
-                       else
-                       {
-                               damage_blurpostprocess_x = 0;
-                               damage_blurpostprocess_y = 0;
-                               damage_blurpostprocess_z = 0;
-                       }
-               }
-       }
-
-       float e1 = (autocvar_hud_postprocessing_maxbluralpha != 0);
-       float e2 = (autocvar_hud_powerup != 0);
-       if(autocvar_hud_postprocessing && (e1 || e2)) // TODO: Remove this code and re-do the postprocess handling in the engine, where it properly belongs.
-       {
-               // enable or disable rendering types if they are used or not
-               if(cvar("r_glsl_postprocess_uservec1_enable") != e1) { cvar_set("r_glsl_postprocess_uservec1_enable", ftos(e1)); }
-               if(cvar("r_glsl_postprocess_uservec2_enable") != e2) { cvar_set("r_glsl_postprocess_uservec2_enable", ftos(e2)); }
-
-               // blur postprocess handling done first (used by hud_damage and hud_contents)
-               if((damage_blurpostprocess_x || content_blurpostprocess_x))
-               {
-                       float blurradius = bound(0, damage_blurpostprocess_y + content_blurpostprocess_y, autocvar_hud_postprocessing_maxblurradius);
-                       float bluralpha = bound(0, damage_blurpostprocess_z + content_blurpostprocess_z, autocvar_hud_postprocessing_maxbluralpha);
-                       if(blurradius != old_blurradius || bluralpha != old_bluralpha) // reduce cvar_set spam as much as possible
-                       {
-                               cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(blurradius), " ", ftos(bluralpha), " 0 0"));
-                               old_blurradius = blurradius;
-                               old_bluralpha = bluralpha;
-                       }
-               }
-               else if(cvar_string("r_glsl_postprocess_uservec1") != "0 0 0 0") // reduce cvar_set spam as much as possible
-               {
-                       cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");
-                       old_blurradius = 0;
-                       old_bluralpha = 0;
-               }
-
-               // edge detection postprocess handling done second (used by hud_powerup)
-               float sharpen_intensity = 0, strength_finished = getstatf(STAT_STRENGTH_FINISHED), invincible_finished = getstatf(STAT_INVINCIBLE_FINISHED);
-               if (strength_finished - time > 0) { sharpen_intensity += (strength_finished - time); }
-               if (invincible_finished - time > 0) { sharpen_intensity += (invincible_finished - time); }
-
-               sharpen_intensity = bound(0, ((getstati(STAT_HEALTH) > 0) ? sharpen_intensity : 0), 5); // Check to see if player is alive (if not, set 0) - also bound to fade out starting at 5 seconds.
-
-               if(autocvar_hud_powerup && sharpen_intensity > 0)
-               {
-                       if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible
-                       {
-                               cvar_set("r_glsl_postprocess_uservec2", strcat(ftos((sharpen_intensity / 5) * autocvar_hud_powerup), " ", ftos(-sharpen_intensity * autocvar_hud_powerup), " 0 0"));
-                               old_sharpen_intensity = sharpen_intensity;
-                       }
-               }
-               else if(cvar_string("r_glsl_postprocess_uservec2") != "0 0 0 0") // reduce cvar_set spam as much as possible
-               {
-                       cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");
-                       old_sharpen_intensity = 0;
-               }
-
-               if(cvar("r_glsl_postprocess") == 0)
-                       cvar_set("r_glsl_postprocess", "2");
-       }
-       else if(cvar("r_glsl_postprocess") == 2)
-               cvar_set("r_glsl_postprocess", "0");
-
-       if(menu_visible)
-               menu_show();
-
-       /*if(gametype == MAPINFO_TYPE_CTF)
-         {
-         ctf_view();
-         } else */
-
-       // draw 2D entities
-       e = self;
-       for(self = world; (self = nextent(self)); )
-               if(self.draw2d)
-                       self.draw2d();
-       self = e;
-       Draw_ShowNames_All();
-
-       scoreboard_active = HUD_WouldDrawScoreboard();
-
-       UpdateDamage();
-       UpdateCrosshair();
-       UpdateHitsound();
-
-       if(NextFrameCommand)
-       {
-               localcmd("\n", NextFrameCommand, "\n");
-               NextFrameCommand = string_null;
-       }
-
-       // we must do this check AFTER a frame was rendered, or it won't work
-       if(cs_project_is_b0rked == 0)
-       {
-               string w0, h0;
-               w0 = ftos(autocvar_vid_conwidth);
-               h0 = ftos(autocvar_vid_conheight);
-               //setproperty(VF_VIEWPORT, '0 0 0', '640 480 0');
-               //setproperty(VF_FOV, '90 90 0');
-               setproperty(VF_ORIGIN, '0 0 0');
-               setproperty(VF_ANGLES, '0 0 0');
-               setproperty(VF_PERSPECTIVE, 1);
-               makevectors('0 0 0');
-               vector v1, v2;
-               cvar_set("vid_conwidth", "800");
-               cvar_set("vid_conheight", "600");
-               v1 = cs_project(v_forward);
-               cvar_set("vid_conwidth", "640");
-               cvar_set("vid_conheight", "480");
-               v2 = cs_project(v_forward);
-               if(v1 == v2)
-                       cs_project_is_b0rked = 1;
-               else
-                       cs_project_is_b0rked = -1;
-               cvar_set("vid_conwidth", w0);
-               cvar_set("vid_conheight", h0);
-       }
-
-       if(autocvar__hud_configure)
-               HUD_Panel_Mouse();
-
-    if(hud && !intermission)
-    {
-        if(hud == HUD_SPIDERBOT)
-            CSQC_SPIDER_HUD();
-        else if(hud == HUD_WAKIZASHI)
-            CSQC_WAKIZASHI_HUD();
-        else if(hud == HUD_RAPTOR)
-            CSQC_RAPTOR_HUD();
-        else if(hud == HUD_BUMBLEBEE)
-            CSQC_BUMBLE_HUD();
-        else if(hud == HUD_BUMBLEBEE_GUN)
-            CSQC_BUMBLE_GUN_HUD();
-    }
-
-       cl_notice_run();
-
-       // let's reset the view back to normal for the end
-       setproperty(VF_MIN, '0 0 0');
-       setproperty(VF_SIZE, '1 0 0' * w + '0 1 0' * h);
-}
-
-
-void CSQC_common_hud(void)
-{
-       if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS))
-               Accuracy_LoadLevels();
-
-       HUD_Main(); // always run these functions for alpha checks
-       HUD_DrawScoreboard();
-
-       if (scoreboard_active) // scoreboard/accuracy
-               HUD_Reset();
-       else if (intermission == 2) // map voting screen
-       {
-               MapVote_Draw();
-               HUD_Reset();
-       }
-}
-
-
-// following vectors must be global to allow seamless switching between camera modes
-vector camera_offset, current_camera_offset, mouse_angles, current_angles, current_origin, current_position;
-void CSQC_Demo_Camera()
-{
-       float speed, attenuation, dimensions;
-       vector tmp, delta;
-
-       if( autocvar_camera_reset || !camera_mode )
-       {
-               camera_offset = '0 0 0';
-               current_angles = '0 0 0';
-               camera_direction = '0 0 0';
-               camera_offset_z += 30;
-               camera_offset_x += 30 * -cos(current_angles_y * DEG2RAD);
-               camera_offset_y += 30 * -sin(current_angles_y * DEG2RAD);
-               current_origin = view_origin;
-               current_camera_offset  = camera_offset;
-               cvar_set("camera_reset", "0");
-               camera_mode = CAMERA_CHASE;
-       }
-
-       // Camera angles
-       if( camera_roll )
-               mouse_angles_z += camera_roll * autocvar_camera_speed_roll;
-
-       if(autocvar_camera_look_player)
-       {
-               vector dir;
-               float n;
-
-               dir = normalize(view_origin - current_position);
-               n = mouse_angles_z;
-               mouse_angles = vectoangles(dir);
-               mouse_angles_x = mouse_angles_x * -1;
-               mouse_angles_z = n;
-       }
-       else
-       {
-               tmp = getmousepos() * 0.1;
-               if(vlen(tmp)>autocvar_camera_mouse_threshold)
-               {
-                       mouse_angles_x += tmp_y * cos(mouse_angles_z * DEG2RAD) + (tmp_x * sin(mouse_angles_z * DEG2RAD));
-                       mouse_angles_y -= tmp_x * cos(mouse_angles_z * DEG2RAD) + (tmp_y * -sin(mouse_angles_z * DEG2RAD));
-               }
-       }
-
-       while (mouse_angles_x < -180) mouse_angles_x = mouse_angles_x + 360;
-       while (mouse_angles_x > 180) mouse_angles_x = mouse_angles_x - 360;
-       while (mouse_angles_y < -180) mouse_angles_y = mouse_angles_y + 360;
-       while (mouse_angles_y > 180) mouse_angles_y = mouse_angles_y - 360;
-
-       // Fix difference when angles don't have the same sign
-       delta = '0 0 0';
-       if(mouse_angles_y < -60 && current_angles_y > 60)
-               delta = '0 360 0';
-       if(mouse_angles_y > 60 && current_angles_y < -60)
-               delta = '0 -360 0';
-
-       if(autocvar_camera_look_player)
-               attenuation = autocvar_camera_look_attenuation;
-       else
-               attenuation = autocvar_camera_speed_attenuation;
-
-       attenuation = 1 / max(1, attenuation);
-       current_angles += (mouse_angles - current_angles + delta) * attenuation;
-
-       while (current_angles_x < -180) current_angles_x = current_angles_x + 360;
-       while (current_angles_x > 180) current_angles_x = current_angles_x - 360;
-       while (current_angles_y < -180) current_angles_y = current_angles_y + 360;
-       while (current_angles_y > 180) current_angles_y = current_angles_y - 360;
-
-       // Camera position
-       tmp = '0 0 0';
-       dimensions = 0;
-
-       if( camera_direction_x )
-       {
-               tmp_x = camera_direction_x * cos(current_angles_y * DEG2RAD);
-               tmp_y = camera_direction_x * sin(current_angles_y * DEG2RAD);
-               if( autocvar_camera_forward_follows && !autocvar_camera_look_player )
-                       tmp_z = camera_direction_x * -sin(current_angles_x * DEG2RAD);
-               ++dimensions;
-       }
-
-       if( camera_direction_y )
-       {
-               tmp_x += camera_direction_y * -sin(current_angles_y * DEG2RAD);
-               tmp_y += camera_direction_y * cos(current_angles_y * DEG2RAD) * cos(current_angles_z * DEG2RAD);
-               tmp_z += camera_direction_y * sin(current_angles_z * DEG2RAD);
-               ++dimensions;
-       }
-
-       if( camera_direction_z )
-       {
-               tmp_z += camera_direction_z * cos(current_angles_z * DEG2RAD);
-               ++dimensions;
-       }
-
-       if(autocvar_camera_free)
-               speed = autocvar_camera_speed_free;
-       else
-               speed = autocvar_camera_speed_chase;
-
-       if(dimensions)
-       {
-               speed = speed * sqrt(1 / dimensions);
-               camera_offset += tmp * speed;
-       }
-
-       current_camera_offset += (camera_offset - current_camera_offset) * attenuation;
-
-       // Camera modes
-       if( autocvar_camera_free )
-       {
-               if ( camera_mode == CAMERA_CHASE )
-               {
-                       current_camera_offset = current_origin + current_camera_offset;
-                       camera_offset = current_origin + camera_offset;
-               }
-
-               camera_mode = CAMERA_FREE;
-               current_position = current_camera_offset;
-       }
-       else
-       {
-               if ( camera_mode == CAMERA_FREE )
-               {
-                       current_origin = view_origin;
-                       camera_offset = camera_offset - current_origin;
-                       current_camera_offset = current_camera_offset - current_origin;
-               }
-
-               camera_mode = CAMERA_CHASE;
-
-               if(autocvar_camera_chase_smoothly)
-                       current_origin += (view_origin - current_origin) * attenuation;
-               else
-                       current_origin = view_origin;
-
-               current_position = current_origin + current_camera_offset;
-       }
-
-       setproperty(VF_ANGLES, current_angles);
-       setproperty(VF_ORIGIN, current_position);
-}
index 35077496911a9ea8f8f56664068d3cd06437e3f0..116dba7d3cc5898bf6acc70f13772e810babdd6c 100644 (file)
@@ -1,5 +1,16 @@
-float announcer_1min;
-float announcer_5min;
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+    #include "../common/stats.qh"
+    #include "../common/util.qh"
+    #include "autocvars.qh"
+    #include "../common/notifications.qh"
+    #include "main.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
+bool announcer_1min;
+bool announcer_5min;
 void Announcer_Countdown()
 {
        float starttime = getstatf(STAT_GAMESTARTTIME);
@@ -13,7 +24,7 @@ void Announcer_Countdown()
        if(roundstarttime >= starttime)
                starttime = roundstarttime;
        if(starttime <= time && roundstarttime != starttime) // game start time has passed
-               announcer_5min = announcer_1min = FALSE; // reset maptime announcers now as well
+               announcer_5min = announcer_1min = false; // reset maptime announcers now as well
 
        float countdown = (starttime - time);
        float countdown_rounded = floor(0.5 + countdown);
@@ -27,6 +38,7 @@ void Announcer_Countdown()
        }
        else // countdown is still going
        {
+               // if concomitant countdown to round start overrides countdown to game start
                if(roundstarttime == starttime)
                {
                        Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTART, countdown_rounded);
@@ -59,9 +71,6 @@ void Announcer_Gamestart()
 
        if(previous_game_starttime != startTime)
        {
-               if((time + 5.0) < startTime) // if connecting to server while restart was active don't always play prepareforbattle
-                       Local_Notification(MSG_ANNCE, ANNCE_PREPARE);
-
                if(time < startTime)
                {
                        entity e = find(world, classname, "announcer_countdown");
@@ -71,6 +80,11 @@ void Announcer_Gamestart()
                                e.classname = "announcer_countdown";
                                e.think = Announcer_Countdown;
                        }
+
+                       if(time + 5.0 < startTime) // if connecting to server while restart was active don't always play prepareforbattle
+                       if(time > e.nextthink) // don't play it again if countdown was already going
+                               Local_Notification(MSG_ANNCE, ANNCE_PREPARE);
+
                        e.nextthink = startTime - floor(startTime - time); //synchronize nextthink to startTime
                }
        }
@@ -98,7 +112,7 @@ void Announcer_Time()
                {
                        if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft > 300)
                                || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft > 300))
-                                       announcer_5min = FALSE;
+                                       announcer_5min = false;
                }
                else
                {
@@ -108,7 +122,7 @@ void Announcer_Time()
                                //if we're in warmup mode, check whether there's a warmup timelimit
                                if(!(autocvar_g_warmup_limit == -1 && warmup_stage))
                                {
-                                       announcer_5min = TRUE;
+                                       announcer_5min = true;
                                        Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_5);
                                }
                        }
@@ -122,7 +136,7 @@ void Announcer_Time()
                {
                        if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft > 60)
                                || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft > 60))
-                                       announcer_1min = FALSE;
+                                       announcer_1min = false;
                }
                else if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timelimit > 0 && timeleft < 60)
                        || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft < 60))
@@ -130,7 +144,7 @@ void Announcer_Time()
                        // if we're in warmup mode, check whether there's a warmup timelimit
                        if(!(autocvar_g_warmup_limit == -1 && warmup_stage))
                        {
-                               announcer_1min = TRUE;
+                               announcer_1min = true;
                                Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_1);
                        }
                }
index 8215b9faf2aeddfe7057eede883513cbc258a4c7..e35bf82dd2759122afc2cf11d46707ef5fc1177b 100644 (file)
-float autocvar__con_chat_maximized;
-float autocvar__hud_configure;
+#ifndef CLIENT_AUTOCVARS_H
+#define CLIENT_AUTOCVARS_H
+
+bool autocvar__con_chat_maximized;
+bool autocvar__hud_configure;
 string autocvar__hud_panelorder;
 float autocvar__menu_alpha;
 string autocvar_accuracy_color_levels;
 float autocvar_bgmvolume;
-float autocvar_camera_chase_smoothly;
-float autocvar_camera_enable;
-float autocvar_camera_forward_follows;
-float autocvar_camera_free;
+bool autocvar_camera_chase_smoothly;
+bool autocvar_camera_enable;
+bool autocvar_camera_forward_follows;
+bool autocvar_camera_free;
 float autocvar_camera_look_attenuation;
 float autocvar_camera_look_player;
 float autocvar_camera_mouse_threshold;
-float autocvar_camera_reset;
+bool autocvar_camera_reset;
 float autocvar_camera_speed_attenuation;
 float autocvar_camera_speed_chase;
 float autocvar_camera_speed_free;
 float autocvar_camera_speed_roll;
-float autocvar_chase_active;
-float autocvar_cl_allow_uid2name;
+int autocvar_chase_active;
+int autocvar_cl_allow_uid2name;
 string autocvar_cl_announcer;
-var float autocvar_cl_announcer_antispam = 2;
-var float autocvar_cl_announcer_maptime = 3;
-float autocvar_cl_autodemo_delete;
-float autocvar_cl_autodemo_delete_keeprecords;
-float autocvar_cl_casings;
+float autocvar_cl_announcer_antispam = 2;
+float autocvar_cl_announcer_maptime = 3;
+bool autocvar_cl_autodemo_delete;
+bool autocvar_cl_autodemo_delete_keeprecords;
+bool autocvar_cl_casings;
 float autocvar_cl_casings_bronze_time;
-var float autocvar_cl_casings_maxcount = 100;
+int autocvar_cl_casings_maxcount = 100;
 float autocvar_cl_casings_shell_time;
-var float autocvar_cl_casings_sloppy = 1;
-var float autocvar_cl_casings_ticrate = 0.1;
-float autocvar_cl_db_saveasdump;
-float autocvar_cl_deathscoreboard;
+bool autocvar_cl_casings_sloppy = 1;
+float autocvar_cl_casings_ticrate = 0.1;
+bool autocvar_cl_db_saveasdump;
+bool autocvar_cl_deathscoreboard;
 float autocvar_cl_effects_lightningarc_branchfactor_add;
 float autocvar_cl_effects_lightningarc_branchfactor_start;
 float autocvar_cl_effects_lightningarc_drift_end;
 float autocvar_cl_effects_lightningarc_drift_start;
 float autocvar_cl_effects_lightningarc_segmentlength;
-float autocvar_cl_effects_lightningarc_simple;
-float autocvar_cl_gentle;
-float autocvar_cl_gentle_damage;
-float autocvar_cl_gentle_gibs;
-float autocvar_cl_gentle_messages;
-var float autocvar_cl_gibs_damageforcescale = 3.5;
-var float autocvar_cl_gibs_lifetime = 14;
-var float autocvar_cl_gibs_maxcount = 100;
-var float autocvar_cl_gibs_sloppy = 1;
-var float autocvar_cl_gibs_ticrate = 0.1;
-var float autocvar_cl_gibs_velocity_random = 1;
-var float autocvar_cl_gibs_velocity_scale = 1;
-var float autocvar_cl_gibs_avelocity_scale = 1;
+bool autocvar_cl_effects_lightningarc_simple;
+int autocvar_cl_gentle;
+int autocvar_cl_gentle_damage;
+int autocvar_cl_gentle_gibs;
+int autocvar_cl_gentle_messages;
+float autocvar_cl_gibs_damageforcescale = 3.5;
+float autocvar_cl_gibs_lifetime = 14;
+float autocvar_cl_gibs_maxcount = 100;
+bool autocvar_cl_gibs_sloppy = 1;
+float autocvar_cl_gibs_ticrate = 0.1;
+float autocvar_cl_gibs_velocity_random = 1;
+float autocvar_cl_gibs_velocity_scale = 1;
+float autocvar_cl_gibs_avelocity_scale = 1;
 float autocvar_cl_gibs_velocity_up;
-float autocvar_cl_gunalign;
-float autocvar_cl_hidewaypoints;
-float autocvar_cl_lockview;
-float autocvar_cl_nogibs;
-float autocvar_cl_orthoview;
-float autocvar_cl_orthoview_nofog;
-float autocvar_cl_particlegibs;
-float autocvar_cl_particles_oldvortexbeam;
+int autocvar_cl_gunalign;
+bool autocvar_cl_hidewaypoints;
+bool autocvar_cl_lockview;
+bool autocvar_cl_nogibs;
+bool autocvar_cl_orthoview;
+bool autocvar_cl_orthoview_nofog;
+bool autocvar_cl_particlegibs;
+bool autocvar_cl_particles_oldvortexbeam;
 float autocvar_cl_particles_quality;
-float autocvar_cl_projectiles_sloppy;
-float autocvar_cl_readpicture_force;
-var float autocvar_cl_reticle = 1;
-var float autocvar_cl_reticle_normal_alpha = 1;
-var float autocvar_cl_reticle_weapon = 1;
-var float autocvar_cl_reticle_weapon_alpha = 1;
-float autocvar_cl_reticle_stretch;
-float autocvar_cl_spawn_event_particles;
-var float autocvar_cl_spawn_event_sound = 1;
+bool autocvar_cl_projectiles_sloppy;
+bool autocvar_cl_readpicture_force;
+bool autocvar_cl_reticle = 1;
+float autocvar_cl_reticle_normal_alpha = 1;
+bool autocvar_cl_reticle_weapon = 1;
+float autocvar_cl_reticle_weapon_alpha = 1;
+bool autocvar_cl_reticle_stretch;
+bool autocvar_cl_spawn_event_particles;
+bool autocvar_cl_spawn_event_sound = 1;
 // float autocvar_cl_spawn_point_model;
-float autocvar_cl_spawn_point_particles;
-var float autocvar_cl_spawnzoom = 1;
-var float autocvar_cl_spawnzoom_speed = 1;
-var float autocvar_cl_spawnzoom_factor = 2;
-float autocvar_cl_stripcolorcodes;
-var float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
-var float autocvar_cl_vehicle_spiderbot_cross_size = 1;
-var float autocvar_cl_vehicles_hud_tactical = 1;
-float autocvar_cl_velocityzoom_enabled;
+bool autocvar_cl_spawn_point_particles;
+bool autocvar_cl_spawnzoom = 1;
+float autocvar_cl_spawnzoom_speed = 1;
+float autocvar_cl_spawnzoom_factor = 2;
+bool autocvar_cl_stripcolorcodes;
+float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
+float autocvar_cl_vehicle_spiderbot_cross_size = 1;
+bool autocvar_cl_vehicles_hud_tactical = 1;
+bool autocvar_cl_velocityzoom_enabled;
 float autocvar_cl_velocityzoom_factor;
-var float autocvar_cl_velocityzoom_type = 3;
+int autocvar_cl_velocityzoom_type = 3;
 float autocvar_cl_velocityzoom_speed;
 float autocvar_cl_velocityzoom_time;
 string autocvar_cl_weaponpriority;
 float autocvar_cl_zoomfactor;
 float autocvar_cl_zoomsensitivity;
 float autocvar_cl_zoomspeed;
-var float autocvar_cl_unpress_zoom_on_spawn = 1;
-var float autocvar_cl_unpress_zoom_on_death = 1;
-var float autocvar_cl_unpress_zoom_on_weapon_switch = 1;
-var float autocvar_cl_unpress_attack_on_weapon_switch = 1;
-float autocvar_con_chat;
+bool autocvar_cl_unpress_zoom_on_spawn = 1;
+bool autocvar_cl_unpress_zoom_on_death = 1;
+bool autocvar_cl_unpress_zoom_on_weapon_switch = 1;
+bool autocvar_cl_unpress_attack_on_weapon_switch = 1;
+bool autocvar_con_chat;
 float autocvar_con_chatpos;
-float autocvar_con_chatrect;
+bool autocvar_con_chatrect;
 float autocvar_con_chatsize;
 float autocvar_con_chattime;
 float autocvar_con_notify;
@@ -100,60 +103,60 @@ float autocvar_con_notifysize;
 string autocvar_crosshair;
 float autocvar_crosshair_alpha;
 string autocvar_crosshair_color;
-float autocvar_crosshair_color_special;
-var float autocvar_crosshair_color_special_rainbow_brightness = 2;
-var float autocvar_crosshair_color_special_rainbow_delay = 0.1;
-float autocvar_crosshair_dot;
+int autocvar_crosshair_color_special;
+float autocvar_crosshair_color_special_rainbow_brightness = 2;
+float autocvar_crosshair_color_special_rainbow_delay = 0.1;
+bool autocvar_crosshair_dot;
 float autocvar_crosshair_dot_alpha;
 string autocvar_crosshair_dot_color;
-var float autocvar_crosshair_dot_color_custom = 1;
+bool autocvar_crosshair_dot_color_custom = 1;
 float autocvar_crosshair_dot_size;
-float autocvar_crosshair_effect_scalefade;
-var float autocvar_crosshair_effect_time = 0.2;
-var float autocvar_crosshair_enabled = 1;
-float autocvar_crosshair_hitindication;
+bool autocvar_crosshair_effect_scalefade;
+float autocvar_crosshair_effect_time = 0.2;
+bool autocvar_crosshair_enabled = 1;
+bool autocvar_crosshair_hitindication;
 string autocvar_crosshair_hitindication_color;
 string autocvar_crosshair_hitindication_per_weapon_color;
 float autocvar_crosshair_hitindication_speed;
-float autocvar_crosshair_hittest;
-float autocvar_crosshair_hittest_blur;
-var float autocvar_crosshair_hittest_scale = 1.25;
-float autocvar_crosshair_hittest_showimpact;
-float autocvar_crosshair_per_weapon;
+bool autocvar_crosshair_hittest;
+bool autocvar_crosshair_hittest_blur;
+float autocvar_crosshair_hittest_scale = 1.25;
+bool autocvar_crosshair_hittest_showimpact;
+bool autocvar_crosshair_per_weapon;
 float autocvar_crosshair_pickup;
 float autocvar_crosshair_pickup_speed;
-float autocvar_crosshair_ring;
-float autocvar_crosshair_ring_inner;
-float autocvar_crosshair_ring_minelayer;
+bool autocvar_crosshair_ring;
+bool autocvar_crosshair_ring_inner;
+bool autocvar_crosshair_ring_minelayer;
 float autocvar_crosshair_ring_minelayer_alpha;
-float autocvar_crosshair_ring_hagar;
+bool autocvar_crosshair_ring_hagar;
 float autocvar_crosshair_ring_hagar_alpha;
-var float autocvar_crosshair_ring_vortex = 1;
-var float autocvar_crosshair_ring_vortex_alpha = 0.15;
-var float autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate = 0.05;
-var float autocvar_crosshair_ring_vortex_currentcharge_scale = 30;
-var float autocvar_crosshair_ring_vortex_inner_alpha = 0.15;
-var float autocvar_crosshair_ring_vortex_inner_color_blue = 0;
-var float autocvar_crosshair_ring_vortex_inner_color_green = 0;
-var float autocvar_crosshair_ring_vortex_inner_color_red = 0.8;
-var float autocvar_crosshair_ring_arc = 1;
-var vector autocvar_crosshair_ring_arc_hot_color = '1 0 0';
-var float autocvar_crosshair_ring_arc_cold_alpha = 0.2;
-var float autocvar_crosshair_ring_arc_hot_alpha = 0.5;
+bool autocvar_crosshair_ring_vortex = 1;
+float autocvar_crosshair_ring_vortex_alpha = 0.15;
+float autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate = 0.05;
+float autocvar_crosshair_ring_vortex_currentcharge_scale = 30;
+float autocvar_crosshair_ring_vortex_inner_alpha = 0.15;
+float autocvar_crosshair_ring_vortex_inner_color_blue = 0;
+float autocvar_crosshair_ring_vortex_inner_color_green = 0;
+float autocvar_crosshair_ring_vortex_inner_color_red = 0.8;
+bool autocvar_crosshair_ring_arc = 1;
+vector autocvar_crosshair_ring_arc_hot_color = '1 0 0';
+float autocvar_crosshair_ring_arc_cold_alpha = 0.2;
+float autocvar_crosshair_ring_arc_hot_alpha = 0.5;
 float autocvar_crosshair_ring_size;
-float autocvar_crosshair_ring_reload;
+bool autocvar_crosshair_ring_reload;
 float autocvar_crosshair_ring_reload_alpha;
 float autocvar_crosshair_ring_reload_size;
 float autocvar_crosshair_size;
-float autocvar_ekg;
+int autocvar_ekg;
 float autocvar_fov;
 float autocvar_g_balance_damagepush_speedfactor;
 float autocvar_g_balance_tuba_attenuation;
 float autocvar_g_balance_tuba_fadetime;
 float autocvar_g_balance_tuba_volume;
-float autocvar_g_balance_tuba_pitchstep;
+int autocvar_g_balance_tuba_pitchstep;
 float autocvar_g_warmup_limit;
-float autocvar_g_waypointsprite_uppercase;
+bool autocvar_g_waypointsprite_uppercase;
 float autocvar_g_waypointsprite_alpha;
 float autocvar_g_waypointsprite_crosshairfadealpha;
 float autocvar_g_waypointsprite_crosshairfadedistance;
@@ -174,17 +177,17 @@ float autocvar_g_waypointsprite_minalpha;
 float autocvar_g_waypointsprite_minscale;
 float autocvar_g_waypointsprite_normdistance;
 float autocvar_g_waypointsprite_scale;
-float autocvar_g_waypointsprite_spam;
+int autocvar_g_waypointsprite_spam;
 float autocvar_g_waypointsprite_timealphaexponent;
-var float autocvar_g_waypointsprite_turrets = TRUE;
-var float autocvar_g_waypointsprite_turrets_maxdist = 5000;
-var float autocvar_hud_cursormode = TRUE;
+bool autocvar_g_waypointsprite_turrets = true;
+float autocvar_g_waypointsprite_turrets_maxdist = 5000;
+bool autocvar_hud_cursormode = true;
 float autocvar_hud_colorflash_alpha;
-float autocvar_hud_configure_checkcollisions;
-float autocvar_hud_configure_grid;
+bool autocvar_hud_configure_checkcollisions;
+bool autocvar_hud_configure_grid;
 float autocvar_hud_configure_grid_alpha;
-float autocvar_hud_configure_teamcolorforced;
-float autocvar_hud_contents;
+bool autocvar_hud_configure_teamcolorforced;
+bool autocvar_hud_contents;
 float autocvar_hud_contents_blur;
 float autocvar_hud_contents_blur_alpha;
 float autocvar_hud_contents_fadeintime;
@@ -195,7 +198,7 @@ float autocvar_hud_contents_slime_alpha;
 string autocvar_hud_contents_slime_color;
 float autocvar_hud_contents_water_alpha;
 string autocvar_hud_contents_water_color;
-float autocvar_hud_damage;
+bool autocvar_hud_damage;
 float autocvar_hud_damage_blur;
 float autocvar_hud_damage_blur_alpha;
 string autocvar_hud_damage_color;
@@ -209,151 +212,152 @@ float autocvar_hud_damage_pain_threshold_lower;
 float autocvar_hud_damage_pain_threshold_lower_health;
 float autocvar_hud_damage_pain_threshold_pulsating_min;
 float autocvar_hud_damage_pain_threshold_pulsating_period;
-float autocvar_hud_powerup;
-float autocvar_hud_postprocessing;
+bool autocvar_hud_powerup;
+bool autocvar_hud_postprocessing;
 float autocvar_hud_postprocessing_maxbluralpha;
 float autocvar_hud_postprocessing_maxblurradius;
 string autocvar_hud_dock;
 float autocvar_hud_dock_alpha;
 string autocvar_hud_dock_color;
-float autocvar_hud_dock_color_team;
-float autocvar_hud_panel_ammo;
-float autocvar_hud_panel_ammo_iconalign;
-float autocvar_hud_panel_ammo_maxammo;
-float autocvar_hud_panel_ammo_onlycurrent;
+bool autocvar_hud_dock_color_team;
+bool autocvar_hud_panel_ammo;
+bool autocvar_hud_panel_ammo_iconalign; // TODO: check if this should be turned into an int
+int autocvar_hud_panel_ammo_maxammo;
+bool autocvar_hud_panel_ammo_onlycurrent;
 float autocvar_hud_panel_ammo_noncurrent_alpha = 0.7;
 float autocvar_hud_panel_ammo_noncurrent_scale = 1;
-float autocvar_hud_panel_ammo_progressbar;
+bool autocvar_hud_panel_ammo_progressbar;
 string autocvar_hud_panel_ammo_progressbar_name;
 float autocvar_hud_panel_ammo_progressbar_xoffset;
-float autocvar_hud_panel_ammo_text;
+bool autocvar_hud_panel_ammo_text;
 string autocvar_hud_panel_bg;
 float autocvar_hud_panel_bg_alpha;
 float autocvar_hud_panel_bg_border;
-vector autocvar_hud_panel_bg_color;
-float autocvar_hud_panel_bg_color_team;
+vector autocvar_hud_panel_bg_color; // TODO: int?
+float autocvar_hud_panel_bg_color_team; // ^
 float autocvar_hud_panel_bg_padding;
-float autocvar_hud_panel_centerprint;
+bool autocvar_hud_panel_centerprint;
 float autocvar_hud_panel_centerprint_align;
-var float autocvar_hud_panel_centerprint_fade_in = 0.2;
-var float autocvar_hud_panel_centerprint_fade_out = 0.5;
-var float autocvar_hud_panel_centerprint_fade_subsequent = 1;
-var float autocvar_hud_panel_centerprint_fade_subsequent_passone = 3;
-var float autocvar_hud_panel_centerprint_fade_subsequent_passone_minalpha = 0.5;
-var float autocvar_hud_panel_centerprint_fade_subsequent_passtwo = 10;
-var float autocvar_hud_panel_centerprint_fade_subsequent_passtwo_minalpha = 0.5;
-var float autocvar_hud_panel_centerprint_fade_subsequent_minfontsize = 0.75;
-var float autocvar_hud_panel_centerprint_fade_minfontsize = 0;
-float autocvar_hud_panel_centerprint_flip;
+float autocvar_hud_panel_centerprint_fade_in = 0.2;
+float autocvar_hud_panel_centerprint_fade_out = 0.5;
+float autocvar_hud_panel_centerprint_fade_subsequent = 1;
+float autocvar_hud_panel_centerprint_fade_subsequent_passone = 3;
+float autocvar_hud_panel_centerprint_fade_subsequent_passone_minalpha = 0.5;
+float autocvar_hud_panel_centerprint_fade_subsequent_passtwo = 10;
+float autocvar_hud_panel_centerprint_fade_subsequent_passtwo_minalpha = 0.5;
+float autocvar_hud_panel_centerprint_fade_subsequent_minfontsize = 0.75;
+float autocvar_hud_panel_centerprint_fade_minfontsize = 0;
+bool autocvar_hud_panel_centerprint_flip;
 float autocvar_hud_panel_centerprint_fontscale;
 float autocvar_hud_panel_centerprint_time;
-float autocvar_hud_panel_chat;
-float autocvar_hud_panel_engineinfo;
+bool autocvar_hud_panel_chat;
+bool autocvar_hud_panel_engineinfo;
 float autocvar_hud_panel_engineinfo_framecounter_decimals;
 float autocvar_hud_panel_engineinfo_framecounter_time;
 float autocvar_hud_panel_fg_alpha;
-float autocvar_hud_panel_healtharmor;
-float autocvar_hud_panel_healtharmor_baralign;
-float autocvar_hud_panel_healtharmor_flip;
-float autocvar_hud_panel_healtharmor_iconalign;
-float autocvar_hud_panel_healtharmor_maxarmor;
-float autocvar_hud_panel_healtharmor_maxhealth;
-float autocvar_hud_panel_healtharmor_progressbar;
+bool autocvar_hud_panel_healtharmor;
+int autocvar_hud_panel_healtharmor_baralign;
+bool autocvar_hud_panel_healtharmor_flip;
+int autocvar_hud_panel_healtharmor_iconalign;
+int autocvar_hud_panel_healtharmor_maxarmor;
+int autocvar_hud_panel_healtharmor_maxhealth;
+bool autocvar_hud_panel_healtharmor_progressbar;
 string autocvar_hud_panel_healtharmor_progressbar_armor;
 string autocvar_hud_panel_healtharmor_progressbar_health;
-float autocvar_hud_panel_healtharmor_progressbar_gfx;
+bool autocvar_hud_panel_healtharmor_progressbar_gfx;
 float autocvar_hud_panel_healtharmor_progressbar_gfx_damage;
 float autocvar_hud_panel_healtharmor_progressbar_gfx_lowhealth;
 float autocvar_hud_panel_healtharmor_progressbar_gfx_smooth;
-float autocvar_hud_panel_healtharmor_text;
-float autocvar_hud_panel_infomessages;
-float autocvar_hud_panel_infomessages_flip;
-float autocvar_hud_panel_modicons;
-float autocvar_hud_panel_modicons_ca_layout;
-float autocvar_hud_panel_modicons_dom_layout;
-float autocvar_hud_panel_modicons_freezetag_layout;
-float autocvar_hud_panel_notify;
+int autocvar_hud_panel_healtharmor_text;
+bool autocvar_hud_panel_infomessages;
+bool autocvar_hud_panel_infomessages_flip;
+bool autocvar_hud_panel_modicons;
+int autocvar_hud_panel_modicons_ca_layout;
+int autocvar_hud_panel_modicons_dom_layout;
+int autocvar_hud_panel_modicons_freezetag_layout;
+bool autocvar_hud_panel_notify;
 float autocvar_hud_panel_notify_fadetime;
 float autocvar_hud_panel_notify_flip;
 float autocvar_hud_panel_notify_fontsize;
 float autocvar_hud_panel_notify_time;
 float autocvar_hud_panel_notify_icon_aspect;
-float autocvar_hud_panel_physics;
+bool autocvar_hud_panel_physics;
 float autocvar_hud_panel_physics_acceleration_progressbar_mode;
 float autocvar_hud_panel_physics_acceleration_progressbar_scale;
 float autocvar_hud_panel_physics_acceleration_progressbar_nonlinear;
 float autocvar_hud_panel_physics_acceleration_max;
-float autocvar_hud_panel_physics_progressbar;
-float autocvar_hud_panel_physics_acceleration_vertical;
-float autocvar_hud_panel_physics_baralign;
-float autocvar_hud_panel_physics_flip;
+int autocvar_hud_panel_physics_progressbar;
+bool autocvar_hud_panel_physics_acceleration_vertical;
+int autocvar_hud_panel_physics_baralign;
+bool autocvar_hud_panel_physics_flip;
 float autocvar_hud_panel_physics_speed_max;
-float autocvar_hud_panel_physics_speed_unit;
-float autocvar_hud_panel_physics_speed_unit_show;
-float autocvar_hud_panel_physics_speed_vertical;
-float autocvar_hud_panel_physics_text;
+int autocvar_hud_panel_physics_speed_unit;
+bool autocvar_hud_panel_physics_speed_unit_show;
+bool autocvar_hud_panel_physics_speed_vertical;
+int autocvar_hud_panel_physics_text;
 float autocvar_hud_panel_physics_text_scale;
-float autocvar_hud_panel_physics_topspeed;
+bool autocvar_hud_panel_physics_topspeed;
 float autocvar_hud_panel_physics_topspeed_time;
-float autocvar_hud_panel_powerups;
-float autocvar_hud_panel_powerups_baralign;
-float autocvar_hud_panel_powerups_flip;
-float autocvar_hud_panel_powerups_iconalign;
-float autocvar_hud_panel_powerups_progressbar;
-float autocvar_hud_panel_buffs;
+bool autocvar_hud_panel_powerups;
+int autocvar_hud_panel_powerups_baralign;
+bool autocvar_hud_panel_powerups_flip;
+int autocvar_hud_panel_powerups_iconalign;
+bool autocvar_hud_panel_powerups_progressbar;
+bool autocvar_hud_panel_buffs;
 //float autocvar_hud_panel_buffs_iconalign;
 string autocvar_hud_panel_powerups_progressbar_shield;
 string autocvar_hud_panel_powerups_progressbar_strength;
 string autocvar_hud_panel_powerups_progressbar_superweapons;
-float autocvar_hud_panel_powerups_text;
-float autocvar_hud_panel_pressedkeys;
+bool autocvar_hud_panel_powerups_text;
+int autocvar_hud_panel_pressedkeys;
 float autocvar_hud_panel_pressedkeys_aspect;
-float autocvar_hud_panel_pressedkeys_attack;
-float autocvar_hud_panel_racetimer;
-float autocvar_hud_panel_radar;
+bool autocvar_hud_panel_pressedkeys_attack;
+bool autocvar_hud_panel_racetimer;
+int autocvar_hud_panel_radar;
 float autocvar_hud_panel_radar_foreground_alpha;
 float autocvar_hud_panel_radar_maximized_scale;
 vector autocvar_hud_panel_radar_maximized_size;
 float autocvar_hud_panel_radar_rotation;
 float autocvar_hud_panel_radar_scale;
-float autocvar_hud_panel_radar_zoommode;
+int autocvar_hud_panel_radar_zoommode;
 float autocvar_hud_panel_radar_maximized_rotation;
-float autocvar_hud_panel_radar_maximized_zoommode;
-float autocvar_hud_panel_score;
-float autocvar_hud_panel_score_rankings;
-float autocvar_hud_panel_timer;
-float autocvar_hud_panel_timer_increment;
+int autocvar_hud_panel_radar_maximized_zoommode;
+bool autocvar_hud_panel_score;
+bool autocvar_hud_panel_score_rankings;
+bool autocvar_hud_panel_timer;
+bool autocvar_hud_panel_timer_increment;
 float autocvar_hud_panel_update_interval;
-float autocvar_hud_panel_vote;
+bool autocvar_hud_panel_vote;
 float autocvar_hud_panel_vote_alreadyvoted_alpha;
 string autocvar_hud_panel_vote_bg_alpha;
-float autocvar_hud_panel_weapons;
-float autocvar_hud_panel_weapons_accuracy;
-float autocvar_hud_panel_weapons_ammo;
+bool autocvar_hud_panel_weapons;
+bool autocvar_hud_panel_weapons_accuracy;
+bool autocvar_hud_panel_weapons_ammo;
 float autocvar_hud_panel_weapons_ammo_alpha;
 string autocvar_hud_panel_weapons_ammo_color;
-float autocvar_hud_panel_weapons_ammo_full_cells;
-float autocvar_hud_panel_weapons_ammo_full_plasma;
-float autocvar_hud_panel_weapons_ammo_full_fuel;
-float autocvar_hud_panel_weapons_ammo_full_nails;
-float autocvar_hud_panel_weapons_ammo_full_rockets;
-float autocvar_hud_panel_weapons_ammo_full_shells;
+int autocvar_hud_panel_weapons_ammo_full_cells;
+int autocvar_hud_panel_weapons_ammo_full_plasma;
+int autocvar_hud_panel_weapons_ammo_full_fuel;
+int autocvar_hud_panel_weapons_ammo_full_nails;
+int autocvar_hud_panel_weapons_ammo_full_rockets;
+int autocvar_hud_panel_weapons_ammo_full_shells;
 float autocvar_hud_panel_weapons_aspect;
-float autocvar_hud_panel_weapons_complainbubble;
+bool autocvar_hud_panel_weapons_complainbubble;
 string autocvar_hud_panel_weapons_complainbubble_color_donthave;
 string autocvar_hud_panel_weapons_complainbubble_color_outofammo;
 string autocvar_hud_panel_weapons_complainbubble_color_unavailable;
 float autocvar_hud_panel_weapons_complainbubble_fadetime;
 float autocvar_hud_panel_weapons_complainbubble_padding;
 float autocvar_hud_panel_weapons_complainbubble_time;
-float autocvar_hud_panel_weapons_label;
-float autocvar_hud_panel_weapons_onlyowned;
+int autocvar_hud_panel_weapons_label;
+float autocvar_hud_panel_weapons_label_scale = 0.5;
+bool autocvar_hud_panel_weapons_onlyowned;
 float autocvar_hud_panel_weapons_timeout;
-float autocvar_hud_panel_weapons_timeout_effect;
+int autocvar_hud_panel_weapons_timeout_effect;
 float autocvar_hud_panel_weapons_timeout_fadebgmin;
 float autocvar_hud_panel_weapons_timeout_fadefgmin;
-var float autocvar_hud_panel_weapons_timeout_speed_in = 0.25;
-var float autocvar_hud_panel_weapons_timeout_speed_out = 0.75;
+float autocvar_hud_panel_weapons_timeout_speed_in = 0.25;
+float autocvar_hud_panel_weapons_timeout_speed_out = 0.75;
 vector autocvar_hud_progressbar_acceleration_color;
 vector autocvar_hud_progressbar_acceleration_neg_color;
 float autocvar_hud_progressbar_alpha;
@@ -365,40 +369,40 @@ vector autocvar_hud_progressbar_shield_color;
 vector autocvar_hud_progressbar_speed_color;
 vector autocvar_hud_progressbar_strength_color;
 vector autocvar_hud_progressbar_superweapons_color;
-float autocvar_hud_showbinds;
-float autocvar_hud_showbinds_limit;
-float autocvar__hud_showbinds_reload;
-float autocvar_hud_shownames;
-float autocvar_hud_shownames_enemies;
+bool autocvar_hud_showbinds;
+bool autocvar_hud_showbinds_limit;
+bool autocvar__hud_showbinds_reload;
+bool autocvar_hud_shownames;
+bool autocvar_hud_shownames_enemies;
 float autocvar_hud_shownames_crosshairdistance;
 float autocvar_hud_shownames_crosshairdistance_time;
 float autocvar_hud_shownames_crosshairdistance_antioverlap;
-float autocvar_hud_shownames_self;
-float autocvar_hud_shownames_status;
+bool autocvar_hud_shownames_self;
+bool autocvar_hud_shownames_status;
 float autocvar_hud_shownames_statusbar_height;
 float autocvar_hud_shownames_aspect;
 float autocvar_hud_shownames_fontsize;
-float autocvar_hud_shownames_decolorize;
+int autocvar_hud_shownames_decolorize;
 float autocvar_hud_shownames_alpha;
-float autocvar_hud_shownames_resize;
+bool autocvar_hud_shownames_resize;
 float autocvar_hud_shownames_mindistance;
 float autocvar_hud_shownames_maxdistance;
-float autocvar_hud_shownames_antioverlap;
+bool autocvar_hud_shownames_antioverlap;
 float autocvar_hud_shownames_antioverlap_distance;
 float autocvar_hud_shownames_offset;
 string autocvar_hud_skin;
 float autocvar_menu_mouse_speed;
 string autocvar_menu_skin;
-float autocvar_r_fakelight;
-float autocvar_r_fullbright;
+int autocvar_r_fakelight;
+int autocvar_r_fullbright;
 float autocvar_r_letterbox;
-float autocvar_scoreboard_accuracy;
-float autocvar_scoreboard_accuracy_doublerows;
-float autocvar_scoreboard_accuracy_nocolors;
+bool autocvar_scoreboard_accuracy;
+bool autocvar_scoreboard_accuracy_doublerows;
+bool autocvar_scoreboard_accuracy_nocolors;
 float autocvar_scoreboard_alpha_bg;
-var float autocvar_scoreboard_alpha_fg = 1.0;
-var float autocvar_scoreboard_alpha_name = 0.9;
-var float autocvar_scoreboard_alpha_name_self = 1;
+float autocvar_scoreboard_alpha_fg = 1.0;
+float autocvar_scoreboard_alpha_name = 0.9;
+float autocvar_scoreboard_alpha_name_self = 1;
 float autocvar_scoreboard_bg_scale;
 float autocvar_scoreboard_border_thickness;
 float autocvar_scoreboard_color_bg_b;
@@ -406,62 +410,63 @@ float autocvar_scoreboard_color_bg_g;
 float autocvar_scoreboard_color_bg_r;
 float autocvar_scoreboard_color_bg_team;
 string autocvar_scoreboard_columns;
-var float autocvar_scoreboard_fadeinspeed = 10;
-var float autocvar_scoreboard_fadeoutspeed = 5;
-float autocvar_scoreboard_highlight;
-var float autocvar_scoreboard_highlight_alpha = 0.10;
-var float autocvar_scoreboard_highlight_alpha_self = 0.25;
+float autocvar_scoreboard_fadeinspeed = 10;
+float autocvar_scoreboard_fadeoutspeed = 5;
+bool autocvar_scoreboard_highlight;
+float autocvar_scoreboard_highlight_alpha = 0.10;
+float autocvar_scoreboard_highlight_alpha_self = 0.25;
 float autocvar_scoreboard_offset_left;
 float autocvar_scoreboard_offset_right;
 float autocvar_scoreboard_offset_vertical;
 float autocvar_scoreboard_respawntime_decimals;
-float autocvar_v_flipped;
+bool autocvar_v_flipped;
 float autocvar_vid_conheight;
 float autocvar_vid_conwidth;
 float autocvar_vid_pixelheight;
 float autocvar_viewsize;
-float autocvar_cl_hitsound;
-var float autocvar_cl_hitsound_min_pitch = 0.75; // minimal difference in minsta
-var float autocvar_cl_hitsound_max_pitch = 1.5;
-var float autocvar_cl_hitsound_nom_damage = 25;
+int autocvar_cl_hitsound;
+float autocvar_cl_hitsound_min_pitch = 0.75;
+float autocvar_cl_hitsound_max_pitch = 1.5;
+float autocvar_cl_hitsound_nom_damage = 25;
 float autocvar_cl_hitsound_antispam_time;
-var float autocvar_cl_eventchase_death = 1;
-var float autocvar_cl_eventchase_nexball = 1;
-var float autocvar_cl_eventchase_distance = 140;
-var float autocvar_cl_eventchase_speed = 1.3;
-var vector autocvar_cl_eventchase_maxs = '12 12 8';
-var vector autocvar_cl_eventchase_mins = '-12 -12 -8';
-var vector autocvar_cl_eventchase_viewoffset = '0 0 20';
-float autocvar_cl_lerpexcess;
+int autocvar_cl_eventchase_death = 1;
+int autocvar_cl_eventchase_nexball = 1;
+float autocvar_cl_eventchase_distance = 140;
+float autocvar_cl_eventchase_speed = 1.3;
+vector autocvar_cl_eventchase_maxs = '12 12 8';
+vector autocvar_cl_eventchase_mins = '-12 -12 -8';
+vector autocvar_cl_eventchase_viewoffset = '0 0 20';
+float autocvar_cl_lerpexcess; // TODO: int?
 string autocvar__togglezoom;
-float autocvar_cl_damageeffect;
+int autocvar_cl_damageeffect;
 float autocvar_cl_damageeffect_ticrate;
 float autocvar_cl_damageeffect_bones;
-float autocvar_cl_damageeffect_distribute;
+bool autocvar_cl_damageeffect_distribute;
 float autocvar_cl_damageeffect_lifetime;
 float autocvar_cl_damageeffect_lifetime_min;
 float autocvar_cl_damageeffect_lifetime_max;
-float autocvar_cl_playerdetailreduction;
-float autocvar_cl_modeldetailreduction;
+int autocvar_cl_playerdetailreduction;
+int autocvar_cl_modeldetailreduction;
 float autocvar_cl_loddistance1 = 768;
 float autocvar_cl_loddistance2 = 2048;
-float autocvar_cl_forceplayermodels;
-float autocvar_cl_forceplayercolors;
+bool autocvar_cl_forceplayermodels;
+bool autocvar_cl_forceplayercolors;
 string autocvar_cl_forcemyplayermodel;
-float autocvar_cl_forcemyplayerskin;
-float autocvar_cl_forcemyplayercolors;
-float autocvar__cl_color;
-float autocvar__cl_playerskin;
+int autocvar_cl_forcemyplayerskin;
+int autocvar_cl_forcemyplayercolors;
+int autocvar__cl_color;
+int autocvar__cl_playerskin;
 string autocvar__cl_playermodel;
 float autocvar_cl_deathglow;
-float autocvar_developer_csqcentities;
+bool autocvar_developer_csqcentities;
 float autocvar_g_jetpack_attenuation;
-var string autocvar_crosshair_hmg = ""; 
-var vector autocvar_crosshair_hmg_color = '0.2 1.0 0.2';
-var float autocvar_crosshair_hmg_alpha = 1;
-var float autocvar_crosshair_hmg_size = 1;
-var string autocvar_crosshair_rpc = ""; 
-var vector autocvar_crosshair_rpc_color = '0.2 1.0 0.2';
-var float autocvar_crosshair_rpc_alpha = 1;
-var float autocvar_crosshair_rpc_size = 1;
-float autocvar_cl_nade_timer;
+string autocvar_crosshair_hmg = "";
+vector autocvar_crosshair_hmg_color = '0.2 1.0 0.2';
+float autocvar_crosshair_hmg_alpha = 1;
+float autocvar_crosshair_hmg_size = 1;
+string autocvar_crosshair_rpc = "";
+vector autocvar_crosshair_rpc_color = '0.2 1.0 0.2';
+float autocvar_crosshair_rpc_alpha = 1;
+float autocvar_crosshair_rpc_size = 1;
+int autocvar_cl_nade_timer;
+#endif
index 9d024941e6bf00d4b8c7f53133deca7535edbde4..b567190caa666f165cfe49bea7a09ea6fd8b0d73 100644 (file)
@@ -1,3 +1,14 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "defs.qh"
+       #include "../common/util.qh"
+       #include "autocvars.qh"
+       #include "bgmscript.qh"
+       #include "main.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
 #define CONSTANT_SPEED_DECAY
 
 float bgmscriptbuf;
@@ -176,7 +187,7 @@ float BGMScript(entity e)
        if(autocvar_bgmvolume <= 0)
                return -1;
 
-       e.just_toggled = FALSE;
+       e.just_toggled = false;
 
        if(bgmtime < 0)
                return -1;
@@ -189,13 +200,13 @@ float BGMScript(entity e)
                e.bgmscripttime = bgmtime;
 
                // treat this as a stop event for all notes, to prevent sticking keys
-               e.bgmscriptstate = FALSE;
+               e.bgmscriptstate = false;
                e.bgmscriptvolume = 1;
                e.bgmscriptstatetime = bgmtime - GetTimeForAmplitude(e, amp);
        }
 
        // find the CURRENT line
-       for(;;)
+       for (;;)
        {
                tokenize_console(bufstr_get(bgmscriptbuf, e.bgmscriptline));
                if(stof(argv(1)) >= bgmtime || argv(0) != e.bgmscript)
@@ -214,11 +225,11 @@ float BGMScript(entity e)
                        vel = stof(argv(2));
                        if(vel > 0)
                        {
-                               e.just_toggled = e.bgmscriptstate = TRUE;
+                               e.just_toggled = e.bgmscriptstate = true;
                                e.bgmscriptvolume = vel;
                        }
                        else
-                               e.just_toggled = e.bgmscriptstate = FALSE;
+                               e.just_toggled = e.bgmscriptstate = false;
 
                        e.bgmscriptstatetime = e.bgmscripttime - GetTimeForAmplitude(e, amp);
                }
index 713cf5798cd61184eaa2b1ecee096b9e4e36a569..910ef6b5df006c69f3347ad33363498d31f53a74 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef BGMSCRIPT_H
+#define BGMSCRIPT_H
+
 .string bgmscript;
 .float bgmscriptattack;
 .float bgmscriptdecay;
@@ -8,3 +11,4 @@
 
 void BGMScript_InitEntity(entity e);
 float BGMScript(entity e);
+#endif
index 2225c0f35260d6ac88320cc2027939d4ba5d528e..6068a799f752892a2d1dc8f86b7d412537c0644c 100644 (file)
@@ -1,4 +1,17 @@
-.float silent;
+#if defined(CSQC)
+       #include "movetypes.qh"
+       #include "prandom.qh"
+       #include "rubble.qh"
+
+       .float cnt;
+       .float alpha;
+       .int state;
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
+
+.bool silent;
 
 void Casing_Delete()
 {
@@ -44,16 +57,15 @@ void Casing_Touch()
                        if(time >= self.nextthink)
                        {
                                string s;
-                               float f;
+                               int f = floor(prandom() * 3) + 1;
 
-                               f = floor(prandom() * 3) + 1;
                                switch(self.state)
                                {
                                        case 1:
-                                               s = strcat("weapons/casings", ftos(f), ".wav");
+                                               s = strcat("weapons/casings", itos(f), ".wav");
                                                break;
                                        default:
-                                               s = strcat("weapons/brass", ftos(f), ".wav");
+                                               s = strcat("weapons/brass", itos(f), ".wav");
                                                break;
                                }
 
@@ -65,10 +77,10 @@ void Casing_Touch()
        self.nextthink = time + 0.2;
 }
 
-void Casing_Damage(float thisdmg, float hittype, vector org, vector thisforce)
+void Casing_Damage(float thisdmg, int hittype, vector org, vector thisforce)
 {
-       if(thisforce_z < 0)
-               thisforce_z = 0;
+       if(thisforce.z < 0)
+               thisforce.z = 0;
        self.move_velocity = self.move_velocity + thisforce + '0 0 100';
        self.move_flags &= ~FL_ONGROUND;
 }
index 9aae77dde687ef5417a61b71ae29b4524365e963..7b74d2dd7fa56752889ee75f6abb3cdbb1e08115 100644 (file)
@@ -3,6 +3,9 @@
 //  Last updated: December 28th, 2011
 // ==============================================
 
+#include "../../common/command/generic.qh"
+#include "../../common/command/shared_defs.qh"
+
 void DrawDebugModel()
 {
        if(time - floor(time) > 0.5)
@@ -22,7 +25,7 @@ void DrawDebugModel()
 //  Command Sub-Functions
 // =======================
 
-void LocalCommand_blurtest(float request)
+void LocalCommand_blurtest(int request)
 {
        // Simple command to work with postprocessing temporarily... possibly completely pointless, the glsl shader is used for a real feature now...
        // Anyway, to enable it, just compile the client with -DBLURTEST and then you can use the command.
@@ -57,7 +60,7 @@ void LocalCommand_blurtest(float request)
        #endif
 }
 
-void LocalCommand_boxparticles(float request, float argc)
+void LocalCommand_boxparticles(int request, int argc)
 {
        switch(request)
        {
@@ -65,10 +68,10 @@ void LocalCommand_boxparticles(float request, float argc)
                {
                        if (argc == 9)
                        {
-                               float effect = particleeffectnum(argv(1));
+                               int effect = particleeffectnum(argv(1));
                                if (effect >= 0)
                                {
-                                       float index = stof(argv(2));
+                                       int index = stoi(argv(2));
                                        entity own;
                                        if(index <= 0)
                                                own = entitybyindex(-index);
@@ -78,8 +81,8 @@ void LocalCommand_boxparticles(float request, float argc)
                                        vector org_to = stov(argv(4));
                                        vector dir_from = stov(argv(5));
                                        vector dir_to = stov(argv(6));
-                                       float countmultiplier = stof(argv(7));
-                                       float flags = stof(argv(8));
+                                       int countmultiplier = stoi(argv(7));
+                                       int flags = stoi(argv(8));
                                        boxparticles(effect, own, org_from, org_to, dir_from, dir_to, countmultiplier, flags);
                                        return;
                                }
@@ -108,22 +111,21 @@ void LocalCommand_boxparticles(float request, float argc)
        }
 }
 
-void LocalCommand_create_scrshot_ent(float request)
+void LocalCommand_create_scrshot_ent(int request)
 {
        switch(request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       float fh;
                        string filename = strcat(MapInfo_Map_bspname, "_scrshot_ent.txt");
-                       fh = fopen(filename, FILE_WRITE);
+                       int fh = fopen(filename, FILE_WRITE);
 
                        if(fh >= 0)
                        {
                                fputs(fh, "{\n");
                                fputs(fh, strcat("\"classname\" \"info_autoscreenshot\"\n"));
-                               fputs(fh, strcat("\"origin\" \"", strcat(ftos(view_origin_x), " ", ftos(view_origin_y), " ", ftos(view_origin_z)), "\"\n"));
-                               fputs(fh, strcat("\"angles\" \"", strcat(ftos(view_angles_x), " ", ftos(view_angles_y), " ", ftos(view_angles_z)), "\"\n"));
+                               fputs(fh, strcat("\"origin\" \"", strcat(ftos(view_origin.x), " ", ftos(view_origin.y), " ", ftos(view_origin.z)), "\"\n"));
+                               fputs(fh, strcat("\"angles\" \"", strcat(ftos(view_angles.x), " ", ftos(view_angles.y), " ", ftos(view_angles.z)), "\"\n"));
                                fputs(fh, "}\n");
 
                                print("Completed screenshot entity dump in ^2data/data/", MapInfo_Map_bspname, "_scrshot_ent.txt^7.\n");
@@ -147,7 +149,7 @@ void LocalCommand_create_scrshot_ent(float request)
        }
 }
 
-void LocalCommand_debugmodel(float request, float argc)
+void LocalCommand_debugmodel(int request, int argc)
 {
        switch(request)
        {
@@ -177,13 +179,13 @@ void LocalCommand_debugmodel(float request, float argc)
        }
 }
 
-void LocalCommand_handlevote(float request, float argc)
+void LocalCommand_handlevote(int request, int argc)
 {
        switch(request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       float vote_selection;
+                       int vote_selection;
                        string vote_string;
 
                        if(InterpretBoolean(argv(1)))
@@ -224,7 +226,7 @@ void LocalCommand_handlevote(float request, float argc)
        }
 }
 
-void LocalCommand_hud(float request, float argc)
+void LocalCommand_hud(int request, int argc)
 {
        switch(request)
        {
@@ -289,7 +291,7 @@ void LocalCommand_hud(float request, float argc)
        }
 }
 
-void LocalCommand_localprint(float request, float argc)
+void LocalCommand_localprint(int request, int argc)
 {
        switch(request)
        {
@@ -313,7 +315,7 @@ void LocalCommand_localprint(float request, float argc)
        }
 }
 
-void LocalCommand_mv_download(float request, float argc)
+void LocalCommand_mv_download(int request, int argc)
 {
        switch(request)
        {
@@ -337,7 +339,7 @@ void LocalCommand_mv_download(float request, float argc)
        }
 }
 
-void LocalCommand_sendcvar(float request, float argc)
+void LocalCommand_sendcvar(int request, int argc)
 {
        switch(request)
        {
@@ -373,7 +375,7 @@ void LocalCommand_sendcvar(float request, float argc)
 
 /* use this when creating a new command, making sure to place it in alphabetical order... also,
 ** ADD ALL NEW COMMANDS TO commands.cfg WITH PROPER ALIASES IN THE SAME FASHION!
-void LocalCommand_(float request)
+void LocalCommand_(int request)
 {
        switch(request)
        {
@@ -417,40 +419,40 @@ void LocalCommand_macro_help()
        #define CLIENT_COMMAND(name,function,description) \
                { if(strtolower(description) != "") { print("  ^2", name, "^7: ", description, "\n"); } }
 
-       CLIENT_COMMANDS(0, 0)
+       CLIENT_COMMANDS(0, 0);
        #undef CLIENT_COMMAND
 
        return;
 }
 
-float LocalCommand_macro_command(float argc)
+bool LocalCommand_macro_command(int argc)
 {
        #define CLIENT_COMMAND(name,function,description) \
-               { if(name == strtolower(argv(0))) { function; return TRUE; } }
+               { if(name == strtolower(argv(0))) { function; return true; } }
 
-       CLIENT_COMMANDS(CMD_REQUEST_COMMAND, argc)
+       CLIENT_COMMANDS(CMD_REQUEST_COMMAND, argc);
        #undef CLIENT_COMMAND
 
-       return FALSE;
+       return false;
 }
 
-float LocalCommand_macro_usage(float argc)
+bool LocalCommand_macro_usage(int argc)
 {
        #define CLIENT_COMMAND(name,function,description) \
-               { if(name == strtolower(argv(1))) { function; return TRUE; } }
+               { if(name == strtolower(argv(1))) { function; return true; } }
 
-       CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc)
+       CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc);
        #undef CLIENT_COMMAND
 
-       return FALSE;
+       return false;
 }
 
-void LocalCommand_macro_write_aliases(float fh)
+void LocalCommand_macro_write_aliases(int fh)
 {
        #define CLIENT_COMMAND(name,function,description) \
                { if(strtolower(description) != "") { CMD_Write_Alias("qc_cmd_cl", name, description); } }
 
-       CLIENT_COMMANDS(0, 0)
+       CLIENT_COMMANDS(0, 0);
        #undef CLIENT_COMMAND
 
        return;
@@ -464,7 +466,7 @@ void LocalCommand_macro_write_aliases(float fh)
 
 void GameCommand(string command)
 {
-       float argc = tokenize_console(command);
+       int argc = tokenize_console(command);
 
        // Guide for working with argc arguments by example:
        // argc:   1    - 2      - 3     - 4
@@ -517,26 +519,26 @@ void GameCommand(string command)
 
 // These functions are here specifically to add special + - commands to the game, and are not really normal commands.
 // Please add client commands to the function above this, as this is only for special reasons.
-#define CONSOLE_COMMANDS_NORMAL \
-       CONSOLE_COMMAND("+showscores", { scoreboard_showscores = TRUE; }) \
-       CONSOLE_COMMAND("-showscores", { scoreboard_showscores = FALSE; }) \
-       CONSOLE_COMMAND("+showaccuracy", { scoreboard_showaccuracy = TRUE; }) \
-       CONSOLE_COMMAND("-showaccuracy", { scoreboard_showaccuracy = FALSE; }) \
+#define CONSOLE_COMMANDS_NORMAL() \
+       CONSOLE_COMMAND("+showscores", { scoreboard_showscores = true; }) \
+       CONSOLE_COMMAND("-showscores", { scoreboard_showscores = false; }) \
+       CONSOLE_COMMAND("+showaccuracy", { scoreboard_showaccuracy = true; }) \
+       CONSOLE_COMMAND("-showaccuracy", { scoreboard_showaccuracy = false; }) \
        /* nothing */
 
-#define CONSOLE_COMMANDS_MOVEMENT \
-       CONSOLE_COMMAND("+forward", { ++camera_direction_x; }) \
-       CONSOLE_COMMAND("-forward", { --camera_direction_x; }) \
-       CONSOLE_COMMAND("+back", { --camera_direction_x; }) \
-       CONSOLE_COMMAND("-back", { ++camera_direction_x; }) \
-       CONSOLE_COMMAND("+moveup", { ++camera_direction_z; }) \
-       CONSOLE_COMMAND("-moveup", { --camera_direction_z; }) \
-       CONSOLE_COMMAND("+movedown", { --camera_direction_z; }) \
-       CONSOLE_COMMAND("-movedown", { ++camera_direction_z; }) \
-       CONSOLE_COMMAND("+moveright", { --camera_direction_y; }) \
-       CONSOLE_COMMAND("-moveright", { ++camera_direction_y; }) \
-       CONSOLE_COMMAND("+moveleft", { ++camera_direction_y; }) \
-       CONSOLE_COMMAND("-moveleft", { --camera_direction_y; }) \
+#define CONSOLE_COMMANDS_MOVEMENT() \
+       CONSOLE_COMMAND("+forward", { ++camera_direction.x; }) \
+       CONSOLE_COMMAND("-forward", { --camera_direction.x; }) \
+       CONSOLE_COMMAND("+back", { --camera_direction.x; }) \
+       CONSOLE_COMMAND("-back", { ++camera_direction.x; }) \
+       CONSOLE_COMMAND("+moveup", { ++camera_direction.z; }) \
+       CONSOLE_COMMAND("-moveup", { --camera_direction.z; }) \
+       CONSOLE_COMMAND("+movedown", { --camera_direction.z; }) \
+       CONSOLE_COMMAND("-movedown", { ++camera_direction.z; }) \
+       CONSOLE_COMMAND("+moveright", { --camera_direction.y; }) \
+       CONSOLE_COMMAND("-moveright", { ++camera_direction.y; }) \
+       CONSOLE_COMMAND("+moveleft", { ++camera_direction.y; }) \
+       CONSOLE_COMMAND("-moveleft", { --camera_direction.y; }) \
        CONSOLE_COMMAND("+roll_right", { ++camera_roll; }) \
        CONSOLE_COMMAND("-roll_right", { --camera_roll; }) \
        CONSOLE_COMMAND("+roll_left", { --camera_roll; }) \
@@ -549,7 +551,7 @@ void ConsoleCommand_macro_init()
        #define CONSOLE_COMMAND(name,execution) \
                { registercommand(name); }
 
-       CONSOLE_COMMANDS_NORMAL
+       CONSOLE_COMMANDS_NORMAL();
        #undef CONSOLE_COMMAND
 
        // then init movement commands
@@ -560,7 +562,7 @@ void ConsoleCommand_macro_init()
                #define CONSOLE_COMMAND(name,execution) \
                        { registercommand(name); }
 
-               CONSOLE_COMMANDS_MOVEMENT
+               CONSOLE_COMMANDS_MOVEMENT();
                #undef CONSOLE_COMMAND
        #ifndef CAMERATEST
        }
@@ -569,29 +571,29 @@ void ConsoleCommand_macro_init()
        return;
 }
 
-float ConsoleCommand_macro_normal(float argc)
+bool ConsoleCommand_macro_normal(int argc)
 {
        #define CONSOLE_COMMAND(name,execution) \
-               { if(name == strtolower(argv(0))) { { execution } return TRUE; } }
+               { if(name == strtolower(argv(0))) { { execution } return true; } }
 
-       CONSOLE_COMMANDS_NORMAL
+       CONSOLE_COMMANDS_NORMAL();
        #undef CONSOLE_COMMAND
 
-       return FALSE;
+       return false;
 }
 
-float ConsoleCommand_macro_movement(float argc)
+bool ConsoleCommand_macro_movement(int argc)
 {
        if(camera_active)
        {
                #define CONSOLE_COMMAND(name,execution) \
-                       { if(name == strtolower(argv(0))) { { execution } return TRUE; } }
+                       { if(name == strtolower(argv(0))) { { execution } return true; } }
 
-               CONSOLE_COMMANDS_MOVEMENT
+               CONSOLE_COMMANDS_MOVEMENT();
                #undef CONSOLE_COMMAND
        }
 
-       return FALSE;
+       return false;
 }
 
 
@@ -600,20 +602,20 @@ float ConsoleCommand_macro_movement(float argc)
 // ======================================================
 // Used to parse commands in the console that have been registered with the "registercommand" function
 
-float CSQC_ConsoleCommand(string command)
+bool CSQC_ConsoleCommand(string command)
 {
-       float argc = tokenize_console(command);
+       int argc = tokenize_console(command);
 
        if(ConsoleCommand_macro_normal(argc))
        {
-               return TRUE;
+               return true;
        }
        else if(ConsoleCommand_macro_movement(argc))
        {
-               return TRUE;
+               return true;
        }
 
        // Return value should be 1 if CSQC handled the command, otherwise return 0 to have the engine handle it.
 
-       return FALSE;
+       return false;
 }
index 9c29c40ee7ca11150169981275ff41fa5457b8a8..da34310e3cbbd59110bce0bade5f3fa1daa0b27d 100644 (file)
@@ -1,10 +1,13 @@
+#ifndef CL_CMD_H
+#define CL_CMD_H
 // ==============================================
 //  CSQC client commands code, written by Samual
 //  Last updated: December 17th, 2011
 // ==============================================
 
-void Cmd_HUD_SetFields(float);
+void Cmd_HUD_SetFields(int);
 void Cmd_HUD_Help();
 
 // used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
-void LocalCommand_macro_write_aliases(float fh);
+void LocalCommand_macro_write_aliases(int fh);
+#endif
index 1b06bb80defddb16f5c46581440cc883ee893a09..b07ec4a0958623ee4ac8b1c0deb95e5c1cb85cd5 100644 (file)
@@ -1,3 +1,3 @@
 Credits go to Dresk for putting this CSQC scratch source together.
 
-and Urre :o
\ No newline at end of file
+and Urre :o
index 4d966476f3eb91d7ac835c62994ac296f1d005ad..f11c31c62244c9c1667800e6353c1a51d0e25732 100644 (file)
@@ -1,59 +1,54 @@
+// MenuQC redefines world, change define it here to be safe
 #define world world
 
 // Mask Constants (set .drawmask on entities; use R_AddEntities to add all entities based on mask)
-const float            MASK_ENGINE                                             = 1;
-const float            MASK_ENGINEVIEWMODELS                   = 2;
-const float            MASK_NORMAL                                             = 4;
+const int              MASK_ENGINE                                             = 1;
+const int              MASK_ENGINEVIEWMODELS                   = 2;
+const int              MASK_NORMAL                                             = 4;
 
 // Renderflag Constants (used for CSQC entities)
-const float            RF_VIEWMODEL                                    = 1;
-const float            RF_EXTERNALMODEL                                = 2;
-const float            RF_DEPTHHACK                                    = 4;
-const float            RF_ADDITIVE                                             = 8;
-const float            RF_USEAXIS                                              = 16;
+const int              RF_VIEWMODEL                                    = 1;
+const int              RF_EXTERNALMODEL                                = 2;
+const int              RF_DEPTHHACK                                    = 4;
+const int              RF_ADDITIVE                                             = 8;
+const int              RF_USEAXIS                                              = 16;
 
 // Viewflag Constants (use with R_SetView)
-const float            VF_MIN                                                  = 1;    //(vector)
-const float            VF_MIN_X                                                = 2;    //(float)
-const float            VF_MIN_Y                                                = 3;    //(float)
-const float            VF_SIZE                                                 = 4;    //(vector) (viewport size)
-const float            VF_SIZE_Y                                               = 5;    //(float)
-const float            VF_SIZE_X                                               = 6;    //(float)
-const float            VF_VIEWPORT                                             = 7;    //(vector, vector)
-const float            VF_FOV                                                  = 8;    //(vector)
-const float            VF_FOVX                                                 = 9;    //(float)
-const float            VF_FOVY                                                 = 10;   //(float)
-const float            VF_ORIGIN                                               = 11;   //(vector)
-const float            VF_ORIGIN_X                                             = 12;   //(float)
-const float            VF_ORIGIN_Y                                             = 13;   //(float)
-const float            VF_ORIGIN_Z                                             = 14;   //(float)
-const float            VF_ANGLES                                               = 15;   //(vector)
-const float            VF_ANGLES_X                                             = 16;   //(float)
-const float            VF_ANGLES_Y                                             = 17;   //(float)
-const float            VF_ANGLES_Z                                             = 18;   //(float)
-const float            VF_DRAWWORLD                                    = 19;   //(float)
-const float            VF_DRAWENGINEHUD                                = 20;   //(float)
-const float            VF_DRAWCROSSHAIR                                = 21;   //(float)
-const float            VF_PERSPECTIVE                                  = 200;  //(float)
-
-const float            VF_CL_VIEWANGLES                                = 33;   //(vector)
-const float            VF_CL_VIEWANGLES_X                              = 34;   //(float)
-const float            VF_CL_VIEWANGLES_Y                              = 35;   //(float)
-const float            VF_CL_VIEWANGLES_Z                              = 36;   //(float)
+const int              VF_MIN                                                  = 1;    //(vector)
+const int              VF_MIN_X                                                = 2;    //(float)
+const int              VF_MIN_Y                                                = 3;    //(float)
+const int              VF_SIZE                                                 = 4;    //(vector) (viewport size)
+const int              VF_SIZE_Y                                               = 5;    //(float)
+const int              VF_SIZE_X                                               = 6;    //(float)
+const int              VF_VIEWPORT                                             = 7;    //(vector, vector)
+const int              VF_FOV                                                  = 8;    //(vector)
+const int              VF_FOVX                                                 = 9;    //(float)
+const int              VF_FOVY                                                 = 10;   //(float)
+const int              VF_ORIGIN                                               = 11;   //(vector)
+const int              VF_ORIGIN_X                                             = 12;   //(float)
+const int              VF_ORIGIN_Y                                             = 13;   //(float)
+const int              VF_ORIGIN_Z                                             = 14;   //(float)
+const int              VF_ANGLES                                               = 15;   //(vector)
+const int              VF_ANGLES_X                                             = 16;   //(float)
+const int              VF_ANGLES_Y                                             = 17;   //(float)
+const int              VF_ANGLES_Z                                             = 18;   //(float)
+const int              VF_DRAWWORLD                                    = 19;   //(float)
+const int              VF_DRAWENGINEHUD                                = 20;   //(float)
+const int              VF_DRAWCROSSHAIR                                = 21;   //(float)
+const int              VF_PERSPECTIVE                                  = 200;  //(float)
+
+const int              VF_CL_VIEWANGLES                                = 33;   //(vector)
+const int              VF_CL_VIEWANGLES_X                              = 34;   //(float)
+const int              VF_CL_VIEWANGLES_Y                              = 35;   //(float)
+const int              VF_CL_VIEWANGLES_Z                              = 36;   //(float)
 
 // Quake-style Point Contents
-const float            CONTENT_EMPTY                                   = -1;
-const float            CONTENT_SOLID                                   = -2;
-const float            CONTENT_WATER                                   = -3;
-const float            CONTENT_SLIME                                   = -4;
-const float            CONTENT_LAVA                                    = -5;
-const float            CONTENT_SKY                                             = -6;
-
-// Boolean Constants
-const float            true                                                    = 1;
-const float            false                                                   = 0;
-const float    TRUE                                                    = 1;
-const float    FALSE                                                   = 0;
+const int              CONTENT_EMPTY                                   = -1;
+const int              CONTENT_SOLID                                   = -2;
+const int              CONTENT_WATER                                   = -3;
+const int              CONTENT_SLIME                                   = -4;
+const int              CONTENT_LAVA                                    = -5;
+const int              CONTENT_SKY                                             = -6;
 
 // Vector / Hull Constants
 const vector   VEC_1                                                   = '1 1 1';
@@ -64,85 +59,85 @@ const vector        VEC_HULL_MIN                                    = '-16 -16 -24';
 const vector   VEC_HULL_MAX                                    = '16 16 32';
 
 // Effect Constants
-const float    EF_NODRAW                                               = 16;
-const float    EF_ADDITIVE                                             = 32;
-const float    EF_BLUE                                                 = 64;
-const float    EF_RED                                                  = 128;
-const float    EF_FULLBRIGHT                                   = 512;
-const float    EF_FLAME                                                = 1024;
-const float    EF_STARDUST                                             = 2048;
-const float    EF_NOSHADOW                                             = 4096;
-const float    EF_NODEPTHTEST                                  = 8192;
+const int      EF_NODRAW                                               = 16;
+const int      EF_ADDITIVE                                             = 32;
+const int      EF_BLUE                                                 = 64;
+const int      EF_RED                                                  = 128;
+const int      EF_FULLBRIGHT                                   = 512;
+const int      EF_FLAME                                                = 1024;
+const int      EF_STARDUST                                             = 2048;
+const int      EF_NOSHADOW                                             = 4096;
+const int      EF_NODEPTHTEST                                  = 8192;
 
 // Quake Player Flag Constants
-const float    PFL_ONGROUND                                    = 1;
-const float    PFL_CROUCH                                              = 2;
-const float    PFL_DEAD                                                = 4;
-const float    PFL_GIBBED                                              = 8;
+const int      PFL_ONGROUND                                    = 1;
+const int      PFL_CROUCH                                              = 2;
+const int      PFL_DEAD                                                = 4;
+const int      PFL_GIBBED                                              = 8;
 
 // Quake Temporary Entity Constants
-const float            TE_SPIKE                                                = 0;
-const float            TE_SUPERSPIKE                                   = 1;
-const float            TE_GUNSHOT                                              = 2;
-const float            TE_EXPLOSION                                    = 3;
-const float            TE_TAREXPLOSION                                 = 4;
-const float            TE_LIGHTNING1                                   = 5;
-const float            TE_LIGHTNING2                                   = 6;
-const float            TE_WIZSPIKE                                             = 7;
-const float            TE_KNIGHTSPIKE                                  = 8;
-const float            TE_LIGHTNING3                                   = 9;
-const float            TE_LAVASPLASH                                   = 10;
-const float            TE_TELEPORT                                             = 11;
-const float    TE_EXPLOSION2                                   = 12;
+const int              TE_SPIKE                                                = 0;
+const int              TE_SUPERSPIKE                                   = 1;
+const int              TE_GUNSHOT                                              = 2;
+const int              TE_EXPLOSION                                    = 3;
+const int              TE_TAREXPLOSION                                 = 4;
+const int              TE_LIGHTNING1                                   = 5;
+const int              TE_LIGHTNING2                                   = 6;
+const int              TE_WIZSPIKE                                             = 7;
+const int              TE_KNIGHTSPIKE                                  = 8;
+const int              TE_LIGHTNING3                                   = 9;
+const int              TE_LAVASPLASH                                   = 10;
+const int              TE_TELEPORT                                             = 11;
+const int      TE_EXPLOSION2                                   = 12;
 // Darkplaces Additions
-const float    TE_EXPLOSIONRGB                                 = 53;
-const float            TE_GUNSHOTQUAD                                  = 57;
-const float            TE_EXPLOSIONQUAD                                = 70;
+const int      TE_EXPLOSIONRGB                                 = 53;
+const int              TE_GUNSHOTQUAD                                  = 57;
+const int              TE_EXPLOSIONQUAD                                = 70;
 
 // Math Constants
-const float    EXTRA_LOW                                               = -99999999;
-const float    EXTRA_HIGH                                              = 99999999;
+const int      EXTRA_LOW                                               = -99999999;
+const int      EXTRA_HIGH                                              = 99999999;
 
 // Frik File Constants
-const float            FILE_READ                                               = 0;
-const float            FILE_APPEND                                             = 1;
-const float            FILE_WRITE                                              = 2;
+const int              FILE_READ                                               = 0;
+const int              FILE_APPEND                                             = 1;
+const int              FILE_WRITE                                              = 2;
 
 // Button values used by input_buttons
-const float BUTTON_ATTACK = 1;
-const float BUTTON_JUMP = 2;
-const float BUTTON_3 = 4;
-const float BUTTON_4 = 8;
-const float BUTTON_5 = 16;
-const float BUTTON_6 = 32;
-const float BUTTON7 = 64;
-const float BUTTON8 = 128;
-const float BUTTON_USE = 256;
-const float BUTTON_CHAT = 512;
-const float BUTTON_PRYDONCURSOR = 1024;
-const float BUTTON_9 = 2048;
-const float BUTTON_10 = 4096;
-const float BUTTON_11 = 8192;
-const float BUTTON_12 = 16384;
-const float BUTTON_13 = 32768;
-const float BUTTON_14 = 65536;
-const float BUTTON_15 = 131072;
-const float BUTTON_16 = 262144;
-
-#define        SOLID_NOT                               0               // no interaction with other objects
-#define        SOLID_TRIGGER                   1               // touch on edge, but not blocking
-#define        SOLID_BBOX                              2               // touch on edge, block
-#define        SOLID_SLIDEBOX                  3               // touch on edge, but not an onground
-#define        SOLID_BSP                               4               // bsp clip, touch on edge, block
-#define        SOLID_CORPSE                    5               // same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters)
-
-const float MOVE_NORMAL = 0; // same as FALSE
-const float MOVE_NOMONSTERS = 1; // same as TRUE
-const float MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE
-const float MOVE_HITMODEL = 4;
-const float MOVE_WORLDONLY = 3;
-
-const float CAMERA_FREE = 1;
-const float CAMERA_CHASE = 2;
-
-const float EF_NOMODELFLAGS = 8388608;
+const int BUTTON_ATTACK = 1;
+const int BUTTON_JUMP = 2;
+const int BUTTON_3 = 4;
+const int BUTTON_4 = 8;
+const int BUTTON_5 = 16;
+const int BUTTON_6 = 32;
+const int BUTTON7 = 64;
+const int BUTTON8 = 128;
+const int BUTTON_USE = 256;
+const int BUTTON_CHAT = 512;
+const int BUTTON_PRYDONCURSOR = 1024;
+const int BUTTON_9 = 2048;
+const int BUTTON_10 = 4096;
+const int BUTTON_11 = 8192;
+const int BUTTON_12 = 16384;
+const int BUTTON_13 = 32768;
+const int BUTTON_14 = 65536;
+const int BUTTON_15 = 131072;
+const int BUTTON_16 = 262144;
+
+const int SOLID_NOT            = 0; // no interaction with other objects
+const int SOLID_TRIGGER        = 1; // touch on edge, but not blocking
+const int SOLID_BBOX           = 2; // touch on edge, block
+const int SOLID_SLIDEBOX       = 3; // touch on edge, but not an onground
+const int SOLID_BSP            = 4; // bsp clip, touch on edge, block
+const int SOLID_CORPSE         = 5; // same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters)
+
+const int MOVE_NORMAL = 0; // same as false
+const int MOVE_NOMONSTERS = 1; // same as true
+const int MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE
+const int MOVE_HITMODEL = 4;
+const int MOVE_WORLDONLY = 3;
+
+const int CAMERA_FREE = 1;
+const int CAMERA_CHASE = 2;
+
+const int EF_NOMODELFLAGS = 8388608;
index 4cb416063509daca3b6ad6b8b920dbf2ce0a7a53..dde4461821ee9feef7e501d25961931082a79028 100644 (file)
@@ -1,11 +1,35 @@
-void CSQCModel_Hook_PreDraw(float isplayer);
+#if defined(CSQC)
+       #include "gibs.qh"
+       #include "miscfunctions.qh"
+       #include "player_skeleton.qh"
+       #include "sortlist.qh"
 
-.float isplayermodel;
+       #include "../client/weapons/projectile.qh"
+
+       #include "../common/animdecide.qh"
+       #include "../common/csqcmodel_settings.qh"
+
+       #include "../csqcmodellib/cl_model.qh"
+       #include "../csqcmodellib/cl_player.qh"
+       #include "../csqcmodellib/interpolate.qh"
+
+       #include "../warpzonelib/mathlib.qh"
+
+       .float death_time;
+       .int modelflags;
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
+
+void CSQCModel_Hook_PreDraw(bool isplayer);
+
+.bool isplayermodel;
 
 // FEATURE: LOD
-.float lodmodelindex0;
-.float lodmodelindex1;
-.float lodmodelindex2;
+.int lodmodelindex0;
+.int lodmodelindex1;
+.int lodmodelindex2;
 void CSQCPlayer_LOD_Apply(void)
 {
        // LOD model loading
@@ -71,26 +95,26 @@ void CSQCPlayer_LOD_Apply(void)
 
 // FEATURE: forcemodel and model color selection (MUST be called BEFORE LOD!)
 string forceplayermodels_model;
-float forceplayermodels_modelisgoodmodel;
-float forceplayermodels_modelindex;
-float forceplayermodels_skin;
+bool forceplayermodels_modelisgoodmodel;
+int forceplayermodels_modelindex;
+int forceplayermodels_skin;
 
 string forceplayermodels_mymodel;
-float forceplayermodels_myisgoodmodel;
-float forceplayermodels_mymodelindex;
+bool forceplayermodels_myisgoodmodel;
+int forceplayermodels_mymodelindex;
 
-float forceplayermodels_attempted;
+bool forceplayermodels_attempted;
 
 .string forceplayermodels_savemodel;
-.float forceplayermodels_savemodelindex;
-.float forceplayermodels_saveskin;
-.float forceplayermodels_savecolormap;
+.int forceplayermodels_savemodelindex;
+.int forceplayermodels_saveskin;
+.int forceplayermodels_savecolormap;
 
 .string forceplayermodels_isgoodmodel_mdl;
-.float forceplayermodels_isgoodmodel;
+.bool forceplayermodels_isgoodmodel;
 
 string forceplayermodels_goodmodel;
-float forceplayermodels_goodmodelindex;
+int forceplayermodels_goodmodelindex;
 
 .vector glowmod;
 .vector old_glowmod;
@@ -117,7 +141,7 @@ void CSQCPlayer_ModelAppearance_PostUpdate(void)
                        printf("Warning: missing model %s has been used\n", self.forceplayermodels_savemodel);
        }
 }
-void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
+void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer)
 {
        // FORCEMODEL
        // which one is ALWAYS good?
@@ -177,8 +201,8 @@ void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
        }
 
        // apply it
-       float isfriend;
-       float cm;
+       bool isfriend;
+       int cm;
        cm = self.forceplayermodels_savecolormap;
        cm = (cm >= 1024) ? cm : (stof(getplayerkeyvalue(cm - 1, "colors")) + 1024);
 
@@ -216,8 +240,8 @@ void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
        if(teamplay)
        {
                // own team's color is never forced
-               float forcecolor_friend = 0;
-               float forcecolor_enemy = 0;
+               int forcecolor_friend = 0;
+               int forcecolor_enemy = 0;
                entity tm;
 
                if(autocvar_cl_forcemyplayercolors)
@@ -267,7 +291,7 @@ void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
 
        // GLOWMOD AND DEATH FADING
        if(self.colormap > 0)
-               self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, TRUE) * 2;
+               self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, true) * 2;
        else
                self.glowmod = '1 1 1';
 
@@ -280,9 +304,9 @@ void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
                        self.colormap = 0;
 
                        self.glowmod = self.old_glowmod * bound(0, 1 - (time - self.death_time) / autocvar_cl_deathglow, 1);
-                       self.glowmod_x = max(self.glowmod_x, 0.0001);
-                       self.glowmod_y = max(self.glowmod_y, 0.0001);
-                       self.glowmod_z = max(self.glowmod_z, 0.0001);
+                       self.glowmod_x = max(self.glowmod.x, 0.0001);
+                       self.glowmod_y = max(self.glowmod.y, 0.0001);
+                       self.glowmod_z = max(self.glowmod.z, 0.0001);
                }
                else if(self.old_glowmod != '0 0 0') { self.old_glowmod = '0 0 0'; }
        }
@@ -291,13 +315,13 @@ void CSQCPlayer_ModelAppearance_Apply(float islocalplayer)
 }
 
 // FEATURE: fallback frames
-.float csqcmodel_saveframe;
-.float csqcmodel_saveframe2;
+.int csqcmodel_saveframe;
+.int csqcmodel_saveframe2;
 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
-.float csqcmodel_saveframe3;
-.float csqcmodel_saveframe4;
+.int csqcmodel_saveframe3;
+.int csqcmodel_saveframe4;
 #endif
-.float csqcmodel_framecount;
+.int csqcmodel_framecount;
 
 #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1)
 void CSQCPlayer_FallbackFrame_PreUpdate(void)
@@ -309,7 +333,7 @@ void CSQCPlayer_FallbackFrame_PreUpdate(void)
        self.frame4 = self.csqcmodel_saveframe4;
 #endif
 }
-void CSQCPlayer_FallbackFrame_PostUpdate(float isnew)
+void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew)
 {
        self.csqcmodel_saveframe = self.frame;
        self.csqcmodel_saveframe2 = self.frame2;
@@ -322,25 +346,24 @@ void CSQCPlayer_FallbackFrame_PostUpdate(float isnew)
        // player "pops in"
        if(isnew)
        {
-#define FIX_FRAMETIME(f,ft) \
-               if(IS_DEAD_FRAME(self.f) && self.ft != 0 && self.death_time != 0) \
-               { \
-                       self.ft = self.death_time; \
-               }
-               FIX_FRAMETIME(frame, frame1time)
-               FIX_FRAMETIME(frame2, frame2time)
+#define FIX_FRAMETIME(f,ft) do {                                                                                                                                                                       \
+               if(IS_DEAD_FRAME(self.f) && self.ft != 0 && self.death_time != 0)                                                                                       \
+                       self.ft = self.death_time;                                                                                                                                                              \
+} while(0)
+               FIX_FRAMETIME(frame, frame1time);
+               FIX_FRAMETIME(frame2, frame2time);
 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
-               FIX_FRAMETIME(frame3, frame3time)
-               FIX_FRAMETIME(frame4, frame4time)
+               FIX_FRAMETIME(frame3, frame3time);
+               FIX_FRAMETIME(frame4, frame4time);
 #endif
        }
        self.csqcmodel_isdead = IS_DEAD_FRAME(self.frame);
 }
-void CSQCPlayer_AnimDecide_PostUpdate(float isnew)
+void CSQCPlayer_AnimDecide_PostUpdate(bool isnew)
 {
        self.csqcmodel_isdead = !!(self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
 }
-float CSQCPlayer_FallbackFrame(float f)
+int CSQCPlayer_FallbackFrame(int f)
 {
        if(frameduration(self.modelindex, f) > 0)
                return f; // goooooood
@@ -372,8 +395,8 @@ void CSQCPlayer_FallbackFrame_Apply(void)
 
 // FEATURE: auto tag_index
 .entity tag_entity;
-.float tag_entity_lastmodelindex;
-.float tag_index;
+.int tag_entity_lastmodelindex;
+.int tag_index;
 void CSQCModel_AutoTagIndex_Apply(void)
 {
        if(self.tag_entity && wasfreed(self.tag_entity))
@@ -382,7 +405,7 @@ void CSQCModel_AutoTagIndex_Apply(void)
        if(self.tag_networkentity)
        {
                // we are ATTACHED!
-               float changed = 0;
+               bool changed = 0;
                if(self.tag_entity.entnum != self.tag_networkentity)
                {
                        self.tag_entity = findfloat(world, entnum, self.tag_networkentity);
@@ -447,24 +470,24 @@ void CSQCModel_AutoTagIndex_Apply(void)
 }
 
 // FEATURE: EF_NODRAW workalike
-const float EF_BRIGHTFIELD     = 1;
-const float EF_BRIGHTLIGHT     = 4;
-const float EF_DIMLIGHT        = 8;
-const float EF_DOUBLESIDED = 32768;
-const float EF_NOSELFSHADOW = 65536;
-const float EF_DYNAMICMODELLIGHT = 131072;
-const float EF_RESTARTANIM_BIT = 1048576;
-const float EF_TELEPORT_BIT = 2097152;
-const float MF_ROCKET  =   1; // leave a trail
-const float MF_GRENADE =   2; // leave a trail
-const float MF_GIB     =   4; // leave a trail
-const float MF_ROTATE  =   8; // rotate (bonus items)
-const float MF_TRACER  =  16; // green split trail
-const float MF_ZOMGIB  =  32; // small blood trail
-const float MF_TRACER2 =  64; // orange split trail
-const float MF_TRACER3 = 128; // purple trail
-.float csqcmodel_effects;
-.float csqcmodel_modelflags;
+const int EF_BRIGHTFIELD       = 1;
+const int EF_BRIGHTLIGHT       = 4;
+const int EF_DIMLIGHT          = 8;
+const int EF_DOUBLESIDED       = 32768;
+const int EF_NOSELFSHADOW      = 65536;
+const int EF_DYNAMICMODELLIGHT = 131072;
+const int EF_RESTARTANIM_BIT = 1048576;
+const int EF_TELEPORT_BIT = 2097152;
+const int MF_ROCKET  =   1; // leave a trail
+const int MF_GRENADE =   2; // leave a trail
+const int MF_GIB     =   4; // leave a trail
+const int MF_ROTATE  =   8; // rotate (bonus items)
+const int MF_TRACER  =  16; // green split trail
+const int MF_ZOMGIB  =  32; // small blood trail
+const int MF_TRACER2 =  64; // orange split trail
+const int MF_TRACER3 = 128; // purple trail
+.int csqcmodel_effects;
+.int csqcmodel_modelflags;
 void CSQCModel_Effects_PreUpdate(void)
 {
        self.effects = self.csqcmodel_effects;
@@ -485,11 +508,10 @@ void CSQCModel_Effects_PostUpdate(void)
        if(self.csqcmodel_teleported)
                Projectile_ResetTrail(self.origin);
 }
-.float snd_looping;
+.int snd_looping;
 void CSQCModel_Effects_Apply(void)
 {
-       float eff = self.csqcmodel_effects;
-       eff &= ~CSQCMODEL_EF_RESPAWNGHOST;
+       int eff = self.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST;
 
        self.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
        self.effects = 0;
@@ -582,17 +604,17 @@ void CSQCPlayer_Precache()
 }
 
 // general functions
-.float csqcmodel_predraw_run;
-.float anim_frame;
-.float anim_frame1time;
-.float anim_frame2;
-.float anim_frame2time;
-.float anim_saveframe;
-.float anim_saveframe1time;
-.float anim_saveframe2;
-.float anim_saveframe2time;
-.float anim_prev_pmove_flags;
-void CSQCModel_Hook_PreDraw(float isplayer)
+.int csqcmodel_predraw_run;
+.int anim_frame;
+.int anim_frame1time;
+.int anim_frame2;
+.int anim_frame2time;
+.int anim_saveframe;
+.int anim_saveframe1time;
+.int anim_saveframe2;
+.int anim_saveframe2time;
+.int anim_prev_pmove_flags;
+void CSQCModel_Hook_PreDraw(bool isplayer)
 {
        if(self.csqcmodel_predraw_run == framecount)
                return;
@@ -613,7 +635,7 @@ void CSQCModel_Hook_PreDraw(float isplayer)
                if(!isplayer)
                {
                        skeleton_loadinfo(self);
-                       float doblend = (self.bone_upperbody >= 0);
+                       bool doblend = (self.bone_upperbody >= 0);
                        CSQCPlayer_FallbackFrame_Apply();
                        if(doblend)
                        {
@@ -631,17 +653,17 @@ void CSQCModel_Hook_PreDraw(float isplayer)
                {
                        // we know that frame3 and frame4 fields, used by InterpolateAnimation, are left alone - but that is all we know!
                        skeleton_loadinfo(self);
-                       float doblend = (self.bone_upperbody >= 0);
-                       float onground = 0;
+                       bool doblend = (self.bone_upperbody >= 0);
+                       bool onground = 0;
                        if(self == csqcplayer)
                        {
                                if(self.pmove_flags & PMF_ONGROUND)
                                        onground = 1;
                                self.anim_prev_pmove_flags = self.pmove_flags;
                                if(self.pmove_flags & PMF_DUCKED)
-                                       animdecide_setstate(self, self.anim_state | ANIMSTATE_DUCK, FALSE);
+                                       animdecide_setstate(self, self.anim_state | ANIMSTATE_DUCK, false);
                                else if(self.anim_state & ANIMSTATE_DUCK)
-                                       animdecide_setstate(self, self.anim_state - ANIMSTATE_DUCK, FALSE);
+                                       animdecide_setstate(self, self.anim_state - ANIMSTATE_DUCK, false);
                        }
                        else
                        {
@@ -652,7 +674,7 @@ void CSQCModel_Hook_PreDraw(float isplayer)
                        animdecide_load_if_needed(self);
                        animdecide_setimplicitstate(self, onground);
                        animdecide_setframes(self, doblend, anim_frame, anim_frame1time, anim_frame2, anim_frame2time);
-                       float sf = 0;
+                       int sf = 0;
                        if(self.anim_saveframe != self.anim_frame || self.anim_saveframe1time != self.anim_frame1time)
                                sf |= CSQCMODEL_PROPERTY_FRAME;
                        if(self.anim_saveframe2 != self.anim_frame2 || self.anim_saveframe2time != self.anim_frame2time)
@@ -669,7 +691,7 @@ void CSQCModel_Hook_PreDraw(float isplayer)
                        self.frame1time = self.anim_frame1time;
                        self.frame2 = self.anim_frame2;
                        self.frame2time = self.anim_frame2time;
-                       CSQCModel_InterpolateAnimation_2To4_Note(sf | CSQCMODEL_PROPERTY_LERPFRAC, FALSE);
+                       CSQCModel_InterpolateAnimation_2To4_Note(sf | CSQCMODEL_PROPERTY_LERPFRAC, false);
                        CSQCModel_InterpolateAnimation_2To4_Do();
                        if(doblend)
                        {
@@ -690,7 +712,7 @@ void CSQCModel_Hook_PreDraw(float isplayer)
        CSQCModel_Effects_Apply();
 }
 
-void CSQCModel_Hook_PreUpdate(float isnew, float isplayer, float islocalplayer)
+void CSQCModel_Hook_PreUpdate(bool isnew, bool isplayer, bool islocalplayer)
 {
        // interpolate v_angle
        self.iflags |= IFLAG_V_ANGLE_X;
@@ -704,7 +726,7 @@ void CSQCModel_Hook_PreUpdate(float isnew, float isplayer, float islocalplayer)
        }
 }
 
-void CSQCModel_Hook_PostUpdate(float isnew, float isplayer, float islocalplayer)
+void CSQCModel_Hook_PostUpdate(bool isnew, bool isplayer, bool islocalplayer)
 {
        // is it a player model? (shared state)
        self.isplayermodel = (substring(self.model, 0, 14) == "models/player/" || substring(self.model, 0, 17) == "models/ok_player/");
index 0cbcfbd085d49af7814bf5af04897c1c39fd6549..e3660b21a295c01ce7a079187898f6bfba1b1d3b 100644 (file)
@@ -1,3 +1,19 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "defs.qh"
+       #include "../common/constants.qh"
+       #include "../common/util.qh"
+       #include "../common/weapons/weapons.qh"
+       #include "autocvars.qh"
+       #include "../common/deathtypes.qh"
+       #include "damage.qh"
+       #include "movetypes.qh"
+       #include "prandom.qh"
+       #include "vehicles/vehicles.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
 void DamageEffect_Think()
 {
        // if particle distribution is enabled, slow ticrate by total number of damages
@@ -31,11 +47,12 @@ void DamageEffect_Think()
        pointparticles(self.team, org, '0 0 0', 1);
 }
 
-void DamageEffect(vector hitorg, float dmg, float type, float specnum)
+void DamageEffect(vector hitorg, float dmg, int type, int specnum)
 {
        // particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets)
 
-       float life, nearestbone = 0;
+       int nearestbone = 0;
+       float life;
        string specstr, effectname;
        entity e;
 
@@ -85,7 +102,7 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum)
                {
                        specstr = species_prefix(specnum);
                        specstr = substring(specstr, 0, strlen(specstr) - 1);
-                       effectname = strreplace("BLOOD", specstr, effectname); 
+                       effectname = strreplace("BLOOD", specstr, effectname);
                }
                else { return; } // objects don't bleed
        }
@@ -104,7 +121,9 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum)
 
 void Ent_DamageInfo(float isNew)
 {
-       float dmg, rad, edge, thisdmg, forcemul, species, hitplayer = FALSE;
+       float dmg, rad, edge, thisdmg;
+       bool hitplayer = false;
+       int species, forcemul;
        vector force, thisforce;
        entity oldself;
 
@@ -114,9 +133,9 @@ void Ent_DamageInfo(float isNew)
        w_issilent = (w_deathtype & 0x8000);
        w_deathtype = (w_deathtype & 0x7FFF);
 
-       w_org_x = ReadCoord();
-       w_org_y = ReadCoord();
-       w_org_z = ReadCoord();
+       w_org.x = ReadCoord();
+       w_org.y = ReadCoord();
+       w_org.z = ReadCoord();
 
        dmg = ReadByte();
        rad = ReadByte();
@@ -185,7 +204,7 @@ void Ent_DamageInfo(float isNew)
                DamageEffect(w_org, thisdmg, w_deathtype, species);
 
                if(self.isplayermodel)
-                       hitplayer = TRUE; // this impact damaged a player
+                       hitplayer = true; // this impact damaged a player
        }
 
        self = oldself;
@@ -329,9 +348,7 @@ void Ent_DamageInfo(float isNew)
        if(!DEATH_ISSPECIAL(w_deathtype))
        if(!hitplayer || rad) // don't show ground impacts for hitscan weapons if a player was hit
        {
-               float hitwep;
-
-               hitwep = DEATH_WEAPONOFWEAPONDEATH(w_deathtype);
+               int hitwep = DEATH_WEAPONOFWEAPONDEATH(w_deathtype);
                w_random = prandom();
 
                traceline(w_org - normalize(force) * 16, w_org + normalize(force) * 16, MOVE_NOMONSTERS, world);
index 23982f132c0ee33c2085af8ebe403b8c95698cb9..7c5c74130e41d8e7cf3dd27ade14b5748eef38bc 100644 (file)
@@ -1 +1,5 @@
-.float total_damages; // number of effects which currently are attached to a player
\ No newline at end of file
+#ifndef DAMAGE_H
+#define DAMAGE_H
+
+.float total_damages; // number of effects which currently are attached to a player
+#endif
diff --git a/qcsrc/client/defs.qh b/qcsrc/client/defs.qh
new file mode 100644 (file)
index 0000000..82c43e2
--- /dev/null
@@ -0,0 +1,134 @@
+#ifndef DEFS_H
+#define DEFS_H
+
+// Additional OPTIONAL Fields and Globals
+//float                intermission;
+float          scoreboard_showscores;
+float          scoreboard_showaccuracy;
+.string                message;
+.int           renderflags;
+// float               coop;
+// float               deathmatch;
+
+float          dmg_take;
+// float               dmg_save;
+// vector              dmg_origin;
+
+// Darkplaces Render Modifications
+#if 0
+.float alpha;
+.float renderflags;
+.vector colormod;
+.float scale;
+#endif
+
+// Basic variables
+.float enttype; // entity type sent from server
+.int   sv_entnum; // entity number sent from server
+.int team;
+.int team_size;
+
+float vid_conwidth, vid_conheight;
+int binddb;
+
+// QUALIFYING
+float race_checkpoint;
+float race_time;
+float race_laptime;
+float race_checkpointtime;
+float race_previousbesttime;
+string race_previousbestname;
+float race_nextcheckpoint;
+float race_nextbesttime;
+string race_nextbestname;
+float race_penaltyaccumulator; // qualifying: total penalty time in tenths
+float race_penaltyeventtime; // time when the player got the penalty
+float race_penaltytime; // duration of penalty time, in tenths
+string race_penaltyreason; // reason for penalty
+float race_server_record; // server record
+float race_speedaward;
+string race_speedaward_holder;
+float race_speedaward_alltimebest;
+string race_speedaward_alltimebest_holder;
+
+// RACE
+float race_mycheckpoint;
+float race_mycheckpointtime;
+float race_mycheckpointdelta;
+float race_mycheckpointlapsdelta;
+string race_mycheckpointenemy;
+float race_othercheckpoint;
+float race_othercheckpointtime;
+float race_othercheckpointdelta;
+float race_othercheckpointlapsdelta;
+string race_othercheckpointenemy;
+float scoreboard_showscores_force;
+float race_status;
+string race_status_name;
+float race_myrank;
+
+// Nexball
+float nb_pb_period;
+
+// Spectating
+float spectatee_status;
+
+// short mapname
+string shortmapname;
+
+// database for misc stuff
+int tempdb;
+int ClientProgsDB;
+vector hook_shotorigin[4];
+vector lightning_shotorigin[4];
+
+
+#ifdef BLURTEST
+float blurtest_time0, blurtest_time1, blurtest_radius, blurtest_power;
+#endif
+
+float servertime, serverprevtime, serverdeltatime;
+
+float ticrate;
+
+.float damageforcescale;
+const float MIN_DAMAGEEXTRARADIUS = 2;
+const float MAX_DAMAGEEXTRARADIUS = 16;
+.float damageextraradius;
+.void(float thisdmg, int hittype, vector org, vector thisforce) event_damage;
+
+// only for Porto
+float angles_held_status;
+vector angles_held;
+
+// weapons
+.bool silent;
+
+int w_deathtype;
+float w_issilent, w_random;
+vector w_org, w_backoff;
+
+float rifle_scope;
+float vortex_scope;
+
+float minelayer_maxmines;
+
+float hagar_maxrockets;
+
+float bgmtime;
+
+string weaponorder_byimpulse;
+string weaponorder_bypriority;
+
+float vortex_charge_movingavg;
+
+int serverflags;
+
+float uid2name_dialog;
+
+.bool csqcmodel_isdead; // used by shownames and miscfunctions (float getplayerisdead(float) {}) to know when a player is dead
+
+#define player_currententnum (spectatee_status > 0 ? spectatee_status : player_localnum + 1)
+
+float g_balance_porto_secondary;
+#endif
index c35a3a94a7577dc7724a3ebe0330e08cf6c19bf3..95623505b83e297d2a7e63e12a4f78e378838d5b 100644 (file)
@@ -1,3 +1,10 @@
+#if defined(CSQC)
+    #include "../dpdefs/csprogsdefs.qh"
+    #include "autocvars.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
 /*
 .vector fx_start;
 .vector fx_end;
@@ -30,7 +37,7 @@ void b_make(vector s,vector e, string t,float l,float z)
 }
 */
 
-void cl_effetcs_lightningarc(vector from, vector to,float seglength,float drifts,float drifte,float branchfactor,float branchfactor_add)
+void cl_effects_lightningarc(vector from, vector to,float seglength,float drifts,float drifte,float branchfactor,float branchfactor_add)
 {
     vector direction,dirnew, pos, pos_l;
     float length, steps, steplength, i,drift;
@@ -39,7 +46,9 @@ void cl_effetcs_lightningarc(vector from, vector to,float seglength,float drifts
     if(length < 1)
         return;
 
-    steps      = floor(length / seglength);
+    // Use at most 16 te_lightning1 segments, as these eat up beam list segments.
+    // TODO: Change this to R_BeginPolygon code, then we no longer have this limit.
+    steps      = min(16, floor(length / seglength));
     if(steps < 1)
     {
         te_lightning1(world,from,to);
@@ -57,8 +66,9 @@ void cl_effetcs_lightningarc(vector from, vector to,float seglength,float drifts
             dirnew = normalize(direction * (1 - drift) + randomvec() * drift);
             pos = pos_l +  dirnew * steplength;
             te_lightning1(world,pos_l,pos);
-            if(random() < branchfactor)
-                cl_effetcs_lightningarc(pos, pos + (dirnew * length * 0.25),seglength,drifts,drifte,min(branchfactor + branchfactor_add,1),branchfactor_add);
+            // WTF endless recursion if branchfactor is 1.0 (possibly due to adding branchfactor_add). FIXME
+            // if(random() < branchfactor)
+            //     cl_effects_lightningarc(pos, pos + (dirnew * length * 0.25),seglength,drifts,drifte,min(branchfactor + branchfactor_add,1),branchfactor_add);
 
             pos_l = pos;
         }
@@ -74,8 +84,8 @@ void Net_ReadLightningarc()
 {
        vector from, to;
 
-    from_x = ReadCoord(); from_y = ReadCoord(); from_z = ReadCoord();
-    to_x   = ReadCoord(); to_y   = ReadCoord(); to_z   = ReadCoord();
+    from.x = ReadCoord(); from.y = ReadCoord(); from.z = ReadCoord();
+    to.x = ReadCoord(); to.y = ReadCoord(); to.z = ReadCoord();
 
     if(autocvar_cl_effects_lightningarc_simple)
     {
@@ -91,7 +101,7 @@ void Net_ReadLightningarc()
         branchfactor     = autocvar_cl_effects_lightningarc_branchfactor_start;
         branchfactor_add = autocvar_cl_effects_lightningarc_branchfactor_add;
 
-        cl_effetcs_lightningarc(from,to,seglength,drifts,drifte,branchfactor,branchfactor_add);
+        cl_effects_lightningarc(from,to,seglength,drifts,drifte,branchfactor,branchfactor_add);
     }
 
 }
index 835d14a1ee6f3b6d9336ae96ffdbef27ac6c6cc6..eb7d4787777c0435b67721dd874aff64a87592e7 100644 (file)
@@ -1,11 +1,11 @@
-.float silent;
+#include "gibs.qh"
 
 void Gib_Delete()
 {
        remove(self);
 }
 
-string species_prefix(float specnum)
+string species_prefix(int specnum)
 {
        switch(specnum)
        {
@@ -20,7 +20,7 @@ string species_prefix(float specnum)
        }
 }
 
-void Gib_setmodel(entity gib, string mdlname, float specnum)
+void Gib_setmodel(entity gib, string mdlname, int specnum)
 {
        switch(specnum)
        {
@@ -48,7 +48,7 @@ void Gib_setmodel(entity gib, string mdlname, float specnum)
        }
 }
 
-void new_te_bloodshower (float ef, vector org, float explosionspeed, float howmany)
+void new_te_bloodshower (int ef, vector org, float explosionspeed, int howmany)
 {
        float i, pmod;
        pmod = autocvar_cl_particles_quality;
@@ -109,7 +109,7 @@ void Gib_Draw()
        }
 }
 
-void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector vrand, float specnum, float destroyontouch, float issilent)
+void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector vrand, int specnum, bool destroyontouch, bool issilent)
 {
        entity gib;
 
@@ -151,21 +151,22 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector
        RubbleLimit("gib", autocvar_cl_gibs_maxcount, Gib_Delete);
 }
 
-void Ent_GibSplash(float isNew)
+void Ent_GibSplash(bool isNew)
 {
-       float amount, type, specnum;
+       int amount, type, specnum;
        vector org, vel;
        string specstr;
-       float issilent;
+       bool issilent;
        string gentle_prefix = "morphed_";
 
-       float c, randomvalue;
+       float randomvalue;
+       int c;
 
        type = ReadByte(); // gibbage type
        amount = ReadByte() / 16.0; // gibbage amount
-       org_x = ReadShort() * 4 + 2;
-       org_y = ReadShort() * 4 + 2;
-       org_z = ReadShort() * 4 + 2;
+       org.x = ReadShort() * 4 + 2;
+       org.y = ReadShort() * 4 + 2;
+       org.z = ReadShort() * 4 + 2;
        vel = decompressShortVector(ReadShort());
 
        float cl_gentle_gibs = autocvar_cl_gentle_gibs;
diff --git a/qcsrc/client/gibs.qh b/qcsrc/client/gibs.qh
new file mode 100644 (file)
index 0000000..b33a1a5
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef GIBS_H
+#define GIBS_H
+
+.vector colormod;
+
+.bool silent;
+
+void Gib_Delete();
+
+string species_prefix(int specnum);
+
+void Gib_setmodel(entity gib, string mdlname, int specnum);
+
+void new_te_bloodshower (int ef, vector org, float explosionspeed, int howmany);
+
+void SUB_RemoveOnNoImpact();
+
+void Gib_Touch();
+
+void Gib_Draw();
+
+void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector vrand, int specnum, bool destroyontouch, bool issilent);
+
+void Ent_GibSplash(bool isNew);
+
+void GibSplash_Precache();
+#endif
index 8b2ffca19cdb6e9997edddd5f6c566d93a7b104a..8436ff6225a0ccc0e546bf5007fccec05720c394 100644 (file)
@@ -1,3 +1,7 @@
+#include "hud.qh"
+#include "noise.qh"
+#include "../warpzonelib/common.qh"
+
 .float HookType; // ENT_CLIENT_*
 .vector origin;
 .vector velocity;
@@ -52,7 +56,7 @@ void Draw_GrapplingHook()
        string tex;
        vector rgb;
        float t;
-       float s;
+       int s;
        vector vs;
        float intensity, offset;
 
@@ -86,7 +90,7 @@ void Draw_GrapplingHook()
                {
                        default:
                        case ENT_CLIENT_HOOK:
-                               a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z;
+                               a = view_origin + view_forward * vs.x + view_right * -vs.y + view_up * vs.z;
                                b = self.origin;
                                break;
                        case ENT_CLIENT_ARC_BEAM:
@@ -96,7 +100,7 @@ void Draw_GrapplingHook()
                                        b = view_origin + view_forward * vlen(self.velocity - self.origin); // honor original length of beam!
                                WarpZone_TraceLine(view_origin, b, MOVE_NORMAL, world);
                                b = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
-                               a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z;
+                               a = view_origin + view_forward * vs.x + view_right * -vs.y + view_up * vs.z;
                                break;
                }
        }
@@ -190,8 +194,7 @@ void Ent_ReadHook(float bIsNew, float type)
 {
        self.HookType = type;
 
-       float sf;
-       sf = ReadByte();
+       int sf = ReadByte();
 
        self.HookSilent = (sf & 0x80);
        self.iflags = IFLAG_VELOCITY | IFLAG_ORIGIN;
@@ -200,7 +203,7 @@ void Ent_ReadHook(float bIsNew, float type)
 
        if(sf & 1)
        {
-               float myowner = ReadByte();
+               int myowner = ReadByte();
                self.owner = playerslots[myowner - 1];
                self.sv_entnum = myowner;
                switch(self.HookType)
index 9e6861ebd06e7d05a4a0fabfc4c305dc4433c3c3..74a5df16627d45735fbbbbb876475ea428da3bf8 100644 (file)
@@ -1,3 +1,11 @@
+#include "scoreboard.qh"
+#include "teamradar.qh"
+#include "../common/buffs.qh"
+#include "../common/counting.qh"
+#include "../common/mapinfo.qh"
+#include "../common/nades.qh"
+#include "../server/t_items.qh"
+
 /*
 ==================
 Misc HUD functions
@@ -14,12 +22,12 @@ Misc HUD functions
 //   1/4 height: bottom part
 void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
 {
-    if (theBorderSize_x < 0 && theBorderSize_y < 0) // draw whole image as it is
+    if (theBorderSize.x < 0 && theBorderSize.y < 0) // draw whole image as it is
     {
                drawpic(theOrigin, pic, theSize, theColor, theAlpha, 0);
                return;
     }
-       if (theBorderSize_x == 0 && theBorderSize_y == 0) // no border
+       if (theBorderSize.x == 0 && theBorderSize.y == 0) // no border
        {
                // draw only the central part
                drawsubpic(theOrigin, theSize, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
@@ -30,16 +38,16 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
        vector width, height;
        vector bW, bH;
        //pic = draw_UseSkinFor(pic);
-       width = eX * theSize_x;
-       height = eY * theSize_y;
-       if(theSize_x <= theBorderSize_x * 2)
+       width = eX * theSize.x;
+       height = eY * theSize.y;
+       if(theSize.x <= theBorderSize.x * 2)
        {
                // not wide enough... draw just left and right then
-               bW = eX * (0.25 * theSize_x / (theBorderSize_x * 2));
-               if(theSize_y <= theBorderSize_y * 2)
+               bW = eX * (0.25 * theSize.x / (theBorderSize.x * 2));
+               if(theSize.y <= theBorderSize.y * 2)
                {
                        // not high enough... draw just corners
-                       bH = eY * (0.25 * theSize_y / (theBorderSize_y * 2));
+                       bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
                        drawsubpic(theOrigin,                 width * 0.5 + height * 0.5, pic, '0 0 0',           bW + bH, theColor, theAlpha, 0);
                        drawsubpic(theOrigin + width   * 0.5, width * 0.5 + height * 0.5, pic, eX - bW,           bW + bH, theColor, theAlpha, 0);
                        drawsubpic(theOrigin + height  * 0.5, width * 0.5 + height * 0.5, pic, eY - bH,           bW + bH, theColor, theAlpha, 0);
@@ -47,7 +55,7 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
                }
                else
                {
-                       dY = theBorderSize_x * eY;
+                       dY = theBorderSize.x * eY;
                        drawsubpic(theOrigin,                             width * 0.5          +     dY, pic, '0 0    0',           '0 0.25 0' + bW, theColor, theAlpha, 0);
                        drawsubpic(theOrigin + width * 0.5,               width * 0.5          +     dY, pic, '0 0    0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
                        drawsubpic(theOrigin                        + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0',           '0 0.5  0' + bW, theColor, theAlpha, 0);
@@ -58,11 +66,11 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
        }
        else
        {
-               if(theSize_y <= theBorderSize_y * 2)
+               if(theSize.y <= theBorderSize.y * 2)
                {
                        // not high enough... draw just top and bottom then
-                       bH = eY * (0.25 * theSize_y / (theBorderSize_y * 2));
-                       dX = theBorderSize_x * eX;
+                       bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
+                       dX = theBorderSize.x * eX;
                        drawsubpic(theOrigin,                                         dX + height * 0.5, pic, '0    0 0',           '0.25 0 0' + bH, theColor, theAlpha, 0);
                        drawsubpic(theOrigin + dX,                        width - 2 * dX + height * 0.5, pic, '0.25 0 0',           '0.5  0 0' + bH, theColor, theAlpha, 0);
                        drawsubpic(theOrigin + width - dX,                            dX + height * 0.5, pic, '0.75 0 0',           '0.25 0 0' + bH, theColor, theAlpha, 0);
@@ -72,8 +80,8 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
                }
                else
                {
-                       dX = theBorderSize_x * eX;
-                       dY = theBorderSize_x * eY;
+                       dX = theBorderSize.x * eX;
+                       dY = theBorderSize.x * eY;
                        drawsubpic(theOrigin,                                        dX          +     dY, pic, '0    0    0', '0.25 0.25 0', theColor, theAlpha, 0);
                        drawsubpic(theOrigin                  + dX,      width - 2 * dX          +     dY, pic, '0.25 0    0', '0.5  0.25 0', theColor, theAlpha, 0);
                        drawsubpic(theOrigin          + width - dX,                  dX          +     dY, pic, '0.75 0    0', '0.25 0.25 0', theColor, theAlpha, 0);
@@ -92,65 +100,111 @@ vector HUD_Get_Num_Color (float x, float maxvalue)
        float blinkingamt;
        vector color;
        if(x >= maxvalue) {
-               color_x = sin(2*M_PI*time);
-               color_y = 1;
-               color_z = sin(2*M_PI*time);
+               color.x = sin(2*M_PI*time);
+               color.y = 1;
+               color.z = sin(2*M_PI*time);
        }
        else if(x > maxvalue * 0.75) {
-               color_x = 0.4 - (x-150)*0.02 * 0.4; //red value between 0.4 -> 0
-               color_y = 0.9 + (x-150)*0.02 * 0.1; // green value between 0.9 -> 1
-               color_z = 0;
+               color.x = 0.4 - (x-150)*0.02 * 0.4; //red value between 0.4 -> 0
+               color.y = 0.9 + (x-150)*0.02 * 0.1; // green value between 0.9 -> 1
+               color.z = 0;
        }
        else if(x > maxvalue * 0.5) {
-               color_x = 1 - (x-100)*0.02 * 0.6; //red value between 1 -> 0.4
-               color_y = 1 - (x-100)*0.02 * 0.1; // green value between 1 -> 0.9
-               color_z = 1 - (x-100)*0.02; // blue value between 1 -> 0
+               color.x = 1 - (x-100)*0.02 * 0.6; //red value between 1 -> 0.4
+               color.y = 1 - (x-100)*0.02 * 0.1; // green value between 1 -> 0.9
+               color.z = 1 - (x-100)*0.02; // blue value between 1 -> 0
        }
        else if(x > maxvalue * 0.25) {
-               color_x = 1;
-               color_y = 1;
-               color_z = 0.2 + (x-50)*0.02 * 0.8; // blue value between 0.2 -> 1
+               color.x = 1;
+               color.y = 1;
+               color.z = 0.2 + (x-50)*0.02 * 0.8; // blue value between 0.2 -> 1
        }
        else if(x > maxvalue * 0.1) {
-               color_x = 1;
-               color_y = (x-20)*90/27/100; // green value between 0 -> 1
-               color_z = (x-20)*90/27/100 * 0.2; // blue value between 0 -> 0.2
+               color.x = 1;
+               color.y = (x-20)*90/27/100; // green value between 0 -> 1
+               color.z = (x-20)*90/27/100 * 0.2; // blue value between 0 -> 0.2
        }
        else {
-               color_x = 1;
-               color_y = 0;
-               color_z = 0;
+               color.x = 1;
+               color.y = 0;
+               color.z = 0;
        }
 
        blinkingamt = (1 - x/maxvalue/0.25);
        if(blinkingamt > 0)
        {
-               color_x = color_x - color_x * blinkingamt * sin(2*M_PI*time);
-               color_y = color_y - color_y * blinkingamt * sin(2*M_PI*time);
-               color_z = color_z - color_z * blinkingamt * sin(2*M_PI*time);
+               color.x = color.x - color.x * blinkingamt * sin(2*M_PI*time);
+               color.y = color.y - color.y * blinkingamt * sin(2*M_PI*time);
+               color.z = color.z - color.z * blinkingamt * sin(2*M_PI*time);
        }
        return color;
 }
 
+float HUD_GetRowCount(float item_count, vector size, float item_aspect)
+{
+       float aspect = size_y / size_x;
+       return bound(1, floor((sqrt(4 * item_aspect * aspect * item_count + aspect * aspect) + aspect + 0.5) / 2), item_count);
+}
+
+vector HUD_GetTableSize(float item_count, vector psize, float item_aspect)
+{
+       float columns, rows;
+       float ratio, best_ratio = 0;
+       float best_columns = 1, best_rows = 1;
+       bool vertical = (psize.x / psize.y >= item_aspect);
+       if(vertical)
+       {
+               psize = eX * psize.y + eY * psize.x;
+               item_aspect = 1 / item_aspect;
+       }
+
+       rows = ceil(sqrt(item_count));
+       columns = ceil(item_count/rows);
+       while(columns >= 1)
+       {
+               ratio = (psize.x/columns) / (psize.y/rows);
+               if(ratio > item_aspect)
+                       ratio = item_aspect * item_aspect / ratio;
+
+               if(ratio <= best_ratio)
+                       break; // ratio starts decreasing by now, skip next configurations
+
+               best_columns = columns;
+               best_rows = rows;
+               best_ratio = ratio;
+
+               if(columns == 1)
+                       break;
+
+               --columns;
+               rows = ceil(item_count/columns);
+       }
+
+       if(vertical)
+               return eX * best_rows + eY * best_columns;
+       else
+               return eX * best_columns + eY * best_rows;
+}
+
 float stringwidth_colors(string s, vector theSize)
 {
-       return stringwidth(s, TRUE, theSize);
+       return stringwidth(s, true, theSize);
 }
 
 float stringwidth_nocolors(string s, vector theSize)
 {
-       return stringwidth(s, FALSE, theSize);
+       return stringwidth(s, false, theSize);
 }
 
 void drawstringright(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag)
 {
-       position_x -= 2 / 3 * strlen(text) * theScale_x;
+       position.x -= 2 / 3 * strlen(text) * theScale.x;
        drawstring(position, text, theScale, rgb, theAlpha, flag);
 }
 
 void drawstringcenter(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag)
 {
-       position_x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * theScale_x);
+       position.x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * theScale.x);
        drawstring(position, text, theScale, rgb, theAlpha, flag);
 }
 
@@ -232,7 +286,7 @@ float race_CheckName(string net_name) {
        return 0;
 }
 
-float GetPlayerColorForce(float i)
+float GetPlayerColorForce(int i)
 {
        if(!teamplay)
                return 0;
@@ -240,7 +294,7 @@ float GetPlayerColorForce(float i)
                return stof(getplayerkeyvalue(i, "colors")) & 15;
 }
 
-float GetPlayerColor(float i)
+float GetPlayerColor(int i)
 {
        if(!playerslots[i].gotscores) // unconnected
                return NUM_SPECTATOR;
@@ -250,7 +304,7 @@ float GetPlayerColor(float i)
                return GetPlayerColorForce(i);
 }
 
-string GetPlayerName(float i)
+string GetPlayerName(int i)
 {
        return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
 }
@@ -263,9 +317,10 @@ HUD panels
 */
 
 // draw the background/borders
-#define HUD_Panel_DrawBg(theAlpha)\
-if(panel.current_panel_bg != "0" && panel.current_panel_bg != "")\
-       draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel.current_panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * theAlpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER))
+#define HUD_Panel_DrawBg(theAlpha) do {                                                                                                                                                                \
+       if(panel.current_panel_bg != "0" && panel.current_panel_bg != "")                                                                                               \
+               draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel.current_panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * theAlpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER));\
+} while(0)
 
 //basically the same code of draw_ButtonPicture and draw_VertButtonPicture for the menu
 void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, float vertical, float baralign, vector theColor, float theAlpha, float drawflag)
@@ -291,37 +346,37 @@ void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, flo
                }
 
         if (baralign == 1) // bottom align
-                       theOrigin_y += (1 - length_ratio) * theSize_y;
+                       theOrigin.y += (1 - length_ratio) * theSize.y;
         else if (baralign == 2) // center align
-            theOrigin_y += 0.5 * (1 - length_ratio) * theSize_y;
+            theOrigin.y += 0.5 * (1 - length_ratio) * theSize.y;
         else if (baralign == 3) // center align, positive values down, negative up
                {
-                       theSize_y *= 0.5;
+                       theSize.y *= 0.5;
                        if (length_ratio > 0)
-                               theOrigin_y += theSize_y;
+                               theOrigin.y += theSize.y;
                        else
                        {
-                               theOrigin_y += (1 + length_ratio) * theSize_y;
+                               theOrigin.y += (1 + length_ratio) * theSize.y;
                                length_ratio = -length_ratio;
                        }
                }
-               theSize_y *= length_ratio;
+               theSize.y *= length_ratio;
 
                vector bH;
-               width = eX * theSize_x;
-               height = eY * theSize_y;
-               if(theSize_y <= theSize_x * 2)
+               width = eX * theSize.x;
+               height = eY * theSize.y;
+               if(theSize.y <= theSize.x * 2)
                {
                        // button not high enough
                        // draw just upper and lower part then
-                       square = eY * theSize_y * 0.5;
-                       bH = eY * (0.25 * theSize_y / (theSize_x * 2));
+                       square = eY * theSize.y * 0.5;
+                       bH = eY * (0.25 * theSize.y / (theSize.x * 2));
                        drawsubpic(theOrigin,          square + width, pic, '0 0 0', eX + bH, theColor, theAlpha, drawflag);
                        drawsubpic(theOrigin + square, square + width, pic, eY - bH, eX + bH, theColor, theAlpha, drawflag);
                }
                else
                {
-                       square = eY * theSize_x;
+                       square = eY * theSize.x;
                        drawsubpic(theOrigin,                   width   +     square, pic, '0 0    0', '1 0.25 0', theColor, theAlpha, drawflag);
                        drawsubpic(theOrigin +          square, theSize - 2 * square, pic, '0 0.25 0', '1 0.5  0', theColor, theAlpha, drawflag);
                        drawsubpic(theOrigin + height - square, width   +     square, pic, '0 0.75 0', '1 0.25 0', theColor, theAlpha, drawflag);
@@ -333,37 +388,37 @@ void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, flo
                }
 
                if (baralign == 1) // right align
-                       theOrigin_x += (1 - length_ratio) * theSize_x;
+                       theOrigin.x += (1 - length_ratio) * theSize.x;
         else if (baralign == 2) // center align
-            theOrigin_x += 0.5 * (1 - length_ratio) * theSize_x;
+            theOrigin.x += 0.5 * (1 - length_ratio) * theSize.x;
         else if (baralign == 3) // center align, positive values on the right, negative on the left
                {
-                       theSize_x *= 0.5;
+                       theSize.x *= 0.5;
                        if (length_ratio > 0)
-                               theOrigin_x += theSize_x;
+                               theOrigin.x += theSize.x;
                        else
                        {
-                               theOrigin_x += (1 + length_ratio) * theSize_x;
+                               theOrigin.x += (1 + length_ratio) * theSize.x;
                                length_ratio = -length_ratio;
                        }
                }
-               theSize_x *= length_ratio;
+               theSize.x *= length_ratio;
 
                vector bW;
-               width = eX * theSize_x;
-               height = eY * theSize_y;
-               if(theSize_x <= theSize_y * 2)
+               width = eX * theSize.x;
+               height = eY * theSize.y;
+               if(theSize.x <= theSize.y * 2)
                {
                        // button not wide enough
                        // draw just left and right part then
-                       square = eX * theSize_x * 0.5;
-                       bW = eX * (0.25 * theSize_x / (theSize_y * 2));
+                       square = eX * theSize.x * 0.5;
+                       bW = eX * (0.25 * theSize.x / (theSize.y * 2));
                        drawsubpic(theOrigin,          square + height, pic, '0 0 0', eY + bW, theColor, theAlpha, drawflag);
                        drawsubpic(theOrigin + square, square + height, pic, eX - bW, eY + bW, theColor, theAlpha, drawflag);
                }
                else
                {
-                       square = eX * theSize_y;
+                       square = eX * theSize.y;
                        drawsubpic(theOrigin,                  height  +     square, pic, '0    0 0', '0.25 1 0', theColor, theAlpha, drawflag);
                        drawsubpic(theOrigin +         square, theSize - 2 * square, pic, '0.25 0 0', '0.5  1 0', theColor, theAlpha, drawflag);
                        drawsubpic(theOrigin + width - square, height  +     square, pic, '0.75 0 0', '0.25 1 0', theColor, theAlpha, drawflag);
@@ -382,19 +437,18 @@ void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theA
                pic = "gfx/hud/default/num_leading";
        }
 
-       drawsubpic(pos, eX * min(mySize_x * 0.5, mySize_y) + eY * mySize_y, pic, '0 0 0', '0.25 1 0', color, theAlpha, drawflag);
-       if(mySize_x/mySize_y > 2)
-               drawsubpic(pos + eX * mySize_y, eX * (mySize_x - 2 * mySize_y) + eY * mySize_y, pic, '0.25 0 0', '0.5 1 0', color, theAlpha, drawflag);
-       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);
+       drawsubpic(pos, eX * min(mySize.x * 0.5, mySize.y) + eY * mySize.y, pic, '0 0 0', '0.25 1 0', color, theAlpha, drawflag);
+       if(mySize.x/mySize.y > 2)
+               drawsubpic(pos + eX * mySize.y, eX * (mySize.x - 2 * mySize.y) + eY * mySize.y, pic, '0.25 0 0', '0.5 1 0', color, theAlpha, drawflag);
+       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);
 }
 
 // Weapon icons (#0)
 //
 entity weaponorder[WEP_MAXCOUNT];
-void weaponorder_swap(float i, float j, entity pass)
+void weaponorder_swap(int i, int j, entity pass)
 {
-       entity h;
-       h = weaponorder[i];
+       entity h = weaponorder[i];
        weaponorder[i] = weaponorder[j];
        weaponorder[j] = h;
 }
@@ -413,19 +467,18 @@ void HUD_Weapons(void)
        // declarations
        WepSet weapons_stat = WepSet_GetFromStat();
        float i, f, a;
-       float screen_ar, center_x = 0, center_y;
+       float screen_ar;
+       vector center = '0 0 0';
        float weapon_count, weapon_id;
-       float row, column, rows = 0, columns;
+       float row, column, rows = 0, columns = 0;
+       bool vertical_order = true;
        float aspect = autocvar_hud_panel_weapons_aspect;
 
-       float panel_weapon_accuracy;
-
        float timeout = autocvar_hud_panel_weapons_timeout;
        float timein_effect_length = autocvar_hud_panel_weapons_timeout_speed_in; //? 0.375 : 0);
        float timeout_effect_length = autocvar_hud_panel_weapons_timeout_speed_out; //? 0.75 : 0);
 
-       float ammo_full;
-       float barsize_x = 0, barsize_y = 0, baroffset_x = 0, baroffset_y = 0;
+       vector barsize = '0 0 0', baroffset = '0 0 0';
        vector ammo_color = '1 0 1';
        float ammo_alpha = 1;
 
@@ -433,7 +486,6 @@ void HUD_Weapons(void)
        float fadetime = max(0, autocvar_hud_panel_weapons_complainbubble_fadetime);
 
        vector weapon_pos, weapon_size = '0 0 0';
-       local noref vector old_panel_size; // fteqcc sucks
        vector color;
 
        // check to see if we want to continue
@@ -459,7 +511,7 @@ void HUD_Weapons(void)
        // figure out weapon order (how the weapons are sorted) // TODO make this configurable
        if(weaponorder_bypriority != autocvar_cl_weaponpriority || !weaponorder[0])
        {
-               float weapon_cnt;
+               int weapon_cnt;
                if(weaponorder_bypriority)
                        strunzone(weaponorder_bypriority);
                if(weaponorder_byimpulse)
@@ -489,15 +541,29 @@ void HUD_Weapons(void)
        if(!autocvar_hud_panel_weapons_complainbubble || autocvar__hud_configure || time - complain_weapon_time >= when + fadetime)
                complain_weapon = 0;
 
+       if(autocvar__hud_configure)
+       {
+               if(!weapons_stat)
+                       for(i = WEP_FIRST; i <= WEP_LAST; i += floor((WEP_LAST-WEP_FIRST)/5))
+                               weapons_stat |= WepSet_FromWeapon(i);
+
+               #if 0
+               /// debug code
+               if(cvar("wep_add"))
+               {
+                       weapons_stat = '0 0 0';
+                       float countw = 1 + floor((floor(time * cvar("wep_add"))) % WEP_COUNT);
+                       for(i = WEP_FIRST; i <= countw; ++i)
+                               weapons_stat |= WepSet_FromWeapon(i);
+               }
+               #endif
+       }
+
        // determine which weapons are going to be shown
        if (autocvar_hud_panel_weapons_onlyowned)
        {
                if(autocvar__hud_configure)
                {
-                       if (!weapons_stat)
-                               for(i = WEP_FIRST; i <= WEP_LAST; i += floor((WEP_LAST-WEP_FIRST)/5))
-                                       weapons_stat |= WepSet_FromWeapon(i);
-
                        if(menu_enabled != 2)
                                HUD_Panel_DrawBg(1); // also draw the bg of the entire panel
                }
@@ -505,12 +571,9 @@ void HUD_Weapons(void)
                // do we own this weapon?
                weapon_count = 0;
                for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
-                       if(weapons_stat & WepSet_FromWeapon(weaponorder[i].weapon))
+                       if((weapons_stat & WepSet_FromWeapon(weaponorder[i].weapon)) || (weaponorder[i].weapon == complain_weapon))
                                ++weapon_count;
 
-               // add it anyway if weaponcomplain is shown
-               if(complain_weapon)
-                       ++weapon_count;
 
                // might as well commit suicide now, no reason to live ;)
                if (weapon_count == 0)
@@ -519,38 +582,63 @@ void HUD_Weapons(void)
                        return;
                }
 
-               old_panel_size = panel_size;
-               if(panel_bg_padding)
-                       old_panel_size -= '2 2 0' * panel_bg_padding;
+               vector old_panel_size = panel_size;
+               vector padded_panel_size = panel_size - '2 2 0' * panel_bg_padding;
 
-               // first find values for the standard table (with all the weapons)
-               rows = old_panel_size_y/old_panel_size_x;
-               rows = bound(1, floor((sqrt(4 * aspect * rows * WEP_COUNT + rows * rows) + rows + 0.5) / 2), WEP_COUNT);
-               columns = ceil(WEP_COUNT/rows);
-               weapon_size_x = old_panel_size_x / columns;
-               weapon_size_y = old_panel_size_y / rows;
+               // get the all-weapons layout
+               vector table_size = HUD_GetTableSize(WEP_COUNT, padded_panel_size, aspect);
+               columns = table_size.x;
+               rows = table_size.y;
+               weapon_size.x = padded_panel_size.x / columns;
+               weapon_size.y = padded_panel_size.y / rows;
 
-               // change table values to include only the owned weapons
-               float columns_save = columns;
-               if(weapon_count <= rows)
+               // NOTE: although weapons should aways look the same even if onlyowned is enabled,
+               // we enlarge them a bit when possible to better match the desired aspect ratio
+               if(padded_panel_size.x / padded_panel_size.y < aspect)
                {
-                       rows = weapon_count;
-                       columns = 1;
+                       // maximum number of rows that allows to display items with the desired aspect ratio
+                       float max_rows = floor(padded_panel_size.y / (weapon_size.x / aspect));
+                       columns = min(columns, ceil(weapon_count / max_rows));
+                       rows = ceil(weapon_count / columns);
+                       weapon_size.y = min(padded_panel_size.y / rows, weapon_size.x / aspect);
+                       weapon_size.x = min(padded_panel_size.x / columns, aspect * weapon_size.y);
+                       vertical_order = false;
                }
                else
+               {
+                       float max_columns = floor(padded_panel_size.x / (weapon_size.y * aspect));
+                       rows = min(rows, ceil(weapon_count / max_columns));
                        columns = ceil(weapon_count / rows);
-
-               // enlarge weapon_size to match desired aspect ratio in order to capitalize on panel space
-               if(columns < columns_save)
-                       weapon_size_x = min(old_panel_size_x / columns, aspect * weapon_size_y);
+                       weapon_size.x = min(padded_panel_size.x / columns, aspect * weapon_size.y);
+                       weapon_size.y = min(padded_panel_size.y / rows, weapon_size.x / aspect);
+                       vertical_order = true;
+               }
 
                // reduce size of the panel
-               panel_size_x = columns * weapon_size_x;
-               panel_size_y = rows * weapon_size_y;
-               panel_pos_x += (old_panel_size_x - panel_size_x) / 2;
-               panel_pos_y += (old_panel_size_y - panel_size_y) / 2;
-               if(panel_bg_padding)
-                       panel_size += '2 2 0' * panel_bg_padding;
+               panel_size.x = columns * weapon_size.x;
+               panel_size.y = rows * weapon_size.y;
+               panel_size += '2 2 0' * panel_bg_padding;
+
+               // center the resized panel, or snap it to the screen edge when close enough
+               if(panel_pos.x > vid_conwidth * 0.001)
+               {
+                       if(panel_pos.x + old_panel_size.x > vid_conwidth * 0.999)
+                               panel_pos.x += old_panel_size.x - panel_size.x;
+                       else
+                               panel_pos.x += (old_panel_size.x - panel_size.x) / 2;
+               }
+               else if(old_panel_size.x > vid_conwidth * 0.999)
+                       panel_pos.x += (old_panel_size.x - panel_size.x) / 2;
+
+               if(panel_pos.y > vid_conheight * 0.001)
+               {
+                       if(panel_pos.y + old_panel_size.y > vid_conheight * 0.999)
+                               panel_pos.y += old_panel_size.y - panel_size.y;
+                       else
+                               panel_pos.y += (old_panel_size.y - panel_size.y) / 2;
+               }
+               else if(old_panel_size.y > vid_conheight * 0.999)
+                       panel_pos.y += (old_panel_size.y - panel_size.y) / 2;
        }
        else
                weapon_count = WEP_COUNT;
@@ -578,25 +666,25 @@ void HUD_Weapons(void)
                        if (autocvar_hud_panel_weapons_timeout_effect == 2 || autocvar_hud_panel_weapons_timeout_effect == 3)
                        {
                                f *= f; // for a cooler movement
-                               center_x = panel_pos_x + panel_size_x/2;
-                               center_y = panel_pos_y + panel_size_y/2;
+                               center.x = panel_pos.x + panel_size.x/2;
+                               center.y = panel_pos.y + panel_size.y/2;
                                screen_ar = vid_conwidth/vid_conheight;
-                               if (center_x/center_y < screen_ar) //bottom left
+                               if (center.x/center.y < screen_ar) //bottom left
                                {
-                                       if ((vid_conwidth - center_x)/center_y < screen_ar) //bottom
-                                               panel_pos_y += f * (vid_conheight - panel_pos_y);
+                                       if ((vid_conwidth - center.x)/center.y < screen_ar) //bottom
+                                               panel_pos.y += f * (vid_conheight - panel_pos.y);
                                        else //left
-                                               panel_pos_x -= f * (panel_pos_x + panel_size_x);
+                                               panel_pos.x -= f * (panel_pos.x + panel_size.x);
                                }
                                else //top right
                                {
-                                       if ((vid_conwidth - center_x)/center_y < screen_ar) //right
-                                               panel_pos_x += f * (vid_conwidth - panel_pos_x);
+                                       if ((vid_conwidth - center.x)/center.y < screen_ar) //right
+                                               panel_pos.x += f * (vid_conwidth - panel_pos.x);
                                        else //top
-                                               panel_pos_y -= f * (panel_pos_y + panel_size_y);
+                                               panel_pos.y -= f * (panel_pos.y + panel_size.y);
                                }
                                if(f == 1)
-                                       center_x = -1; // mark the panel as off screen
+                                       center.x = -1; // mark the panel as off screen
                        }
                        weaponprevtime = time - (1 - f) * timein_effect_length;
                }
@@ -621,22 +709,22 @@ void HUD_Weapons(void)
                        {
                                f *= f; // for a cooler movement
                                f = 1 - f;
-                               center_x = panel_pos_x + panel_size_x/2;
-                               center_y = panel_pos_y + panel_size_y/2;
+                               center.x = panel_pos.x + panel_size.x/2;
+                               center.y = panel_pos.y + panel_size.y/2;
                                screen_ar = vid_conwidth/vid_conheight;
-                               if (center_x/center_y < screen_ar) //bottom left
+                               if (center.x/center.y < screen_ar) //bottom left
                                {
-                                       if ((vid_conwidth - center_x)/center_y < screen_ar) //bottom
-                                               panel_pos_y += f * (vid_conheight - panel_pos_y);
+                                       if ((vid_conwidth - center.x)/center.y < screen_ar) //bottom
+                                               panel_pos.y += f * (vid_conheight - panel_pos.y);
                                        else //left
-                                               panel_pos_x -= f * (panel_pos_x + panel_size_x);
+                                               panel_pos.x -= f * (panel_pos.x + panel_size.x);
                                }
                                else //top right
                                {
-                                       if ((vid_conwidth - center_x)/center_y < screen_ar) //right
-                                               panel_pos_x += f * (vid_conwidth - panel_pos_x);
+                                       if ((vid_conwidth - center.x)/center.y < screen_ar) //right
+                                               panel_pos.x += f * (vid_conwidth - panel_pos.x);
                                        else //top
-                                               panel_pos_y -= f * (panel_pos_y + panel_size_y);
+                                               panel_pos.y -= f * (panel_pos.y + panel_size.y);
                                }
                        }
                }
@@ -645,7 +733,7 @@ void HUD_Weapons(void)
        // draw the background, then change the virtual size of it to better fit other items inside
        HUD_Panel_DrawBg(1);
 
-       if(center_x == -1)
+       if(center.x == -1)
        {
                draw_endBoldFont();
                return;
@@ -661,10 +749,12 @@ void HUD_Weapons(void)
 
        if(!rows) // if rows is > 0 onlyowned code has already updated these vars
        {
-               rows = panel_size_y/panel_size_x;
-               rows = bound(1, floor((sqrt(4 * aspect * rows * weapon_count + rows * rows) + rows + 0.5) / 2), weapon_count);
-               columns = ceil(weapon_count/rows);
-               weapon_size = eX * panel_size_x*(1/columns) + eY * panel_size_y*(1/rows);
+               vector table_size = HUD_GetTableSize(WEP_COUNT, panel_size, aspect);
+               columns = table_size.x;
+               rows = table_size.y;
+               weapon_size.x = panel_size.x / columns;
+               weapon_size.y = panel_size.y / rows;
+               vertical_order = (panel_size.x / panel_size.y >= aspect);
        }
 
        // calculate position/size for visual bar displaying ammount of ammo status
@@ -673,23 +763,25 @@ void HUD_Weapons(void)
                ammo_color = stov(autocvar_hud_panel_weapons_ammo_color);
                ammo_alpha = panel_fg_alpha * autocvar_hud_panel_weapons_ammo_alpha;
 
-               if(weapon_size_x/weapon_size_y > aspect)
+               if(weapon_size.x/weapon_size.y > aspect)
                {
-                       barsize_x = aspect * weapon_size_y;
-                       barsize_y = weapon_size_y;
-                       baroffset_x = (weapon_size_x - barsize_x) / 2;
+                       barsize.x = aspect * weapon_size.y;
+                       barsize.y = weapon_size.y;
+                       baroffset.x = (weapon_size.x - barsize.x) / 2;
                }
                else
                {
-                       barsize_y = 1/aspect * weapon_size_x;
-                       barsize_x = weapon_size_x;
-                       baroffset_y = (weapon_size_y - barsize_y) / 2;
+                       barsize.y = 1/aspect * weapon_size.x;
+                       barsize.x = weapon_size.x;
+                       baroffset.y = (weapon_size.y - barsize.y) / 2;
                }
        }
        if(autocvar_hud_panel_weapons_accuracy)
                Accuracy_LoadColors();
 
+       // draw items
        row = column = 0;
+       vector label_size = '1 1 0' * min(weapon_size.x, weapon_size.y) * bound(0, autocvar_hud_panel_weapons_label_scale, 1);
        for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
        {
                // retrieve information about the current weapon to be drawn
@@ -706,8 +798,8 @@ void HUD_Weapons(void)
 
                // figure out the drawing position of weapon
                weapon_pos = (panel_pos
-                       + eX * column * weapon_size_x
-                       + eY * row * weapon_size_y);
+                       + eX * column * weapon_size.x
+                       + eY * row * weapon_size.y);
 
                // draw background behind currently selected weapon
                if(self.weapon == switchweapon)
@@ -716,7 +808,7 @@ void HUD_Weapons(void)
                // draw the weapon accuracy
                if(autocvar_hud_panel_weapons_accuracy)
                {
-                       panel_weapon_accuracy = weapon_accuracy[self.weapon-WEP_FIRST];
+                       float panel_weapon_accuracy = weapon_accuracy[self.weapon-WEP_FIRST];
                        if(panel_weapon_accuracy >= 0)
                        {
                                color = Accuracy_GetColor(panel_weapon_accuracy);
@@ -734,15 +826,15 @@ void HUD_Weapons(void)
                        switch(autocvar_hud_panel_weapons_label)
                        {
                                case 1: // weapon number
-                                       drawstring(weapon_pos, ftos(weapon_id), '1 1 0' * 0.5 * weapon_size_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       drawstring(weapon_pos, ftos(weapon_id), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                                        break;
 
                                case 2: // bind
-                                       drawstring(weapon_pos, getcommandkey(ftos(weapon_id), strcat("weapon_group_", ftos(weapon_id))), '1 1 0' * 0.5 * weapon_size_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       drawstring(weapon_pos, getcommandkey(ftos(weapon_id), strcat("weapon_group_", ftos(weapon_id))), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                                        break;
 
                                case 3: // weapon name
-                                       drawstring(weapon_pos, strtolower(self.message), '1 1 0' * 0.5 * weapon_size_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       drawstring(weapon_pos, strtolower(self.message), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                                        break;
 
                                default: // nothing
@@ -752,6 +844,7 @@ void HUD_Weapons(void)
                        // draw ammo status bar
                        if(autocvar_hud_panel_weapons_ammo && (self.ammo_field != ammo_none))
                        {
+                               float ammo_full;
                                a = getstati(GetAmmoStat(self.ammo_field)); // how much ammo do we have?
 
                                if(a > 0)
@@ -768,10 +861,10 @@ void HUD_Weapons(void)
                                        }
 
                                        drawsetcliparea(
-                                               weapon_pos_x + baroffset_x,
-                                               weapon_pos_y + baroffset_y,
-                                               barsize_x * bound(0, a/ammo_full, 1),
-                                               barsize_y
+                                               weapon_pos.x + baroffset.x,
+                                               weapon_pos.y + baroffset.y,
+                                               barsize.x * bound(0, a/ammo_full, 1),
+                                               barsize.y
                                        );
 
                                        drawpic_aspect_skin(
@@ -818,12 +911,33 @@ void HUD_Weapons(void)
                        drawstring_aspect(weapon_pos + '1 1 0' * padding, s, weapon_size - '2 2 0' * padding, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
                }
 
+               #if 0
+               /// debug code
+               if(!autocvar_hud_panel_weapons_onlyowned)
+               {
+                       drawfill(weapon_pos + '1 1 0', weapon_size - '2 2 0', '1 1 1', panel_fg_alpha * 0.2, DRAWFLAG_NORMAL);
+                       drawstring(weapon_pos, ftos(i + 1), label_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               }
+               #endif
+
                // continue with new position for the next weapon
-               ++row;
-               if(row >= rows)
+               if(vertical_order)
                {
-                       row = 0;
                        ++column;
+                       if(column >= columns)
+                       {
+                               column = 0;
+                               ++row;
+                       }
+               }
+               else
+               {
+                       ++row;
+                       if(row >= rows)
+                       {
+                               row = 0;
+                               ++column;
+                       }
                }
        }
 
@@ -833,12 +947,12 @@ void HUD_Weapons(void)
 // Ammo (#1)
 void DrawNadeScoreBar(vector myPos, vector mySize, vector color)
 {
-       
+
        HUD_Panel_DrawProgressBar(
-               myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize_x, 
-               mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize_x, 
-               autocvar_hud_panel_ammo_progressbar_name, 
-               getstatf(STAT_NADE_BONUS_SCORE), 0, 0, color, 
+               myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x,
+               mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x,
+               autocvar_hud_panel_ammo_progressbar_name,
+               getstatf(STAT_NADE_BONUS_SCORE), 0, 0, color,
                autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
 
 }
@@ -847,20 +961,20 @@ void DrawAmmoNades(vector myPos, vector mySize, float draw_expanding, float expa
 {
        float theAlpha = 1, a, b;
        vector nade_color, picpos, numpos;
-       
+
        nade_color = Nade_Color(getstati(STAT_NADE_BONUS_TYPE));
-       
+
        a = getstatf(STAT_NADE_BONUS);
        b = getstatf(STAT_NADE_BONUS_SCORE);
-       
+
        if(autocvar_hud_panel_ammo_iconalign)
        {
                numpos = myPos;
-               picpos = myPos + eX * 2 * mySize_y;
+               picpos = myPos + eX * 2 * mySize.y;
        }
        else
        {
-               numpos = myPos + eX * mySize_y;
+               numpos = myPos + eX * mySize.y;
                picpos = myPos;
        }
 
@@ -869,13 +983,13 @@ void DrawAmmoNades(vector myPos, vector mySize, float draw_expanding, float expa
        if(b > 0 || a > 0)
        {
                if(autocvar_hud_panel_ammo_text)
-                       drawstring_aspect(numpos, ftos(a), eX * (2/3) * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
-               
+                       drawstring_aspect(numpos, ftos(a), eX * (2/3) * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
+
                if(draw_expanding)
-                       drawpic_aspect_skin_expanding(picpos, "nade_nbg", '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, expand_time);
-                       
-               drawpic_aspect_skin(picpos, "nade_bg" , '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
-               drawpic_aspect_skin(picpos, "nade_nbg" , '1 1 0' * mySize_y, nade_color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
+                       drawpic_aspect_skin_expanding(picpos, "nade_nbg", '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, expand_time);
+
+               drawpic_aspect_skin(picpos, "nade_bg" , '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
+               drawpic_aspect_skin(picpos, "nade_nbg" , '1 1 0' * mySize.y, nade_color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
        }
 }
 
@@ -905,13 +1019,13 @@ void DrawAmmoItem(vector myPos, vector mySize, .float ammoType, float isCurrent,
        vector iconPos, textPos;
        if(autocvar_hud_panel_ammo_iconalign)
        {
-               iconPos = myPos + eX * 2 * mySize_y;
+               iconPos = myPos + eX * 2 * mySize.y;
                textPos = myPos;
        }
        else
        {
                iconPos = myPos;
-               textPos = myPos + eX * mySize_y;
+               textPos = myPos + eX * mySize.y;
        }
 
        float isShadowed = (ammo <= 0 && !isCurrent && !isInfinite);
@@ -943,12 +1057,12 @@ void DrawAmmoItem(vector myPos, vector mySize, .float ammoType, float isCurrent,
                drawpic_aspect_skin(myPos, "ammo_current_bg", mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 
        if(ammo > 0 && autocvar_hud_panel_ammo_progressbar)
-               HUD_Panel_DrawProgressBar(myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize_x, mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize_x, autocvar_hud_panel_ammo_progressbar_name, ammo/autocvar_hud_panel_ammo_maxammo, 0, 0, textColor, autocvar_hud_progressbar_alpha * alpha, DRAWFLAG_NORMAL);
+               HUD_Panel_DrawProgressBar(myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x, mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x, autocvar_hud_panel_ammo_progressbar_name, ammo/autocvar_hud_panel_ammo_maxammo, 0, 0, textColor, autocvar_hud_progressbar_alpha * alpha, DRAWFLAG_NORMAL);
 
        if(autocvar_hud_panel_ammo_text)
-               drawstring_aspect(textPos, text, eX * (2/3) * mySize_x + eY * mySize_y, textColor, alpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(textPos, text, eX * (2/3) * mySize.x + eY * mySize.y, textColor, alpha, DRAWFLAG_NORMAL);
 
-       drawpic_aspect_skin(iconPos, GetAmmoPicture(ammoType), '1 1 0' * mySize_y, iconColor, alpha, DRAWFLAG_NORMAL);
+       drawpic_aspect_skin(iconPos, GetAmmoPicture(ammoType), '1 1 0' * mySize.y, iconColor, alpha, DRAWFLAG_NORMAL);
 }
 
 float nade_prevstatus;
@@ -1002,30 +1116,25 @@ void HUD_Ammo(void)
        else
                nade_prevstatus = nade_prevframe = nade_statuschange_time = 0;
 
-       rows = mySize_y/mySize_x;
-       rows = bound(1, floor((sqrt(4 * (3/1) * rows * (total_ammo_count) + rows * rows) + rows + 0.5) / 2), (total_ammo_count));
-       //                               ^^^ ammo item aspect goes here
-
+       rows = HUD_GetRowCount(total_ammo_count, mySize, 3);
        columns = ceil((total_ammo_count)/rows);
+       ammo_size = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
 
-       ammo_size = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
-       
-
-       local vector offset = '0 0 0'; // fteqcc sucks
+       vector offset = '0 0 0'; // fteqcc sucks
        float newSize;
-       if(ammo_size_x/ammo_size_y > 3)
+       if(ammo_size.x/ammo_size.y > 3)
        {
-               newSize = 3 * ammo_size_y;
-               offset_x = ammo_size_x - newSize;
-               pos_x += offset_x/2;
-               ammo_size_x = newSize;
+               newSize = 3 * ammo_size.y;
+               offset.x = ammo_size.x - newSize;
+               pos.x += offset.x/2;
+               ammo_size.x = newSize;
        }
        else
        {
-               newSize = 1/3 * ammo_size_x;
-               offset_y = ammo_size_y - newSize;
-               pos_y += offset_y/2;
-               ammo_size_y = newSize;
+               newSize = 1/3 * ammo_size.x;
+               offset.y = ammo_size.y - newSize;
+               pos.y += offset.y/2;
+               ammo_size.y = newSize;
        }
 
        float i;
@@ -1035,7 +1144,7 @@ void HUD_Ammo(void)
        {
                if(autocvar__hud_configure)
                {
-                       DrawAmmoItem(pos, ammo_size, ammo_rockets, TRUE, FALSE);
+                       DrawAmmoItem(pos, ammo_size, ammo_rockets, true, false);
                }
                else
                {
@@ -1043,7 +1152,7 @@ void HUD_Ammo(void)
                                pos,
                                ammo_size,
                                (get_weaponinfo(switchweapon)).ammo_field,
-                               TRUE,
+                               true,
                                infinite_ammo
                        );
                }
@@ -1063,7 +1172,7 @@ void HUD_Ammo(void)
                {
                        ammotype = GetAmmoFieldFromNum(i);
                        DrawAmmoItem(
-                               pos + eX * column * (ammo_size_x + offset_x) + eY * row * (ammo_size_y + offset_y),
+                               pos + eX * column * (ammo_size.x + offset.x) + eY * row * (ammo_size.y + offset.y),
                                ammo_size,
                                ammotype,
                                ((get_weaponinfo(switchweapon)).ammo_field == ammotype),
@@ -1085,7 +1194,7 @@ void HUD_Ammo(void)
 
                float f = bound(0, nade_statuschange_elapsedtime*2, 1);
 
-               DrawAmmoNades(pos + eX * column * (ammo_size_x + offset_x) + eY * row * (ammo_size_y + offset_y), ammo_size, nade_prevstatus < nade_cnt && nade_cnt != 0 && f < 1, f);
+               DrawAmmoNades(pos + eX * column * (ammo_size.x + offset.x) + eY * row * (ammo_size.y + offset.y), ammo_size, nade_prevstatus < nade_cnt && nade_cnt != 0 && f < 1, f);
        }
 
        draw_endBoldFont();
@@ -1098,76 +1207,76 @@ void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, fl
 
        if (vertical)
        {
-               if(mySize_y/mySize_x > 2)
+               if(mySize.y/mySize.x > 2)
                {
-                       newSize_y = 2 * mySize_x;
-                       newSize_x = mySize_x;
+                       newSize.y = 2 * mySize.x;
+                       newSize.x = mySize.x;
 
-                       newPos_y = myPos_y + (mySize_y - newSize_y) / 2;
-                       newPos_x = myPos_x;
+                       newPos.y = myPos.y + (mySize.y - newSize.y) / 2;
+                       newPos.x = myPos.x;
                }
                else
                {
-                       newSize_x = 1/2 * mySize_y;
-                       newSize_y = mySize_y;
+                       newSize.x = 1/2 * mySize.y;
+                       newSize.y = mySize.y;
 
-                       newPos_x = myPos_x + (mySize_x - newSize_x) / 2;
-                       newPos_y = myPos_y;
+                       newPos.x = myPos.x + (mySize.x - newSize.x) / 2;
+                       newPos.y = myPos.y;
                }
 
                if(icon_right_align)
                {
                        numpos = newPos;
-                       picpos = newPos + eY * newSize_x;
+                       picpos = newPos + eY * newSize.x;
                }
                else
                {
                        picpos = newPos;
-                       numpos = newPos + eY * newSize_x;
+                       numpos = newPos + eY * newSize.x;
                }
 
-               newSize_y /= 2;
+               newSize.y /= 2;
                drawpic_aspect_skin(picpos, icon, newSize, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
                // make number smaller than icon, it looks better
                // reduce only y to draw numbers with different number of digits with the same y size
-               numpos_y += newSize_y * ((1 - 0.7) / 2);
-               newSize_y *= 0.7;
+               numpos.y += newSize.y * ((1 - 0.7) / 2);
+               newSize.y *= 0.7;
                drawstring_aspect(numpos, ftos(x), newSize, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
                return;
        }
 
-       if(mySize_x/mySize_y > 3)
+       if(mySize.x/mySize.y > 3)
        {
-               newSize_x = 3 * mySize_y;
-               newSize_y = mySize_y;
+               newSize.x = 3 * mySize.y;
+               newSize.y = mySize.y;
 
-               newPos_x = myPos_x + (mySize_x - newSize_x) / 2;
-               newPos_y = myPos_y;
+               newPos.x = myPos.x + (mySize.x - newSize.x) / 2;
+               newPos.y = myPos.y;
        }
        else
        {
-               newSize_y = 1/3 * mySize_x;
-               newSize_x = mySize_x;
+               newSize.y = 1/3 * mySize.x;
+               newSize.x = mySize.x;
 
-               newPos_y = myPos_y + (mySize_y - newSize_y) / 2;
-               newPos_x = myPos_x;
+               newPos.y = myPos.y + (mySize.y - newSize.y) / 2;
+               newPos.x = myPos.x;
        }
 
        if(icon_right_align) // right align
        {
                numpos = newPos;
-               picpos = newPos + eX * 2 * newSize_y;
+               picpos = newPos + eX * 2 * newSize.y;
        }
        else // left align
        {
-               numpos = newPos + eX * newSize_y;
+               numpos = newPos + eX * newSize.y;
                picpos = newPos;
        }
 
        // NOTE: newSize_x is always equal to 3 * mySize_y so we can use
        // '2 1 0' * newSize_y instead of eX * (2/3) * newSize_x + eY * newSize_y
-       drawstring_aspect_expanding(numpos, ftos(x), '2 1 0' * newSize_y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
-       drawpic_aspect_skin_expanding(picpos, icon, '1 1 0' * newSize_y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
+       drawstring_aspect_expanding(numpos, ftos(x), '2 1 0' * newSize.y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
+       drawpic_aspect_skin_expanding(picpos, icon, '1 1 0' * newSize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
 }
 
 void DrawNumIcon(vector myPos, vector mySize, float x, string icon, float vertical, float icon_right_align, vector color, float theAlpha)
@@ -1220,7 +1329,7 @@ void HUD_Powerups(void)
                mySize -= '2 2 0' * panel_bg_padding;
        }
 
-       float panel_ar = mySize_x/mySize_y;
+       float panel_ar = mySize.x/mySize.y;
        float is_vertical = (panel_ar < 1);
        vector shield_offset = '0 0 0', strength_offset = '0 0 0', superweapons_offset = '0 0 0';
 
@@ -1249,40 +1358,40 @@ void HUD_Powerups(void)
        {
                if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1))
                {
-                       mySize_x *= (1.0 / 3.0);
-                       superweapons_offset_x = mySize_x;
+                       mySize.x *= (1.0 / 3.0);
+                       superweapons_offset.x = mySize.x;
                        if (autocvar_hud_panel_powerups_flip)
-                               shield_offset_x = 2*mySize_x;
+                               shield_offset.x = 2*mySize.x;
                        else
-                               strength_offset_x = 2*mySize_x;
+                               strength_offset.x = 2*mySize.x;
                }
                else
                {
-                       mySize_y *= (1.0 / 3.0);
-                       superweapons_offset_y = mySize_y;
+                       mySize.y *= (1.0 / 3.0);
+                       superweapons_offset.y = mySize.y;
                        if (autocvar_hud_panel_powerups_flip)
-                               shield_offset_y = 2*mySize_y;
+                               shield_offset.y = 2*mySize.y;
                        else
-                               strength_offset_y = 2*mySize_y;
+                               strength_offset.y = 2*mySize.y;
                }
        }
        else
        {
                if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1))
                {
-                       mySize_x *= 0.5;
+                       mySize.x *= 0.5;
                        if (autocvar_hud_panel_powerups_flip)
-                               shield_offset_x = mySize_x;
+                               shield_offset.x = mySize.x;
                        else
-                               strength_offset_x = mySize_x;
+                               strength_offset.x = mySize.x;
                }
                else
                {
-                       mySize_y *= 0.5;
+                       mySize.y *= 0.5;
                        if (autocvar_hud_panel_powerups_flip)
-                               shield_offset_y = mySize_y;
+                               shield_offset.y = mySize.y;
                        else
-                               strength_offset_y = mySize_y;
+                               strength_offset.y = mySize.y;
                }
        }
 
@@ -1459,18 +1568,18 @@ void HUD_HealthArmor(void)
                v = healtharmor_maxdamage(health, armor, armorblockpercent, DEATH_WEAPON);
 
                float x;
-               x = floor(v_x + 1);
+               x = floor(v.x + 1);
 
         float maxtotal = maxhealth + maxarmor;
                string biggercount;
-               if(v_z) // NOT fully armored
+               if(v.z) // NOT fully armored
                {
                        biggercount = "health";
                        if(autocvar_hud_panel_healtharmor_progressbar)
                                HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_health, x/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_health_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        if(armor)
             if(autocvar_hud_panel_healtharmor_text)
-                               drawpic_aspect_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "armor", '0.5 0.5 0' * mySize_y, '1 1 1', panel_fg_alpha * armor / health, DRAWFLAG_NORMAL);
+                               drawpic_aspect_skin(pos + eX * mySize.x - eX * 0.5 * mySize.y, "armor", '0.5 0.5 0' * mySize.y, '1 1 1', panel_fg_alpha * armor / health, DRAWFLAG_NORMAL);
                }
                else
                {
@@ -1479,34 +1588,34 @@ void HUD_HealthArmor(void)
                                HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, x/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_armor_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        if(health)
             if(autocvar_hud_panel_healtharmor_text)
-                               drawpic_aspect_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "health", '0.5 0.5 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawpic_aspect_skin(pos + eX * mySize.x - eX * 0.5 * mySize.y, "health", '0.5 0.5 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
         if(autocvar_hud_panel_healtharmor_text)
                        DrawNumIcon(pos, mySize, x, biggercount, 0, iconalign, HUD_Get_Num_Color(x, maxtotal), 1);
 
                if(fuel)
-                       HUD_Panel_DrawProgressBar(pos, eX * mySize_x + eY * 0.2 * mySize_y, "progressbar", fuel/100, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+                       HUD_Panel_DrawProgressBar(pos, eX * mySize.x + eY * 0.2 * mySize.y, "progressbar", fuel/100, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
        }
        else
        {
-               float panel_ar = mySize_x/mySize_y;
+               float panel_ar = mySize.x/mySize.y;
                float is_vertical = (panel_ar < 1);
                vector health_offset = '0 0 0', armor_offset = '0 0 0';
                if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1))
                {
-                       mySize_x *= 0.5;
+                       mySize.x *= 0.5;
                        if (autocvar_hud_panel_healtharmor_flip)
-                               health_offset_x = mySize_x;
+                               health_offset.x = mySize.x;
                        else
-                               armor_offset_x = mySize_x;
+                               armor_offset.x = mySize.x;
                }
                else
                {
-                       mySize_y *= 0.5;
+                       mySize.y *= 0.5;
                        if (autocvar_hud_panel_healtharmor_flip)
-                               health_offset_y = mySize_y;
+                               health_offset.y = mySize.y;
                        else
-                               armor_offset_y = mySize_y;
+                               armor_offset.y = mySize.y;
                }
 
                float health_baralign, armor_baralign, fuel_baralign;
@@ -1632,13 +1741,13 @@ void HUD_HealthArmor(void)
                if(fuel)
                {
                        if (is_vertical)
-                               mySize_x *= 0.2 / 2; //if vertical always halve x to not cover too much numbers with 3 digits
+                               mySize.x *= 0.2 / 2; //if vertical always halve x to not cover too much numbers with 3 digits
                        else
-                               mySize_y *= 0.2;
+                               mySize.y *= 0.2;
                        if (panel_ar >= 4)
-                               mySize_x *= 2; //restore full panel size
+                               mySize.x *= 2; //restore full panel size
                        else if (panel_ar < 1/4)
-                               mySize_y *= 2; //restore full panel size
+                               mySize.y *= 2; //restore full panel size
                        HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", fuel/100, is_vertical, fuel_baralign, autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
                }
        }
@@ -1714,18 +1823,18 @@ void HUD_Notify(void)
        float fade_time = max(0, autocvar_hud_panel_notify_fadetime);
        float icon_aspect = max(1, autocvar_hud_panel_notify_icon_aspect);
 
-       float entry_count = bound(1, floor(NOTIFY_MAX_ENTRIES * size_y / size_x), NOTIFY_MAX_ENTRIES);
-       float entry_height = size_y / entry_count;
+       float entry_count = bound(1, floor(NOTIFY_MAX_ENTRIES * size.y / size.x), NOTIFY_MAX_ENTRIES);
+       float entry_height = size.y / entry_count;
 
-       float panel_width_half = size_x * 0.5;
+       float panel_width_half = size.x * 0.5;
        float icon_width_half = entry_height * icon_aspect / 2;
-       float name_maxwidth = panel_width_half - icon_width_half - size_x * NOTIFY_ICON_MARGIN;
+       float name_maxwidth = panel_width_half - icon_width_half - size.x * NOTIFY_ICON_MARGIN;
 
        vector font_size = '0.5 0.5 0' * entry_height * autocvar_hud_panel_notify_fontsize;
        vector icon_size = (eX * icon_aspect + eY) * entry_height;
        vector icon_left = eX * (panel_width_half - icon_width_half);
        vector attacker_right = eX * name_maxwidth;
-       vector victim_left = eX * (size_x - name_maxwidth);
+       vector victim_left = eX * (size.x - name_maxwidth);
 
        vector attacker_pos, victim_pos, icon_pos;
        string attacker, victim, icon;
@@ -1778,7 +1887,7 @@ void HUD_Notify(void)
 
                if (icon != "" && victim != "")
                {
-                       vector name_top = eY * (i * entry_height + 0.5 * (entry_height - font_size_y));
+                       vector name_top = eY * (i * entry_height + 0.5 * (entry_height - font_size.y));
 
                        icon_pos = pos + icon_left + eY * i * entry_height;
                        drawpic_aspect_skin(icon_pos, icon, icon_size, '1 1 1', panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
@@ -1790,7 +1899,7 @@ void HUD_Notify(void)
                        if (attacker != "")
                        {
                                attacker = textShortenToWidth(attacker, name_maxwidth, font_size, stringwidth_colors);
-                               attacker_pos = pos + attacker_right - eX * stringwidth(attacker, TRUE, font_size) + name_top;
+                               attacker_pos = pos + attacker_right - eX * stringwidth(attacker, true, font_size) + name_top;
                                drawcolorcodedstring(attacker_pos, attacker, font_size, panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
                        }
                }
@@ -1897,10 +2006,10 @@ void HUD_Radar(void)
        if (hud_panel_radar_maximized && !autocvar__hud_configure)
        {
                panel_size = autocvar_hud_panel_radar_maximized_size;
-               panel_size_x = bound(0.2, panel_size_x, 1) * vid_conwidth;
-               panel_size_y = bound(0.2, panel_size_y, 1) * vid_conheight;
-               panel_pos_x = (vid_conwidth - panel_size_x) / 2;
-               panel_pos_y = (vid_conheight - panel_size_y) / 2;
+               panel_size.x = bound(0.2, panel_size.x, 1) * vid_conwidth;
+               panel_size.y = bound(0.2, panel_size.y, 1) * vid_conheight;
+               panel_pos.x = (vid_conwidth - panel_size.x) / 2;
+               panel_pos.y = (vid_conheight - panel_size.y) / 2;
 
                string panel_bg;
                panel_bg = strcat(hud_skin_path, "/border_default"); // always use the default border when maximized
@@ -1932,7 +2041,7 @@ void HUD_Radar(void)
                switch(hud_panel_radar_maximized_rotation)
                {
                        case 0:
-                               teamradar_angle = view_angles_y - 90;
+                               teamradar_angle = view_angles.y - 90;
                                break;
                        default:
                                teamradar_angle = 90 * hud_panel_radar_maximized_rotation;
@@ -1961,7 +2070,7 @@ void HUD_Radar(void)
                switch(hud_panel_radar_rotation)
                {
                        case 0:
-                               teamradar_angle = view_angles_y - 90;
+                               teamradar_angle = view_angles.y - 90;
                                break;
                        default:
                                teamradar_angle = 90 * hud_panel_radar_rotation;
@@ -2008,16 +2117,16 @@ void HUD_Radar(void)
                vector c0, c1, c2, c3, span;
                c0 = rotate(mi_min, teamradar_angle * DEG2RAD);
                c1 = rotate(mi_max, teamradar_angle * DEG2RAD);
-               c2 = rotate('1 0 0' * mi_min_x + '0 1 0' * mi_max_y, teamradar_angle * DEG2RAD);
-               c3 = rotate('1 0 0' * mi_max_x + '0 1 0' * mi_min_y, teamradar_angle * DEG2RAD);
+               c2 = rotate('1 0 0' * mi_min.x + '0 1 0' * mi_max.y, teamradar_angle * DEG2RAD);
+               c3 = rotate('1 0 0' * mi_max.x + '0 1 0' * mi_min.y, teamradar_angle * DEG2RAD);
                span = '0 0 0';
-               span_x = max(c0_x, c1_x, c2_x, c3_x) - min(c0_x, c1_x, c2_x, c3_x);
-               span_y = max(c0_y, c1_y, c2_y, c3_y) - min(c0_y, c1_y, c2_y, c3_y);
+               span.x = max(c0_x, c1_x, c2_x, c3_x) - min(c0_x, c1_x, c2_x, c3_x);
+               span.y = max(c0_y, c1_y, c2_y, c3_y) - min(c0_y, c1_y, c2_y, c3_y);
 
                // max-min distance must fit the radar in x=x, y=y
                bigsize = min(
-                       teamradar_size2d_x * scale2d / (1.05 * span_x),
-                       teamradar_size2d_y * scale2d / (1.05 * span_y)
+                       teamradar_size2d.x * scale2d / (1.05 * span.x),
+                       teamradar_size2d.y * scale2d / (1.05 * span.y)
                );
        }
 
@@ -2033,10 +2142,10 @@ void HUD_Radar(void)
                + (1 - f) * view_origin);
 
        drawsetcliparea(
-               pos_x,
-               pos_y,
-               mySize_x,
-               mySize_y
+               pos.x,
+               pos.y,
+               mySize.x,
+               mySize.y
        );
 
        draw_teamradar_background(hud_panel_radar_foreground_alpha);
@@ -2063,17 +2172,17 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me)
 {
        float score;
        entity tm = world, pl;
-#define SCOREPANEL_MAX_ENTRIES 6
-#define SCOREPANEL_ASPECTRATIO 2
-       float entries = bound(1, floor(SCOREPANEL_MAX_ENTRIES * mySize_y/mySize_x * SCOREPANEL_ASPECTRATIO), SCOREPANEL_MAX_ENTRIES);
-       vector fontsize = '1 1 0' * (mySize_y/entries);
+       float SCOREPANEL_MAX_ENTRIES = 6;
+       float SCOREPANEL_ASPECTRATIO = 2;
+       float entries = bound(1, floor(SCOREPANEL_MAX_ENTRIES * mySize.y/mySize.x * SCOREPANEL_ASPECTRATIO), SCOREPANEL_MAX_ENTRIES);
+       vector fontsize = '1 1 0' * (mySize.y/entries);
 
        vector rgb, score_color;
        rgb = '1 1 1';
        score_color = '1 1 1';
 
-       float name_size = mySize_x*0.75;
-       float spacing_size = mySize_x*0.04;
+       float name_size = mySize.x*0.75;
+       float spacing_size = mySize.x*0.04;
        const float highlight_alpha = 0.2;
        float i = 0, me_printed = 0, first_pl = 0;
        string s;
@@ -2083,15 +2192,15 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me)
                if (team_count)
                {
                        // show team scores in the first line
-                       float score_size = mySize_x / team_count;
+                       float score_size = mySize.x / team_count;
                        players_per_team = max(2, ceil((entries - 1) / team_count));
                        for(i=0; i<team_count; ++i) {
                                if (i == floor((entries - 2) / players_per_team) || (entries == 1 && i == 0))
-                                       HUD_Panel_DrawHighlight(pos + eX * score_size * i, eX * score_size + eY * fontsize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-                               drawstring_aspect(pos + eX * score_size * i, ftos(175 - 23*i), eX * score_size + eY * fontsize_y, Team_ColorRGB(ColorByTeam(i)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       HUD_Panel_DrawHighlight(pos + eX * score_size * i, eX * score_size + eY * fontsize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawstring_aspect(pos + eX * score_size * i, ftos(175 - 23*i), eX * score_size + eY * fontsize.y, Team_ColorRGB(ColorByTeam(i)) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
                        first_pl = 1;
-                       pos_y += fontsize_y;
+                       pos.y += fontsize.y;
                }
                score = 10 + SCOREPANEL_MAX_ENTRIES * 3;
                for (i=first_pl; i<entries; ++i)
@@ -2102,7 +2211,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me)
                        if (i == entries-1 && autocvar_hud_panel_score_rankings == 1)
                        {
                                rgb = '1 1 0';
-                               drawfill(pos, eX * mySize_x + eY * fontsize_y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawfill(pos, eX * mySize.x + eY * fontsize.y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                                s = GetPlayerName(player_localnum);
                                score = 7;
                        }
@@ -2115,9 +2224,9 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me)
                        if (team_count)
                                score_color = Team_ColorRGB(ColorByTeam(floor((i - first_pl) / players_per_team))) * 0.8;
                        s = textShortenToWidth(s, name_size, fontsize, stringwidth_colors);
-                       drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, TRUE, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, true, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
                        drawstring(pos + eX * (name_size + spacing_size), ftos(score), fontsize, score_color, panel_fg_alpha, DRAWFLAG_NORMAL);
-                       pos_y += fontsize_y;
+                       pos.y += fontsize.y;
                }
                return;
        }
@@ -2127,17 +2236,17 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me)
        if (team_count)
        {
                // show team scores in the first line
-               float score_size = mySize_x / team_count;
+               float score_size = mySize.x / team_count;
                for(tm = teams.sort_next; tm; tm = tm.sort_next) {
                        if(tm.team == NUM_SPECTATOR)
                                continue;
                        if (tm.team == myteam)
-                               drawfill(pos + eX * score_size * i, eX * score_size + eY * fontsize_y, '1 1 1', highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
-                       drawstring_aspect(pos + eX * score_size * i, ftos(tm.(teamscores[ts_primary])), eX * score_size + eY * fontsize_y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawfill(pos + eX * score_size * i, eX * score_size + eY * fontsize.y, '1 1 1', highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawstring_aspect(pos + eX * score_size * i, ftos(tm.(teamscores[ts_primary])), eX * score_size + eY * fontsize.y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
                        ++i;
                }
                first_pl = 1;
-               pos_y += fontsize_y;
+               pos.y += fontsize.y;
                tm = teams.sort_next;
        }
        i = first_pl;
@@ -2167,14 +2276,14 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me)
                        if (i == first_pl)
                                rgb = '0 1 0'; //first: green
                        me_printed = 1;
-                       drawfill(pos, eX * mySize_x + eY * fontsize_y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawfill(pos, eX * mySize.x + eY * fontsize.y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                }
                if (team_count)
                        score_color = Team_ColorRGB(pl.team) * 0.8;
                s = textShortenToWidth(GetPlayerName(pl.sv_entnum), name_size, fontsize, stringwidth_colors);
-               drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, TRUE, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, true, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
                drawstring(pos + eX * (name_size + spacing_size), ftos(pl.(scores[ps_primary])), fontsize, score_color, panel_fg_alpha, DRAWFLAG_NORMAL);
-               pos_y += fontsize_y;
+               pos.y += fontsize.y;
                ++i;
        }
        while (i<entries && team_count && (tm = tm.sort_next) && (tm.team != NUM_SPECTATOR || (tm = tm.sort_next)));
@@ -2235,12 +2344,12 @@ void HUD_Score(void)
                                distribution_color = '1 0 0';
                                sign = "+";
                        }
-                       drawstring_aspect(pos + eX * 0.75 * mySize_x, strcat(sign, distrtimer), eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawstring_aspect(pos + eX * 0.75 * mySize.x, strcat(sign, distrtimer), eX * 0.25 * mySize.x + eY * (1/3) * mySize.y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
                }
                // race record display
                if (distribution <= 0)
-                       HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-               drawstring_aspect(pos, timer, eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                       HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(pos, timer, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                draw_endBoldFont();
        } else if (!teamplay) { // non-teamgames
                if ((spectatee_status == -1 && !autocvar__hud_configure) || autocvar_hud_panel_score_rankings)
@@ -2280,14 +2389,14 @@ void HUD_Score(void)
                {
                        if (distribution > 0)
                                distribution_str = strcat("+", distribution_str);
-                       HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                       HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
-               drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize_x + eY * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
-               drawstring_aspect(pos + eX * 0.75 * mySize_x, distribution_str, eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize.x + eY * mySize.y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(pos + eX * 0.75 * mySize.x, distribution_str, eX * 0.25 * mySize.x + eY * (1/3) * mySize.y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
                draw_endBoldFont();
        } else { // teamgames
                float row, column, rows = 0, columns = 0;
-               local noref vector offset = '0 0 0';
+               vector offset = '0 0 0';
                vector score_pos, score_size; //for scores other than myteam
                if(autocvar_hud_panel_score_rankings)
                {
@@ -2296,32 +2405,28 @@ void HUD_Score(void)
                }
                if(spectatee_status == -1)
                {
-                       rows = mySize_y/mySize_x;
-                       rows = bound(1, floor((sqrt(4 * (3/1) * rows * team_count + rows * rows) + rows + 0.5) / 2), team_count);
-                       //                               ^^^ ammo item aspect goes here
-
+                       rows = HUD_GetRowCount(team_count, mySize, 3);
                        columns = ceil(team_count/rows);
-
-                       score_size = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
+                       score_size = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
 
                        float newSize;
-                       if(score_size_x/score_size_y > 3)
+                       if(score_size.x/score_size.y > 3)
                        {
-                               newSize = 3 * score_size_y;
-                               offset_x = score_size_x - newSize;
-                               pos_x += offset_x/2;
-                               score_size_x = newSize;
+                               newSize = 3 * score_size.y;
+                               offset.x = score_size.x - newSize;
+                               pos.x += offset.x/2;
+                               score_size.x = newSize;
                        }
                        else
                        {
-                               newSize = 1/3 * score_size_x;
-                               offset_y = score_size_y - newSize;
-                               pos_y += offset_y/2;
-                               score_size_y = newSize;
+                               newSize = 1/3 * score_size.x;
+                               offset.y = score_size.y - newSize;
+                               pos.y += offset.y/2;
+                               score_size.y = newSize;
                        }
                }
                else
-                       score_size = eX * mySize_x*(1/4) + eY * mySize_y*(1/3);
+                       score_size = eX * mySize.x*(1/4) + eY * mySize.y*(1/3);
 
                float max_fragcount;
                max_fragcount = -99;
@@ -2339,7 +2444,7 @@ void HUD_Score(void)
 
                        if (spectatee_status == -1)
                        {
-                               score_pos = pos + eX * column * (score_size_x + offset_x) + eY * row * (score_size_y + offset_y);
+                               score_pos = pos + eX * column * (score_size.x + offset.x) + eY * row * (score_size.y + offset.y);
                                if (max_fragcount == score)
                                        HUD_Panel_DrawHighlight(score_pos, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                                drawstring_aspect(score_pos, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
@@ -2352,12 +2457,12 @@ void HUD_Score(void)
                        }
                        else if(tm.team == myteam) {
                                if (max_fragcount == score)
-                                       HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-                               drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize_x + eY * mySize_y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize.x + eY * mySize.y, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
                        } else {
                                if (max_fragcount == score)
-                                       HUD_Panel_DrawHighlight(pos + eX * 0.75 * mySize_x + eY * (1/3) * rows * mySize_y, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-                               drawstring_aspect(pos + eX * 0.75 * mySize_x + eY * (1/3) * rows * mySize_y, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       HUD_Panel_DrawHighlight(pos + eX * 0.75 * mySize.x + eY * (1/3) * rows * mySize.y, score_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawstring_aspect(pos + eX * 0.75 * mySize.x + eY * (1/3) * rows * mySize.y, ftos(score), score_size, Team_ColorRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
                                ++rows;
                        }
                }
@@ -2393,19 +2498,19 @@ void HUD_RaceTimer (void)
 
        // always force 4:1 aspect
        vector newSize = '0 0 0';
-       if(mySize_x/mySize_y > 4)
+       if(mySize.x/mySize.y > 4)
        {
-               newSize_x = 4 * mySize_y;
-               newSize_y = mySize_y;
+               newSize.x = 4 * mySize.y;
+               newSize.y = mySize.y;
 
-               pos_x = pos_x + (mySize_x - newSize_x) / 2;
+               pos.x = pos.x + (mySize.x - newSize.x) / 2;
        }
        else
        {
-               newSize_y = 1/4 * mySize_x;
-               newSize_x = mySize_x;
+               newSize.y = 1/4 * mySize.x;
+               newSize.x = mySize.x;
 
-               pos_y = pos_y + (mySize_y - newSize_y) / 2;
+               pos.y = pos.y + (mySize.y - newSize.y) / 2;
        }
        mySize = newSize;
 
@@ -2415,11 +2520,11 @@ void HUD_RaceTimer (void)
        if(autocvar__hud_configure)
        {
                s = "0:13:37";
-               drawstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, FALSE, '0.60 0.60 0' * mySize_y), s, '0.60 0.60 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, false, '0.60 0.60 0' * mySize.y), s, '0.60 0.60 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                s = _("^1Intermediate 1 (+15.42)");
-               drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.20 * mySize_y) + eY * 0.60 * mySize_y, s, '1 1 0' * 0.20 * mySize_y, panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.20 * mySize.y) + eY * 0.60 * mySize.y, s, '1 1 0' * 0.20 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
                s = sprintf(_("^1PENALTY: %.1f (%s)"), 2, "missing a checkpoint");
-               drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.20 * mySize_y) + eY * 0.80 * mySize_y, s, '1 1 0' * 0.20 * mySize_y, panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.20 * mySize.y) + eY * 0.80 * mySize.y, s, '1 1 0' * 0.20 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL);
        }
        else if(race_checkpointtime)
        {
@@ -2452,7 +2557,7 @@ void HUD_RaceTimer (void)
 
                if(s != "" && a > 0)
                {
-                       drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize_y) + eY * 0.6 * mySize_y, s, '1 1 0' * 0.2 * mySize_y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.2 * mySize.y) + eY * 0.6 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
                }
 
                if(race_penaltytime)
@@ -2461,14 +2566,14 @@ void HUD_RaceTimer (void)
                        if(a > 0)
                        {
                                s = sprintf(_("^1PENALTY: %.1f (%s)"), race_penaltytime * 0.1, race_penaltyreason);
-                               drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize_y) + eY * 0.8 * mySize_y, s, '1 1 0' * 0.2 * mySize_y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
+                               drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.2 * mySize.y) + eY * 0.8 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
                        }
                }
 
                if(forcetime != "")
                {
                        a = bound(0, (time - race_checkpointtime) / 0.5, 1);
-                       drawstring_expanding(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(forcetime, FALSE, '1 1 0' * 0.6 * mySize_y), forcetime, '1 1 0' * 0.6 * mySize_y, '1 1 1', panel_fg_alpha, 0, a);
+                       drawstring_expanding(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(forcetime, false, '1 1 0' * 0.6 * mySize.y), forcetime, '1 1 0' * 0.6 * mySize.y, '1 1 1', panel_fg_alpha, 0, a);
                }
                else
                        a = 1;
@@ -2476,7 +2581,7 @@ void HUD_RaceTimer (void)
                if(race_laptime && race_checkpoint != 255)
                {
                        s = TIME_ENCODED_TOSTRING(TIME_ENCODE(time + TIME_DECODE(race_penaltyaccumulator) - race_laptime));
-                       drawstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, FALSE, '0.6 0.6 0' * mySize_y), s, '0.6 0.6 0' * mySize_y, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
+                       drawstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, false, '0.6 0.6 0' * mySize.y), s, '0.6 0.6 0' * mySize.y, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
                }
        }
        else
@@ -2485,13 +2590,13 @@ void HUD_RaceTimer (void)
                {
                        a = bound(0, 2 - (time - race_mycheckpointtime), 1);
                        s = MakeRaceString(race_mycheckpoint, TIME_DECODE(race_mycheckpointdelta), -(race_mycheckpointenemy == ""), race_mycheckpointlapsdelta, race_mycheckpointenemy);
-                       drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize_y) + eY * 0.6 * mySize_y, s, '1 1 0' * 0.2 * mySize_y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.2 * mySize.y) + eY * 0.6 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
                }
                if(race_othercheckpointtime && race_othercheckpointenemy != "")
                {
                        a = bound(0, 2 - (time - race_othercheckpointtime), 1);
                        s = MakeRaceString(race_othercheckpoint, -TIME_DECODE(race_othercheckpointdelta), -(race_othercheckpointenemy == ""), race_othercheckpointlapsdelta, race_othercheckpointenemy);
-                       drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize_y) + eY * 0.6 * mySize_y, s, '1 1 0' * 0.2 * mySize_y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.2 * mySize.y) + eY * 0.6 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
                }
 
                if(race_penaltytime && !race_penaltyaccumulator)
@@ -2504,7 +2609,7 @@ void HUD_RaceTimer (void)
                                        s = sprintf(_("^1PENALTY: %.1f (%s)"), (t - time) * 0.1, race_penaltyreason);
                                else
                                        s = sprintf(_("^2PENALTY: %.1f (%s)"), 0, race_penaltyreason);
-                               drawcolorcodedstring(pos + eX * 0.5 * mySize_x - '0.5 0 0' * stringwidth(s, TRUE, '1 1 0' * 0.2 * mySize_y) + eY * 0.6 * mySize_y, s, '1 1 0' * 0.2 * mySize_y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
+                               drawcolorcodedstring(pos + eX * 0.5 * mySize.x - '0.5 0 0' * stringwidth(s, true, '1 1 0' * 0.2 * mySize.y) + eY * 0.6 * mySize.y, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL);
                        }
                }
        }
@@ -2601,61 +2706,61 @@ void HUD_Vote(void)
 
        // always force 3:1 aspect
        vector newSize = '0 0 0';
-       if(mySize_x/mySize_y > 3)
+       if(mySize.x/mySize.y > 3)
        {
-               newSize_x = 3 * mySize_y;
-               newSize_y = mySize_y;
+               newSize.x = 3 * mySize.y;
+               newSize.y = mySize.y;
 
-               pos_x = pos_x + (mySize_x - newSize_x) / 2;
+               pos.x = pos.x + (mySize.x - newSize.x) / 2;
        }
        else
        {
-               newSize_y = 1/3 * mySize_x;
-               newSize_x = mySize_x;
+               newSize.y = 1/3 * mySize.x;
+               newSize.x = mySize.x;
 
-               pos_y = pos_y + (mySize_y - newSize_y) / 2;
+               pos.y = pos.y + (mySize.y - newSize.y) / 2;
        }
        mySize = newSize;
 
        s = _("A vote has been called for:");
        if(uid2name_dialog)
                s = _("Allow servers to store and display your name?");
-       drawstring_aspect(pos, s, eX * mySize_x + eY * (2/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
-       s = textShortenToWidth(vote_called_vote, mySize_x, '1 1 0' * mySize_y * (1/8), stringwidth_colors);
+       drawstring_aspect(pos, s, eX * mySize.x + eY * (2/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL);
+       s = textShortenToWidth(vote_called_vote, mySize.x, '1 1 0' * mySize.y * (1/8), stringwidth_colors);
        if(autocvar__hud_configure)
                s = _("^1Configure the HUD");
-       drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize_y, s, eX * mySize_x + eY * (1.75/8) * mySize_y, a, DRAWFLAG_NORMAL);
+       drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize.y, s, eX * mySize.x + eY * (1.75/8) * mySize.y, a, DRAWFLAG_NORMAL);
 
        // print the yes/no counts
     s = sprintf(_("Yes (%s): %d"), getcommandkey("vyes", "vyes"), vote_yescount);
-       drawstring_aspect(pos + eY * (4/8) * mySize_y, s, eX * 0.5 * mySize_x + eY * (1.5/8) * mySize_y, '0 1 0', a, DRAWFLAG_NORMAL);
+       drawstring_aspect(pos + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, '0 1 0', a, DRAWFLAG_NORMAL);
     s = sprintf(_("No (%s): %d"), getcommandkey("vno", "vno"), vote_nocount);
-       drawstring_aspect(pos + eX * 0.5 * mySize_x + eY * (4/8) * mySize_y, s, eX * 0.5 * mySize_x + eY * (1.5/8) * mySize_y, '1 0 0', a, DRAWFLAG_NORMAL);
+       drawstring_aspect(pos + eX * 0.5 * mySize.x + eY * (4/8) * mySize.y, s, eX * 0.5 * mySize.x + eY * (1.5/8) * mySize.y, '1 0 0', a, DRAWFLAG_NORMAL);
 
        // draw the progress bar backgrounds
-       drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_back", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
+       drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_back", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL);
 
        // draw the highlights
        if(vote_highlighted == 1) {
-               drawsetcliparea(pos_x, pos_y, mySize_x * 0.5, mySize_y);
-               drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_voted", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
+               drawsetcliparea(pos.x, pos.y, mySize.x * 0.5, mySize.y);
+               drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_voted", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL);
        }
        else if(vote_highlighted == -1) {
-               drawsetcliparea(pos_x + 0.5 * mySize_x, pos_y, mySize_x * 0.5, mySize_y);
-               drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_voted", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
+               drawsetcliparea(pos.x + 0.5 * mySize.x, pos.y, mySize.x * 0.5, mySize.y);
+               drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_voted", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL);
        }
 
        // draw the progress bars
        if(vote_yescount && vote_needed)
        {
-               drawsetcliparea(pos_x, pos_y, mySize_x * 0.5 * (vote_yescount/vote_needed), mySize_y);
-               drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_prog", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
+               drawsetcliparea(pos.x, pos.y, mySize.x * 0.5 * (vote_yescount/vote_needed), mySize.y);
+               drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_prog", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL);
        }
 
        if(vote_nocount && vote_needed)
        {
-               drawsetcliparea(pos_x + mySize_x - mySize_x * 0.5 * (vote_nocount/vote_needed), pos_y, mySize_x * 0.5, mySize_y);
-               drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_prog", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
+               drawsetcliparea(pos.x + mySize.x - mySize.x * 0.5 * (vote_nocount/vote_needed), pos.y, mySize.x * 0.5, mySize.y);
+               drawpic_skin(pos + eY * (5/8) * mySize.y, "voteprogress_prog", eX * mySize.x + eY * (3/8) * mySize.y, '1 1 1', a, DRAWFLAG_NORMAL);
        }
 
        drawresetcliparea();
@@ -2666,16 +2771,11 @@ void HUD_Vote(void)
 
 float mod_active; // is there any active mod icon?
 
-void DrawCAItem(vector myPos, vector mySize, float aspect_ratio, float layout, float i)
+void DrawCAItem(vector myPos, vector mySize, float aspect_ratio, int layout, float i)
 {
-       float stat;
-       string pic;
-       vector color;
-#ifdef GMQCC
-       stat = -1;
-       pic = "";
-       color = '0 0 0';
-#endif
+       float stat = -1;
+       string pic = "";
+       vector color = '0 0 0';
        switch(i)
        {
                case 0:
@@ -2701,23 +2801,23 @@ void DrawCAItem(vector myPos, vector mySize, float aspect_ratio, float layout, f
                        break;
        }
 
-       if(mySize_x/mySize_y > aspect_ratio)
+       if(mySize.x/mySize.y > aspect_ratio)
        {
-               i = aspect_ratio * mySize_y;
-               myPos_x = myPos_x + (mySize_x - i) / 2;
-               mySize_x = i;
+               i = aspect_ratio * mySize.y;
+               myPos.x = myPos.x + (mySize.x - i) / 2;
+               mySize.x = i;
        }
        else
        {
-               i = 1/aspect_ratio * mySize_x;
-               myPos_y = myPos_y + (mySize_y - i) / 2;
-               mySize_y = i;
+               i = 1/aspect_ratio * mySize.x;
+               myPos.y = myPos.y + (mySize.y - i) / 2;
+               mySize.y = i;
        }
 
        if(layout)
        {
-               drawpic_aspect_skin(myPos, pic, eX * 0.7 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-               drawstring_aspect(myPos + eX * 0.7 * mySize_x, ftos(stat), eX * 0.3 * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawpic_aspect_skin(myPos, pic, eX * 0.7 * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(myPos + eX * 0.7 * mySize.x, ftos(stat), eX * 0.3 * mySize.x + eY * mySize.y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
        }
        else
                drawstring_aspect(myPos, ftos(stat), mySize, color, panel_fg_alpha, DRAWFLAG_NORMAL);
@@ -2728,24 +2828,23 @@ void HUD_Mod_CA(vector myPos, vector mySize)
 {
        mod_active = 1; // required in each mod function that always shows something
 
-       float layout;
+       int layout;
        if(gametype == MAPINFO_TYPE_CA)
                layout = autocvar_hud_panel_modicons_ca_layout;
        else //if(gametype == MAPINFO_TYPE_FREEZETAG)
                layout = autocvar_hud_panel_modicons_freezetag_layout;
        float rows, columns, aspect_ratio;
-       rows = mySize_y/mySize_x;
        aspect_ratio = (layout) ? 2 : 1;
-       rows = bound(1, floor((sqrt((4 * aspect_ratio * team_count + rows) * rows) + rows + 0.5) / 2), team_count);
+       rows = HUD_GetRowCount(team_count, mySize, aspect_ratio);
        columns = ceil(team_count/rows);
 
        int i;
        float row = 0, column = 0;
        vector pos, itemSize;
-       itemSize = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
+       itemSize = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
        for(i=0; i<team_count; ++i)
        {
-               pos = myPos + eX * column * itemSize_x + eY * row * itemSize_y;
+               pos = myPos + eX * column * itemSize.x + eY * row * itemSize.y;
 
                DrawCAItem(pos, itemSize, aspect_ratio, layout, i);
 
@@ -2876,24 +2975,24 @@ void HUD_Mod_CTF(vector pos, vector mySize)
                        break;
        }
 
-       if(mySize_x > mySize_y) {
+       if(mySize.x > mySize.y) {
                if (myteam == NUM_TEAM_1) { // always draw own flag on left
                        redflag_pos = pos;
-                       blueflag_pos = pos + eX * 0.5 * mySize_x;
+                       blueflag_pos = pos + eX * 0.5 * mySize.x;
                } else {
                        blueflag_pos = pos;
-                       redflag_pos = pos + eX * 0.5 * mySize_x;
+                       redflag_pos = pos + eX * 0.5 * mySize.x;
                }
-               flag_size = eX * 0.5 * mySize_x + eY * mySize_y;
+               flag_size = eX * 0.5 * mySize.x + eY * mySize.y;
        } else {
                if (myteam == NUM_TEAM_1) { // always draw own flag on left
                        redflag_pos = pos;
-                       blueflag_pos = pos + eY * 0.5 * mySize_y;
+                       blueflag_pos = pos + eY * 0.5 * mySize.y;
                } else {
                        blueflag_pos = pos;
-                       redflag_pos = pos + eY * 0.5 * mySize_y;
+                       redflag_pos = pos + eY * 0.5 * mySize.y;
                }
-               flag_size = eY * 0.5 * mySize_y + eX * mySize_x;
+               flag_size = eY * 0.5 * mySize.y + eX * mySize.x;
        }
 
        f = bound(0, redflag_statuschange_elapsedtime*2, 1);
@@ -2910,148 +3009,132 @@ void HUD_Mod_CTF(vector pos, vector mySize)
 }
 
 // Keyhunt HUD modicon section
-float kh_runheretime;
-
-void HUD_Mod_KH_Reset(void)
-{
-       kh_runheretime = 0;
-}
+vector KH_SLOTS[4];
 
 void HUD_Mod_KH(vector pos, vector mySize)
 {
        mod_active = 1; // keyhunt should never hide the mod icons panel
-       float kh_keys;
-       float keyteam;
-       float a, aa;
-       vector p = '0 0 0', pa, kh_size = '0 0 0', kh_asize = '0 0 0';
 
-       kh_keys = getstati(STAT_KH_KEYS);
+       // Read current state
 
-       p_x = pos_x;
-       if(mySize_x > mySize_y)
-       {
-               p_y = pos_y + 0.25 * mySize_y;
-               pa = p - eY * 0.25 * mySize_y;
+       float state = getstati(STAT_KH_KEYS);
+       float i, key_state;
+       float all_keys, team1_keys, team2_keys, team3_keys, team4_keys, dropped_keys, carrying_keys;
+       all_keys = team1_keys = team2_keys = team3_keys = team4_keys = dropped_keys = carrying_keys = 0;
 
-               kh_size_x = mySize_x * 0.25;
-               kh_size_y = 0.75 * mySize_y;
-               kh_asize_x = mySize_x * 0.25;
-               kh_asize_y = mySize_y * 0.25;
-       }
-       else
+       for(i = 0; i < 4; ++i)
        {
-               p_y = pos_y + 0.125 * mySize_y;
-               pa = p - eY * 0.125 * mySize_y;
+               key_state = (bitshift(state, i * -5) & 31) - 1;
 
-               kh_size_x = mySize_x * 0.5;
-               kh_size_y = 0.375 * mySize_y;
-               kh_asize_x = mySize_x * 0.5;
-               kh_asize_y = mySize_y * 0.125;
-       }
+               if(key_state == -1)
+                       continue;
 
-       float i, key;
+               if(key_state == 30)
+               {
+                       ++carrying_keys;
+                       key_state = myteam;
+               }
 
-       float keycount;
-       keycount = 0;
-       for(i = 0; i < 4; ++i)
-       {
-               key = floor(kh_keys / pow(32, i)) & 31;
-               keyteam = key - 1;
-               if(keyteam == 30 && keycount <= 4)
-                       keycount += 4;
-               if(keyteam == myteam || keyteam == -1 || keyteam == 30)
-                       keycount += 1;
+               switch(key_state)
+               {
+                       case NUM_TEAM_1: ++team1_keys; break;
+                       case NUM_TEAM_2: ++team2_keys; break;
+                       case NUM_TEAM_3: ++team3_keys; break;
+                       case NUM_TEAM_4: ++team4_keys; break;
+                       case 29: ++dropped_keys; break;
+               }
+
+               ++all_keys;
        }
 
-       // this yields 8 exactly if "RUN HERE" shows
+       // Calculate slot measurements
 
-       if(keycount == 8)
+       vector slot_size;
+
+       if(all_keys == 4 && mySize.x * 0.5 < mySize.y && mySize.y * 0.5 < mySize.x)
        {
-               if(!kh_runheretime)
-                       kh_runheretime = time;
-               pa_y -= fabs(sin((time - kh_runheretime) * 3.5)) * 6; // make the arrows jump in case of RUN HERE
+               // Quadratic arrangement
+               slot_size = eX * mySize.x * 0.5 + eY * mySize.y * 0.5;
+               KH_SLOTS[0] = pos;
+               KH_SLOTS[1] = pos + eX * slot_size.x;
+               KH_SLOTS[2] = pos + eY * slot_size.y;
+               KH_SLOTS[3] = pos + eX * slot_size.x + eY * slot_size.y;
        }
        else
-               kh_runheretime = 0;
-
-       for(i = 0; i < 4; ++i)
        {
-               key = floor(kh_keys / pow(32, i)) & 31;
-               keyteam = key - 1;
-               switch(keyteam)
+               if(mySize.x > mySize.y)
                {
-                       case 30: // my key
-                               keyteam = myteam;
-                               a = 1;
-                               aa = 1;
-                               break;
-                       case -1: // no key
-                               a = 0;
-                               aa = 0;
-                               break;
-                       default: // owned or dropped
-                               a = 0.2;
-                               aa = 0.5;
-                               break;
+                       // Horizontal arrangement
+                       slot_size = eX * mySize.x / all_keys + eY * mySize.y;
+                       for(i = 0; i < all_keys; ++i)
+                               KH_SLOTS[i] = pos + eX * slot_size.x * i;
                }
-               a = a * panel_fg_alpha;
-               aa = aa * panel_fg_alpha;
-               if(a > 0)
+               else
                {
-                       switch(keyteam)
-                       {
-                               case NUM_TEAM_1:
-                                       drawpic_aspect_skin(pa, "kh_redarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               case NUM_TEAM_2:
-                                       drawpic_aspect_skin(pa, "kh_bluearrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               case NUM_TEAM_3:
-                                       drawpic_aspect_skin(pa, "kh_yellowarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               case NUM_TEAM_4:
-                                       drawpic_aspect_skin(pa, "kh_pinkarrow", kh_asize, '1 1 1', aa, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               default:
-                                       break;
-                       }
-                       switch(i) // YAY! switch(i) inside a for loop for i. DailyWTF, here we come!
-                       {
-                               case 0:
-                                       drawpic_aspect_skin(p, "kh_red", kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               case 1:
-                                       drawpic_aspect_skin(p, "kh_blue", kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               case 2:
-                                       drawpic_aspect_skin(p, "kh_yellow", kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                               case 3:
-                                       drawpic_aspect_skin(p, "kh_pink", kh_size, '1 1 1', a, DRAWFLAG_NORMAL);  // show 30% theAlpha key
-                                       break;
-                       }
+                       // Vertical arrangement
+                       slot_size = eX * mySize.x + eY * mySize.y / all_keys;
+                       for(i = 0; i < all_keys; ++i)
+                               KH_SLOTS[i] = pos + eY * slot_size.y * i;
                }
-               if(mySize_x > mySize_y)
+       }
+
+       // Make icons blink in case of RUN HERE
+
+       float blink = 0.6 + sin(2*M_PI*time) / 2.5; // Oscillate between 0.2 and 1
+       float alpha;
+       alpha = 1;
+
+       if(carrying_keys)
+               switch(myteam)
                {
-                       p_x += 0.25 * mySize_x;
-                       pa_x += 0.25 * mySize_x;
+                       case NUM_TEAM_1: if(team1_keys == all_keys) alpha = blink; break;
+                       case NUM_TEAM_2: if(team2_keys == all_keys) alpha = blink; break;
+                       case NUM_TEAM_3: if(team3_keys == all_keys) alpha = blink; break;
+                       case NUM_TEAM_4: if(team4_keys == all_keys) alpha = blink; break;
+               }
+
+       // Draw icons
+
+       i = 0;
+
+       while(team1_keys--)
+               if(myteam == NUM_TEAM_1 && carrying_keys)
+               {
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_red_carrying", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+                       --carrying_keys;
                }
                else
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_red_taken", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+
+       while(team2_keys--)
+               if(myteam == NUM_TEAM_2 && carrying_keys)
                {
-                       if(i == 1)
-                       {
-                               p_y = pos_y + 0.625 * mySize_y;
-                               pa_y = pos_y + 0.5 * mySize_y;
-                               p_x = pos_x;
-                               pa_x = pos_x;
-                       }
-                       else
-                       {
-                               p_x += 0.5 * mySize_x;
-                               pa_x += 0.5 * mySize_x;
-                       }
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_blue_carrying", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+                       --carrying_keys;
                }
-       }
+               else
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_blue_taken", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+
+       while(team3_keys--)
+               if(myteam == NUM_TEAM_3 && carrying_keys)
+               {
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_yellow_carrying", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+                       --carrying_keys;
+               }
+               else
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_yellow_taken", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+
+       while(team4_keys--)
+               if(myteam == NUM_TEAM_4 && carrying_keys)
+               {
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_pink_carrying", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+                       --carrying_keys;
+               }
+               else
+                       drawpic_aspect_skin(KH_SLOTS[i++], "kh_pink_taken", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
+
+       while(dropped_keys--)
+               drawpic_aspect_skin(KH_SLOTS[i++], "kh_dropped", slot_size, '1 1 1', alpha, DRAWFLAG_NORMAL);
 }
 
 // Keepaway HUD mod icon
@@ -3081,12 +3164,12 @@ void HUD_Mod_Keepaway(vector pos, vector mySize)
 
        vector kaball_pos, kaball_size;
 
-       if(mySize_x > mySize_y) {
-               kaball_pos = pos + eX * 0.25 * mySize_x;
-               kaball_size = eX * 0.5 * mySize_x + eY * mySize_y;
+       if(mySize.x > mySize.y) {
+               kaball_pos = pos + eX * 0.25 * mySize.x;
+               kaball_size = eX * 0.5 * mySize.x + eY * mySize.y;
        } else {
-               kaball_pos = pos + eY * 0.25 * mySize_y;
-               kaball_size = eY * 0.5 * mySize_y + eX * mySize_x;
+               kaball_pos = pos + eY * 0.25 * mySize.y;
+               kaball_size = eY * 0.5 * mySize.y + eX * mySize.x;
        }
 
        float kaball_statuschange_elapsedtime = time - kaball_statuschange_time;
@@ -3096,7 +3179,7 @@ void HUD_Mod_Keepaway(vector pos, vector mySize)
                drawpic_aspect_skin_expanding(kaball_pos, "keepawayball_carrying", kaball_size, '1 1 1', panel_fg_alpha * kaball_alpha, DRAWFLAG_NORMAL, f);
 
        if(kaball)
-               drawpic_aspect_skin(pos, "keepawayball_carrying", eX * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha * kaball_alpha * f, DRAWFLAG_NORMAL);
+               drawpic_aspect_skin(pos, "keepawayball_carrying", eX * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha * kaball_alpha * f, DRAWFLAG_NORMAL);
 }
 
 
@@ -3122,11 +3205,11 @@ void HUD_Mod_NexBall(vector pos, vector mySize)
                if (p > 1)
                        p = 2 - p;
 
-               HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", p, (mySize_x <= mySize_y), 0, autocvar_hud_progressbar_nexball_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+               HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", p, (mySize.x <= mySize.y), 0, autocvar_hud_progressbar_nexball_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
        }
 
        if (stat_items & IT_KEY1)
-               drawpic_aspect_skin(pos, "nexball_carrying", eX * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawpic_aspect_skin(pos, "nexball_carrying", eX * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 }
 
 // Race/CTS HUD mod icons
@@ -3175,16 +3258,16 @@ void HUD_Mod_Race(vector pos, vector mySize)
 
        vector textPos, medalPos;
        float squareSize;
-       if(mySize_x > mySize_y) {
+       if(mySize.x > mySize.y) {
                // text on left side
-               squareSize = min(mySize_y, mySize_x/2);
-               textPos = pos + eX * 0.5 * max(0, mySize_x/2 - squareSize) + eY * 0.5 * (mySize_y - squareSize);
-               medalPos = pos + eX * 0.5 * max(0, mySize_x/2 - squareSize) + eX * 0.5 * mySize_x + eY * 0.5 * (mySize_y - squareSize);
+               squareSize = min(mySize.y, mySize.x/2);
+               textPos = pos + eX * 0.5 * max(0, mySize.x/2 - squareSize) + eY * 0.5 * (mySize.y - squareSize);
+               medalPos = pos + eX * 0.5 * max(0, mySize.x/2 - squareSize) + eX * 0.5 * mySize.x + eY * 0.5 * (mySize.y - squareSize);
        } else {
                // text on top
-               squareSize = min(mySize_x, mySize_y/2);
-               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);
+               squareSize = min(mySize.x, mySize.y/2);
+               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);
        }
 
        f = time - crecordtime_change_time;
@@ -3276,16 +3359,11 @@ void HUD_Mod_Race(vector pos, vector mySize)
        }
 }
 
-void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, float layout, float i)
+void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, int layout, float i)
 {
-       float stat, pps_ratio;
-       string pic;
-       vector color;
-#ifdef GMQCC
-       stat = -1;
-       pic = "";
-       color = '0 0 0';
-#endif
+       float stat = -1;
+       string pic = "";
+       vector color = '0 0 0';
        switch(i)
        {
                case 0:
@@ -3310,19 +3388,19 @@ void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, float layout,
                        color = '1 0 1';
                        break;
        }
-       pps_ratio = stat / getstatf(STAT_DOM_TOTAL_PPS);
+       float pps_ratio = stat / getstatf(STAT_DOM_TOTAL_PPS);
 
-       if(mySize_x/mySize_y > aspect_ratio)
+       if(mySize.x/mySize.y > aspect_ratio)
        {
-               i = aspect_ratio * mySize_y;
-               myPos_x = myPos_x + (mySize_x - i) / 2;
-               mySize_x = i;
+               i = aspect_ratio * mySize.y;
+               myPos.x = myPos.x + (mySize.x - i) / 2;
+               mySize.x = i;
        }
        else
        {
-               i = 1/aspect_ratio * mySize_x;
-               myPos_y = myPos_y + (mySize_y - i) / 2;
-               mySize_y = i;
+               i = 1/aspect_ratio * mySize.x;
+               myPos.y = myPos.y + (mySize.y - i) / 2;
+               mySize.y = i;
        }
 
        if (layout) // show text too
@@ -3330,17 +3408,17 @@ void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, float layout,
                //draw the text
                color *= 0.5 + pps_ratio * (1 - 0.5); // half saturated color at min, full saturated at max
                if (layout == 2) // average pps
-                       drawstring_aspect(myPos + eX * mySize_y, ftos_decimals(stat, 2), eX * (2/3) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawstring_aspect(myPos + eX * mySize.y, ftos_decimals(stat, 2), eX * (2/3) * mySize.x + eY * mySize.y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
                else // percentage of average pps
-                       drawstring_aspect(myPos + eX * mySize_y, strcat( ftos(floor(pps_ratio*100 + 0.5)), "%" ), eX * (2/3) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawstring_aspect(myPos + eX * mySize.y, strcat( ftos(floor(pps_ratio*100 + 0.5)), "%" ), eX * (2/3) * mySize.x + eY * mySize.y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
        }
 
        //draw the icon
-       drawpic_aspect_skin(myPos, pic, '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawpic_aspect_skin(myPos, pic, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
        if (stat > 0)
        {
-               drawsetcliparea(myPos_x, myPos_y + mySize_y * (1 - pps_ratio), mySize_y, mySize_y * pps_ratio);
-               drawpic_aspect_skin(myPos, strcat(pic, "-highlighted"), '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawsetcliparea(myPos.x, myPos.y + mySize.y * (1 - pps_ratio), mySize.y, mySize.y * pps_ratio);
+               drawpic_aspect_skin(myPos, strcat(pic, "-highlighted"), '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                drawresetcliparea();
        }
 }
@@ -3349,20 +3427,19 @@ void HUD_Mod_Dom(vector myPos, vector mySize)
 {
        mod_active = 1; // required in each mod function that always shows something
 
-       float layout = autocvar_hud_panel_modicons_dom_layout;
+       int layout = autocvar_hud_panel_modicons_dom_layout;
        float rows, columns, aspect_ratio;
-       rows = mySize_y/mySize_x;
        aspect_ratio = (layout) ? 3 : 1;
-       rows = bound(1, floor((sqrt((4 * aspect_ratio * team_count + rows) * rows) + rows + 0.5) / 2), team_count);
+       rows = HUD_GetRowCount(team_count, mySize, aspect_ratio);
        columns = ceil(team_count/rows);
 
        int i;
        float row = 0, column = 0;
        vector pos, itemSize;
-       itemSize = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
+       itemSize = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
        for(i=0; i<team_count; ++i)
        {
-               pos = myPos + eX * column * itemSize_x + eY * row * itemSize_y;
+               pos = myPos + eX * column * itemSize.x + eY * row * itemSize.y;
 
                DrawDomItem(pos, itemSize, aspect_ratio, layout, i);
 
@@ -3461,42 +3538,42 @@ void HUD_PressedKeys(void)
        if(aspect)
        {
                vector newSize = '0 0 0';
-               if(mySize_x/mySize_y > aspect)
+               if(mySize.x/mySize.y > aspect)
                {
-                       newSize_x = aspect * mySize_y;
-                       newSize_y = mySize_y;
+                       newSize.x = aspect * mySize.y;
+                       newSize.y = mySize.y;
 
-                       pos_x = pos_x + (mySize_x - newSize_x) / 2;
+                       pos.x = pos.x + (mySize.x - newSize.x) / 2;
                }
                else
                {
-                       newSize_y = 1/aspect * mySize_x;
-                       newSize_x = mySize_x;
+                       newSize.y = 1/aspect * mySize.x;
+                       newSize.x = mySize.x;
 
-                       pos_y = pos_y + (mySize_y - newSize_y) / 2;
+                       pos.y = pos.y + (mySize.y - newSize.y) / 2;
                }
                mySize = newSize;
        }
 
        vector keysize;
-       keysize = eX * mySize_x * (1/3.0) + eY * mySize_y * (1/(3.0 - !autocvar_hud_panel_pressedkeys_attack));
+       keysize = eX * mySize.x * (1/3.0) + eY * mySize.y * (1/(3.0 - !autocvar_hud_panel_pressedkeys_attack));
        float pressedkeys;
        pressedkeys = getstatf(STAT_PRESSED_KEYS);
 
        if(autocvar_hud_panel_pressedkeys_attack)
        {
-               drawpic_aspect_skin(pos + eX * keysize_x * 0.5, ((pressedkeys & KEY_ATCK) ? "key_atck_inv.tga" : "key_atck.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-               drawpic_aspect_skin(pos + eX * keysize_x * 1.5, ((pressedkeys & KEY_ATCK2) ? "key_atck_inv.tga" : "key_atck.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-               pos_y += keysize_y;
+               drawpic_aspect_skin(pos + eX * keysize.x * 0.5, ((pressedkeys & KEY_ATCK) ? "key_atck_inv.tga" : "key_atck.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawpic_aspect_skin(pos + eX * keysize.x * 1.5, ((pressedkeys & KEY_ATCK2) ? "key_atck_inv.tga" : "key_atck.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               pos.y += keysize.y;
        }
 
        drawpic_aspect_skin(pos, ((pressedkeys & KEY_CROUCH) ? "key_crouch_inv.tga" : "key_crouch.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-       drawpic_aspect_skin(pos + eX * keysize_x, ((pressedkeys & KEY_FORWARD) ? "key_forward_inv.tga" : "key_forward.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-       drawpic_aspect_skin(pos + eX * keysize_x * 2, ((pressedkeys & KEY_JUMP) ? "key_jump_inv.tga" : "key_jump.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-       pos_y += keysize_y;
+       drawpic_aspect_skin(pos + eX * keysize.x, ((pressedkeys & KEY_FORWARD) ? "key_forward_inv.tga" : "key_forward.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawpic_aspect_skin(pos + eX * keysize.x * 2, ((pressedkeys & KEY_JUMP) ? "key_jump_inv.tga" : "key_jump.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       pos.y += keysize.y;
        drawpic_aspect_skin(pos, ((pressedkeys & KEY_LEFT) ? "key_left_inv.tga" : "key_left.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-       drawpic_aspect_skin(pos + eX * keysize_x, ((pressedkeys & KEY_BACKWARD) ? "key_backward_inv.tga" : "key_backward.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-       drawpic_aspect_skin(pos + eX * keysize_x * 2, ((pressedkeys & KEY_RIGHT) ? "key_right_inv.tga" : "key_right.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawpic_aspect_skin(pos + eX * keysize.x, ((pressedkeys & KEY_BACKWARD) ? "key_backward_inv.tga" : "key_backward.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawpic_aspect_skin(pos + eX * keysize.x * 2, ((pressedkeys & KEY_RIGHT) ? "key_right_inv.tga" : "key_right.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 }
 
 // Handle chat as a panel (#12)
@@ -3526,8 +3603,8 @@ void HUD_Chat(void)
 
        if(autocvar__con_chat_maximized && !autocvar__hud_configure) // draw at full screen height if maximized
        {
-               panel_pos_y = panel_bg_border;
-               panel_size_y = vid_conheight - panel_bg_border * 2;
+               panel_pos.y = panel_bg_border;
+               panel_size.y = vid_conheight - panel_bg_border * 2;
                if(panel.current_panel_bg == "0") // force a border when maximized
                {
                        string panel_bg;
@@ -3557,11 +3634,11 @@ void HUD_Chat(void)
        if (!autocvar_con_chatrect)
                cvar_set("con_chatrect", "1");
 
-       cvar_set("con_chatrect_x", ftos(pos_x/vid_conwidth));
-       cvar_set("con_chatrect_y", ftos(pos_y/vid_conheight));
+       cvar_set("con_chatrect_x", ftos(pos.x/vid_conwidth));
+       cvar_set("con_chatrect_y", ftos(pos.y/vid_conheight));
 
-       cvar_set("con_chatwidth", ftos(mySize_x/vid_conwidth));
-       cvar_set("con_chat", ftos(floor(mySize_y/autocvar_con_chatsize - 0.5)));
+       cvar_set("con_chatwidth", ftos(mySize.x/vid_conwidth));
+       cvar_set("con_chat", ftos(floor(mySize.y/autocvar_con_chatsize - 0.5)));
 
        if(autocvar__hud_configure)
        {
@@ -3575,8 +3652,8 @@ void HUD_Chat(void)
                                a = panel_fg_alpha;
                        else
                                a = panel_fg_alpha * floor(((i + 1) * 7 + autocvar_con_chattime)/45);
-                       drawcolorcodedstring(pos, textShortenToWidth(_("^3Player^7: This is the chat area."), mySize_x, chatsize, stringwidth_colors), chatsize, a, DRAWFLAG_NORMAL);
-                       pos_y += chatsize_y;
+                       drawcolorcodedstring(pos, textShortenToWidth(_("^3Player^7: This is the chat area."), mySize.x, chatsize, stringwidth_colors), chatsize, a, DRAWFLAG_NORMAL);
+                       pos.y += chatsize.y;
                }
        }
 }
@@ -3645,11 +3722,12 @@ void HUD_EngineInfo(void)
 
 // Info messages panel (#14)
 //
-#define drawInfoMessage(s)\
-       if(autocvar_hud_panel_infomessages_flip)\
-               o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize);\
-       drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);\
-       o_y += fontsize_y;
+#define drawInfoMessage(s) do {                                                                                                                                                                                \
+       if(autocvar_hud_panel_infomessages_flip)                                                                                                                                                \
+               o.x = pos.x + mySize.x - stringwidth(s, true, fontsize);                                                                                                        \
+       drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);                                                                                                               \
+       o.y += fontsize.y;                                                                                                                                                                                              \
+} while(0)
 void HUD_InfoMessages(void)
 {
        if(!autocvar__hud_configure)
@@ -3671,19 +3749,19 @@ void HUD_InfoMessages(void)
 
        // always force 5:1 aspect
        vector newSize = '0 0 0';
-       if(mySize_x/mySize_y > 5)
+       if(mySize.x/mySize.y > 5)
        {
-               newSize_x = 5 * mySize_y;
-               newSize_y = mySize_y;
+               newSize.x = 5 * mySize.y;
+               newSize.y = mySize.y;
 
-               pos_x = pos_x + (mySize_x - newSize_x) / 2;
+               pos.x = pos.x + (mySize.x - newSize.x) / 2;
        }
        else
        {
-               newSize_y = 1/5 * mySize_x;
-               newSize_x = mySize_x;
+               newSize.y = 1/5 * mySize.x;
+               newSize.x = mySize.x;
 
-               pos_y = pos_y + (mySize_y - newSize_y) / 2;
+               pos.y = pos.y + (mySize.y - newSize.y) / 2;
        }
 
        mySize = newSize;
@@ -3692,7 +3770,7 @@ void HUD_InfoMessages(void)
        o = pos;
 
        vector fontsize;
-       fontsize = '0.20 0.20 0' * mySize_y;
+       fontsize = '0.20 0.20 0' * mySize.y;
 
        float a;
        a = panel_fg_alpha;
@@ -3707,22 +3785,22 @@ void HUD_InfoMessages(void)
                                s = _("^1Observing");
                        else
                                s = sprintf(_("^1Spectating: ^7%s"), GetPlayerName(player_localentnum - 1));
-                       drawInfoMessage(s)
+                       drawInfoMessage(s);
 
                        if(spectatee_status == -1)
                                s = sprintf(_("^1Press ^3%s^1 to spectate"), getcommandkey("primary fire", "+fire"));
                        else
                                s = sprintf(_("^1Press ^3%s^1 or ^3%s^1 for next or previous player"), getcommandkey("next weapon", "weapnext"), getcommandkey("previous weapon", "weapprev"));
-                       drawInfoMessage(s)
+                       drawInfoMessage(s);
 
                        if(spectatee_status == -1)
                                s = sprintf(_("^1Use ^3%s^1 or ^3%s^1 to change the speed"), getcommandkey("next weapon", "weapnext"), getcommandkey("previous weapon", "weapprev"));
                        else
                                s = sprintf(_("^1Press ^3%s^1 to observe"), getcommandkey("secondary fire", "+fire2"));
-                       drawInfoMessage(s)
+                       drawInfoMessage(s);
 
                        s = sprintf(_("^1Press ^3%s^1 for gamemode info"), getcommandkey("server info", "+show_info"));
-                       drawInfoMessage(s)
+                       drawInfoMessage(s);
 
                        if(gametype == MAPINFO_TYPE_LMS)
                        {
@@ -3737,7 +3815,7 @@ void HUD_InfoMessages(void)
                        }
                        else
                                s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey("jump", "+jump"));
-                       drawInfoMessage(s)
+                       drawInfoMessage(s);
 
                        //show restart countdown:
                        if (time < getstatf(STAT_GAMESTARTTIME)) {
@@ -3746,13 +3824,13 @@ void HUD_InfoMessages(void)
                                countdown = ceil(getstatf(STAT_GAMESTARTTIME) - time);
                                s = sprintf(_("^1Game starts in ^3%d^1 seconds"), countdown);
                                drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
-                               o_y += fontsize_y;
+                               o.y += fontsize.y;
                        }
                }
                if(warmup_stage && !intermission)
                {
                        s = _("^2Currently in ^1warmup^2 stage!");
-                       drawInfoMessage(s)
+                       drawInfoMessage(s);
                }
 
                string blinkcolor;
@@ -3777,12 +3855,12 @@ void HUD_InfoMessages(void)
                                else
                                        s = _("^2Waiting for others to ready up...");
                        }
-                       drawInfoMessage(s)
+                       drawInfoMessage(s);
                }
                else if(warmup_stage && !intermission && !spectatee_status)
                {
                        s = sprintf(_("^2Press ^3%s^2 to end warmup"), getcommandkey("ready", "ready"));
-                       drawInfoMessage(s)
+                       drawInfoMessage(s);
                }
 
                if(teamplay && !intermission && !spectatee_status && gametype != MAPINFO_TYPE_CA && teamnagger)
@@ -3791,7 +3869,7 @@ void HUD_InfoMessages(void)
                        tm = teams.sort_next;
                        if (tm)
                        {
-                               for(; tm.sort_next; tm = tm.sort_next)
+                               for (; tm.sort_next; tm = tm.sort_next)
                                {
                                        if(!tm.team_size || tm.team == NUM_SPECTATOR)
                                                continue;
@@ -3808,7 +3886,7 @@ void HUD_InfoMessages(void)
                                        if (tm.team != NUM_SPECTATOR)
                                        if (tm.team_size == ts_max)
                                                s = strcat(s, sprintf(_(" Press ^3%s%s to adjust"), getcommandkey("team menu", "menu_showteamselect"), blinkcolor));
-                                       drawInfoMessage(s)
+                                       drawInfoMessage(s);
                                }
                        }
                }
@@ -3816,13 +3894,13 @@ void HUD_InfoMessages(void)
        else
        {
                s = _("^7Press ^3ESC ^7to show HUD options.");
-               drawInfoMessage(s)
+               drawInfoMessage(s);
                s = _("^3Doubleclick ^7a panel for panel-specific options.");
-               drawInfoMessage(s)
+               drawInfoMessage(s);
                s = _("^3CTRL ^7to disable collision testing, ^3SHIFT ^7and");
-               drawInfoMessage(s)
+               drawInfoMessage(s);
                s = _("^3ALT ^7+ ^3ARROW KEYS ^7for fine adjustments.");
-               drawInfoMessage(s)
+               drawInfoMessage(s);
        }
 }
 
@@ -3897,7 +3975,7 @@ void HUD_Physics(void)
        else if(autocvar_hud_panel_physics_speed_vertical)
                speed = floor( vlen(vel) * conversion_factor + 0.5 );
        else
-               speed = floor( vlen(vel - vel_z * '0 0 1') * conversion_factor + 0.5 );
+               speed = floor( vlen(vel - vel.z * '0 0 1') * conversion_factor + 0.5 );
 
        //compute acceleration
        float acceleration, f;
@@ -3910,7 +3988,7 @@ void HUD_Physics(void)
                if(autocvar_hud_panel_physics_acceleration_vertical)
                        acceleration = (vlen(vel) - vlen(acc_prevspeed));
                else
-                       acceleration = (vlen(vel - '0 0 1' * vel_z) - vlen(acc_prevspeed - '0 0 1' * acc_prevspeed_z));
+                       acceleration = (vlen(vel - '0 0 1' * vel.z) - vlen(acc_prevspeed - '0 0 1' * acc_prevspeed.z));
 
                acceleration = acceleration * (1 / max(0.0001, f)) * (0.0254 / 9.80665);
 
@@ -3922,23 +4000,23 @@ void HUD_Physics(void)
        }
 
        //compute layout
-       float panel_ar = panel_size_x/panel_size_y;
+       float panel_ar = panel_size.x/panel_size.y;
        vector speed_offset = '0 0 0', acceleration_offset = '0 0 0';
        if (panel_ar >= 5 && !acceleration_progressbar_scale)
        {
-               panel_size_x *= 0.5;
+               panel_size.x *= 0.5;
                if (autocvar_hud_panel_physics_flip)
-                       speed_offset_x = panel_size_x;
+                       speed_offset.x = panel_size.x;
                else
-                       acceleration_offset_x = panel_size_x;
+                       acceleration_offset.x = panel_size.x;
        }
        else
        {
-               panel_size_y *= 0.5;
+               panel_size.y *= 0.5;
                if (autocvar_hud_panel_physics_flip)
-                       speed_offset_y = panel_size_y;
+                       speed_offset.y = panel_size.y;
                else
-                       acceleration_offset_y = panel_size_y;
+                       acceleration_offset.y = panel_size.y;
        }
        float speed_baralign, acceleration_baralign;
        if (autocvar_hud_panel_physics_baralign == 1)
@@ -3965,26 +4043,26 @@ void HUD_Physics(void)
        vector tmp_offset = '0 0 0', tmp_size = '0 0 0';
        if (autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 2)
        {
-               tmp_size_x = panel_size_x * 0.75;
-               tmp_size_y = panel_size_y * text_scale;
+               tmp_size.x = panel_size.x * 0.75;
+               tmp_size.y = panel_size.y * text_scale;
                if (speed_baralign)
-                       tmp_offset_x = panel_size_x - tmp_size_x;
+                       tmp_offset.x = panel_size.x - tmp_size.x;
                //else
                        //tmp_offset_x = 0;
-               tmp_offset_y = (panel_size_y - tmp_size_y) / 2;
+               tmp_offset.y = (panel_size.y - tmp_size.y) / 2;
                drawstring_aspect(panel_pos + speed_offset + tmp_offset, ftos(speed), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 
                //draw speed unit
                if (speed_baralign)
-                       tmp_offset_x = 0;
+                       tmp_offset.x = 0;
                else
-                       tmp_offset_x = tmp_size_x;
+                       tmp_offset.x = tmp_size.x;
                if (autocvar_hud_panel_physics_speed_unit_show)
                {
                        //tmp_offset_y = 0;
-                       tmp_size_x = panel_size_x * (1 - 0.75);
-                       tmp_size_y = panel_size_y * 0.4 * text_scale;
-                       tmp_offset_y = (panel_size_y * 0.4 - tmp_size_y) / 2;
+                       tmp_size.x = panel_size.x * (1 - 0.75);
+                       tmp_size.y = panel_size.y * 0.4 * text_scale;
+                       tmp_offset.y = (panel_size.y * 0.4 - tmp_size.y) / 2;
                        drawstring_aspect(panel_pos + speed_offset + tmp_offset, unit, tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
        }
@@ -4020,30 +4098,30 @@ void HUD_Physics(void)
                        if(speed < top_speed)
                        if(autocvar_hud_panel_physics_progressbar == 1 || autocvar_hud_panel_physics_progressbar == 2)
                        {
-                               float peak_offset_x;
+                               float peak_offsetX;
                                vector peak_size = '0 0 0';
                                if (speed_baralign == 0)
-                                       peak_offset_x = min(top_speed, max_speed)/max_speed * panel_size_x;
+                                       peak_offsetX = min(top_speed, max_speed)/max_speed * panel_size.x;
                 else if (speed_baralign == 1)
-                                       peak_offset_x = (1 - min(top_speed, max_speed)/max_speed) * panel_size_x;
+                                       peak_offsetX = (1 - min(top_speed, max_speed)/max_speed) * panel_size.x;
                 else // if (speed_baralign == 2)
-                    peak_offset_x = min(top_speed, max_speed)/max_speed * panel_size_x * 0.5;
-                               peak_size_x = floor(panel_size_x * 0.01 + 1.5);
-                peak_size_y = panel_size_y;
+                    peak_offsetX = min(top_speed, max_speed)/max_speed * panel_size.x * 0.5;
+                               peak_size.x = floor(panel_size.x * 0.01 + 1.5);
+                peak_size.y = panel_size.y;
                 if (speed_baralign == 2) // draw two peaks, on both sides
                 {
-                    drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size_x + peak_offset_x - peak_size_x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
-                    drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size_x - peak_offset_x + peak_size_x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                    drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size.x + peak_offsetX - peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                    drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size.x - peak_offsetX + peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                 }
                 else
-                    drawfill(panel_pos + speed_offset + eX * (peak_offset_x - peak_size_x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                    drawfill(panel_pos + speed_offset + eX * (peak_offsetX - peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
 
                        //top speed
-                       tmp_offset_y = panel_size_y * 0.4;
-                       tmp_size_x = panel_size_x * (1 - 0.75);
-                       tmp_size_y = (panel_size_y - tmp_offset_y) * text_scale;
-                       tmp_offset_y += (panel_size_y - tmp_offset_y - tmp_size_y) / 2;
+                       tmp_offset.y = panel_size.y * 0.4;
+                       tmp_size.x = panel_size.x * (1 - 0.75);
+                       tmp_size.y = (panel_size.y - tmp_offset.y) * text_scale;
+                       tmp_offset.y += (panel_size.y - tmp_offset.y - tmp_size.y) / 2;
                        drawstring_aspect(panel_pos + speed_offset + tmp_offset, ftos(top_speed), tmp_size, '1 0 0', f * panel_fg_alpha, DRAWFLAG_NORMAL);
                }
                else
@@ -4066,15 +4144,15 @@ void HUD_Physics(void)
 
                if (acceleration_progressbar_scale) // allow progressbar to go out of panel bounds
                {
-                       tmp_size = acceleration_progressbar_scale * panel_size_x * eX + panel_size_y * eY;
+                       tmp_size = acceleration_progressbar_scale * panel_size.x * eX + panel_size.y * eY;
 
                        if (acceleration_baralign == 1)
-                               tmp_offset_x = panel_size_x - tmp_size_x;
+                               tmp_offset.x = panel_size.x - tmp_size.x;
                        else if (acceleration_baralign == 2 || acceleration_baralign == 3)
-                               tmp_offset_x = (panel_size_x - tmp_size_x) / 2;
+                               tmp_offset.x = (panel_size.x - tmp_size.x) / 2;
                        else
-                               tmp_offset_x = 0;
-                       tmp_offset_y = 0;
+                               tmp_offset.x = 0;
+                       tmp_offset.y = 0;
                }
                else
                {
@@ -4084,10 +4162,10 @@ void HUD_Physics(void)
 
                HUD_Panel_DrawProgressBar(panel_pos + acceleration_offset + tmp_offset, tmp_size, "accelbar", f, 0, acceleration_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
        }
-       tmp_size_x = panel_size_x;
-       tmp_size_y = panel_size_y * text_scale;
-       tmp_offset_x = 0;
-       tmp_offset_y = (panel_size_y - tmp_size_y) / 2;
+       tmp_size.x = panel_size.x;
+       tmp_size.y = panel_size.y * text_scale;
+       tmp_offset.x = 0;
+       tmp_offset.y = (panel_size.y - tmp_size.y) / 2;
        if (autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 3)
                drawstring_aspect(panel_pos + acceleration_offset + tmp_offset, strcat(ftos_decimals(acceleration, 2), "g"), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 
@@ -4096,9 +4174,9 @@ void HUD_Physics(void)
 
 // CenterPrint (#16)
 //
-#define CENTERPRINT_MAX_MSGS 10
-#define CENTERPRINT_MAX_ENTRIES 50
-#define CENTERPRINT_SPACING 0.7
+const float CENTERPRINT_MAX_MSGS = 10;
+const float CENTERPRINT_MAX_ENTRIES = 50;
+const float CENTERPRINT_SPACING = 0.7;
 float cpm_index;
 string centerprint_messages[CENTERPRINT_MAX_MSGS];
 float centerprint_msgID[CENTERPRINT_MAX_MSGS];
@@ -4136,7 +4214,7 @@ void centerprint_generic(float new_id, string strMessage, float duration, float
                return;
 
        if (!centerprint_showing)
-               centerprint_showing = TRUE;
+               centerprint_showing = true;
 
        for (i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
        {
@@ -4208,12 +4286,12 @@ void HUD_CenterPrint (void)
        {
                if(!autocvar_hud_panel_centerprint) return;
 
-               if (hud_configure_prev && hud_configure_prev != -1)
+               if(hud_configure_prev)
                        reset_centerprint_messages();
        }
        else
        {
-               if (!hud_configure_prev)
+               if(!hud_configure_prev)
                        reset_centerprint_messages();
                if (time > hud_configure_cp_generation_time)
                {
@@ -4247,12 +4325,12 @@ void HUD_CenterPrint (void)
                        return;
                vector target_pos;
 
-               target_pos = eY * scoreboard_bottom + eX * 0.5 * (vid_conwidth - panel_size_x);
+               target_pos = eY * scoreboard_bottom + eX * 0.5 * (vid_conwidth - panel_size.x);
 
-               if(target_pos_y > panel_pos_y)
+               if(target_pos.y > panel_pos.y)
                {
                        panel_pos = panel_pos + (target_pos - panel_pos) * sqrt(scoreboard_fade_alpha);
-                       panel_size_y = min(panel_size_y, vid_conheight - scoreboard_bottom);
+                       panel_size.y = min(panel_size.y, vid_conheight - scoreboard_bottom);
                }
        }
 
@@ -4274,17 +4352,17 @@ void HUD_CenterPrint (void)
        // fontsize = '1 1 0' * height;
        height = vid_conheight/50 * autocvar_hud_panel_centerprint_fontscale;
        fontsize = '1 1 0' * height;
-       entries = bound(1, floor(panel_size_y/height), CENTERPRINT_MAX_ENTRIES);
+       entries = bound(1, floor(panel_size.y/height), CENTERPRINT_MAX_ENTRIES);
 
        float i, j, k, n, g;
-       float a, sz, align, current_msg_pos_y = 0, msg_size;
+       float a, sz, align, current_msg_posY = 0, msg_size;
        vector pos;
        string ts;
-       float all_messages_expired = TRUE;
+       float all_messages_expired = true;
 
        pos = panel_pos;
        if (autocvar_hud_panel_centerprint_flip)
-               pos_y += panel_size_y;
+               pos.y += panel_size.y;
        align = bound(0, autocvar_hud_panel_centerprint_align, 1);
        for (g=0, i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
        {
@@ -4303,7 +4381,7 @@ void HUD_CenterPrint (void)
                                continue;
                }
 
-               all_messages_expired = FALSE;
+               all_messages_expired = false;
 
                // fade the centerprint_hud in/out
                if(centerprint_time[j] < 0)  // Expired but forced. Expire time is the fade-in time.
@@ -4347,46 +4425,46 @@ void HUD_CenterPrint (void)
                                getWrappedLine_remaining = argv(k);
                                while(getWrappedLine_remaining)
                                {
-                                       ts = getWrappedLine(panel_size_x * sz, fontsize, stringwidth_colors);
+                                       ts = getWrappedLine(panel_size.x * sz, fontsize, stringwidth_colors);
                                        if (ts != "")
-                                               pos_y -= fontsize_y;
+                                               pos.y -= fontsize.y;
                                        else
-                                               pos_y -= fontsize_y * CENTERPRINT_SPACING/2;
+                                               pos.y -= fontsize.y * CENTERPRINT_SPACING/2;
                                }
                        }
-                       current_msg_pos_y = pos_y; // save starting pos (first line) of the current message
+                       current_msg_posY = pos.y; // save starting pos (first line) of the current message
                }
 
-               msg_size = pos_y;
+               msg_size = pos.y;
                for(k = 0; k < n; ++k)
                {
                        getWrappedLine_remaining = argv(k);
                        while(getWrappedLine_remaining)
                        {
-                               ts = getWrappedLine(panel_size_x * sz, fontsize, stringwidth_colors);
+                               ts = getWrappedLine(panel_size.x * sz, fontsize, stringwidth_colors);
                                if (ts != "")
                                {
                                        if (align)
-                                               pos_x = panel_pos_x + (panel_size_x - stringwidth(ts, TRUE, fontsize)) * align;
+                                               pos.x = panel_pos.x + (panel_size.x - stringwidth(ts, true, fontsize)) * align;
                                        if (a > 0.5/255.0)  // Otherwise guaranteed invisible - don't show. This is checked a second time after some multiplications with other factors were done so temporary changes of these cannot cause flicker.
-                                               drawcolorcodedstring(pos + eY * 0.5 * (1 - sz) * fontsize_y, ts, fontsize, a, DRAWFLAG_NORMAL);
-                                       pos_y += fontsize_y;
+                                               drawcolorcodedstring(pos + eY * 0.5 * (1 - sz) * fontsize.y, ts, fontsize, a, DRAWFLAG_NORMAL);
+                                       pos.y += fontsize.y;
                                }
                                else
-                                       pos_y += fontsize_y * CENTERPRINT_SPACING/2;
+                                       pos.y += fontsize.y * CENTERPRINT_SPACING/2;
                        }
                }
 
                ++g; // move next position number up
 
-               msg_size = pos_y - msg_size;
+               msg_size = pos.y - msg_size;
                if (autocvar_hud_panel_centerprint_flip)
                {
-                       pos_y = current_msg_pos_y - CENTERPRINT_SPACING * fontsize_y;
+                       pos.y = current_msg_posY - CENTERPRINT_SPACING * fontsize.y;
                        if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
-                               pos_y += (msg_size + CENTERPRINT_SPACING * fontsize_y) * (1 - sqrt(sz));
+                               pos.y += (msg_size + CENTERPRINT_SPACING * fontsize.y) * (1 - sqrt(sz));
 
-                       if (pos_y < panel_pos_y) // check if the next message can be shown
+                       if (pos.y < panel_pos.y) // check if the next message can be shown
                        {
                                drawfontscale = '1 1 0';
                                return;
@@ -4394,11 +4472,11 @@ void HUD_CenterPrint (void)
                }
                else
                {
-                       pos_y += CENTERPRINT_SPACING * fontsize_y;
+                       pos.y += CENTERPRINT_SPACING * fontsize.y;
                        if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
-                               pos_y -= (msg_size + CENTERPRINT_SPACING * fontsize_y) * (1 - sqrt(sz));
+                               pos.y -= (msg_size + CENTERPRINT_SPACING * fontsize.y) * (1 - sqrt(sz));
 
-                       if(pos_y > panel_pos_y + panel_size_y - fontsize_y) // check if the next message can be shown
+                       if(pos.y > panel_pos.y + panel_size.y - fontsize.y) // check if the next message can be shown
                        {
                                drawfontscale = '1 1 0';
                                return;
@@ -4408,7 +4486,7 @@ void HUD_CenterPrint (void)
        drawfontscale = '1 1 0';
        if (all_messages_expired)
        {
-               centerprint_showing = FALSE;
+               centerprint_showing = false;
                reset_centerprint_messages();
        }
 }
@@ -4429,7 +4507,7 @@ void HUD_Buffs(void)
        {
                buffs = Buff_Type_first.items; // force first buff
        }
-       
+
        float b = 0; // counter to tell other functions that we have buffs
        entity e;
        string s = "";
@@ -4462,7 +4540,7 @@ void HUD_Buffs(void)
        //float is_vertical = (panel_ar < 1);
        //float buff_iconalign = autocvar_hud_panel_buffs_iconalign;
        vector buff_offset = '0 0 0';
-       
+
        for(e = Buff_Type_first; e; e = e.enemy) if(buffs & e.items)
        {
                //DrawNumIcon(pos + buff_offset, mySize, shield, "shield", is_vertical, buff_iconalign, '1 1 1', 1);
@@ -4482,15 +4560,13 @@ Main HUD system
 void HUD_Reset (void)
 {
        // reset gametype specific icons
-       if(gametype == MAPINFO_TYPE_KEYHUNT)
-               HUD_Mod_KH_Reset();
-       else if(gametype == MAPINFO_TYPE_CTF)
+       if(gametype == MAPINFO_TYPE_CTF)
                HUD_Mod_CTF_Reset();
 }
 
 void HUD_Main (void)
 {
-       float i;
+       int i;
        // global hud theAlpha fade
        if(menu_enabled == 1)
                hud_fade_alpha = 1;
index d56caf1331e88fa48e9624f20b2cf7982c581f70..16a7645fd991819a55fd1b8de4349d318ee15f30 100644 (file)
@@ -1,10 +1,15 @@
-#define HUD_PANEL_MAX 24
+#ifndef HUD_H
+#define HUD_H
+
+#include "../common/weapons/weapons.qh"
+
+const int HUD_PANEL_MAX = 24;
 entity hud_panel[HUD_PANEL_MAX];
-#define HUD_PANEL_FIRST 0
-float HUD_PANEL_NUM;
-float HUD_PANEL_LAST;
+const int HUD_PANEL_FIRST = 0;
+int HUD_PANEL_NUM;
+int HUD_PANEL_LAST;
 
-float panel_order[HUD_PANEL_MAX];
+int panel_order[HUD_PANEL_MAX];
 string hud_panelorder_prev;
 
 float hud_draw_maximized;
@@ -21,18 +26,18 @@ float highlightedAction; // 0 = nothing, 1 = move, 2 = resize
 
 const float BORDER_MULTIPLIER = 0.25;
 float scoreboard_bottom;
-float weapon_accuracy[WEP_MAXCOUNT];
+int weapon_accuracy[WEP_MAXCOUNT];
 
-float complain_weapon;
+int complain_weapon;
 string complain_weapon_name;
 float complain_weapon_type;
 float complain_weapon_time;
 
-float ps_primary, ps_secondary;
-float ts_primary, ts_secondary;
+int ps_primary, ps_secondary;
+int ts_primary, ts_secondary;
 
-float last_switchweapon;
-float last_activeweapon;
+int last_switchweapon;
+int last_activeweapon;
 float weapontime;
 float weaponprevtime;
 
@@ -40,13 +45,13 @@ float teamnagger;
 
 float hud_configure_checkcollisions;
 float hud_configure_prev;
-noref vector hud_configure_gridSize; // fteqcc sucks
-noref vector hud_configure_realGridSize; // fteqcc sucks
+vector hud_configure_gridSize;
+vector hud_configure_realGridSize;
 
-float hudShiftState;
-const float S_SHIFT = 1;
-const float S_CTRL = 2;
-const float S_ALT = 4;
+int hudShiftState;
+const int S_SHIFT = 1;
+const int S_CTRL = 2;
+const int S_ALT = 4;
 
 float menu_enabled; // 1 showing the entire HUD, 2 showing only the clicked panel
 
@@ -58,14 +63,14 @@ string hud_skin_prev;
 vector myteamcolors;
 
 entity highlightedPanel_backup;
-var vector panel_pos_backup;
-var vector panel_size_backup;
+vector panel_pos_backup;
+vector panel_size_backup;
 
-var vector panel_size_copied;
+vector panel_size_copied;
 
 entity panel;
 .string panel_name;
-.float panel_id;
+.int panel_id;
 .vector current_panel_pos;
 .vector current_panel_size;
 .string current_panel_bg;
@@ -76,64 +81,65 @@ entity panel;
 .float current_panel_bg_padding;
 .float current_panel_fg_alpha;
 .float update_time;
-var float panel_enabled;
-var vector panel_pos;
-var vector panel_size;
-var string panel_bg_str; // "_str" vars contain the raw value of the cvar, non-"_str" contains what hud.qc code should use
-var vector panel_bg_color;
-var string panel_bg_color_str;
-var float panel_bg_color_team;
-var string panel_bg_color_team_str;
-var float panel_fg_alpha;
-var float panel_bg_alpha;
-var string panel_bg_alpha_str;
-var float panel_bg_border;
-var string panel_bg_border_str;
-var float panel_bg_padding;
-var string panel_bg_padding_str;
+float panel_enabled;
+vector panel_pos;
+vector panel_size;
+string panel_bg_str; // "_str" vars contain the raw value of the cvar, non-"_str" contains what hud.qc code should use
+vector panel_bg_color;
+string panel_bg_color_str;
+float panel_bg_color_team;
+string panel_bg_color_team_str;
+float panel_fg_alpha;
+float panel_bg_alpha;
+string panel_bg_alpha_str;
+float panel_bg_border;
+string panel_bg_border_str;
+float panel_bg_padding;
+string panel_bg_padding_str;
 
 .void() panel_draw;
 
 float current_player;
 
-
-#define HUD_PANELS \
-       HUD_PANEL(WEAPONS      , HUD_Weapons      , weapons) \
-       HUD_PANEL(AMMO         , HUD_Ammo         , ammo) \
-       HUD_PANEL(POWERUPS     , HUD_Powerups     , powerups) \
-       HUD_PANEL(HEALTHARMOR  , HUD_HealthArmor  , healtharmor) \
-       HUD_PANEL(NOTIFY       , HUD_Notify       , notify) \
-       HUD_PANEL(TIMER        , HUD_Timer        , timer) \
-       HUD_PANEL(RADAR        , HUD_Radar        , radar) \
-       HUD_PANEL(SCORE        , HUD_Score        , score) \
-       HUD_PANEL(RACETIMER    , HUD_RaceTimer    , racetimer) \
-       HUD_PANEL(VOTE         , HUD_Vote         , vote) \
-       HUD_PANEL(MODICONS     , HUD_ModIcons     , modicons) \
-       HUD_PANEL(PRESSEDKEYS  , HUD_PressedKeys  , pressedkeys) \
-       HUD_PANEL(CHAT         , HUD_Chat         , chat) \
-       HUD_PANEL(ENGINEINFO   , HUD_EngineInfo   , engineinfo) \
-       HUD_PANEL(INFOMESSAGES , HUD_InfoMessages , infomessages) \
-       HUD_PANEL(PHYSICS      , HUD_Physics      , physics) \
-       HUD_PANEL(CENTERPRINT  , HUD_CenterPrint  , centerprint) \
-       HUD_PANEL(BUFFS        , HUD_Buffs        , buffs) 
-
-#define HUD_PANEL(NAME,draw_func,name) \
-       float HUD_PANEL_##NAME; \
-       void draw_func(void); \
-       void RegisterHUD_Panel_##NAME() \
-       { \
-               HUD_PANEL_LAST = HUD_PANEL_##NAME = HUD_PANEL_NUM; \
-               entity hud_panelent = spawn(); \
-               hud_panel[HUD_PANEL_##NAME] = hud_panelent; \
-               hud_panelent.classname = "hud_panel"; \
-               hud_panelent.panel_name = #name; \
-               hud_panelent.panel_id = HUD_PANEL_##NAME; \
-               hud_panelent.panel_draw = draw_func; \
-               ++HUD_PANEL_NUM; \
-       } \
+float GetPlayerColorForce(int i);
+
+
+#define HUD_PANELS(HUD_PANEL)                                                                                                                                                                          \
+       HUD_PANEL(WEAPONS      , HUD_Weapons      , weapons)                                                                                                                    \
+       HUD_PANEL(AMMO         , HUD_Ammo         , ammo)                                                                                                                               \
+       HUD_PANEL(POWERUPS     , HUD_Powerups     , powerups)                                                                                                                   \
+       HUD_PANEL(HEALTHARMOR  , HUD_HealthArmor  , healtharmor)                                                                                                                \
+       HUD_PANEL(NOTIFY       , HUD_Notify       , notify)                                                                                                                     \
+       HUD_PANEL(TIMER        , HUD_Timer        , timer)                                                                                                                              \
+       HUD_PANEL(RADAR        , HUD_Radar        , radar)                                                                                                                              \
+       HUD_PANEL(SCORE        , HUD_Score        , score)                                                                                                                              \
+       HUD_PANEL(RACETIMER    , HUD_RaceTimer    , racetimer)                                                                                                                  \
+       HUD_PANEL(VOTE         , HUD_Vote         , vote)                                                                                                                               \
+       HUD_PANEL(MODICONS     , HUD_ModIcons     , modicons)                                                                                                                   \
+       HUD_PANEL(PRESSEDKEYS  , HUD_PressedKeys  , pressedkeys)                                                                                                                \
+       HUD_PANEL(CHAT         , HUD_Chat         , chat)                                                                                                                               \
+       HUD_PANEL(ENGINEINFO   , HUD_EngineInfo   , engineinfo)                                                                                                                 \
+       HUD_PANEL(INFOMESSAGES , HUD_InfoMessages , infomessages)                                                                                                               \
+       HUD_PANEL(PHYSICS      , HUD_Physics      , physics)                                                                                                                    \
+       HUD_PANEL(CENTERPRINT  , HUD_CenterPrint  , centerprint)                                                                                                                \
+       HUD_PANEL(BUFFS        , HUD_Buffs        , buffs)
+
+#define HUD_PANEL(NAME, draw_func, name)                                                                                                                                                       \
+       int HUD_PANEL_##NAME;                                                                                                                                                                                   \
+       void draw_func(void);                                                                                                                                                                                   \
+       void RegisterHUD_Panel_##NAME() {                                                                                                                                                               \
+               HUD_PANEL_LAST = HUD_PANEL_##NAME = HUD_PANEL_NUM;                                                                                                                      \
+               entity hud_panelent = spawn();                                                                                                                                                          \
+               hud_panel[HUD_PANEL_##NAME] = hud_panelent;                                                                                                                             \
+               hud_panelent.classname = "hud_panel";                                                                                                                                           \
+               hud_panelent.panel_name = #name;                                                                                                                                                        \
+               hud_panelent.panel_id = HUD_PANEL_##NAME;                                                                                                                                       \
+               hud_panelent.panel_draw = draw_func;                                                                                                                                            \
+               HUD_PANEL_NUM++;                                                                                                                                                                                        \
+       }                                                                                                                                                                                                                               \
        ACCUMULATE_FUNCTION(RegisterHUD_Panels, RegisterHUD_Panel_##NAME);
 
-HUD_PANELS
+HUD_PANELS(HUD_PANEL)
 #undef HUD_PANEL
 
 #define HUD_PANEL(NAME) hud_panel[HUD_PANEL_##NAME]
@@ -147,202 +153,207 @@ HUD_PANELS
 
 // Get value for panel.current_panel_bg: if "" fetch default, else use panel_bg_str
 // comment on last line of macro: // we probably want to see a background in config mode at all times...
-#define HUD_Panel_GetBg()\
-string panel_bg;\
-if(!autocvar__hud_configure && panel_bg_str == "0") {\
-       panel_bg = "0";\
-} else {\
-       if(panel_bg_str == "") {\
-               panel_bg_str = autocvar_hud_panel_bg;\
-       }\
-       if(panel_bg_str == "0" && !autocvar__hud_configure) {\
-                       panel_bg = "0";\
-       } else {\
-               if (panel_bg_str == "0" && autocvar__hud_configure)\
-                       panel_bg_alpha_str = "0";\
-               panel_bg = strcat(hud_skin_path, "/", panel_bg_str);\
-               if(precache_pic(panel_bg) == "") {\
-                       panel_bg = strcat(hud_skin_path, "/", "border_default");\
-                       if(precache_pic(panel_bg) == "") {\
-                               panel_bg = strcat("gfx/hud/default/", "border_default");\
-                       }\
-               }\
-       }\
-}\
-if(panel.current_panel_bg)\
-       strunzone(panel.current_panel_bg);\
-panel.current_panel_bg = strzone(panel_bg);
+#define HUD_Panel_GetBg() do {                                                                                      \
+       string panel_bg;                                                                                                \
+       if (!autocvar__hud_configure && panel_bg_str == "0") {                                                          \
+               panel_bg = "0";                                                                                             \
+       } else {                                                                                                        \
+               if (panel_bg_str == "") {                                                                                   \
+                       panel_bg_str = autocvar_hud_panel_bg;                                                                   \
+               }                                                                                                           \
+               if (panel_bg_str == "0" && !autocvar__hud_configure) {                                                      \
+                       panel_bg = "0";                                                                                         \
+               } else {                                                                                                    \
+                       if (panel_bg_str == "0" && autocvar__hud_configure)                                                     \
+                               panel_bg_alpha_str = "0";                                                                           \
+                       panel_bg = strcat(hud_skin_path, "/", panel_bg_str);                                                    \
+                       if (precache_pic(panel_bg) == "") {                                                                     \
+                               panel_bg = strcat(hud_skin_path, "/", "border_default");                                            \
+                               if (precache_pic(panel_bg) == "") {                                                                 \
+                                       panel_bg = strcat("gfx/hud/default/", "border_default");                                        \
+                               }                                                                                                   \
+                       }                                                                                                       \
+               }                                                                                                           \
+       }                                                                                                               \
+       if (panel.current_panel_bg)                                                                                     \
+               strunzone(panel.current_panel_bg);                                                                          \
+       panel.current_panel_bg = strzone(panel_bg);                                                                     \
+} while(0)
 
 // Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector.
-#define HUD_Panel_GetColor()\
-if((teamplay) && panel_bg_color_team) {\
-       if(autocvar__hud_configure && myteam == NUM_SPECTATOR)\
-               panel_bg_color = '1 0 0' * panel_bg_color_team;\
-       else\
-               panel_bg_color = myteamcolors * panel_bg_color_team;\
-} else if (autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && panel_bg_color_team) {\
-       panel_bg_color = '1 0 0' * panel_bg_color_team;\
-} else {\
-       if(panel_bg_color_str == "") {\
-               panel_bg_color = autocvar_hud_panel_bg_color;\
-       } else {\
-               if(panel_bg_color_str == "shirt") {\
-                       panel_bg_color = colormapPaletteColor(floor(stof(getplayerkeyvalue(current_player - 1, "colors")) / 16), 0);\
-               } else if(panel_bg_color_str == "pants") {\
-                       panel_bg_color = colormapPaletteColor(stof(getplayerkeyvalue(current_player - 1, "colors")) % 16, 1);\
-               } else {\
-                       panel_bg_color = stov(panel_bg_color_str);\
-               }\
-       }\
-}
+#define HUD_Panel_GetColor() do {                                                                                   \
+       if ((teamplay) && panel_bg_color_team) {                                                                        \
+               if (autocvar__hud_configure && myteam == NUM_SPECTATOR)                                                     \
+                       panel_bg_color = '1 0 0' * panel_bg_color_team;                                                         \
+               else                                                                                                        \
+                       panel_bg_color = myteamcolors * panel_bg_color_team;                                                    \
+       } else if (autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && panel_bg_color_team) {          \
+               panel_bg_color = '1 0 0' * panel_bg_color_team;                                                             \
+       } else {                                                                                                        \
+               if (panel_bg_color_str == "") {                                                                             \
+                       panel_bg_color = autocvar_hud_panel_bg_color;                                                           \
+               } else {                                                                                                    \
+                       if (panel_bg_color_str == "shirt") {                                                                    \
+                               panel_bg_color = colormapPaletteColor(floor(stof(getplayerkeyvalue(current_player - 1, "colors")) / 16), 0);\
+                       } else if (panel_bg_color_str == "pants") {                                                             \
+                               panel_bg_color = colormapPaletteColor(stof(getplayerkeyvalue(current_player - 1, "colors")) % 16, 1);\
+                       } else {                                                                                                \
+                               panel_bg_color = stov(panel_bg_color_str);                                                          \
+                       }                                                                                                       \
+               }                                                                                                           \
+       }                                                                                                               \
+} while(0)
 
 // Get value for panel_bg_color_team: if "" fetch default, else use panel_bg_color_team_str
-#define HUD_Panel_GetColorTeam()\
-if(panel_bg_color_team_str == "") {\
-       panel_bg_color_team = autocvar_hud_panel_bg_color_team;\
-} else {\
-       panel_bg_color_team = stof(panel_bg_color_team_str);\
-}
+#define HUD_Panel_GetColorTeam() do {                                                                               \
+       if (panel_bg_color_team_str == "") {                                                                            \
+               panel_bg_color_team = autocvar_hud_panel_bg_color_team;                                                     \
+       } else {                                                                                                        \
+               panel_bg_color_team = stof(panel_bg_color_team_str);                                                        \
+       }                                                                                                               \
+} while(0)
 
 // Get value for panel_bg_alpha: if "" fetch default, else use panel_bg_alpha. Also do various menu dialog fadeout/in checks, and minalpha checks
 // comment on line 3 of macro: // do not set a minalpha cap when showing the config dialog for this panel
-#define HUD_Panel_GetBgAlpha()\
-if(panel_bg_alpha_str == "") {\
-       panel_bg_alpha_str = ftos(autocvar_hud_panel_bg_alpha);\
-}\
-panel_bg_alpha = stof(panel_bg_alpha_str);\
-if(autocvar__hud_configure) {\
-       if(!panel_enabled)\
-               panel_bg_alpha = 0.25;\
-       else if(menu_enabled == 2 && panel == highlightedPanel)\
-               panel_bg_alpha = (1 - autocvar__menu_alpha) * max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha) + autocvar__menu_alpha * panel_bg_alpha;\
-       else\
-               panel_bg_alpha = max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha);\
-}
+#define HUD_Panel_GetBgAlpha() do {                                                                                 \
+       if (panel_bg_alpha_str == "") {                                                                                 \
+               panel_bg_alpha_str = ftos(autocvar_hud_panel_bg_alpha);                                                     \
+       }                                                                                                               \
+       panel_bg_alpha = stof(panel_bg_alpha_str);                                                                      \
+       if (autocvar__hud_configure) {                                                                                  \
+               if (!panel_enabled)                                                                                         \
+                       panel_bg_alpha = 0.25;                                                                                  \
+               else if (menu_enabled == 2 && panel == highlightedPanel)                                                    \
+                       panel_bg_alpha = (1 - autocvar__menu_alpha) * max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha) + autocvar__menu_alpha * panel_bg_alpha;\
+               else                                                                                                        \
+                       panel_bg_alpha = max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha);                                \
+       }                                                                                                               \
+} while(0)
 
 // Get value for panel_fg_alpha. Also do various minalpha checks
 // comment on line 2 of macro: // ALWAYS show disabled panels at 0.25 alpha when in config mode
-#define HUD_Panel_GetFgAlpha()\
-panel_fg_alpha = autocvar_hud_panel_fg_alpha;\
-if(autocvar__hud_configure && !panel_enabled)\
-       panel_fg_alpha = 0.25;\
+#define HUD_Panel_GetFgAlpha() do {                                                                                 \
+       panel_fg_alpha = autocvar_hud_panel_fg_alpha;                                                                   \
+       if (autocvar__hud_configure && !panel_enabled)                                                                  \
+               panel_fg_alpha = 0.25;                                                                                      \
+} while(0)
 
 // Get border. See comments above, it's similar.
-#define HUD_Panel_GetBorder()\
-if(panel_bg_border_str == "") {\
-       panel_bg_border = autocvar_hud_panel_bg_border;\
-} else {\
-       panel_bg_border = stof(panel_bg_border_str);\
-} ENDS_WITH_CURLY_BRACE
+#define HUD_Panel_GetBorder() do {                                                                                  \
+       if (panel_bg_border_str == "") {                                                                                \
+               panel_bg_border = autocvar_hud_panel_bg_border;                                                             \
+       } else {                                                                                                        \
+               panel_bg_border = stof(panel_bg_border_str);                                                                \
+       }                                                                                                               \
+} while(0)
 
 // Get padding. See comments above, it's similar.
 // last line is a port of the old function, basically always make sure the panel contents are at least 5 pixels tall/wide, to disallow extreme padding values
-#define HUD_Panel_GetPadding()\
-if(panel_bg_padding_str == "") {\
-       panel_bg_padding = autocvar_hud_panel_bg_padding;\
-} else {\
-       panel_bg_padding = stof(panel_bg_padding_str);\
-}\
-panel_bg_padding = min(min(panel_size_x, panel_size_y)/2 - 5, panel_bg_padding);
+#define HUD_Panel_GetPadding() do {                                                                                 \
+       if (panel_bg_padding_str == "") {                                                                               \
+               panel_bg_padding = autocvar_hud_panel_bg_padding;                                                           \
+       } else {                                                                                                        \
+               panel_bg_padding = stof(panel_bg_padding_str);                                                              \
+       }                                                                                                               \
+       panel_bg_padding = min(min(panel_size.x, panel_size.y)/2 - 5, panel_bg_padding);                                \
+} while(0)
 
 // return smoothly faded pos and size of given panel when a dialog is active
-#define HUD_Panel_UpdatePosSize_ForMenu()\
-vector menu_enable_pos;\
-vector menu_enable_size = '0 0 0';\
-float menu_enable_maxsize_x = 0.3 * vid_conwidth;\
-float menu_enable_maxsize_y = 0.18 * vid_conheight;\
-if(panel_size_x > panel_size_y)\
-{\
-       if(panel_size_y > menu_enable_maxsize_y)\
-       {\
-               menu_enable_size_y = menu_enable_maxsize_y;\
-               menu_enable_size_x = panel_size_x * (menu_enable_maxsize_y/panel_size_y);\
-               panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * menu_enable_size;\
-       }\
-       menu_enable_pos = eX * 0.5 * vid_conwidth - eX * 0.5 * panel_size_x + eY * (vid_conheight - menu_enable_maxsize_y);\
-}\
-else\
-{\
-       if(panel_size_x > menu_enable_maxsize_x)\
-       {\
-               menu_enable_size_x = menu_enable_maxsize_x;\
-               menu_enable_size_y = panel_size_y * (menu_enable_maxsize_x/panel_size_x);\
-               panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * menu_enable_size;\
-       }\
-       menu_enable_pos = eY * 0.5 * vid_conheight - eY * 0.5 * panel_size_y + eX * (vid_conwidth - menu_enable_maxsize_x);\
-}\
-panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * menu_enable_pos;
+#define HUD_Panel_UpdatePosSize_ForMenu() do {                                                                      \
+       vector menu_enable_pos;                                                                                         \
+       vector menu_enable_size = '0 0 0';                                                                              \
+       float menu_enable_maxsize_x = 0.3 * vid_conwidth;                                                               \
+       float menu_enable_maxsize_y = 0.18 * vid_conheight;                                                             \
+       if (panel_size.x > panel_size.y) {                                                                              \
+               if (panel_size.y > menu_enable_maxsize_y) {                                                                 \
+                       menu_enable_size.y = menu_enable_maxsize_y;                                                             \
+                       menu_enable_size.x = panel_size.x * (menu_enable_maxsize_y/panel_size.y);                               \
+                       panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * menu_enable_size;       \
+               }                                                                                                           \
+               menu_enable_pos = eX * 0.5 * vid_conwidth - eX * 0.5 * panel_size.x + eY * (vid_conheight - menu_enable_maxsize_y);\
+       } else {                                                                                                        \
+               if (panel_size.x > menu_enable_maxsize_x) {                                                                 \
+                       menu_enable_size.x = menu_enable_maxsize_x;                                                             \
+                       menu_enable_size.y = panel_size.y * (menu_enable_maxsize_x/panel_size.x);                               \
+                       panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * menu_enable_size;       \
+               }                                                                                                           \
+               menu_enable_pos = eY * 0.5 * vid_conheight - eY * 0.5 * panel_size.y + eX * (vid_conwidth - menu_enable_maxsize_x);\
+       }                                                                                                               \
+       panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * menu_enable_pos;                  \
+} while(0)
 
 // Scale the pos and size vectors to absolute coordinates
-#define HUD_Panel_ScalePosSize()\
-panel_pos_x *= vid_conwidth; panel_pos_y *= vid_conheight;\
-panel_size_x *= vid_conwidth; panel_size_y *= vid_conheight;
+#define HUD_Panel_ScalePosSize() do {                                                                               \
+       panel_pos.x *= vid_conwidth;  panel_pos.y *= vid_conheight;                                                     \
+       panel_size.x *= vid_conwidth; panel_size.y *= vid_conheight;                                                    \
+} while(0)
 
 // NOTE: in hud_configure mode cvars must be reloaded every frame
-#define HUD_Panel_UpdateCvars() \
-if(panel.update_time <= time) { \
-       if(autocvar__hud_configure) panel_enabled = cvar(strcat("hud_panel_", panel.panel_name)); \
-       panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos"))); \
-       panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size"))); \
-       HUD_Panel_ScalePosSize() \
-       panel_bg_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg")); \
-       panel_bg_color_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_color")); \
-       panel_bg_color_team_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_color_team")); \
-       panel_bg_alpha_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_alpha")); \
-       panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border")); \
-       panel_bg_padding_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_padding")); \
-       HUD_Panel_GetBg()\
-       if (panel.current_panel_bg != "0") {\
-               HUD_Panel_GetColorTeam()\
-               HUD_Panel_GetColor()\
-               HUD_Panel_GetBgAlpha()\
-               HUD_Panel_GetBorder()\
-       }\
-       HUD_Panel_GetFgAlpha()\
-       HUD_Panel_GetPadding()\
-       panel.current_panel_bg_alpha = panel_bg_alpha; \
-       panel.current_panel_fg_alpha = panel_fg_alpha; \
-       if(menu_enabled == 2 && panel == highlightedPanel) {\
-               HUD_Panel_UpdatePosSize_ForMenu()\
-       } else {\
-               panel_bg_alpha *= hud_fade_alpha;\
-               panel_fg_alpha *= hud_fade_alpha;\
-       }\
-       panel.current_panel_pos = panel_pos; \
-       panel.current_panel_size = panel_size; \
-       panel.current_panel_bg_border = panel_bg_border; \
-       panel.current_panel_bg_color = panel_bg_color; \
-       panel.current_panel_bg_color_team = panel_bg_color_team; \
-       panel.current_panel_bg_padding = panel_bg_padding; \
-       panel.update_time = (autocvar__hud_configure) ? time : time + autocvar_hud_panel_update_interval; \
-} else { \
-       panel_pos = panel.current_panel_pos; \
-       panel_size = panel.current_panel_size; \
-       panel_bg_alpha = panel.current_panel_bg_alpha * hud_fade_alpha; \
-       panel_bg_border = panel.current_panel_bg_border; \
-       panel_bg_color = panel.current_panel_bg_color; \
-       panel_bg_color_team = panel.current_panel_bg_color_team; \
-       panel_bg_padding = panel.current_panel_bg_padding; \
-       panel_fg_alpha = panel.current_panel_fg_alpha * hud_fade_alpha; \
-} ENDS_WITH_CURLY_BRACE
-
-#define HUD_Panel_UpdatePosSize() {\
-panel_enabled = cvar(strcat("hud_panel_", panel.panel_name)); \
-panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos"))); \
-panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size"))); \
-HUD_Panel_ScalePosSize()\
-if(menu_enabled == 2 && panel == highlightedPanel) {\
-       HUD_Panel_UpdatePosSize_ForMenu()\
-}\
-panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border")); \
-HUD_Panel_GetBorder() \
-} ENDS_WITH_CURLY_BRACE
-
-#define NOTIFY_MAX_ENTRIES 10
-#define NOTIFY_ICON_MARGIN 0.02
-
-float notify_index;
-float notify_count;
+#define HUD_Panel_UpdateCvars() do {                                                                                \
+       if (panel.update_time <= time) {                                                                                \
+               if (autocvar__hud_configure) panel_enabled = cvar(strcat("hud_panel_", panel.panel_name));                  \
+               panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos")));                              \
+               panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size")));                            \
+               HUD_Panel_ScalePosSize();                                                                                   \
+               panel_bg_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg"));                                  \
+               panel_bg_color_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_color"));                      \
+               panel_bg_color_team_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_color_team"));            \
+               panel_bg_alpha_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_alpha"));                      \
+               panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border"));                    \
+               panel_bg_padding_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_padding"));                  \
+               HUD_Panel_GetBg();                                                                                          \
+               if (panel.current_panel_bg != "0") {                                                                        \
+                       HUD_Panel_GetColorTeam();                                                                               \
+                       HUD_Panel_GetColor();                                                                                   \
+                       HUD_Panel_GetBgAlpha();                                                                                 \
+                       HUD_Panel_GetBorder();                                                                                  \
+               }                                                                                                           \
+               HUD_Panel_GetFgAlpha();                                                                                     \
+               HUD_Panel_GetPadding();                                                                                     \
+               panel.current_panel_bg_alpha = panel_bg_alpha;                                                              \
+               panel.current_panel_fg_alpha = panel_fg_alpha;                                                              \
+               if (menu_enabled == 2 && panel == highlightedPanel) {                                                       \
+                       HUD_Panel_UpdatePosSize_ForMenu();                                                                      \
+               } else {                                                                                                    \
+                       panel_bg_alpha *= hud_fade_alpha;                                                                       \
+                       panel_fg_alpha *= hud_fade_alpha;                                                                       \
+               }                                                                                                           \
+               panel.current_panel_pos = panel_pos;                                                                        \
+               panel.current_panel_size = panel_size;                                                                      \
+               panel.current_panel_bg_border = panel_bg_border;                                                            \
+               panel.current_panel_bg_color = panel_bg_color;                                                              \
+               panel.current_panel_bg_color_team = panel_bg_color_team;                                                    \
+               panel.current_panel_bg_padding = panel_bg_padding;                                                          \
+               panel.update_time = (autocvar__hud_configure) ? time : time + autocvar_hud_panel_update_interval;           \
+       } else {                                                                                                        \
+               panel_pos = panel.current_panel_pos;                                                                        \
+               panel_size = panel.current_panel_size;                                                                      \
+               panel_bg_alpha = panel.current_panel_bg_alpha * hud_fade_alpha;                                             \
+               panel_bg_border = panel.current_panel_bg_border;                                                            \
+               panel_bg_color = panel.current_panel_bg_color;                                                              \
+               panel_bg_color_team = panel.current_panel_bg_color_team;                                                    \
+               panel_bg_padding = panel.current_panel_bg_padding;                                                          \
+               panel_fg_alpha = panel.current_panel_fg_alpha * hud_fade_alpha;                                             \
+       }                                                                                                               \
+} while(0)
+
+#define HUD_Panel_UpdatePosSize() do {                                                                              \
+       panel_enabled = cvar(strcat("hud_panel_", panel.panel_name));                                                   \
+       panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos")));                                  \
+       panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size")));                                \
+       HUD_Panel_ScalePosSize();                                                                                       \
+       if (menu_enabled == 2 && panel == highlightedPanel) {                                                           \
+               HUD_Panel_UpdatePosSize_ForMenu();                                                                          \
+       }                                                                                                               \
+       panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border"));                        \
+       HUD_Panel_GetBorder();                                                                                          \
+} while(0)
+
+const int NOTIFY_MAX_ENTRIES = 10;
+const float NOTIFY_ICON_MARGIN = 0.02;
+
+int notify_index;
+int notify_count;
 float notify_times[NOTIFY_MAX_ENTRIES];
 string notify_attackers[NOTIFY_MAX_ENTRIES];
 string notify_victims[NOTIFY_MAX_ENTRIES];
@@ -352,3 +363,4 @@ void HUD_Notify_Push(string icon, string attacker, string victim);
 
 var void HUD_ModIcons_GameType(vector pos, vector size);
 void HUD_ModIcons_SetFunc();
+#endif
index 78f16f88db99f7b851edc2c426cb6d960527ccee..4ddc049ba167395173809af150f5cd88707525ac 100644 (file)
@@ -1,3 +1,15 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "defs.qh"
+       #include "../dpdefs/keycodes.qh"
+       #include "../common/constants.qh"
+       #include "autocvars.qh"
+       #include "hud.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
+
 #define HUD_Write(s) fputs(fh, s)
 // q: quoted, n: not quoted
 #define HUD_Write_Cvar_n(cvar) HUD_Write(strcat("seta ", cvar, " ", cvar_string(cvar), "\n"))
@@ -49,7 +61,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                HUD_Write("\n");
 
                // common cvars for all panels
-               float i;
+               int i;
                for (i = 0; i < HUD_PANEL_NUM; ++i)
                {
                        panel = hud_panel[i];
@@ -67,6 +79,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                                case HUD_PANEL_WEAPONS:
                                        HUD_Write_PanelCvar_q("_accuracy");
                                        HUD_Write_PanelCvar_q("_label");
+                                       HUD_Write_PanelCvar_q("_label_scale");
                                        HUD_Write_PanelCvar_q("_complainbubble");
                                        HUD_Write_PanelCvar_q("_complainbubble_padding");
                                        HUD_Write_PanelCvar_q("_complainbubble_time");
@@ -216,65 +229,63 @@ void HUD_Configure_Exit_Force()
 // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
 vector HUD_Panel_CheckMove(vector myPos, vector mySize)
 {
-       float i;
-       float myCenter_x, myCenter_y, targCenter_x, targCenter_y;
-       vector myTarget;
-       myTarget = myPos;
-
+       vector myCenter, targCenter;
+       vector myTarget = myPos;
+       int i;
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
                panel = hud_panel[i];
                if(panel == highlightedPanel) continue;
-               HUD_Panel_UpdatePosSize()
+               HUD_Panel_UpdatePosSize();
                if(!panel_enabled) continue;
 
                panel_pos -= '1 1 0' * panel_bg_border;
                panel_size += '2 2 0' * panel_bg_border;
 
-               if(myPos_y + mySize_y < panel_pos_y)
+               if(myPos.y + mySize.y < panel_pos.y)
                        continue;
-               if(myPos_y > panel_pos_y + panel_size_y)
+               if(myPos.y > panel_pos.y + panel_size.y)
                        continue;
 
-               if(myPos_x + mySize_x < panel_pos_x)
+               if(myPos.x + mySize.x < panel_pos.x)
                        continue;
-               if(myPos_x > panel_pos_x + panel_size_x)
+               if(myPos.x > panel_pos.x + panel_size.x)
                        continue;
 
                // OK, there IS a collision.
 
-               myCenter_x = myPos_x + 0.5 * mySize_x;
-               myCenter_y = myPos_y + 0.5 * mySize_y;
+               myCenter.x = myPos.x + 0.5 * mySize.x;
+               myCenter.y = myPos.y + 0.5 * mySize.y;
 
-               targCenter_x = panel_pos_x + 0.5 * panel_size_x;
-               targCenter_y = panel_pos_y + 0.5 * panel_size_y;
+               targCenter.x = panel_pos.x + 0.5 * panel_size.x;
+               targCenter.y = panel_pos.y + 0.5 * panel_size.y;
 
-               if(myCenter_x < targCenter_x && myCenter_y < targCenter_y) // top left (of the target panel)
+               if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel)
                {
-                       if(myPos_x + mySize_x - panel_pos_x < myPos_y + mySize_y - panel_pos_y) // push it to the side
-                               myTarget_x = panel_pos_x - mySize_x;
+                       if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
+                               myTarget.x = panel_pos.x - mySize.x;
                        else // push it upwards
-                               myTarget_y = panel_pos_y - mySize_y;
+                               myTarget.y = panel_pos.y - mySize.y;
                }
-               else if(myCenter_x > targCenter_x && myCenter_y < targCenter_y) // top right
+               else if(myCenter.x > targCenter.x && myCenter.y < targCenter.y) // top right
                {
-                       if(panel_pos_x + panel_size_x - myPos_x < myPos_y + mySize_y - panel_pos_y) // push it to the side
-                               myTarget_x = panel_pos_x + panel_size_x;
+                       if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
+                               myTarget.x = panel_pos.x + panel_size.x;
                        else // push it upwards
-                               myTarget_y = panel_pos_y - mySize_y;
+                               myTarget.y = panel_pos.y - mySize.y;
                }
-               else if(myCenter_x < targCenter_x && myCenter_y > targCenter_y) // bottom left
+               else if(myCenter.x < targCenter.x && myCenter.y > targCenter.y) // bottom left
                {
-                       if(myPos_x + mySize_x - panel_pos_x < panel_pos_y + panel_size_y - myPos_y) // push it to the side
-                               myTarget_x = panel_pos_x - mySize_x;
+                       if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
+                               myTarget.x = panel_pos.x - mySize.x;
                        else // push it downwards
-                               myTarget_y = panel_pos_y + panel_size_y;
+                               myTarget.y = panel_pos.y + panel_size.y;
                }
-               else if(myCenter_x > targCenter_x && myCenter_y > targCenter_y) // bottom right
+               else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right
                {
-                       if(panel_pos_x + panel_size_x - myPos_x < panel_pos_y + panel_size_y - myPos_y) // push it to the side
-                               myTarget_x = panel_pos_x + panel_size_x;
+                       if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
+                               myTarget.x = panel_pos.x + panel_size.x;
                        else // push it downwards
-                               myTarget_y = panel_pos_y + panel_size_y;
+                               myTarget.y = panel_pos.y + panel_size.y;
                }
                //if(cvar("hud_configure_checkcollisions_debug"))
                        //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
@@ -286,7 +297,7 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize)
 void HUD_Panel_SetPos(vector pos)
 {
        panel = highlightedPanel;
-       HUD_Panel_UpdatePosSize()
+       HUD_Panel_UpdatePosSize();
        vector mySize;
        mySize = panel_size;
 
@@ -295,36 +306,32 @@ void HUD_Panel_SetPos(vector pos)
 
        if(autocvar_hud_configure_grid)
        {
-               pos_x = floor((pos_x/vid_conwidth)/hud_configure_gridSize_x + 0.5) * hud_configure_realGridSize_x;
-               pos_y = floor((pos_y/vid_conheight)/hud_configure_gridSize_y + 0.5) * hud_configure_realGridSize_y;
+               pos.x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
+               pos.y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
        }
 
        if(hud_configure_checkcollisions)
                pos = HUD_Panel_CheckMove(pos, mySize);
 
-       pos_x = bound(0, pos_x, vid_conwidth - mySize_x);
-       pos_y = bound(0, pos_y, vid_conheight - mySize_y);
+       pos.x = bound(0, pos.x, vid_conwidth - mySize.x);
+       pos.y = bound(0, pos.y, vid_conheight - mySize.y);
 
        string s;
-       s = strcat(ftos(pos_x/vid_conwidth), " ", ftos(pos_y/vid_conheight));
+       s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight));
 
        cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
 }
 
 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
-       float i;
-
        vector targEndPos;
-
-       float dist_x, dist_y;
-       float ratio;
-       ratio = mySize_x/mySize_y;
-
+       vector dist;
+       float ratio = mySize.x/mySize.y;
+       int i;
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
                panel = hud_panel[i];
                if(panel == highlightedPanel) continue;
-               HUD_Panel_UpdatePosSize()
+               HUD_Panel_UpdatePosSize();
                if(!panel_enabled) continue;
 
                panel_pos -= '1 1 0' * panel_bg_border;
@@ -333,19 +340,19 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
                targEndPos = panel_pos + panel_size;
 
                // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
-               if(resizeorigin_x > panel_pos_x && resizeorigin_x < targEndPos_x && resizeorigin_y > panel_pos_y && resizeorigin_y < targEndPos_y)
+               if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y)
                        continue;
 
                if (resizeCorner == 1)
                {
                        // check if this panel is on our way
-                       if (resizeorigin_x <= panel_pos_x)
+                       if (resizeorigin.x <= panel_pos.x)
                                continue;
-                       if (resizeorigin_y <= panel_pos_y)
+                       if (resizeorigin.y <= panel_pos.y)
                                continue;
-                       if (targEndPos_x <= resizeorigin_x - mySize_x)
+                       if (targEndPos.x <= resizeorigin.x - mySize.x)
                                continue;
-                       if (targEndPos_y <= resizeorigin_y - mySize_y)
+                       if (targEndPos.y <= resizeorigin.y - mySize.y)
                                continue;
 
                        // there is a collision:
@@ -354,66 +361,66 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
                        //
                        // dist is the distance between resizeorigin and the "analogous" point of the panel
                        // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
-                       dist_x = resizeorigin_x - targEndPos_x;
-                       dist_y = resizeorigin_y - targEndPos_y;
-                       if (dist_y <= 0 || dist_x / dist_y > ratio)
-                               mySize_x = min(mySize_x, dist_x);
+                       dist.x = resizeorigin.x - targEndPos.x;
+                       dist.y = resizeorigin.y - targEndPos.y;
+                       if (dist.y <= 0 || dist.x / dist.y > ratio)
+                               mySize.x = min(mySize.x, dist.x);
                        else
-                               mySize_y = min(mySize_y, dist_y);
+                               mySize.y = min(mySize.y, dist.y);
                }
                else if (resizeCorner == 2)
                {
-                       if (resizeorigin_x >= targEndPos_x)
+                       if (resizeorigin.x >= targEndPos.x)
                                continue;
-                       if (resizeorigin_y <= panel_pos_y)
+                       if (resizeorigin.y <= panel_pos.y)
                                continue;
-                       if (panel_pos_x >= resizeorigin_x + mySize_x)
+                       if (panel_pos.x >= resizeorigin.x + mySize.x)
                                continue;
-                       if (targEndPos_y <= resizeorigin_y - mySize_y)
+                       if (targEndPos.y <= resizeorigin.y - mySize.y)
                                continue;
 
-                       dist_x = panel_pos_x - resizeorigin_x;
-                       dist_y = resizeorigin_y - targEndPos_y;
-                       if (dist_y <= 0 || dist_x / dist_y > ratio)
-                               mySize_x = min(mySize_x, dist_x);
+                       dist.x = panel_pos.x - resizeorigin.x;
+                       dist.y = resizeorigin.y - targEndPos.y;
+                       if (dist.y <= 0 || dist.x / dist.y > ratio)
+                               mySize.x = min(mySize.x, dist.x);
                        else
-                               mySize_y = min(mySize_y, dist_y);
+                               mySize.y = min(mySize.y, dist.y);
                }
                else if (resizeCorner == 3)
                {
-                       if (resizeorigin_x <= panel_pos_x)
+                       if (resizeorigin.x <= panel_pos.x)
                                continue;
-                       if (resizeorigin_y >= targEndPos_y)
+                       if (resizeorigin.y >= targEndPos.y)
                                continue;
-                       if (targEndPos_x <= resizeorigin_x - mySize_x)
+                       if (targEndPos.x <= resizeorigin.x - mySize.x)
                                continue;
-                       if (panel_pos_y >= resizeorigin_y + mySize_y)
+                       if (panel_pos.y >= resizeorigin.y + mySize.y)
                                continue;
 
-                       dist_x = resizeorigin_x - targEndPos_x;
-                       dist_y = panel_pos_y - resizeorigin_y;
-                       if (dist_y <= 0 || dist_x / dist_y > ratio)
-                               mySize_x = min(mySize_x, dist_x);
+                       dist.x = resizeorigin.x - targEndPos.x;
+                       dist.y = panel_pos.y - resizeorigin.y;
+                       if (dist.y <= 0 || dist.x / dist.y > ratio)
+                               mySize.x = min(mySize.x, dist.x);
                        else
-                               mySize_y = min(mySize_y, dist_y);
+                               mySize.y = min(mySize.y, dist.y);
                }
                else if (resizeCorner == 4)
                {
-                       if (resizeorigin_x >= targEndPos_x)
+                       if (resizeorigin.x >= targEndPos.x)
                                continue;
-                       if (resizeorigin_y >= targEndPos_y)
+                       if (resizeorigin.y >= targEndPos.y)
                                continue;
-                       if (panel_pos_x >= resizeorigin_x + mySize_x)
+                       if (panel_pos.x >= resizeorigin.x + mySize.x)
                                continue;
-                       if (panel_pos_y >= resizeorigin_y + mySize_y)
+                       if (panel_pos.y >= resizeorigin.y + mySize.y)
                                continue;
 
-                       dist_x = panel_pos_x - resizeorigin_x;
-                       dist_y = panel_pos_y - resizeorigin_y;
-                       if (dist_y <= 0 || dist_x / dist_y > ratio)
-                               mySize_x = min(mySize_x, dist_x);
+                       dist.x = panel_pos.x - resizeorigin.x;
+                       dist.y = panel_pos.y - resizeorigin.y;
+                       if (dist.y <= 0 || dist.x / dist.y > ratio)
+                               mySize.x = min(mySize.x, dist.x);
                        else
-                               mySize_y = min(mySize_y, dist_y);
+                               mySize.y = min(mySize.y, dist.y);
                }
                //if(cvar("hud_configure_checkcollisions_debug"))
                        //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
@@ -425,19 +432,19 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
 void HUD_Panel_SetPosSize(vector mySize)
 {
        panel = highlightedPanel;
-       HUD_Panel_UpdatePosSize()
+       HUD_Panel_UpdatePosSize();
        vector resizeorigin;
        resizeorigin = panel_click_resizeorigin;
-       local noref vector myPos; // fteqcc sucks
+       vector myPos;
 
        // minimum panel size cap
-       mySize_x = max(0.025 * vid_conwidth, mySize_x);
-       mySize_y = max(0.025 * vid_conheight, mySize_y);
+       mySize.x = max(0.025 * vid_conwidth, mySize.x);
+       mySize.y = max(0.025 * vid_conheight, mySize.y);
 
        if(highlightedPanel == HUD_PANEL(CHAT)) // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small.
        {
-               mySize_x = max(17 * autocvar_con_chatsize, mySize_x);
-               mySize_y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize_y);
+               mySize.x = max(17 * autocvar_con_chatsize, mySize.x);
+               mySize.y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y);
        }
 
        // collision testing|
@@ -445,30 +452,30 @@ void HUD_Panel_SetPosSize(vector mySize)
 
        // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
        if(resizeCorner == 1) {
-               myPos_x = resizeorigin_x - mySize_x;
-               myPos_y = resizeorigin_y - mySize_y;
+               myPos.x = resizeorigin.x - mySize.x;
+               myPos.y = resizeorigin.y - mySize.y;
        } else if(resizeCorner == 2) {
-               myPos_x = resizeorigin_x;
-               myPos_y = resizeorigin_y - mySize_y;
+               myPos.x = resizeorigin.x;
+               myPos.y = resizeorigin.y - mySize.y;
        } else if(resizeCorner == 3) {
-               myPos_x = resizeorigin_x - mySize_x;
-               myPos_y = resizeorigin_y;
+               myPos.x = resizeorigin.x - mySize.x;
+               myPos.y = resizeorigin.y;
        } else { // resizeCorner == 4
-               myPos_x = resizeorigin_x;
-               myPos_y = resizeorigin_y;
+               myPos.x = resizeorigin.x;
+               myPos.y = resizeorigin.y;
        }
 
        // left/top screen edges
-       if(myPos_x < 0)
-               mySize_x = mySize_x + myPos_x;
-       if(myPos_y < 0)
-               mySize_y = mySize_y + myPos_y;
+       if(myPos.x < 0)
+               mySize.x = mySize.x + myPos.x;
+       if(myPos.y < 0)
+               mySize.y = mySize.y + myPos.y;
 
        // bottom/right screen edges
-       if(myPos_x + mySize_x > vid_conwidth)
-               mySize_x = vid_conwidth - myPos_x;
-       if(myPos_y + mySize_y > vid_conheight)
-               mySize_y = vid_conheight - myPos_y;
+       if(myPos.x + mySize.x > vid_conwidth)
+               mySize.x = vid_conwidth - myPos.x;
+       if(myPos.y + mySize.y > vid_conheight)
+               mySize.y = vid_conheight - myPos.y;
 
        //if(cvar("hud_configure_checkcollisions_debug"))
                //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
@@ -476,40 +483,40 @@ void HUD_Panel_SetPosSize(vector mySize)
        // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
        if(autocvar_hud_configure_grid)
        {
-               mySize_x = floor((mySize_x/vid_conwidth)/hud_configure_gridSize_x + 0.5) * hud_configure_realGridSize_x;
-               mySize_y = floor((mySize_y/vid_conheight)/hud_configure_gridSize_y + 0.5) * hud_configure_realGridSize_y;
+               mySize.x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
+               mySize.y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
        }
 
        if(hud_configure_checkcollisions)
                mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
 
        // minimum panel size cap, do this once more so we NEVER EVER EVER have a panel smaller than this, JUST IN CASE above code still makes the panel eg negative (impossible to resize back without changing cvars manually then)
-       mySize_x = max(0.025 * vid_conwidth, mySize_x);
-       mySize_y = max(0.025 * vid_conheight, mySize_y);
+       mySize.x = max(0.025 * vid_conwidth, mySize.x);
+       mySize.y = max(0.025 * vid_conheight, mySize.y);
 
        // do another pos check, as size might have changed by now
        if(resizeCorner == 1) {
-               myPos_x = resizeorigin_x - mySize_x;
-               myPos_y = resizeorigin_y - mySize_y;
+               myPos.x = resizeorigin.x - mySize.x;
+               myPos.y = resizeorigin.y - mySize.y;
        } else if(resizeCorner == 2) {
-               myPos_x = resizeorigin_x;
-               myPos_y = resizeorigin_y - mySize_y;
+               myPos.x = resizeorigin.x;
+               myPos.y = resizeorigin.y - mySize.y;
        } else if(resizeCorner == 3) {
-               myPos_x = resizeorigin_x - mySize_x;
-               myPos_y = resizeorigin_y;
+               myPos.x = resizeorigin.x - mySize.x;
+               myPos.y = resizeorigin.y;
        } else { // resizeCorner == 4
-               myPos_x = resizeorigin_x;
-               myPos_y = resizeorigin_y;
+               myPos.x = resizeorigin.x;
+               myPos.y = resizeorigin.y;
        }
 
        //if(cvar("hud_configure_checkcollisions_debug"))
                //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
 
        string s;
-       s = strcat(ftos(mySize_x/vid_conwidth), " ", ftos(mySize_y/vid_conheight));
+       s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight));
        cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
 
-       s = strcat(ftos(myPos_x/vid_conwidth), " ", ftos(myPos_y/vid_conheight));
+       s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight));
        cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
 }
 
@@ -528,16 +535,16 @@ void HUD_Panel_Arrow_Action(float nPrimary)
                if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
                {
                        if (hudShiftState & S_SHIFT)
-                               step = hud_configure_realGridSize_y;
+                               step = hud_configure_realGridSize.y;
                        else
-                               step = 2 * hud_configure_realGridSize_y;
+                               step = 2 * hud_configure_realGridSize.y;
                }
                else
                {
                        if (hudShiftState & S_SHIFT)
-                               step = hud_configure_realGridSize_x;
+                               step = hud_configure_realGridSize.x;
                        else
-                               step = 2 * hud_configure_realGridSize_x;
+                               step = 2 * hud_configure_realGridSize.x;
                }
        }
        else
@@ -553,7 +560,7 @@ void HUD_Panel_Arrow_Action(float nPrimary)
        }
 
        panel = highlightedPanel;
-       HUD_Panel_UpdatePosSize()
+       HUD_Panel_UpdatePosSize();
 
        highlightedPanel_initial_pos = panel_pos;
        highlightedPanel_initial_size = panel_size;
@@ -583,15 +590,15 @@ void HUD_Panel_Arrow_Action(float nPrimary)
                panel_click_resizeorigin = panel_pos;
                if(resizeCorner == 1) {
                        panel_click_resizeorigin += mySize;
-                       mySize_y += step;
+                       mySize.y += step;
                } else if(resizeCorner == 2) {
-                       panel_click_resizeorigin_y += mySize_y;
-                       mySize_x += step;
+                       panel_click_resizeorigin.y += mySize.y;
+                       mySize.x += step;
                } else if(resizeCorner == 3) {
-                       panel_click_resizeorigin_x += mySize_x;
-                       mySize_x += step;
+                       panel_click_resizeorigin.x += mySize.x;
+                       mySize.x += step;
                } else { // resizeCorner == 4
-                       mySize_y += step;
+                       mySize.y += step;
                }
                HUD_Panel_SetPosSize(mySize);
        }
@@ -601,19 +608,19 @@ void HUD_Panel_Arrow_Action(float nPrimary)
                vector pos;
                pos = panel_pos;
                if(nPrimary == K_UPARROW)
-                       pos_y -= step;
+                       pos.y -= step;
                else if(nPrimary == K_DOWNARROW)
-                       pos_y += step;
+                       pos.y += step;
                else if(nPrimary == K_LEFTARROW)
-                       pos_x -= step;
+                       pos.x -= step;
                else // if(nPrimary == K_RIGHTARROW)
-                       pos_x += step;
+                       pos.x += step;
 
                HUD_Panel_SetPos(pos);
        }
 
        panel = highlightedPanel;
-       HUD_Panel_UpdatePosSize()
+       HUD_Panel_UpdatePosSize();
 
        if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
        {
@@ -624,11 +631,11 @@ void HUD_Panel_Arrow_Action(float nPrimary)
        }
 }
 
-const float S_MOUSE1 = 1;
-const float S_MOUSE2 = 2;
-const float S_MOUSE3 = 4;
-float mouseClicked;
-float prevMouseClicked; // previous state
+const int S_MOUSE1 = 1;
+const int S_MOUSE2 = 2;
+const int S_MOUSE3 = 4;
+int mouseClicked;
+int prevMouseClicked; // previous state
 float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks
 vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks
 
@@ -656,8 +663,8 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
 
        if(bInputType == 3)
        {
-               mousepos_x = nPrimary;
-               mousepos_y = nSecondary;
+               mousepos.x = nPrimary;
+               mousepos.y = nSecondary;
                return true;
        }
 
@@ -676,11 +683,12 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
        con_keys = findkeysforcommand("toggleconsole", 0);
        keys = tokenize(con_keys); // findkeysforcommand returns data for this
 
-       float hit_con_bind = 0, i;
+       bool hit_con_bind = false;
+       int i;
        for (i = 0; i < keys; ++i)
        {
                if(nPrimary == stof(argv(i)))
-                       hit_con_bind = 1;
+                       hit_con_bind = true;
        }
 
        if(bInputType == 0) {
@@ -755,7 +763,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                        if (highlightedPanel)
                        {
                                panel = highlightedPanel;
-                               HUD_Panel_UpdatePosSize()
+                               HUD_Panel_UpdatePosSize();
                        }
                        else
                                panel_pos = '0 0 0';
@@ -770,14 +778,14 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                }
                tab_backward = (hudShiftState & S_SHIFT);
 
-               float k, level = 0, start_pos_x;
+               float k, level = 0, start_posX;
                vector candidate_pos = '0 0 0';
                const float LEVELS_NUM = 4;
                float level_height = vid_conheight / LEVELS_NUM;
 :find_tab_panel
-               level = floor(tab_panel_pos_y / level_height) * level_height; //starting level
-               candidate_pos_x = (!tab_backward) ? vid_conwidth : 0;
-               start_pos_x = tab_panel_pos_x;
+               level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
+               candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
+               start_posX = tab_panel_pos.x;
                tab_panel = world;
                k=0;
                while(++k)
@@ -787,10 +795,10 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                                panel = hud_panel[i];
                                if (panel == tab_panels[i] || panel == starting_panel)
                                        continue;
-                               HUD_Panel_UpdatePosSize()
-                               if (panel_pos_y >= level && (panel_pos_y - level) < level_height)
-                               if (  ( !tab_backward && panel_pos_x >= start_pos_x && (panel_pos_x < candidate_pos_x || (panel_pos_x == candidate_pos_x && panel_pos_y <= candidate_pos_y)) )
-                                       || ( tab_backward && panel_pos_x <= start_pos_x && (panel_pos_x > candidate_pos_x || (panel_pos_x == candidate_pos_x && panel_pos_y >= candidate_pos_y)) )  )
+                               HUD_Panel_UpdatePosSize();
+                               if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
+                               if (  ( !tab_backward && panel_pos.x >= start_posX && (panel_pos.x < candidate_pos.x || (panel_pos.x == candidate_pos.x && panel_pos.y <= candidate_pos.y)) )
+                                       || ( tab_backward && panel_pos.x <= start_posX && (panel_pos.x > candidate_pos.x || (panel_pos.x == candidate_pos.x && panel_pos.y >= candidate_pos.y)) )  )
                                {
                                        tab_panel = panel;
                                        tab_panel_pos = candidate_pos = panel_pos;
@@ -813,14 +821,14 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                        if (!tab_backward)
                        {
                                level = (level + level_height) % vid_conheight;
-                               start_pos_x = 0;
-                               candidate_pos_x = vid_conwidth;
+                               start_posX = 0;
+                               candidate_pos.x = vid_conwidth;
                        }
                        else
                        {
                                level = (level - level_height) % vid_conheight;
-                               start_pos_x = vid_conwidth;
-                               candidate_pos_x = 0;
+                               start_posX = vid_conwidth;
+                               candidate_pos.x = 0;
                        }
                }
 
@@ -844,7 +852,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                if (highlightedPanel)
                {
                        panel = highlightedPanel;
-                       HUD_Panel_UpdatePosSize()
+                       HUD_Panel_UpdatePosSize();
                        panel_size_copied = panel_size;
                }
        }
@@ -857,14 +865,14 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                        return true;
 
                panel = highlightedPanel;
-               HUD_Panel_UpdatePosSize()
+               HUD_Panel_UpdatePosSize();
 
                // reduce size if it'd go beyond screen boundaries
                vector tmp_size = panel_size_copied;
-               if (panel_pos_x + panel_size_copied_x > vid_conwidth)
-                       tmp_size_x = vid_conwidth - panel_pos_x;
-               if (panel_pos_y + panel_size_copied_y > vid_conheight)
-                       tmp_size_y = vid_conheight - panel_pos_y;
+               if (panel_pos.x + panel_size_copied.x > vid_conwidth)
+                       tmp_size.x = vid_conwidth - panel_pos.x;
+               if (panel_pos.y + panel_size_copied.y > vid_conheight)
+                       tmp_size.y = vid_conheight - panel_pos.y;
 
                if (panel_size == tmp_size)
                        return true;
@@ -874,7 +882,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                panel_size_backup = panel_size;
                highlightedPanel_backup = highlightedPanel;
 
-               s = strcat(ftos(tmp_size_x/vid_conwidth), " ", ftos(tmp_size_y/vid_conheight));
+               s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight));
                cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
        }
        else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
@@ -884,9 +892,9 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                //restore previous values
                if (highlightedPanel_backup)
                {
-                       s = strcat(ftos(panel_pos_backup_x/vid_conwidth), " ", ftos(panel_pos_backup_y/vid_conheight));
+                       s = strcat(ftos(panel_pos_backup.x/vid_conwidth), " ", ftos(panel_pos_backup.y/vid_conheight));
                        cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
-                       s = strcat(ftos(panel_size_backup_x/vid_conwidth), " ", ftos(panel_size_backup_y/vid_conheight));
+                       s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight));
                        cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
                        highlightedPanel_backup = world;
                }
@@ -919,40 +927,39 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
 
 float HUD_Panel_Check_Mouse_Pos(float allow_move)
 {
-       float i, j = 0, border;
-
+       int i, j = 0;
        while(j < HUD_PANEL_NUM)
        {
                i = panel_order[j];
                j += 1;
 
                panel = hud_panel[i];
-               HUD_Panel_UpdatePosSize()
+               HUD_Panel_UpdatePosSize();
 
-               border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
+               float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
 
                // move
-               if(allow_move && mousepos_x > panel_pos_x && mousepos_y > panel_pos_y && mousepos_x < panel_pos_x + panel_size_x && mousepos_y < panel_pos_y + panel_size_y)
+               if(allow_move && mousepos.x > panel_pos.x && mousepos.y > panel_pos.y && mousepos.x < panel_pos.x + panel_size.x && mousepos.y < panel_pos.y + panel_size.y)
                {
                        return 1;
                }
                // resize from topleft border
-               else if(mousepos_x >= panel_pos_x - border && mousepos_y >= panel_pos_y - border && mousepos_x <= panel_pos_x + 0.5 * panel_size_x && mousepos_y <= panel_pos_y + 0.5 * panel_size_y)
+               else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
                {
                        return 2;
                }
                // resize from topright border
-               else if(mousepos_x >= panel_pos_x + 0.5 * panel_size_x && mousepos_y >= panel_pos_y - border && mousepos_x <= panel_pos_x + panel_size_x + border && mousepos_y <= panel_pos_y + 0.5 * panel_size_y)
+               else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
                {
                        return 3;
                }
                // resize from bottomleft border
-               else if(mousepos_x >= panel_pos_x - border && mousepos_y >= panel_pos_y + 0.5 * panel_size_y && mousepos_x <= panel_pos_x + 0.5 * panel_size_x && mousepos_y <= panel_pos_y + panel_size_y + border)
+               else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + panel_size.y + border)
                {
                        return 3;
                }
                // resize from bottomright border
-               else if(mousepos_x >= panel_pos_x + 0.5 * panel_size_x && mousepos_y >= panel_pos_y + 0.5 * panel_size_y && mousepos_x <= panel_pos_x + panel_size_x + border && mousepos_y <= panel_pos_y + panel_size_y + border)
+               else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + panel_size.y + border)
                {
                        return 2;
                }
@@ -963,8 +970,8 @@ float HUD_Panel_Check_Mouse_Pos(float allow_move)
 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
 void HUD_Panel_FirstInDrawQ(float id)
 {
-       float i;
-       var float place = -1;
+       int i;
+       int place = -1;
        // find out where in the array our current id is, save into place
        for(i = 0; i < HUD_PANEL_NUM; ++i)
        {
@@ -1000,7 +1007,7 @@ void HUD_Panel_FirstInDrawQ(float id)
 
 void HUD_Panel_Highlight(float allow_move)
 {
-       float i, j = 0, border;
+       int i, j = 0;
 
        while(j < HUD_PANEL_NUM)
        {
@@ -1008,12 +1015,12 @@ void HUD_Panel_Highlight(float allow_move)
                j += 1;
 
                panel = hud_panel[i];
-               HUD_Panel_UpdatePosSize()
+               HUD_Panel_UpdatePosSize();
 
-               border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
+               float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
 
                // move
-               if(allow_move && mousepos_x > panel_pos_x && mousepos_y > panel_pos_y && mousepos_x < panel_pos_x + panel_size_x && mousepos_y < panel_pos_y + panel_size_y)
+               if(allow_move && mousepos.x > panel_pos.x && mousepos.y > panel_pos.y && mousepos.x < panel_pos.x + panel_size.x && mousepos.y < panel_pos.y + panel_size.y)
                {
                        highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
@@ -1022,7 +1029,7 @@ void HUD_Panel_Highlight(float allow_move)
                        return;
                }
                // resize from topleft border
-               else if(mousepos_x >= panel_pos_x - border && mousepos_y >= panel_pos_y - border && mousepos_x <= panel_pos_x + 0.5 * panel_size_x && mousepos_y <= panel_pos_y + 0.5 * panel_size_y)
+               else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
                {
                        highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
@@ -1033,31 +1040,31 @@ void HUD_Panel_Highlight(float allow_move)
                        return;
                }
                // resize from topright border
-               else if(mousepos_x >= panel_pos_x + 0.5 * panel_size_x && mousepos_y >= panel_pos_y - border && mousepos_x <= panel_pos_x + panel_size_x + border && mousepos_y <= panel_pos_y + 0.5 * panel_size_y)
+               else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
                {
                        highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 2;
-                       panel_click_distance_x = panel_size_x - mousepos_x + panel_pos_x;
-                       panel_click_distance_y = mousepos_y - panel_pos_y;
-                       panel_click_resizeorigin = panel_pos + eY * panel_size_y;
+                       panel_click_distance.x = panel_size.x - mousepos.x + panel_pos.x;
+                       panel_click_distance.y = mousepos.y - panel_pos.y;
+                       panel_click_resizeorigin = panel_pos + eY * panel_size.y;
                        return;
                }
                // resize from bottomleft border
-               else if(mousepos_x >= panel_pos_x - border && mousepos_y >= panel_pos_y + 0.5 * panel_size_y && mousepos_x <= panel_pos_x + 0.5 * panel_size_x && mousepos_y <= panel_pos_y + panel_size_y + border)
+               else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + panel_size.y + border)
                {
                        highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 3;
-                       panel_click_distance_x = mousepos_x - panel_pos_x;
-                       panel_click_distance_y = panel_size_y - mousepos_y + panel_pos_y;
-                       panel_click_resizeorigin = panel_pos + eX * panel_size_x;
+                       panel_click_distance.x = mousepos.x - panel_pos.x;
+                       panel_click_distance.y = panel_size.y - mousepos.y + panel_pos.y;
+                       panel_click_resizeorigin = panel_pos + eX * panel_size.x;
                        return;
                }
                // resize from bottomright border
-               else if(mousepos_x >= panel_pos_x + 0.5 * panel_size_x && mousepos_y >= panel_pos_y + 0.5 * panel_size_y && mousepos_x <= panel_pos_x + panel_size_x + border && mousepos_y <= panel_pos_y + panel_size_y + border)
+               else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + panel_size.y + border)
                {
                        highlightedPanel = hud_panel[i];
                        HUD_Panel_FirstInDrawQ(i);
@@ -1087,8 +1094,8 @@ void HUD_Panel_Mouse()
        {
                mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
 
-               mousepos_x = bound(0, mousepos_x, vid_conwidth);
-               mousepos_y = bound(0, mousepos_y, vid_conheight);
+               mousepos.x = bound(0, mousepos.x, vid_conwidth);
+               mousepos.y = bound(0, mousepos.y, vid_conheight);
        }
 
        if(mouseClicked)
@@ -1127,7 +1134,7 @@ void HUD_Panel_Mouse()
                else
                {
                        panel = highlightedPanel;
-                       HUD_Panel_UpdatePosSize()
+                       HUD_Panel_UpdatePosSize();
                }
 
                if (highlightedPanel)
@@ -1154,17 +1161,17 @@ void HUD_Panel_Mouse()
                {
                        vector mySize = '0 0 0';
                        if(resizeCorner == 1) {
-                               mySize_x = panel_click_resizeorigin_x - (mousepos_x - panel_click_distance_x);
-                               mySize_y = panel_click_resizeorigin_y - (mousepos_y - panel_click_distance_y);
+                               mySize.x = panel_click_resizeorigin.x - (mousepos.x - panel_click_distance.x);
+                               mySize.y = panel_click_resizeorigin.y - (mousepos.y - panel_click_distance.y);
                        } else if(resizeCorner == 2) {
-                               mySize_x = mousepos_x + panel_click_distance_x - panel_click_resizeorigin_x;
-                               mySize_y = panel_click_distance_y + panel_click_resizeorigin_y - mousepos_y;
+                               mySize.x = mousepos.x + panel_click_distance.x - panel_click_resizeorigin.x;
+                               mySize.y = panel_click_distance.y + panel_click_resizeorigin.y - mousepos.y;
                        } else if(resizeCorner == 3) {
-                               mySize_x = panel_click_resizeorigin_x + panel_click_distance_x - mousepos_x;
-                               mySize_y = mousepos_y + panel_click_distance_y - panel_click_resizeorigin_y;
+                               mySize.x = panel_click_resizeorigin.x + panel_click_distance.x - mousepos.x;
+                               mySize.y = mousepos.y + panel_click_distance.y - panel_click_resizeorigin.y;
                        } else { // resizeCorner == 4
-                               mySize_x = mousepos_x - (panel_click_resizeorigin_x - panel_click_distance_x);
-                               mySize_y = mousepos_y - (panel_click_resizeorigin_y - panel_click_distance_y);
+                               mySize.x = mousepos.x - (panel_click_resizeorigin.x - panel_click_distance.x);
+                               mySize.y = mousepos.y - (panel_click_resizeorigin.y - panel_click_distance.y);
                        }
                        HUD_Panel_SetPosSize(mySize);
                }
@@ -1174,7 +1181,7 @@ void HUD_Panel_Mouse()
                if(menu_enabled == 2)
                        mouse_over_panel = 0;
                else
-                       mouse_over_panel = HUD_Panel_Check_Mouse_Pos(TRUE);
+                       mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true);
                if (mouse_over_panel && !tab_panel)
                        drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
        }
@@ -1198,26 +1205,26 @@ void HUD_Configure_DrawGrid()
        float i;
        if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
        {
-               hud_configure_gridSize_x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
-               hud_configure_gridSize_y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
-               hud_configure_realGridSize_x = hud_configure_gridSize_x * vid_conwidth;
-               hud_configure_realGridSize_y = hud_configure_gridSize_y * vid_conheight;
+               hud_configure_gridSize.x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
+               hud_configure_gridSize.y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
+               hud_configure_realGridSize.x = hud_configure_gridSize.x * vid_conwidth;
+               hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
                vector s;
                // x-axis
                s = eX + eY * vid_conheight;
-               for(i = 1; i < 1/hud_configure_gridSize_x; ++i)
-                       drawfill(eX * i * hud_configure_realGridSize_x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
+               for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
+                       drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
                // y-axis
                s = eY + eX * vid_conwidth;
-               for(i = 1; i < 1/hud_configure_gridSize_y; ++i)
-                       drawfill(eY * i * hud_configure_realGridSize_y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
+               for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
+                       drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
        }
 }
 
 float _menu_alpha_prev;
 void HUD_Configure_Frame()
 {
-       float i;
+       int i;
        if(autocvar__hud_configure)
        {
                if(isdemo() || intermission == 2)
@@ -1226,7 +1233,7 @@ void HUD_Configure_Frame()
                        return;
                }
 
-               if(!hud_configure_prev || hud_configure_prev == -1)
+               if(!hud_configure_prev)
                {
                        if(autocvar_hud_cursormode)
                                setcursormode(1);
@@ -1254,16 +1261,16 @@ void HUD_Configure_Frame()
        }
 }
 
-const float hlBorderSize = 4;
+const float hlBorderSize = 2;
 const string hlBorder = "gfx/hud/default/border_highlighted";
 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
 {
        drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
-       drawpic_tiled(panel_pos - '1 1 0' * myBorder, hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size_x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
-       drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * (panel_size_y + 2 * myBorder - hlBorderSize), hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size_x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
-       drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize, hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size_y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
-       drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize + eX * (panel_size_x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size_y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
+       drawpic_tiled(panel_pos - '1 1 0' * myBorder, hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size.x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
+       drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * (panel_size.y + 2 * myBorder - hlBorderSize), hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size.x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
+       drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize, hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size.y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
+       drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize + eX * (panel_size.x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size.y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
 }
 
 void HUD_Configure_PostDraw()
@@ -1273,14 +1280,14 @@ void HUD_Configure_PostDraw()
                if(tab_panel)
                {
                        panel = tab_panel;
-                       HUD_Panel_UpdatePosSize()
+                       HUD_Panel_UpdatePosSize();
                        drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
                }
                if(highlightedPanel)
                {
                        panel = highlightedPanel;
-                       HUD_Panel_UpdatePosSize()
-                       HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha));
+                       HUD_Panel_UpdatePosSize();
+                       HUD_Panel_HlBorder(panel_bg_border * hlBorderSize, '0 0.5 1', 0.4 * (1 - autocvar__menu_alpha));
                }
        }
 }
index f6b3fc4cbe7894392a38fd455dacbe77d800a0dc..a74c6683a26824b0d9ac091e48012d6fb0258ab1 100644 (file)
@@ -1,10 +1,21 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "../common/buffs.qh"
+       #include "../csqcmodellib/interpolate.qh"
+       #include "main.qh"
+       #include "../csqcmodellib/cl_model.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
+
 // a laser goes from origin in direction angles
 // it has color 'colormod'
 // and stops when something is in the way
-.float cnt; // end effect
+.int cnt; // end effect
 .vector colormod;
-.float state; // on-off
-.float count; // flags for the laser
+.int state; // on-off
+.int count; // flags for the laser
 .vector velocity;
 .float alpha;
 .float scale; // scaling factor of the thickness
@@ -19,7 +30,7 @@ void Draw_Laser()
        {
                if(self.count & 0x10)
                {
-                       trace_endpos = self.velocity,
+                       trace_endpos = self.velocity;
                        trace_dphitq3surfaceflags = 0;
                }
                else
@@ -63,11 +74,10 @@ void Draw_Laser()
 
 void Ent_Laser()
 {
-       float f;
        InterpolateOrigin_Undo();
 
        // 30 bytes, or 13 bytes for just moving
-       f = ReadByte();
+       int f = ReadByte();
        self.count = (f & 0xF0);
 
        if(self.count & 0x80)
diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc
new file mode 100644 (file)
index 0000000..b753139
--- /dev/null
@@ -0,0 +1,1319 @@
+#include "mapvoting.qh"
+#include "modeleffects.qh"
+#include "particles.qh"
+#include "scoreboard.qh"
+#include "shownames.qh"
+#include "target_music.qh"
+#include "tuba.qh"
+#include "wall.qh"
+#include "waypointsprites.qh"
+
+#include "vehicles/vehicles.qh"
+
+#include "../server/vehicles/bumblebee.qh"
+
+#include "../common/net_notice.qh"
+
+#include "../common/monsters/monsters.qh"
+
+#include "../common/turrets/cl_turrets.qh"
+#include "../common/turrets/turrets.qh"
+
+#include "../warpzonelib/client.qh"
+
+// --------------------------------------------------------------------------
+// BEGIN REQUIRED CSQC FUNCTIONS
+//include "main.qh"
+
+entity clearentity_ent;
+void clearentity(entity e)
+{
+       if (!clearentity_ent)
+       {
+               clearentity_ent = spawn();
+               clearentity_ent.classname = "clearentity";
+       }
+       int n = e.entnum;
+       copyentity(clearentity_ent, e);
+       e.entnum = n;
+}
+
+#define DP_CSQC_ENTITY_REMOVE_IS_B0RKED
+void menu_show_error()
+{
+       drawstring('0 200 0', _("ERROR - MENU IS VISIBLE BUT NO MENU WAS DEFINED!"), '8 8 0', '1 0 0', 1, 0);
+}
+
+// CSQC_Init : Called every time the CSQC code is initialized (essentially at map load)
+// Useful for precaching things
+
+void menu_sub_null()
+{
+}
+
+string forcefog;
+void WaypointSprite_Load();
+void ConsoleCommand_macro_init();
+void CSQC_Init(void)
+{
+       prvm_language = cvar_string("prvm_language");
+
+#ifdef WATERMARK
+       dprintf("^4CSQC Build information: ^1%s\n", WATERMARK);
+#endif
+
+       int i;
+
+       binddb = db_create();
+       tempdb = db_create();
+       ClientProgsDB = db_load("client.db");
+       compressShortVector_init();
+
+       draw_endBoldFont();
+       menu_visible = false;
+       menu_show = menu_show_error;
+       menu_action = func_null;
+
+       for(i = 0; i < 255; ++i)
+               if(getplayerkeyvalue(i, "viewentity") == "")
+                       break;
+       maxclients = i;
+
+       //registercommand("hud_configure");
+       //registercommand("hud_save");
+       //registercommand("menu_action");
+
+       ConsoleCommand_macro_init();
+
+       registercvar("hud_usecsqc", "1");
+       registercvar("scoreboard_columns", "default");
+
+       registercvar("cl_nade_type", "3");
+       registercvar("cl_pokenade_type", "zombie");
+
+       gametype = 0;
+
+       // hud_fields uses strunzone on the titles!
+       for(i = 0; i < MAX_HUD_FIELDS; ++i)
+               hud_title[i] = strzone("(null)");
+
+       Cmd_HUD_SetFields(0);
+
+       postinit = false;
+
+       calledhooks = 0;
+
+       teams = Sort_Spawn();
+       players = Sort_Spawn();
+
+       GetTeam(NUM_SPECTATOR, true); // add specs first
+
+       // needs to be done so early because of the constants they create
+       CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
+       CALL_ACCUMULATED_FUNCTION(RegisterTurrets);
+       CALL_ACCUMULATED_FUNCTION(RegisterMonsters);
+       CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
+       CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
+       CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
+       CALL_ACCUMULATED_FUNCTION(RegisterHUD_Panels);
+       CALL_ACCUMULATED_FUNCTION(RegisterBuffs);
+
+       WaypointSprite_Load();
+
+       // precaches
+       precache_model("null");
+       precache_sound("misc/hit.wav");
+       precache_sound("misc/typehit.wav");
+
+       Projectile_Precache();
+       Hook_Precache();
+       GibSplash_Precache();
+       Casings_Precache();
+       Vehicles_Precache();
+       Tuba_Precache();
+       CSQCPlayer_Precache();
+
+       if(autocvar_cl_reticle)
+       {
+               precache_pic("gfx/reticle_normal");
+               // weapon reticles are precached in weapon files
+       }
+
+       get_mi_min_max_texcoords(1); // try the CLEVER way first
+       minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
+       shortmapname = mi_shortname;
+
+       if(precache_pic(minimapname) == "")
+       {
+               // but maybe we have a non-clever minimap
+               minimapname = strcat("gfx/", mi_shortname, "_mini.tga");
+               if(precache_pic(minimapname) == "")
+                       minimapname = ""; // FAIL
+               else
+                       get_mi_min_max_texcoords(0); // load new texcoords
+       }
+
+       mi_center = (mi_min + mi_max) * 0.5;
+       mi_scale = mi_max - mi_min;
+       minimapname = strzone(minimapname);
+
+       WarpZone_Init();
+
+       hud_skin_path = strzone(strcat("gfx/hud/", autocvar_hud_skin));
+       draw_currentSkin = strzone(strcat("gfx/menu/", cvar_string("menu_skin")));
+}
+
+// CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
+void Shutdown(void)
+{
+       WarpZone_Shutdown();
+
+       remove(teams);
+       remove(players);
+       db_close(binddb);
+       db_close(tempdb);
+       if(autocvar_cl_db_saveasdump)
+               db_dump(ClientProgsDB, "client.db");
+       else
+               db_save(ClientProgsDB, "client.db");
+       db_close(ClientProgsDB);
+
+       if(camera_active)
+               cvar_set("chase_active",ftos(chase_active_backup));
+
+       // unset the event chasecam's chase_active
+       if(autocvar_chase_active < 0)
+               cvar_set("chase_active", "0");
+
+       if (!isdemo())
+       {
+               if (!(calledhooks & HOOK_START))
+                       localcmd("\n_cl_hook_gamestart nop\n");
+               if (!(calledhooks & HOOK_END))
+                       localcmd("\ncl_hook_gameend\n");
+       }
+}
+
+.float has_team;
+float SetTeam(entity o, int Team)
+{
+       entity tm;
+       if(teamplay)
+       {
+               switch(Team)
+               {
+                       case -1:
+                       case NUM_TEAM_1:
+                       case NUM_TEAM_2:
+                       case NUM_TEAM_3:
+                       case NUM_TEAM_4:
+                               break;
+                       default:
+                               if(GetTeam(Team, false) == world)
+                               {
+                                       dprintf("trying to switch to unsupported team %d\n", Team);
+                                       Team = NUM_SPECTATOR;
+                               }
+                               break;
+               }
+       }
+       else
+       {
+               switch(Team)
+               {
+                       case -1:
+                       case 0:
+                               break;
+                       default:
+                               if(GetTeam(Team, false) == world)
+                               {
+                                       dprintf("trying to switch to unsupported team %d\n", Team);
+                                       Team = NUM_SPECTATOR;
+                               }
+                               break;
+               }
+       }
+       if(Team == -1) // leave
+       {
+               if(o.has_team)
+               {
+                       tm = GetTeam(o.team, false);
+                       tm.team_size -= 1;
+                       o.has_team = 0;
+                       return true;
+               }
+       }
+       else
+       {
+               if (!o.has_team)
+               {
+                       o.team = Team;
+                       tm = GetTeam(Team, true);
+                       tm.team_size += 1;
+                       o.has_team = 1;
+                       return true;
+               }
+               else if(Team != o.team)
+               {
+                       tm = GetTeam(o.team, false);
+                       tm.team_size -= 1;
+                       o.team = Team;
+                       tm = GetTeam(Team, true);
+                       tm.team_size += 1;
+                       return true;
+               }
+       }
+       return false;
+}
+
+void Playerchecker_Think()
+{
+    int i;
+       entity e;
+       for(i = 0; i < maxclients; ++i)
+       {
+               e = playerslots[i];
+               if(GetPlayerName(i) == "")
+               {
+                       if(e.sort_prev)
+                       {
+                               // player disconnected
+                               SetTeam(e, -1);
+                               RemovePlayer(e);
+                               e.sort_prev = world;
+                               //e.gotscores = 0;
+                       }
+               }
+               else
+               {
+                       if (!e.sort_prev)
+                       {
+                               // player connected
+                               if (!e)
+                                       playerslots[i] = e = spawn();
+                               e.sv_entnum = i;
+                               e.ping = 0;
+                               e.ping_packetloss = 0;
+                               e.ping_movementloss = 0;
+                               //e.gotscores = 0; // we might already have the scores...
+                               SetTeam(e, GetPlayerColor(i)); // will not hurt; later updates come with HUD_UpdatePlayerTeams
+                               RegisterPlayer(e);
+                               HUD_UpdatePlayerPos(e);
+                       }
+               }
+       }
+       self.nextthink = time + 0.2;
+}
+
+void Porto_Init();
+void TrueAim_Init();
+void PostInit(void)
+{
+       entity playerchecker;
+       playerchecker = spawn();
+       playerchecker.think = Playerchecker_Think;
+       playerchecker.nextthink = time + 0.2;
+
+       Porto_Init();
+       TrueAim_Init();
+
+       postinit = true;
+}
+
+// CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
+// Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
+// All keys are in ascii.
+// bInputType = 0 is key pressed, 1 is key released, 2 and 3 are mouse input.
+// In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
+// In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
+// In the case of mouse input after a setcursormode(1) call, nPrimary is xpos, nSecondary is ypos.
+float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
+{
+       float bSkipKey;
+       bSkipKey = false;
+
+       if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
+               return true;
+
+       if (MapVote_InputEvent(bInputType, nPrimary, nSecondary))
+               return true;
+
+       if(menu_visible && menu_action)
+               if(menu_action(bInputType, nPrimary, nSecondary))
+                       return true;
+
+       return bSkipKey;
+}
+
+// END REQUIRED CSQC FUNCTIONS
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// BEGIN OPTIONAL CSQC FUNCTIONS
+void Ent_RemoveEntCS()
+{
+       entcs_receiver[self.sv_entnum] = world;
+}
+void Ent_ReadEntCS()
+{
+    int sf;
+       InterpolateOrigin_Undo();
+
+       self.classname = "entcs_receiver";
+       sf = ReadByte();
+
+       if(sf & 1)
+               self.sv_entnum = ReadByte();
+       if(sf & 2)
+       {
+               self.origin_x = ReadShort();
+               self.origin_y = ReadShort();
+               self.origin_z = ReadShort();
+               setorigin(self, self.origin);
+       }
+       if(sf & 4)
+       {
+               self.angles_y = ReadByte() * 360.0 / 256;
+               self.angles_x = self.angles_z = 0;
+       }
+       if(sf & 8)
+               self.healthvalue = ReadByte() * 10;
+       if(sf & 16)
+               self.armorvalue = ReadByte() * 10;
+
+       entcs_receiver[self.sv_entnum] = self;
+       self.entremove = Ent_RemoveEntCS;
+       self.iflags |= IFLAG_ORIGIN;
+
+       InterpolateOrigin_Note();
+}
+
+void Ent_Remove();
+
+void Ent_RemovePlayerScore()
+{
+       if(self.owner) {
+               SetTeam(self.owner, -1);
+               self.owner.gotscores = 0;
+               for(int i = 0; i < MAX_SCORE; ++i) {
+                       self.owner.(scores[i]) = 0; // clear all scores
+               }
+       }
+}
+
+void Ent_ReadPlayerScore()
+{
+       int i, n;
+       bool isNew;
+       entity o;
+
+       // damnit -.- don't want to go change every single .sv_entnum in hud.qc AGAIN
+       // (no I've never heard of M-x replace-string, sed, or anything like that)
+       isNew = !self.owner; // workaround for DP bug
+       n = ReadByte()-1;
+
+#ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
+       if(!isNew && n != self.sv_entnum)
+       {
+               //print("A CSQC entity changed its owner!\n");
+               printf("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", num_for_edict(self), self.classname);
+               isNew = true;
+               Ent_Remove();
+               self.enttype = ENT_CLIENT_SCORES;
+       }
+#endif
+
+       self.sv_entnum = n;
+
+       if (!(playerslots[self.sv_entnum]))
+               playerslots[self.sv_entnum] = spawn();
+       o = self.owner = playerslots[self.sv_entnum];
+       o.sv_entnum = self.sv_entnum;
+       o.gotscores = 1;
+
+       //if (!o.sort_prev)
+       //      RegisterPlayer(o);
+       //playerchecker will do this for us later, if it has not already done so
+
+    int sf, lf;
+#if MAX_SCORE <= 8
+       sf = ReadByte();
+       lf = ReadByte();
+#else
+       sf = ReadShort();
+       lf = ReadShort();
+#endif
+    int p;
+       for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
+               if(sf & p)
+               {
+                       if(lf & p)
+                               o.(scores[i]) = ReadInt24_t();
+                       else
+                               o.(scores[i]) = ReadChar();
+               }
+
+       if(o.sort_prev)
+               HUD_UpdatePlayerPos(o); // if not registered, we cannot do this yet!
+
+       self.entremove = Ent_RemovePlayerScore;
+}
+
+void Ent_ReadTeamScore()
+{
+       int i;
+       entity o;
+
+       self.team = ReadByte();
+       o = self.owner = GetTeam(self.team, true); // these team numbers can always be trusted
+
+    int sf, lf;
+#if MAX_TEAMSCORE <= 8
+       sf = ReadByte();
+       lf = ReadByte();
+#else
+       sf = ReadShort();
+       lf = ReadShort();
+#endif
+       int p;
+       for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
+               if(sf & p)
+               {
+                       if(lf & p)
+                               o.(teamscores[i]) = ReadInt24_t();
+                       else
+                               o.(teamscores[i]) = ReadChar();
+               }
+
+       HUD_UpdateTeamPos(o);
+}
+
+void Ent_ClientData()
+{
+       float newspectatee_status;
+
+    int f = ReadByte();
+
+       scoreboard_showscores_force = (f & 1);
+
+       if(f & 2)
+       {
+               newspectatee_status = ReadByte();
+               if(newspectatee_status == player_localnum + 1)
+                       newspectatee_status = -1; // observing
+       }
+       else
+               newspectatee_status = 0;
+
+       spectatorbutton_zoom = (f & 4);
+
+       if(f & 8)
+       {
+               angles_held_status = 1;
+               angles_held.x = ReadAngle();
+               angles_held.y = ReadAngle();
+               angles_held.z = 0;
+       }
+       else
+               angles_held_status = 0;
+
+       if(newspectatee_status != spectatee_status)
+       {
+               // clear race stuff
+               race_laptime = 0;
+               race_checkpointtime = 0;
+       }
+       if (autocvar_hud_panel_healtharmor_progressbar_gfx)
+       {
+               if ( (spectatee_status == -1 && newspectatee_status > 0) //before observing, now spectating
+                 || (spectatee_status > 0 && newspectatee_status > 0 && spectatee_status != newspectatee_status) //changed spectated player
+               )
+                       prev_p_health = -1;
+               else if(spectatee_status && !newspectatee_status) //before observing/spectating, now playing
+                       prev_health = -1;
+       }
+       spectatee_status = newspectatee_status;
+
+       // we could get rid of spectatee_status, and derive it from player_localentnum and player_localnum
+}
+
+void Ent_Nagger()
+{
+    int i, j, b, f;
+
+    int nags = ReadByte(); // NAGS NAGS NAGS NAGS NAGS NAGS NADZ NAGS NAGS NAGS
+
+       if(!(nags & 4))
+       {
+               if(vote_called_vote)
+                       strunzone(vote_called_vote);
+               vote_called_vote = string_null;
+               vote_active = 0;
+       }
+       else
+       {
+               vote_active = 1;
+       }
+
+       if(nags & 64)
+       {
+               vote_yescount = ReadByte();
+               vote_nocount = ReadByte();
+               vote_needed = ReadByte();
+               vote_highlighted = ReadChar();
+       }
+
+       if(nags & 128)
+       {
+               if(vote_called_vote)
+                       strunzone(vote_called_vote);
+               vote_called_vote = strzone(ColorTranslateRGB(ReadString()));
+       }
+
+       if(nags & 1)
+       {
+               for(j = 0; j < maxclients; ++j)
+                       if(playerslots[j])
+                               playerslots[j].ready = 1;
+               for(i = 1; i <= maxclients; i += 8)
+               {
+                       f = ReadByte();
+                       for(j = i-1, b = 1; b < 256; b *= 2, ++j)
+                               if (!(f & b))
+                                       if(playerslots[j])
+                                               playerslots[j].ready = 0;
+               }
+       }
+
+       ready_waiting = (nags & 1);
+       ready_waiting_for_me = (nags & 2);
+       vote_waiting = (nags & 4);
+       vote_waiting_for_me = (nags & 8);
+       warmup_stage = (nags & 16);
+}
+
+void Ent_EliminatedPlayers()
+{
+    int i, j, b, f;
+
+    int sf = ReadByte();
+       if(sf & 1)
+       {
+               for(j = 0; j < maxclients; ++j)
+                       if(playerslots[j])
+                               playerslots[j].eliminated = 1;
+               for(i = 1; i <= maxclients; i += 8)
+               {
+                       f = ReadByte();
+                       for(j = i-1, b = 1; b < 256; b *= 2, ++j)
+                               if (!(f & b))
+                                       if(playerslots[j])
+                                               playerslots[j].eliminated = 0;
+               }
+       }
+}
+
+void Ent_RandomSeed()
+{
+       float s;
+       prandom_debug();
+       s = ReadShort();
+       psrandom(s);
+}
+
+void Ent_ReadAccuracy(void)
+{
+    int f, w;
+    int sf = ReadInt24_t();
+       if(sf == 0)
+       {
+               for(w = 0; w <= WEP_LAST - WEP_FIRST; ++w)
+                       weapon_accuracy[w] = -1;
+               return;
+       }
+
+       for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w)
+       {
+               if(sf & f)
+               {
+            int b = ReadByte();
+                       if(b == 0)
+                               weapon_accuracy[w] = -1;
+                       else if(b == 255)
+                               weapon_accuracy[w] = 1.0; // no better error handling yet, sorry
+                       else
+                               weapon_accuracy[w] = (b - 1.0) / 100.0;
+               }
+               if(f == 0x800000)
+                       f = 1;
+               else
+                       f *= 2;
+       }
+}
+
+void Spawn_Draw(void)
+{
+       pointparticles(self.cnt, self.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
+}
+
+void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint
+{
+       float teamnum = (ReadByte() - 1);
+       vector spn_origin;
+       spn_origin.x = ReadShort();
+       spn_origin.y = ReadShort();
+       spn_origin.z = ReadShort();
+
+       if(is_new)
+       {
+               self.origin = spn_origin;
+               setsize(self, PL_MIN, PL_MAX);
+               droptofloor();
+
+               /*if(autocvar_cl_spawn_point_model) // needs a model first
+               {
+                       self.mdl = "models/spawnpoint.md3";
+                       self.colormod = Team_ColorRGB(teamnum);
+                       precache_model(self.mdl);
+                       setmodel(self, self.mdl);
+                       self.drawmask = MASK_NORMAL;
+                       //self.movetype = MOVETYPE_NOCLIP;
+                       //self.draw = Spawn_Draw;
+               }*/
+               if(autocvar_cl_spawn_point_particles)
+               {
+                       if((serverflags & SERVERFLAG_TEAMPLAY))
+                       {
+                               switch(teamnum)
+                               {
+                                       case NUM_TEAM_1: self.cnt = particleeffectnum("spawn_point_red"); break;
+                                       case NUM_TEAM_2: self.cnt = particleeffectnum("spawn_point_blue"); break;
+                                       case NUM_TEAM_3: self.cnt = particleeffectnum("spawn_point_yellow"); break;
+                                       case NUM_TEAM_4: self.cnt = particleeffectnum("spawn_point_pink"); break;
+                                       default: self.cnt = particleeffectnum("spawn_point_neutral"); break;
+                               }
+                       }
+                       else { self.cnt = particleeffectnum("spawn_point_neutral"); }
+
+                       self.draw = Spawn_Draw;
+               }
+       }
+
+       //printf("Ent_ReadSpawnPoint(is_new = %d); origin = %s, team = %d, effect = %d\n", is_new, vtos(self.origin), teamnum, self.cnt);
+}
+
+void Ent_ReadSpawnEvent(float is_new)
+{
+       // If entnum is 0, ONLY do the local spawn actions
+       // this way the server can disable the sending of
+       // spawn origin or such to clients if wanted.
+       float entnum = ReadByte();
+
+       if(entnum)
+       {
+               self.origin_x = ReadShort();
+               self.origin_y = ReadShort();
+               self.origin_z = ReadShort();
+
+               if(is_new)
+               {
+                       float teamnum = GetPlayerColor(entnum - 1);
+
+                       if(autocvar_cl_spawn_event_particles)
+                       {
+                               switch(teamnum)
+                               {
+                                       case NUM_TEAM_1: pointparticles(particleeffectnum("spawn_event_red"), self.origin, '0 0 0', 1); break;
+                                       case NUM_TEAM_2: pointparticles(particleeffectnum("spawn_event_blue"), self.origin, '0 0 0', 1); break;
+                                       case NUM_TEAM_3: pointparticles(particleeffectnum("spawn_event_yellow"), self.origin, '0 0 0', 1); break;
+                                       case NUM_TEAM_4: pointparticles(particleeffectnum("spawn_event_pink"), self.origin, '0 0 0', 1); break;
+                                       default: pointparticles(particleeffectnum("spawn_event_neutral"), self.origin, '0 0 0', 1); break;
+                               }
+                       }
+                       if(autocvar_cl_spawn_event_sound)
+                       {
+                               sound(self, CH_TRIGGER, "misc/spawn.wav", VOL_BASE, ATTEN_NORM);
+                       }
+               }
+       }
+
+       // local spawn actions
+       if(is_new && (!entnum || (entnum == player_localentnum)))
+       {
+               zoomin_effect = 1;
+               current_viewzoom = (1 / bound(1, autocvar_cl_spawnzoom_factor, 16));
+
+               if(autocvar_cl_unpress_zoom_on_spawn)
+               {
+                       localcmd("-zoom\n");
+                       button_zoom = false;
+               }
+       }
+
+       //printf("Ent_ReadSpawnEvent(is_new = %d); origin = %s, entnum = %d, localentnum = %d\n", is_new, vtos(self.origin), entnum, player_localentnum);
+}
+
+// CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
+// The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
+void Ent_RadarLink();
+void Ent_Init();
+void Ent_ScoresInfo();
+void CSQC_Ent_Update(float bIsNewEntity)
+{
+       float t;
+       float savetime;
+       t = ReadByte();
+
+       if(autocvar_developer_csqcentities)
+               printf("CSQC_Ent_Update(%d) with self=%i self.entnum=%d self.enttype=%d t=%d\n", bIsNewEntity, self, self.entnum, self.enttype, t);
+
+       // set up the "time" global for received entities to be correct for interpolation purposes
+       savetime = time;
+       if(servertime)
+       {
+               time = servertime;
+       }
+       else
+       {
+               serverprevtime = time;
+               serverdeltatime = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
+               time = serverprevtime + serverdeltatime;
+       }
+
+#ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
+       if(self.enttype)
+       {
+               if(t != self.enttype || bIsNewEntity)
+               {
+                       //print("A CSQC entity changed its type!\n");
+                       printf("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", num_for_edict(self), self.entnum, self.enttype, t);
+                       Ent_Remove();
+                       clearentity(self);
+                       bIsNewEntity = 1;
+               }
+       }
+       else
+       {
+               if(!bIsNewEntity)
+               {
+                       printf("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", num_for_edict(self), self.entnum, t);
+                       bIsNewEntity = 1;
+               }
+       }
+#endif
+       self.enttype = t;
+       switch(t)
+       {
+               case ENT_CLIENT_ENTCS: Ent_ReadEntCS(); break;
+               case ENT_CLIENT_SCORES: Ent_ReadPlayerScore(); break;
+               case ENT_CLIENT_TEAMSCORES: Ent_ReadTeamScore(); break;
+               case ENT_CLIENT_POINTPARTICLES: Ent_PointParticles(); break;
+               case ENT_CLIENT_RAINSNOW: Ent_RainOrSnow(); break;
+               case ENT_CLIENT_LASER: Ent_Laser(); break;
+               case ENT_CLIENT_NAGGER: Ent_Nagger(); break;
+               case ENT_CLIENT_ELIMINATEDPLAYERS: Ent_EliminatedPlayers(); break;
+               case ENT_CLIENT_WAYPOINT: Ent_WaypointSprite(); break;
+               case ENT_CLIENT_RADARLINK: Ent_RadarLink(); break;
+               case ENT_CLIENT_PROJECTILE: Ent_Projectile(); break;
+               case ENT_CLIENT_GIBSPLASH: Ent_GibSplash(bIsNewEntity); break;
+               case ENT_CLIENT_DAMAGEINFO: Ent_DamageInfo(bIsNewEntity); break;
+               case ENT_CLIENT_CASING: Ent_Casing(bIsNewEntity); break;
+               case ENT_CLIENT_INIT: Ent_Init(); break;
+               case ENT_CLIENT_SCORES_INFO: Ent_ScoresInfo(); break;
+               case ENT_CLIENT_MAPVOTE: Ent_MapVote(); break;
+               case ENT_CLIENT_CLIENTDATA: Ent_ClientData(); break;
+               case ENT_CLIENT_RANDOMSEED: Ent_RandomSeed(); break;
+               case ENT_CLIENT_WALL: Ent_Wall(); break;
+               case ENT_CLIENT_MODELEFFECT: Ent_ModelEffect(bIsNewEntity); break;
+               case ENT_CLIENT_TUBANOTE: Ent_TubaNote(bIsNewEntity); break;
+               case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;
+               case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;
+               case ENT_CLIENT_WARPZONE_TELEPORTED: WarpZone_Teleported_Read(bIsNewEntity); break;
+               case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;
+               case ENT_CLIENT_HOOK: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break;
+               case ENT_CLIENT_ARC_BEAM: Ent_ReadArcBeam(bIsNewEntity); break;
+               case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
+               case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
+               case ENT_CLIENT_TURRET: ent_turret(); break;
+               case ENT_CLIENT_MODEL: CSQCModel_Read(bIsNewEntity); break;
+               case ENT_CLIENT_ITEM: ItemRead(bIsNewEntity); break;
+               case ENT_CLIENT_BUMBLE_RAYGUN: bumble_raygun_read(bIsNewEntity); break;
+               case ENT_CLIENT_SPAWNPOINT: Ent_ReadSpawnPoint(bIsNewEntity); break;
+               case ENT_CLIENT_SPAWNEVENT: Ent_ReadSpawnEvent(bIsNewEntity); break;
+               case ENT_CLIENT_NOTIFICATION: Read_Notification(bIsNewEntity); break;
+               case ENT_CLIENT_HEALING_ORB: ent_healer(); break;
+
+               default:
+                       //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
+                       error(sprintf("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n", self.enttype, num_for_edict(self), self.classname));
+                       break;
+       }
+
+       time = savetime;
+}
+// Destructor, but does NOT deallocate the entity by calling remove(). Also
+// used when an entity changes its type. For an entity that someone interacts
+// with others, make sure it can no longer do so.
+void Ent_Remove()
+{
+       if(self.entremove)
+               self.entremove();
+
+       if(self.skeletonindex)
+       {
+               skel_delete(self.skeletonindex);
+               self.skeletonindex = 0;
+       }
+
+       if(self.snd_looping > 0)
+       {
+               sound(self, self.snd_looping, "misc/null.wav", VOL_BASE, autocvar_g_jetpack_attenuation);
+               self.snd_looping = 0;
+       }
+
+       self.enttype = 0;
+       self.classname = "";
+       self.draw = menu_sub_null;
+       self.entremove = menu_sub_null;
+       // TODO possibly set more stuff to defaults
+}
+// CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed.  Essentially call remove(self) as well.
+void CSQC_Ent_Remove()
+{
+       if(autocvar_developer_csqcentities)
+               printf("CSQC_Ent_Remove() with self=%i self.entnum=%d self.enttype=%d\n", self, self.entnum, self.enttype);
+
+       if(wasfreed(self))
+       {
+               print("WARNING: CSQC_Ent_Remove called for already removed entity. Packet loss?\n");
+               return;
+       }
+       if(self.enttype)
+               Ent_Remove();
+       remove(self);
+}
+
+void Gamemode_Init()
+{
+       if (!isdemo())
+       {
+               if(!(calledhooks & HOOK_START))
+                       localcmd("\n_cl_hook_gamestart ", MapInfo_Type_ToString(gametype), "\n");
+               calledhooks |= HOOK_START;
+       }
+}
+// CSQC_Parse_StuffCmd : Provides the stuffcmd string in the first parameter that the server provided.  To execute standard behavior, simply execute localcmd with the string.
+void CSQC_Parse_StuffCmd(string strMessage)
+{
+       if(autocvar_developer_csqcentities)
+               printf("CSQC_Parse_StuffCmd(\"%s\")\n", strMessage);
+
+       localcmd(strMessage);
+}
+// CSQC_Parse_Print : Provides the print string in the first parameter that the server provided.  To execute standard behavior, simply execute print with the string.
+void CSQC_Parse_Print(string strMessage)
+{
+       if(autocvar_developer_csqcentities)
+               printf("CSQC_Parse_Print(\"%s\")\n", strMessage);
+
+       print(ColorTranslateRGB(strMessage));
+}
+
+// CSQC_Parse_CenterPrint : Provides the centerprint_hud string in the first parameter that the server provided.
+void CSQC_Parse_CenterPrint(string strMessage)
+{
+       if(autocvar_developer_csqcentities)
+               printf("CSQC_Parse_CenterPrint(\"%s\")\n", strMessage);
+
+       centerprint_hud(strMessage);
+}
+
+string notranslate_fogcmd1 = "\nfog ";
+string notranslate_fogcmd2 = "\nr_fog_exp2 0\nr_drawfog 1\n";
+void Fog_Force()
+{
+       // TODO somehow thwart prvm_globalset client ...
+
+       if(autocvar_cl_orthoview && autocvar_cl_orthoview_nofog)
+               { localcmd("\nr_drawfog 0\n"); }
+       else if(forcefog != "")
+               { localcmd(strcat(notranslate_fogcmd1, forcefog, notranslate_fogcmd2)); }
+}
+
+void Gamemode_Init();
+void Ent_ScoresInfo()
+{
+    int i;
+       self.classname = "ent_client_scores_info";
+       gametype = ReadInt24_t();
+       HUD_ModIcons_SetFunc();
+       for(i = 0; i < MAX_SCORE; ++i)
+       {
+               if(scores_label[i])
+                       strunzone(scores_label[i]);
+               scores_label[i] = strzone(ReadString());
+               scores_flags[i] = ReadByte();
+       }
+       for(i = 0; i < MAX_TEAMSCORE; ++i)
+       {
+               if(teamscores_label[i])
+                       strunzone(teamscores_label[i]);
+               teamscores_label[i] = strzone(ReadString());
+               teamscores_flags[i] = ReadByte();
+       }
+       HUD_InitScores();
+       Gamemode_Init();
+}
+
+void Ent_Init()
+{
+       self.classname = "ent_client_init";
+
+       nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
+
+       hook_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
+       hook_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
+       hook_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
+       hook_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
+       arc_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
+       arc_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
+       arc_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
+       arc_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
+
+       if(forcefog)
+               strunzone(forcefog);
+       forcefog = strzone(ReadString());
+
+       armorblockpercent = ReadByte() / 255.0;
+
+       g_balance_mortar_bouncefactor = ReadCoord();
+       g_balance_mortar_bouncestop = ReadCoord();
+       g_balance_electro_secondary_bouncefactor = ReadCoord();
+       g_balance_electro_secondary_bouncestop = ReadCoord();
+
+       vortex_scope = !ReadByte();
+       rifle_scope = !ReadByte();
+
+       serverflags = ReadByte();
+
+       minelayer_maxmines = ReadByte();
+
+       hagar_maxrockets = ReadByte();
+
+       g_trueaim_minrange = ReadCoord();
+       g_balance_porto_secondary = ReadByte();
+
+       if(!postinit)
+               PostInit();
+}
+
+void Net_ReadRace()
+{
+       float b;
+
+       b = ReadByte();
+
+       switch(b)
+       {
+               case RACE_NET_CHECKPOINT_HIT_QUALIFYING:
+                       race_checkpoint = ReadByte();
+                       race_time = ReadInt24_t();
+                       race_previousbesttime = ReadInt24_t();
+                       if(race_previousbestname)
+                               strunzone(race_previousbestname);
+                       race_previousbestname = strzone(ColorTranslateRGB(ReadString()));
+
+                       race_checkpointtime = time;
+
+                       if(race_checkpoint == 0 || race_checkpoint == 254)
+                       {
+                               race_penaltyaccumulator = 0;
+                               race_laptime = time; // valid
+                       }
+
+                       break;
+
+               case RACE_NET_CHECKPOINT_CLEAR:
+                       race_laptime = 0;
+                       race_checkpointtime = 0;
+                       break;
+
+               case RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING:
+                       race_laptime = ReadCoord();
+                       race_checkpointtime = -99999;
+                       // fall through
+               case RACE_NET_CHECKPOINT_NEXT_QUALIFYING:
+                       race_nextcheckpoint = ReadByte();
+
+                       race_nextbesttime = ReadInt24_t();
+                       if(race_nextbestname)
+                               strunzone(race_nextbestname);
+                       race_nextbestname = strzone(ColorTranslateRGB(ReadString()));
+                       break;
+
+               case RACE_NET_CHECKPOINT_HIT_RACE:
+                       race_mycheckpoint = ReadByte();
+                       race_mycheckpointtime = time;
+                       race_mycheckpointdelta = ReadInt24_t();
+                       race_mycheckpointlapsdelta = ReadByte();
+                       if(race_mycheckpointlapsdelta >= 128)
+                               race_mycheckpointlapsdelta -= 256;
+                       if(race_mycheckpointenemy)
+                               strunzone(race_mycheckpointenemy);
+                       race_mycheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
+                       break;
+
+               case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:
+                       race_othercheckpoint = ReadByte();
+                       race_othercheckpointtime = time;
+                       race_othercheckpointdelta = ReadInt24_t();
+                       race_othercheckpointlapsdelta = ReadByte();
+                       if(race_othercheckpointlapsdelta >= 128)
+                               race_othercheckpointlapsdelta -= 256;
+                       if(race_othercheckpointenemy)
+                               strunzone(race_othercheckpointenemy);
+                       race_othercheckpointenemy = strzone(ColorTranslateRGB(ReadString()));
+                       break;
+
+               case RACE_NET_PENALTY_RACE:
+                       race_penaltyeventtime = time;
+                       race_penaltytime = ReadShort();
+                       //race_penaltyaccumulator += race_penaltytime;
+                       if(race_penaltyreason)
+                               strunzone(race_penaltyreason);
+                       race_penaltyreason = strzone(ReadString());
+                       break;
+
+               case RACE_NET_PENALTY_QUALIFYING:
+                       race_penaltyeventtime = time;
+                       race_penaltytime = ReadShort();
+                       race_penaltyaccumulator += race_penaltytime;
+                       if(race_penaltyreason)
+                               strunzone(race_penaltyreason);
+                       race_penaltyreason = strzone(ReadString());
+                       break;
+
+               case RACE_NET_SERVER_RECORD:
+                       race_server_record = ReadInt24_t();
+                       break;
+               case RACE_NET_SPEED_AWARD:
+                       race_speedaward = ReadInt24_t();
+                       if(race_speedaward_holder)
+                               strunzone(race_speedaward_holder);
+                       race_speedaward_holder = strzone(ReadString());
+                       break;
+               case RACE_NET_SPEED_AWARD_BEST:
+                       race_speedaward_alltimebest = ReadInt24_t();
+                       if(race_speedaward_alltimebest_holder)
+                               strunzone(race_speedaward_alltimebest_holder);
+                       race_speedaward_alltimebest_holder = strzone(ReadString());
+                       break;
+               case RACE_NET_SERVER_RANKINGS:
+                       float prevpos, del;
+            int pos = ReadShort();
+                       prevpos = ReadShort();
+                       del = ReadShort();
+
+                       // move other rankings out of the way
+            int i;
+                       if (prevpos) {
+                               for (i=prevpos-1;i>pos-1;--i) {
+                                       grecordtime[i] = grecordtime[i-1];
+                                       if(grecordholder[i])
+                                               strunzone(grecordholder[i]);
+                                       grecordholder[i] = strzone(grecordholder[i-1]);
+                               }
+                       } else if (del) { // a record has been deleted by the admin
+                               for (i=pos-1; i<= RANKINGS_CNT-1; ++i) {
+                                       if (i == RANKINGS_CNT-1) { // clear out last record
+                                               grecordtime[i] = 0;
+                                               if (grecordholder[i])
+                                                       strunzone(grecordholder[i]);
+                                               grecordholder[i] = string_null;
+                                       }
+                                       else {
+                                               grecordtime[i] = grecordtime[i+1];
+                                               if (grecordholder[i])
+                                                       strunzone(grecordholder[i]);
+                                               grecordholder[i] = strzone(grecordholder[i+1]);
+                                       }
+                               }
+                       } else { // player has no ranked record yet
+                               for (i=RANKINGS_CNT-1;i>pos-1;--i) {
+                                       grecordtime[i] = grecordtime[i-1];
+                                       if(grecordholder[i])
+                                               strunzone(grecordholder[i]);
+                                       grecordholder[i] = strzone(grecordholder[i-1]);
+                               }
+                       }
+
+                       // store new ranking
+                       if(grecordholder[pos-1] != "")
+                               strunzone(grecordholder[pos-1]);
+                       grecordholder[pos-1] = strzone(ReadString());
+                       grecordtime[pos-1] = ReadInt24_t();
+                       if(grecordholder[pos-1] == GetPlayerName(player_localnum))
+                               race_myrank = pos;
+                       break;
+               case RACE_NET_SERVER_STATUS:
+                       race_status = ReadShort();
+                       if(race_status_name)
+                               strunzone(race_status_name);
+                       race_status_name = strzone(ReadString());
+       }
+}
+
+void Net_TeamNagger()
+{
+       teamnagger = 1;
+}
+
+void Net_ReadPingPLReport()
+{
+       int e, pi, pl, ml;
+       e = ReadByte();
+       pi = ReadShort();
+       pl = ReadByte();
+       ml = ReadByte();
+       if (!(playerslots[e]))
+               return;
+       playerslots[e].ping = pi;
+       playerslots[e].ping_packetloss = pl / 255.0;
+       playerslots[e].ping_movementloss = ml / 255.0;
+}
+
+void Net_WeaponComplain()
+{
+       complain_weapon = ReadByte();
+
+       if(complain_weapon_name)
+               strunzone(complain_weapon_name);
+       complain_weapon_name = strzone(WEP_NAME(complain_weapon));
+
+       complain_weapon_type = ReadByte();
+
+       complain_weapon_time = time;
+       weapontime = time; // ping the weapon panel
+
+       switch(complain_weapon_type)
+       {
+               case 0: Local_Notification(MSG_MULTI, ITEM_WEAPON_NOAMMO, complain_weapon); break;
+               case 1: Local_Notification(MSG_MULTI, ITEM_WEAPON_DONTHAVE, complain_weapon); break;
+               default: Local_Notification(MSG_MULTI, ITEM_WEAPON_UNAVAILABLE, complain_weapon); break;
+       }
+}
+
+// CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
+// You must ALWAYS first acquire the temporary ID, which is sent as a byte.
+// Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
+float CSQC_Parse_TempEntity()
+{
+       float bHandled;
+               bHandled  = true;
+       // Acquire TE ID
+       float nTEID;
+               nTEID = ReadByte();
+
+       if(autocvar_developer_csqcentities)
+               printf("CSQC_Parse_TempEntity() with nTEID=%d\n", nTEID);
+
+               // NOTE: Could just do return instead of break...
+       switch(nTEID)
+       {
+               case TE_CSQC_TARGET_MUSIC:
+                       Net_TargetMusic();
+                       bHandled = true;
+                       break;
+               case TE_CSQC_PICTURE:
+                       Net_MapVote_Picture();
+                       bHandled = true;
+                       break;
+               case TE_CSQC_RACE:
+                       Net_ReadRace();
+                       bHandled = true;
+                       break;
+               case TE_CSQC_VORTEXBEAMPARTICLE:
+                       Net_ReadVortexBeamParticle();
+                       bHandled = true;
+                       break;
+               case TE_CSQC_TEAMNAGGER:
+                       Net_TeamNagger();
+                       bHandled = true;
+                       break;
+               case TE_CSQC_ARC:
+                       Net_ReadArc();
+                       bHandled = true;
+                       break;
+               case TE_CSQC_PINGPLREPORT:
+                       Net_ReadPingPLReport();
+                       bHandled = true;
+                       break;
+               case TE_CSQC_WEAPONCOMPLAIN:
+                       Net_WeaponComplain();
+                       bHandled = true;
+                       break;
+               case TE_CSQC_VEHICLESETUP:
+                       Net_VehicleSetup();
+                       bHandled = true;
+                       break;
+               case TE_CSQC_SVNOTICE:
+                       cl_notice_read();
+                       bHandled = true;
+                       break;
+               case TE_CSQC_SHOCKWAVEPARTICLE:
+                       Net_ReadShockwaveParticle();
+                       bHandled = true;
+                       break;
+               default:
+                       // No special logic for this temporary entity; return 0 so the engine can handle it
+                       bHandled = false;
+                       break;
+       }
+
+       return bHandled;
+}
+
+string getcommandkey(string text, string command)
+{
+       string keys;
+       float n, j, k, l = 0;
+
+       if (!autocvar_hud_showbinds)
+               return text;
+
+       keys = db_get(binddb, command);
+       if (keys == "")
+       {
+               n = tokenize(findkeysforcommand(command, 0)); // uses '...' strings
+               for(j = 0; j < n; ++j)
+               {
+                       k = stof(argv(j));
+                       if(k != -1)
+                       {
+                               if ("" == keys)
+                                       keys = keynumtostring(k);
+                               else
+                                       keys = strcat(keys, ", ", keynumtostring(k));
+
+                               ++l;
+                               if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit <= l)
+                                       break;
+                       }
+
+               }
+               if (keys == "")
+                       keys = "NO_KEY";
+               db_put(binddb, command, keys);
+       }
+
+       if (keys == "NO_KEY") {
+               if (autocvar_hud_showbinds > 1)
+                       return sprintf(_("%s (not bound)"), text);
+               else
+                       return text;
+       }
+       else if (autocvar_hud_showbinds > 1)
+               return sprintf("%s (%s)", text, keys);
+       else
+               return keys;
+}
index c9aa2fb40f8a9e86b105dcf317edc9a49cd63f1d..b8823e6296d4de67aed98f1f2da417aa00ff0381 100644 (file)
@@ -1,7 +1,10 @@
+#ifndef MAIN_H
+#define MAIN_H
+
 // --------------------------------------------------------------------------
 // MENU Functionality
 
-#define DATABUF_PING 0
+const float DATABUF_PING = 0;
 #define DATABUF_CAPTURES (1*maxclients)
 #define DATABUF_DEATHS (2*maxclients)
 #define DATABUF_RETURNS (3*maxclients)
@@ -27,7 +30,6 @@ string minimapname;
 // --------------------------------------------------------------------------
 // General stuff
 
-float drawfont;
 float postinit;
 float gametype;
 
@@ -38,36 +40,35 @@ float gametype;
 //.float ctf_state;
 //.float health;
 
-#define FONT_DEFAULT 0
-#define FONT_USER 8
+float FONT_USER = 8;
 
 // --------------------------------------------------------------------------
 // Scoreboard stuff
 
-#define MAX_HUD_FIELDS 16
+const int MAX_HUD_FIELDS = 16;
 
-#define SP_END -1
+const int SP_END = -1;
 
-#define SP_PING -2
-#define SP_NAME -3
-#define SP_KDRATIO -4
-#define SP_CLRATIO -5
-#define SP_PL -6
-#define SP_FRAGS -7
-#define SP_SUM -8
+const int SP_PING = -2;
+const int SP_NAME = -3;
+const int SP_KDRATIO = -4;
+const int SP_CLRATIO = -5;
+const int SP_PL = -6;
+const int SP_FRAGS = -7;
+const int SP_SUM = -8;
 
-#define SP_SEPARATOR -100
+const int SP_SEPARATOR = -100;
 
 float hud_field[MAX_HUD_FIELDS + 1];
 float hud_size[MAX_HUD_FIELDS + 1];
 string hud_title[MAX_HUD_FIELDS + 1];
-float hud_num_fields;
+int hud_num_fields;
 
 string scores_label[MAX_SCORE];
-float scores_flags[MAX_SCORE];
+int scores_flags[MAX_SCORE];
 string teamscores_label[MAX_SCORE];
-float teamscores_flags[MAX_SCORE];
-.float scores[MAX_SCORE];
+int teamscores_flags[MAX_SCORE];
+.int scores[MAX_SCORE];
 .float teamscores[MAX_TEAMSCORE];
 
 #define IS_INCREASING(x) ( (x)&SFL_LOWER_IS_BETTER )
@@ -92,15 +93,15 @@ entity teamslots[17];    // 17 teams (including "spectator team")
 .void(void) draw2d;
 .void(void) entremove;
 float drawframetime;
-vector view_origin, view_angles, view_forward, view_right, view_up;
+vector view_origin, view_forward, view_right, view_up;
 
 float button_zoom;
 float spectatorbutton_zoom;
 float button_attack2;
 
-float activeweapon;
-float switchingweapon;
-float switchweapon;
+int activeweapon;
+int switchingweapon;
+int switchweapon;
 float current_viewzoom;
 float zoomin_effect;
 float warmup_stage;
@@ -118,7 +119,7 @@ float current_zoomfraction;
 float cs_project_is_b0rked;
 float vid_width, vid_height, vid_pixelheight;
 
-float camera_active;           // Demo camera is active if set to TRUE
+float camera_active;           // Demo camera is active if set to true
 float chase_active_backup;
 float camera_roll;
 vector camera_direction;
@@ -126,14 +127,14 @@ vector camera_direction;
 void centerprint_hud(string strMessage);
 void centerprint_generic(float new_id, string strMessage, float duration, float countdown_num);
 
-#define ALPHA_MIN_VISIBLE 0.003
+const float ALPHA_MIN_VISIBLE = 0.003;
 
 float armorblockpercent;
 
 //hooks
-float calledhooks;
-#define HOOK_START    1
-#define HOOK_END      2
+int calledhooks;
+const int HOOK_START =    1;
+const int HOOK_END =      2;
 
 .float ping, ping_packetloss, ping_movementloss;
 
@@ -147,4 +148,5 @@ entity entcs_receiver[255]; // 255 is the engine limit on maxclients
 
 float hud;
 float view_quality;
-float framecount;
+int framecount;
+#endif
index 3f30a6a722f7d3e805e6423facaca0b7ad81ab00..28b81fc51ffc9e85c917ff69f34e748bbc18c3a9 100644 (file)
@@ -1,58 +1,32 @@
-float mv_num_maps;
-
-float mv_active;
-string mv_maps[MAPVOTE_COUNT];
-string mv_pics[MAPVOTE_COUNT];
-string mv_pk3[MAPVOTE_COUNT];
-float mv_preview[MAPVOTE_COUNT];
-float mv_votes[MAPVOTE_COUNT];
-float mv_avail[MAPVOTE_COUNT];
-float mv_avail_start[MAPVOTE_COUNT];
-entity mv_pk3list;
-float mv_abstain;
-float mv_ownvote;
-float mv_detail;
-float mv_timeout;
-float mv_top2_time;
-float mv_top2_alpha;
-
-vector mv_mousepos;
-float mv_selection;
-float mv_columns;
-float mv_mouse_selection;
-float mv_selection_keyboard;
-
-float gametypevote;
-string mapvote_chosenmap;
-vector gtv_text_size;
-vector gtv_text_size_small;
-
-string MapVote_FormatMapItem(float id, string map, float count, float maxwidth, vector fontsize)
+#include "mapvoting.qh"
+#include "scoreboard.qh"
+
+string MapVote_FormatMapItem(int id, string map, float _count, float maxwidth, vector fontsize)
 {
        string pre, post;
        pre = sprintf("%d. ", id+1);
        if(mv_detail)
        {
-               if(count == 1)
+               if(_count == 1)
                        post = _(" (1 vote)");
-               else if(count >= 0 && mv_avail[id] == GTV_AVAILABLE)
-                       post = sprintf(_(" (%d votes)"), count);
+               else if(_count >= 0 && mv_avail[id] == GTV_AVAILABLE)
+                       post = sprintf(_(" (%d votes)"), _count);
                else
                        post = "";
        }
        else
                post = "";
-       maxwidth -= stringwidth(pre, FALSE, fontsize) + stringwidth(post, FALSE, fontsize);
+       maxwidth -= stringwidth(pre, false, fontsize) + stringwidth(post, false, fontsize);
        map = textShortenToWidth(map, maxwidth, fontsize, stringwidth_nocolors);
        return strcat(pre, map, post);
 }
 
-string GameTypeVote_DescriptionByID(float id)
+string GameTypeVote_DescriptionByID(int id)
 {
        return MapInfo_Type_Description(MapInfo_Type_FromString(mv_maps[id]));
 }
 
-vector MapVote_RGB(float id)
+vector MapVote_RGB(int id)
 {
        if(mv_avail[id] != GTV_AVAILABLE)
                return '1 1 1';
@@ -64,26 +38,26 @@ vector MapVote_RGB(float id)
                return '1 1 1';
 }
 
-void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string gtype, string pic, float count, float id)
+void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string gtype, string pic, float _count, int id)
 {
        float alpha;
-       float desc_padding = gtv_text_size_x * 3;
-       float rect_margin = hud_fontsize_y / 2;
+       float desc_padding = gtv_text_size.x * 3;
+       float rect_margin = hud_fontsize.y / 2;
        vector rect_pos = pos - '0.5 0.5 0' * rect_margin;
        vector rect_size = '1 1 0';
-       rect_size_x = tsize + rect_margin;
-       rect_size_y = maxh + rect_margin;
+       rect_size.x = tsize + rect_margin;
+       rect_size.y = maxh + rect_margin;
        vector rgb = MapVote_RGB(id);
        vector offset = pos;
        float nlines = 0;
-       
+
        if(mv_avail_start[id] != GTV_AVAILABLE)
                alpha = 0.2;
        else if ( mv_avail[id] != GTV_AVAILABLE && mv_top2_alpha)
                alpha = mv_top2_alpha;
        else
                alpha = 1;
-       
+
        if(id == mv_selection && mv_avail[id] == GTV_AVAILABLE)
        {
                drawfill(rect_pos, rect_size, '1 1 1', 0.1, DRAWFLAG_NORMAL);
@@ -93,35 +67,35 @@ void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string g
                drawfill(rect_pos, rect_size, rgb, 0.1*alpha, DRAWFLAG_NORMAL);
                drawborderlines(autocvar_scoreboard_border_thickness, rect_pos, rect_size, rgb, alpha, DRAWFLAG_NORMAL);
        }
-       
+
        entity title;
        title = spawn();
-       title.message = MapVote_FormatMapItem(id, MapInfo_Type_ToText(MapInfo_Type_FromString(gtype)), 
-                                                                                 count, tsize, gtv_text_size);
+       title.message = MapVote_FormatMapItem(id, MapInfo_Type_ToText(MapInfo_Type_FromString(gtype)),
+                                                                                 _count, tsize, gtv_text_size);
        title.origin = pos-offset;
-       
-       pos_y += gtv_text_size_small_y;
-       pos_y += gtv_text_size_y/2;
-       
-       maxh -= gtv_text_size_y;
-       
+
+       pos.y += gtv_text_size_small.y;
+       pos.y += gtv_text_size.y/2;
+
+       maxh -= gtv_text_size.y;
+
        entity picent = spawn();
        picent.origin = pos-offset;
        picent.maxs = '1 1 0 ' * min(maxh, desc_padding) * 0.8;
-       
-       pos_x += desc_padding;
+
+       pos.x += desc_padding;
        tsize -= desc_padding;
-       
+
        string thelabel = GameTypeVote_DescriptionByID(id), ts;
        entity last = title;
        entity next = world;
-       if( thelabel != "") 
+       if( thelabel != "")
        {
                float i,n = tokenizebyseparator(thelabel, "\n");
-               for(i = 0; i < n && maxh > (nlines+1)*gtv_text_size_small_y; ++i)
+               for(i = 0; i < n && maxh > (nlines+1)*gtv_text_size_small.y; ++i)
                {
                        getWrappedLine_remaining = argv(i);
-                       while(getWrappedLine_remaining && maxh > (nlines+1)*gtv_text_size_small_y)
+                       while(getWrappedLine_remaining && maxh > (nlines+1)*gtv_text_size_small.y)
                        {
                                ts = getWrappedLine(tsize, gtv_text_size_small, stringwidth_colors);
                                if (ts != "")
@@ -131,21 +105,21 @@ void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string g
                                        next.origin = pos-offset;
                                        last.chain = next;
                                        last = next;
-                                       pos_y += gtv_text_size_small_y;
+                                       pos.y += gtv_text_size_small.y;
                                        nlines++;
                                }
                        }
                }
        }
-       
-       maxh -= max(nlines*gtv_text_size_small_y,picent.maxs_y);
+
+       maxh -= max(nlines*gtv_text_size_small.y,picent.maxs.y);
        if ( maxh > 0 )
-               offset_y += maxh/2;
-       drawstring(title.origin+offset, title.message, gtv_text_size, rgb, alpha, DRAWFLAG_NORMAL); 
-       
+               offset.y += maxh/2;
+       drawstring(title.origin+offset, title.message, gtv_text_size, rgb, alpha, DRAWFLAG_NORMAL);
+
        if(pic != "")
                drawpic(picent.origin+offset, pic, picent.maxs, '1 1 1', alpha, DRAWFLAG_NORMAL);
-       
+
        for ( last = title.chain; last ; )
        {
                drawstring(last.origin+offset, last.message, gtv_text_size_small, '1 1 1', alpha, DRAWFLAG_NORMAL);
@@ -153,28 +127,28 @@ void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string g
                last = last.chain;
                remove(next);
        }
-       
+
        remove(picent);
        remove(title);
 }
 
-void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, string pic, float count, float id)
+void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, string pic, float _count, int id)
 {
        vector img_size = '0 0 0';
        vector rgb;
        string label;
        float text_size;
 
-       isize -= hud_fontsize_y; // respect the text when calculating the image size
+       isize -= hud_fontsize.y; // respect the text when calculating the image size
 
        rgb = MapVote_RGB(id);
 
-       img_size_y = isize;
-       img_size_x = isize / 0.75; // 4:3 x can be stretched easily, height is defined in isize
+       img_size.y = isize;
+       img_size.x = isize / 0.75; // 4:3 x can be stretched easily, height is defined in isize
 
-       pos_y = pos_y + img_size_y;
+       pos.y = pos.y + img_size.y;
 
-       label = MapVote_FormatMapItem(id, map, count, tsize, hud_fontsize);
+       label = MapVote_FormatMapItem(id, map, _count, tsize, hud_fontsize);
 
        text_size = stringwidth(label, false, hud_fontsize);
 
@@ -184,11 +158,11 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin
        else
                theAlpha = 1;
 
-       pos_x -= text_size*0.5;
+       pos.x -= text_size*0.5;
        drawstring(pos, label, hud_fontsize, rgb, theAlpha, DRAWFLAG_NORMAL);
 
-       pos_x = pos_x + text_size*0.5 - img_size_x*0.5;
-       pos_y = pos_y - img_size_y;
+       pos.x = pos.x + text_size*0.5 - img_size.x*0.5;
+       pos.y = pos.y - img_size.y;
 
        pos += autocvar_scoreboard_border_thickness * '1 1 0';
        img_size -= (autocvar_scoreboard_border_thickness * 2) * '1 1 0';
@@ -213,7 +187,7 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin
                drawfill(pos, img_size, '1 1 1', 0.1, DRAWFLAG_NORMAL);
 }
 
-void MapVote_DrawAbstain(vector pos, float isize, float tsize, float count, float id)
+void MapVote_DrawAbstain(vector pos, float isize, float tsize, float _count, int id)
 {
        vector rgb;
        float text_size;
@@ -221,24 +195,23 @@ void MapVote_DrawAbstain(vector pos, float isize, float tsize, float count, floa
 
        rgb = MapVote_RGB(id);
 
-       pos_y = pos_y + hud_fontsize_y;
+       pos.y = pos.y + hud_fontsize.y;
 
-       label = MapVote_FormatMapItem(id, _("Don't care"), count, tsize, hud_fontsize);
+       label = MapVote_FormatMapItem(id, _("Don't care"), _count, tsize, hud_fontsize);
 
        text_size = stringwidth(label, false, hud_fontsize);
 
-       pos_x -= text_size*0.5;
+       pos.x -= text_size*0.5;
        drawstring(pos, label, hud_fontsize, rgb, 1, DRAWFLAG_NORMAL);
 }
 
-vector MapVote_GridVec(vector gridspec, float i, float m)
+vector MapVote_GridVec(vector gridspec, int i, int m)
 {
-       float r;
-       r = i % m;
+       int r = i % m;
        return
-               '1 0 0' * (gridspec_x * r)
+               '1 0 0' * (gridspec.x * r)
                +
-               '0 1 0' * (gridspec_y * (i - r) / m);
+               '0 1 0' * (gridspec.y * (i - r) / m);
 }
 
 float MapVote_Selection(vector topleft, vector cellsize, float rows, float columns)
@@ -251,10 +224,10 @@ float MapVote_Selection(vector topleft, vector cellsize, float rows, float colum
        for (r = 0; r < rows; ++r)
                for (c = 0; c < columns; ++c)
                {
-                       if (mv_mousepos_x >= topleft_x + cellsize_x *  c &&
-                               mv_mousepos_x <= topleft_x + cellsize_x * (c + 1) &&
-                               mv_mousepos_y >= topleft_y + cellsize_y *  r &&
-                               mv_mousepos_y <= topleft_y + cellsize_y * (r + 1))
+                       if (mv_mousepos.x >= topleft.x + cellsize.x *  c &&
+                               mv_mousepos.x <= topleft.x + cellsize.x * (c + 1) &&
+                               mv_mousepos.y >= topleft.y + cellsize.y *  r &&
+                               mv_mousepos.y <= topleft.y + cellsize.y * (r + 1))
                        {
                                mv_mouse_selection = r * columns + c;
                                break;
@@ -269,14 +242,15 @@ float MapVote_Selection(vector topleft, vector cellsize, float rows, float colum
 
        if ( mv_selection_keyboard )
                return mv_selection;
-       
+
        return mv_mouse_selection;
 }
 
 void MapVote_Draw()
 {
        string map;
-       float i, tmp;
+       int i;
+       float tmp;
        vector pos;
        float isize;
        float center;
@@ -290,10 +264,10 @@ void MapVote_Draw()
        if (!autocvar_hud_cursormode)
        {
                vector mpos = mv_mousepos + getmousepos();
-               mpos_x = bound(0, mpos_x, vid_conwidth);
-               mpos_y = bound(0, mpos_y, vid_conheight);
-               
-               if ( mpos_x != mv_mousepos_x || mpos_y != mv_mousepos_y )
+               mpos.x = bound(0, mpos.x, vid_conwidth);
+               mpos.y = bound(0, mpos.y, vid_conheight);
+
+               if ( mpos.x != mv_mousepos.x || mpos.y != mv_mousepos.y )
                        mv_selection_keyboard = 0;
                mv_mousepos = mpos;
 
@@ -311,65 +285,65 @@ void MapVote_Draw()
 
        hud_fontsize = HUD_GetFontsize("hud_fontsize");
 
-       pos_y = ymin;
-       pos_z = 0;
+       pos.y = ymin;
+       pos.z = 0;
 
        draw_beginBoldFont();
        map = ((gametypevote) ? _("Decide the gametype") : _("Vote for a map"));
-       pos_x = center - stringwidth(map, false, '12 0 0');
+       pos.x = center - stringwidth(map, false, '12 0 0');
        drawstring(pos, map, '24 24 0', '1 1 1', 1, DRAWFLAG_NORMAL);
-       pos_y += 26;
+       pos.y += 26;
 
        if( mapvote_chosenmap != "" )
        {
-               pos_x = center - stringwidth(mapvote_chosenmap, false, hud_fontsize*1.5/2);
+               pos.x = center - stringwidth(mapvote_chosenmap, false, hud_fontsize*1.5/2);
                drawstring(pos, mapvote_chosenmap, hud_fontsize*1.5, '1 1 1', 1, DRAWFLAG_NORMAL);
-               pos_y += hud_fontsize_y*2;
+               pos.y += hud_fontsize.y*2;
        }
 
        i = ceil(max(0, mv_timeout - time));
        map = sprintf(_("%d seconds left"), i);
-       pos_x = center - stringwidth(map, false, '8 0 0');
+       pos.x = center - stringwidth(map, false, '8 0 0');
        drawstring(pos, map, '16 16 0', '0 1 0', 1, DRAWFLAG_NORMAL);
-       pos_y += 22;
-       pos_x = xmin;
+       pos.y += 22;
+       pos.x = xmin;
        draw_endBoldFont();
 
        // base for multi-column stuff...
-       ymin = pos_y;
+       ymin = pos.y;
        if(mv_abstain)
                mv_num_maps -= 1;
 
        rows = ceil(mv_num_maps / mv_columns);
 
-       dist_x = (xmax - xmin) / mv_columns;
-       dist_y = (ymax - pos_y) / rows;
+       dist.x = (xmax - xmin) / mv_columns;
+       dist.y = (ymax - pos.y) / rows;
 
        if ( gametypevote )
        {
-               tsize = dist_x - hud_fontsize_y;
-               isize = dist_y;
-               float maxheight = (ymax - pos_y) / 3;
+               tsize = dist.x - hud_fontsize.y;
+               isize = dist.y;
+               float maxheight = (ymax - pos.y) / 3;
                if ( isize > maxheight )
                {
-                       pos_x += (isize - maxheight)/2;
+                       pos.x += (isize - maxheight)/2;
                        isize = maxheight;
                }
                else
-                       dist_y += hud_fontsize_y;
-               pos_x = ( vid_conwidth - dist_x * mv_columns ) / 2;
+                       dist.y += hud_fontsize.y;
+               pos.x = ( vid_conwidth - dist.x * mv_columns ) / 2;
        }
        else
        {
-               tsize = dist_x - 10;
-               isize = min(dist_y - 10, 0.75 * tsize);
+               tsize = dist.x - 10;
+               isize = min(dist.y - 10, 0.75 * tsize);
        }
 
        mv_selection = MapVote_Selection(pos, dist, rows, mv_columns);
 
        if ( !gametypevote )
-               pos_x += dist_x / 2;
-       pos_y += (dist_y - isize) / 2;
+               pos.x += dist.x / 2;
+       pos.y += (dist.y - isize) / 2;
        ymax -= isize;
 
        if (mv_top2_time)
@@ -397,8 +371,8 @@ void MapVote_Draw()
 
        if(mv_abstain && i < mv_num_maps) {
                tmp = mv_votes[i];
-               pos_y = ymax + isize - hud_fontsize_y;
-               pos_x = (xmax+xmin)*0.5;
+               pos.y = ymax + isize - hud_fontsize.y;
+               pos.x = (xmax+xmin)*0.5;
                MapVote_DrawAbstain(pos, isize, xmax - xmin, tmp, i);
        }
 
@@ -407,7 +381,6 @@ void MapVote_Draw()
 
 void Cmd_MapVote_MapDownload(float argc)
 {
-       float id;
        entity pak;
 
        if(argc != 2 || !mv_pk3list)
@@ -416,7 +389,7 @@ void Cmd_MapVote_MapDownload(float argc)
                return;
        }
 
-       id = stof(argv(1));
+       int id = stof(argv(1));
        for(pak = mv_pk3list; pak; pak = pak.chain)
                if(pak.sv_entnum == id)
                        break;
@@ -436,7 +409,7 @@ void Cmd_MapVote_MapDownload(float argc)
        }
 }
 
-void MapVote_CheckPK3(string pic, string pk3, float id)
+void MapVote_CheckPK3(string pic, string pk3, int id)
 {
        entity pak;
        pak = spawn();
@@ -457,7 +430,7 @@ void MapVote_CheckPK3(string pic, string pk3, float id)
        }
 }
 
-void MapVote_CheckPic(string pic, string pk3, float id)
+void MapVote_CheckPic(string pic, string pk3, int id)
 {
        // never try to retrieve a pic for the "don't care" 'map'
        if(mv_abstain && id == mv_num_maps - 1)
@@ -473,17 +446,17 @@ void MapVote_CheckPic(string pic, string pk3, float id)
 
 void MapVote_ReadMask()
 {
-       float i;
+       int i;
        if ( mv_num_maps < 24 )
        {
-               float mask, power;
+               int mask, power;
                if(mv_num_maps < 8)
                        mask = ReadByte();
                else if(mv_num_maps < 16)
                        mask = ReadShort();
                else
                        mask = ReadLong();
-               
+
                for(i = 0, power = 1; i < mv_num_maps; ++i, power *= 2)
                        mv_avail[i] = (mask & power) ? GTV_AVAILABLE : GTV_FORBIDDEN;
        }
@@ -494,12 +467,9 @@ void MapVote_ReadMask()
        }
 }
 
-#define NUM_SSDIRS 4
-string ssdirs[NUM_SSDIRS];
-float n_ssdirs;
 void MapVote_Init()
 {
-       float i, j;
+       int i, j;
        string map, pk3, s;
 
        precache_sound ("misc/invshot.wav");
@@ -530,7 +500,7 @@ void MapVote_Init()
        mv_timeout = ReadCoord();
 
        gametypevote = ReadByte();
-       
+
        float mv_real_num_maps = mv_num_maps - mv_abstain;
 
        if(gametypevote)
@@ -541,7 +511,7 @@ void MapVote_Init()
 
                gtv_text_size = hud_fontsize*1.4;
                gtv_text_size_small = hud_fontsize*1.1;
-               
+
                if (mv_real_num_maps > 8 )
                        mv_columns = 3;
                else
@@ -608,10 +578,10 @@ void MapVote_SendChoice(float index)
        localcmd(strcat("\nimpulse ", ftos(index+1), "\n"));
 }
 
-float MapVote_MoveLeft(float pos)
+int MapVote_MoveLeft(int pos)
 {
-       float imp;
-       if ( pos < 0 ) 
+       int imp;
+       if ( pos < 0 )
                imp = mv_num_maps - 1;
        else
                imp = pos < 1 ? mv_num_maps - 1 : pos - 1;
@@ -619,10 +589,10 @@ float MapVote_MoveLeft(float pos)
                imp = MapVote_MoveLeft(imp);
        return imp;
 }
-float MapVote_MoveRight(float pos)
+int MapVote_MoveRight(int pos)
 {
-       float imp;
-       if ( pos < 0 ) 
+       int imp;
+       if ( pos < 0 )
                imp = 0;
        else
                imp = pos >= mv_num_maps - 1 ? 0 : pos + 1;
@@ -630,10 +600,10 @@ float MapVote_MoveRight(float pos)
                imp = MapVote_MoveRight(imp);
        return imp;
 }
-float MapVote_MoveUp(float pos)
+int MapVote_MoveUp(int pos)
 {
-       float imp;
-       if ( pos < 0 ) 
+       int imp;
+       if ( pos < 0 )
                imp = mv_num_maps - 1;
        else
        {
@@ -649,10 +619,10 @@ float MapVote_MoveUp(float pos)
                imp = MapVote_MoveUp(imp);
        return imp;
 }
-float MapVote_MoveDown(float pos)
+int MapVote_MoveDown(int pos)
 {
-       float imp;
-       if ( pos < 0 ) 
+       int imp;
+       if ( pos < 0 )
                imp = 0;
        else
        {
@@ -674,8 +644,8 @@ float MapVote_InputEvent(float bInputType, float nPrimary, float nSecondary)
 
        if(bInputType == 3)
        {
-               mv_mousepos_x = nPrimary;
-               mv_mousepos_y = nSecondary;
+               mv_mousepos.x = nPrimary;
+               mv_mousepos.y = nSecondary;
                mv_selection_keyboard = 0;
                return true;
        }
@@ -750,7 +720,7 @@ void MapVote_UpdateMask()
 
 void MapVote_UpdateVotes()
 {
-       float i;
+       int i;
        for(i = 0; i < mv_num_maps; ++i)
        {
                if(mv_avail[i] == GTV_AVAILABLE)
@@ -769,9 +739,7 @@ void MapVote_UpdateVotes()
 
 void Ent_MapVote()
 {
-       float sf;
-
-       sf = ReadByte();
+       int sf = ReadByte();
 
        if(sf & 1)
                MapVote_Init();
@@ -785,8 +753,7 @@ void Ent_MapVote()
 
 void Net_MapVote_Picture()
 {
-       float type;
-       type = ReadByte();
+       int type = ReadByte();
        mv_preview[type] = true;
        mv_pics[type] = strzone(ReadPicture());
 }
diff --git a/qcsrc/client/mapvoting.qh b/qcsrc/client/mapvoting.qh
new file mode 100644 (file)
index 0000000..8a4133e
--- /dev/null
@@ -0,0 +1,81 @@
+#ifndef MAPVOTING_H
+#define MAPVOTING_H
+
+int mv_num_maps;
+
+float mv_active;
+string mv_maps[MAPVOTE_COUNT];
+string mv_pics[MAPVOTE_COUNT];
+string mv_pk3[MAPVOTE_COUNT];
+float mv_preview[MAPVOTE_COUNT];
+float mv_votes[MAPVOTE_COUNT];
+float mv_avail[MAPVOTE_COUNT];
+float mv_avail_start[MAPVOTE_COUNT];
+entity mv_pk3list;
+float mv_abstain;
+float mv_ownvote;
+float mv_detail;
+float mv_timeout;
+float mv_top2_time;
+float mv_top2_alpha;
+
+vector mv_mousepos;
+int mv_selection;
+int mv_columns;
+int mv_mouse_selection;
+int mv_selection_keyboard;
+
+float gametypevote;
+string mapvote_chosenmap;
+vector gtv_text_size;
+vector gtv_text_size_small;
+
+string MapVote_FormatMapItem(int id, string map, float count, float maxwidth, vector fontsize);
+
+string GameTypeVote_DescriptionByID(int id);
+
+vector MapVote_RGB(int id);
+
+void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string gtype, string pic, float count, int id);
+
+void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, string pic, float count, int id);
+
+void MapVote_DrawAbstain(vector pos, float isize, float tsize, float count, int id);
+
+vector MapVote_GridVec(vector gridspec, int i, int m);
+
+float MapVote_Selection(vector topleft, vector cellsize, float rows, float columns);
+
+void MapVote_Draw();
+
+void Cmd_MapVote_MapDownload(float argc);
+
+void MapVote_CheckPK3(string pic, string pk3, int id);
+
+void MapVote_CheckPic(string pic, string pk3, int id);
+
+void MapVote_ReadMask();
+
+const int NUM_SSDIRS = 4;
+string ssdirs[NUM_SSDIRS];
+int n_ssdirs;
+void MapVote_Init();
+
+void MapVote_SendChoice(float index);
+
+int MapVote_MoveLeft(int pos);
+int MapVote_MoveRight(int pos);
+int MapVote_MoveUp(int pos);
+
+int MapVote_MoveDown(int pos);
+
+float MapVote_InputEvent(float bInputType, float nPrimary, float nSecondary);
+
+void MapVote_UpdateMask();
+
+void MapVote_UpdateVotes();
+
+void Ent_MapVote();
+
+void Net_MapVote_Picture();
+#endif
index 8b674e7826c2ccd6529e46a703d55ee00a21a2ae..d74a24a320142d35e7da242c19f24586ca1e08fe 100644 (file)
@@ -1,6 +1,8 @@
-entity players;
-entity teams;
-var float team_count; // real teams
+#include "miscfunctions.qh"
+
+#include "../common/urllib.qh"
+
+#include "../common/command/generic.qh"
 
 void AuditLists()
 {
@@ -109,16 +111,14 @@ void RemoveTeam(entity Team)
        AuditLists();
 }
 
-entity GetTeam(float Team, float add)
+entity GetTeam(int Team, bool add)
 {
-       float num;
-       entity tm;
-       num = (Team == NUM_SPECTATOR) ? 16 : Team;
+       int num = (Team == NUM_SPECTATOR) ? 16 : Team;
        if(teamslots[num])
                return teamslots[num];
        if (!add)
                return world;
-       tm = spawn();
+       entity tm = spawn();
        tm.team = Team;
        teamslots[num] = tm;
        RegisterTeam(tm);
@@ -129,11 +129,11 @@ vector HUD_GetFontsize(string cvarname)
 {
        vector v;
        v = stov(cvar_string(cvarname));
-       if(v_x == 0)
+       if(v.x == 0)
                v = '8 8 0';
-       if(v_y == 0)
-               v_y = v_x;
-       v_z = 0;
+       if(v.y == 0)
+               v.y = v.x;
+       v.z = 0;
        return v;
 }
 
@@ -154,13 +154,11 @@ vector rotate(vector v, float a)
 {
        vector w = '0 0 0';
        // FTEQCC SUCKS AGAIN
-       w_x =      v_x * cos(a) + v_y * sin(a);
-       w_y = -1 * v_x * sin(a) + v_y * cos(a);
+       w.x =      v.x * cos(a) + v.y * sin(a);
+       w.y = -1 * v.x * sin(a) + v.y * cos(a);
        return w;
 }
 
-float ColorTranslateMode;
-
 string ColorTranslateRGB(string s)
 {
        if(ColorTranslateMode & 1)
@@ -197,8 +195,8 @@ vector project_3d_to_2d(vector vec)
        vec = cs_project(vec);
        if(cs_project_is_b0rked > 0)
        {
-               vec_x *= vid_conwidth / vid_width;
-               vec_y *= vid_conheight / vid_height;
+               vec.x *= vid_conwidth / vid_width;
+               vec.y *= vid_conheight / vid_height;
        }
        return vec;
 }
@@ -214,7 +212,7 @@ float expandingbox_sizefactor_from_fadelerp(float fadelerp)
 
 vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor)
 {
-       boxsize_x *= boxxsizefactor; // easier interface for text
+       boxsize.x *= boxxsizefactor; // easier interface for text
        return boxsize * (0.5 * (1 - sz));
 }
 
@@ -223,18 +221,18 @@ void drawborderlines(float thickness, vector pos, vector dim, vector color, floa
        vector line_dim = '0 0 0';
 
        // left and right lines
-       pos_x -= thickness;
-       line_dim_x = thickness;
-       line_dim_y = dim_y;
+       pos.x -= thickness;
+       line_dim.x = thickness;
+       line_dim.y = dim.y;
        drawfill(pos, line_dim, color, theAlpha, drawflag);
-       drawfill(pos + (dim_x + thickness) * '1 0 0', line_dim, color, theAlpha, drawflag);
+       drawfill(pos + (dim.x + thickness) * '1 0 0', line_dim, color, theAlpha, drawflag);
 
        // upper and lower lines
-       pos_y -= thickness;
-       line_dim_x = dim_x + thickness * 2; // make upper and lower lines longer
-       line_dim_y = thickness;
+       pos.y -= thickness;
+       line_dim.x = dim.x + thickness * 2; // make upper and lower lines longer
+       line_dim.y = thickness;
        drawfill(pos, line_dim, color, theAlpha, drawflag);
-       drawfill(pos + (dim_y + thickness) * '0 1 0', line_dim, color, theAlpha, drawflag);
+       drawfill(pos + (dim.y + thickness) * '0 1 0', line_dim, color, theAlpha, drawflag);
 }
 
 void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color, float theAlpha, float drawflag)
@@ -242,71 +240,23 @@ void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color,
        vector current_pos = '0 0 0', end_pos, new_size = '0 0 0', ratio = '0 0 0';
        end_pos = pos + area;
 
-       current_pos_y = pos_y;
-       while (current_pos_y < end_pos_y)
+       current_pos.y = pos.y;
+       while (current_pos.y < end_pos.y)
        {
-               current_pos_x = pos_x;
-               while (current_pos_x < end_pos_x)
+               current_pos.x = pos.x;
+               while (current_pos.x < end_pos.x)
                {
-                       new_size_x = min(sz_x, end_pos_x - current_pos_x);
-                       new_size_y = min(sz_y, end_pos_y - current_pos_y);
-                       ratio_x = new_size_x / sz_x;
-                       ratio_y = new_size_y / sz_y;
+                       new_size.x = min(sz.x, end_pos.x - current_pos.x);
+                       new_size.y = min(sz.y, end_pos.y - current_pos.y);
+                       ratio.x = new_size.x / sz.x;
+                       ratio.y = new_size.y / sz.y;
                        drawsubpic(current_pos, new_size, pic, '0 0 0', ratio, color, theAlpha, drawflag);
-                       current_pos_x += sz_x;
+                       current_pos.x += sz.x;
                }
-               current_pos_y += sz_y;
+               current_pos.y += sz.y;
        }
 }
 
-// drawpic wrapper to draw an image as large as possible with preserved aspect ratio into a box
-var float _drawpic_imgaspect;
-var vector _drawpic_imgsize;
-var vector _drawpic_sz;
-var float _drawpic_oldsz;
-var string _drawpic_picpath;
-#define drawpic_aspect(pos,pic,mySize,color,theAlpha,drawflag)\
-       do {\
-               _drawpic_imgsize = draw_getimagesize(pic);\
-               if(_drawpic_imgsize != '0 0 0') {\
-                       _drawpic_imgaspect = _drawpic_imgsize_x/_drawpic_imgsize_y;\
-                       _drawpic_sz = mySize;\
-                       if(_drawpic_sz_x/_drawpic_sz_y > _drawpic_imgaspect) {\
-                               _drawpic_oldsz = _drawpic_sz_x;\
-                               _drawpic_sz_x = _drawpic_sz_y * _drawpic_imgaspect;\
-                               if(_drawpic_sz_x)\
-                                       drawpic(pos + eX * (_drawpic_oldsz - _drawpic_sz_x) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
-                       } else {\
-                               _drawpic_oldsz = _drawpic_sz_y;\
-                               _drawpic_sz_y = _drawpic_sz_x / _drawpic_imgaspect;\
-                               if(_drawpic_sz_y)\
-                                       drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz_y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
-                       }\
-               }\
-       } while(0)
-
-// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
-#define drawpic_aspect_skin(pos,pic,sz,color,theAlpha,drawflag)\
-       do{\
-               _drawpic_picpath = strcat(hud_skin_path, "/", pic);\
-               if(precache_pic(_drawpic_picpath) == "") {\
-                       _drawpic_picpath = strcat("gfx/hud/default/", pic);\
-               }\
-               drawpic_aspect(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
-               _drawpic_picpath = string_null;\
-       } while(0)
-
-// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
-#define drawpic_skin(pos,pic,sz,color,theAlpha,drawflag)\
-       do{\
-               _drawpic_picpath = strcat(hud_skin_path, "/", pic);\
-               if(precache_pic(_drawpic_picpath) == "") {\
-                       _drawpic_picpath = strcat("gfx/hud/default/", pic);\
-               }\
-               drawpic(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
-               _drawpic_picpath = string_null;\
-       } while(0)
-
 void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
 {
        float sz;
@@ -320,32 +270,19 @@ void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theSc
        drawpic_aspect_skin_expanding(position, pic, theScale, rgb, theAlpha, flag, fadelerp);
        drawpic_skin(position, pic, theScale, rgb, theAlpha * fadelerp, flag);
 }
-#define SET_POS_AND_SZ_Y_ASPECT(allow_colors)\
-       float textaspect, oldsz;\
-       textaspect = stringwidth(text, allow_colors, '1 1 1' * sz_y) / sz_y;\
-       if(sz_x/sz_y > textaspect) {\
-               oldsz = sz_x;\
-               sz_x = sz_y * textaspect;\
-               pos_x += (oldsz - sz_x) * 0.5;\
-       } else {\
-               oldsz = sz_y;\
-               sz_y = sz_x / textaspect; \
-               pos_y += (oldsz - sz_y) * 0.5;\
-       }
 
 // drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
 void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag) {
-       SET_POS_AND_SZ_Y_ASPECT(FALSE)
-       drawstring(pos, text, '1 1 0' * sz_y, color, theAlpha, drawflag);
+       SET_POS_AND_SZ_Y_ASPECT(false);
+       drawstring(pos, text, '1 1 0' * sz.y, color, theAlpha, drawflag);
 }
 
 // drawstring wrapper to draw a colorcodedstring as large as possible with preserved aspect ratio into a box
 void drawcolorcodedstring_aspect(vector pos, string text, vector sz, float theAlpha, float drawflag) {
-       SET_POS_AND_SZ_Y_ASPECT(TRUE)
-       drawcolorcodedstring(pos, text, '1 1 0' * sz_y, theAlpha, drawflag);
+       SET_POS_AND_SZ_Y_ASPECT(true);
+       drawcolorcodedstring(pos, text, '1 1 0' * sz.y, theAlpha, drawflag);
 }
 
-vector drawfontscale;
 void drawstring_expanding(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
 {
        float sz;
@@ -353,7 +290,7 @@ void drawstring_expanding(vector position, string text, vector theScale, vector
 
        drawfontscale = sz * '1 1 0';
        dummyfunction(0, 0, 0, 0, 0, 0, 0, 0);
-       drawstring(position + expandingbox_resize_centered_box_offset(sz, theScale, stringwidth(text, FALSE, theScale * (sz / drawfontscale_x)) / (theScale_x * sz)), text, theScale * (sz / drawfontscale_x), rgb, theAlpha * (1 - fadelerp), flag);
+       drawstring(position + expandingbox_resize_centered_box_offset(sz, theScale, stringwidth(text, false, theScale * (sz / drawfontscale.x)) / (theScale.x * sz)), text, theScale * (sz / drawfontscale.x), rgb, theAlpha * (1 - fadelerp), flag);
        // width parameter:
        //    (scale_x * sz / drawfontscale_x) * drawfontscale_x * SIZE1 / (scale_x * sz)
        //    SIZE1
@@ -362,8 +299,8 @@ void drawstring_expanding(vector position, string text, vector theScale, vector
 
 // drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
 void drawstring_aspect_expanding(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag, float fadelerp) {
-       SET_POS_AND_SZ_Y_ASPECT(FALSE)
-       drawstring_expanding(pos, text, '1 1 0' * sz_y, color, theAlpha, drawflag, fadelerp);
+       SET_POS_AND_SZ_Y_ASPECT(false);
+       drawstring_expanding(pos, text, '1 1 0' * sz.y, color, theAlpha, drawflag, fadelerp);
 }
 
 void drawcolorcodedstring_expanding(vector position, string text, vector theScale, float theAlpha, float flag, float fadelerp)
@@ -373,13 +310,13 @@ void drawcolorcodedstring_expanding(vector position, string text, vector theScal
 
        drawfontscale = sz * '1 1 0';
        dummyfunction(0, 0, 0, 0, 0, 0, 0, 0);
-       drawcolorcodedstring(position + expandingbox_resize_centered_box_offset(sz, theScale, stringwidth(text, TRUE, theScale * (sz / drawfontscale_x)) / (theScale_x * sz)), text, theScale * (sz / drawfontscale_x), theAlpha * (1 - fadelerp), flag);
+       drawcolorcodedstring(position + expandingbox_resize_centered_box_offset(sz, theScale, stringwidth(text, true, theScale * (sz / drawfontscale.x)) / (theScale.x * sz)), text, theScale * (sz / drawfontscale.x), theAlpha * (1 - fadelerp), flag);
        drawfontscale = '1 1 0';
 }
 
 void drawcolorcodedstring_aspect_expanding(vector pos, string text, vector sz, float theAlpha, float drawflag, float fadelerp) {
-       SET_POS_AND_SZ_Y_ASPECT(TRUE)
-       drawcolorcodedstring_expanding(pos, text, '1 1 0' * sz_y, theAlpha, drawflag, fadelerp);
+       SET_POS_AND_SZ_Y_ASPECT(true);
+       drawcolorcodedstring_expanding(pos, text, '1 1 0' * sz.y, theAlpha, drawflag, fadelerp);
 }
 
 // this draws the triangles of a model DIRECTLY. Don't expect high performance, really...
@@ -397,9 +334,9 @@ float PolyDrawModelSurface(entity e, float i_s)
        {
                tri = getsurfacetriangle(e, i_s, i_t);
                R_BeginPolygon(tex, 0);
-               R_PolygonVertex(getsurfacepoint(e, i_s, tri_x), getsurfacepointattribute(e, i_s, tri_x, SPA_TEXCOORDS0), '1 1 1', 1);
-               R_PolygonVertex(getsurfacepoint(e, i_s, tri_y), getsurfacepointattribute(e, i_s, tri_y, SPA_TEXCOORDS0), '1 1 1', 1);
-               R_PolygonVertex(getsurfacepoint(e, i_s, tri_z), getsurfacepointattribute(e, i_s, tri_z, SPA_TEXCOORDS0), '1 1 1', 1);
+               R_PolygonVertex(getsurfacepoint(e, i_s, tri.x), getsurfacepointattribute(e, i_s, tri.x, SPA_TEXCOORDS0), '1 1 1', 1);
+               R_PolygonVertex(getsurfacepoint(e, i_s, tri.y), getsurfacepointattribute(e, i_s, tri.y, SPA_TEXCOORDS0), '1 1 1', 1);
+               R_PolygonVertex(getsurfacepoint(e, i_s, tri.z), getsurfacepointattribute(e, i_s, tri.z, SPA_TEXCOORDS0), '1 1 1', 1);
                R_EndPolygon();
        }
        return 1;
@@ -429,19 +366,19 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect
                // draw full rectangle
                R_BeginPolygon(pic, drawflag);
                        v = centre;                     t = '0.5 0.5 0';
-                       v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
+                       v.x += 0.5 * ringsize.x;        t += '0.5 0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
 
                        v = centre;                     t = '0.5 0.5 0';
-                       v_y += 0.5 * ringsize_y;        t += '0.5 -0.5 0';
+                       v.y += 0.5 * ringsize.y;        t += '0.5 -0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
 
                        v = centre;                     t = '0.5 0.5 0';
-                       v_x -= 0.5 * ringsize_x;        t -= '0.5 0.5 0';
+                       v.x -= 0.5 * ringsize.x;        t -= '0.5 0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
 
                        v = centre;                     t = '0.5 0.5 0';
-                       v_y -= 0.5 * ringsize_y;        t -= '0.5 -0.5 0';
+                       v.y -= 0.5 * ringsize.y;        t -= '0.5 -0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
                R_EndPolygon();
 
@@ -453,7 +390,7 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect
                                R_PolygonVertex(v, t, rgb, a);
 
                                v = centre;                     t = '0.5 0.5 0';
-                               v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
+                               v.x += 0.5 * ringsize.x;        t += '0.5 0.5 0';
                                R_PolygonVertex(v, t, rgb, a);
                }
        }
@@ -462,15 +399,15 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect
                // draw upper and first triangle
                R_BeginPolygon(pic, drawflag);
                        v = centre;                     t = '0.5 0.5 0';
-                       v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
+                       v.x += 0.5 * ringsize.x;        t += '0.5 0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
 
                        v = centre;                     t = '0.5 0.5 0';
-                       v_y += 0.5 * ringsize_y;        t += '0.5 -0.5 0';
+                       v.y += 0.5 * ringsize.y;        t += '0.5 -0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
 
                        v = centre;                     t = '0.5 0.5 0';
-                       v_x -= 0.5 * ringsize_x;        t -= '0.5 0.5 0';
+                       v.x -= 0.5 * ringsize.x;        t -= '0.5 0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
                R_EndPolygon();
                R_BeginPolygon(pic, drawflag);
@@ -478,11 +415,11 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect
                        R_PolygonVertex(v, t, rgb, a);
 
                        v = centre;                     t = '0.5 0.5 0';
-                       v_x -= 0.5 * ringsize_x;        t -= '0.5 0.5 0';
+                       v.x -= 0.5 * ringsize.x;        t -= '0.5 0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
 
                        v = centre;                     t = '0.5 0.5 0';
-                       v_y -= 0.5 * ringsize_y;        t -= '0.5 -0.5 0';
+                       v.y -= 0.5 * ringsize.y;        t -= '0.5 -0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
 
                d = q - 0.75;
@@ -494,15 +431,15 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect
                // draw upper triangle
                R_BeginPolygon(pic, drawflag);
                        v = centre;                     t = '0.5 0.5 0';
-                       v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
+                       v.x += 0.5 * ringsize.x;        t += '0.5 0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
 
                        v = centre;                     t = '0.5 0.5 0';
-                       v_y += 0.5 * ringsize_y;        t += '0.5 -0.5 0';
+                       v.y += 0.5 * ringsize.y;        t += '0.5 -0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
 
                        v = centre;                     t = '0.5 0.5 0';
-                       v_x -= 0.5 * ringsize_x;        t -= '0.5 0.5 0';
+                       v.x -= 0.5 * ringsize.x;        t -= '0.5 0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
                R_EndPolygon();
 
@@ -514,7 +451,7 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect
                                R_PolygonVertex(v, t, rgb, a);
 
                                v = centre;                     t = '0.5 0.5 0';
-                               v_x -= 0.5 * ringsize_x;        t -= '0.5 0.5 0';
+                               v.x -= 0.5 * ringsize.x;        t -= '0.5 0.5 0';
                                R_PolygonVertex(v, t, rgb, a);
                }
        }
@@ -526,11 +463,11 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect
                        R_PolygonVertex(v, t, rgb, a);
 
                        v = centre;                     t = '0.5 0.5 0';
-                       v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
+                       v.x += 0.5 * ringsize.x;        t += '0.5 0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
 
                        v = centre;                     t = '0.5 0.5 0';
-                       v_y += 0.5 * ringsize_y;        t += '0.5 -0.5 0';
+                       v.y += 0.5 * ringsize.y;        t += '0.5 -0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
 
                d = q - 0.25;
@@ -547,7 +484,7 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect
                                R_PolygonVertex(v, t, rgb, a);
 
                                v = centre;                     t = '0.5 0.5 0';
-                               v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
+                               v.x += 0.5 * ringsize.x;        t += '0.5 0.5 0';
                                R_PolygonVertex(v, t, rgb, a);
                }
        }
@@ -555,15 +492,14 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect
        if(d > 0)
        {
                        v = centre;                     t = '0.5 0.5 0';
-                       v_x += x * 0.5 * ringsize_x;    t += x * '0.5 0.5 0';
-                       v_y += y * 0.5 * ringsize_y;    t += y * '0.5 -0.5 0';
+                       v.x += x * 0.5 * ringsize.x;    t += x * '0.5 0.5 0';
+                       v.y += y * 0.5 * ringsize.y;    t += y * '0.5 -0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
                R_EndPolygon();
        }
 }
 
-const vector GETPLAYERORIGIN_ERROR = '1123581321 2357111317 3141592653'; // way out of bounds for anything on the map
-vector getplayerorigin(float pl)
+vector getplayerorigin(int pl)
 {
        entity e;
 
@@ -597,7 +533,7 @@ vector getcsqcplayercolor(float pl)
        if(e)
        {
                if(e.colormap > 0)
-                       return colormapPaletteColor(((e.colormap >= 1024) ? e.colormap : stof(getplayerkeyvalue(e.colormap - 1, "colors"))) & 0x0F, TRUE);
+                       return colormapPaletteColor(((e.colormap >= 1024) ? e.colormap : stof(getplayerkeyvalue(e.colormap - 1, "colors"))) & 0x0F, true);
        }
 
        return '1 1 1';
@@ -611,10 +547,10 @@ float getplayerisdead(float pl)
        if(e)
                return e.csqcmodel_isdead;
 
-       return FALSE;
+       return false;
 }
 
-void URI_Get_Callback(float id, float status, string data)
+void URI_Get_Callback(int id, float status, string data)
 {
        if(url_URI_Get_Callback(id, status, data))
        {
@@ -645,16 +581,8 @@ void draw_endBoldFont()
        drawfont = FONT_USER+1;
 }
 
-
-#define MAX_ACCURACY_LEVELS 10
-float acc_lev[MAX_ACCURACY_LEVELS];
-vector acc_col[MAX_ACCURACY_LEVELS];
-float acc_col_loadtime;
-float acc_levels;
-string acc_color_levels;
 void Accuracy_LoadLevels()
 {
-       float i;
        if(autocvar_accuracy_color_levels != acc_color_levels)
        {
                if(acc_color_levels)
@@ -666,6 +594,7 @@ void Accuracy_LoadLevels()
                if(acc_levels < 2)
                        print("Warning: accuracy_color_levels must contain at least 2 values\n");
 
+               int i;
                for(i = 0; i < acc_levels; ++i)
                        acc_lev[i] = stof(argv(i)) / 100.0;
        }
@@ -673,10 +602,10 @@ void Accuracy_LoadLevels()
 
 void Accuracy_LoadColors()
 {
-       float i;
        if(time > acc_col_loadtime)
        if(acc_levels >= 2)
        {
+               int i;
                for(i = 0; i < acc_levels; ++i)
                        acc_col[i] = stov(cvar_string(strcat("accuracy_color", ftos(i))));
                acc_col_loadtime = time + 2;
@@ -685,13 +614,13 @@ void Accuracy_LoadColors()
 
 vector Accuracy_GetColor(float accuracy)
 {
-       float j, factor;
+       float factor;
        vector color;
        if(acc_levels < 2)
                return '0 0 0'; // return black, can't determine the right color
 
        // find the max level lower than acc
-       j = acc_levels-1;
+       int j = acc_levels-1;
        while(j && accuracy < acc_lev[j])
                --j;
 
diff --git a/qcsrc/client/miscfunctions.qh b/qcsrc/client/miscfunctions.qh
new file mode 100644 (file)
index 0000000..6c64396
--- /dev/null
@@ -0,0 +1,165 @@
+#ifndef MISCFUNCTIONS_H
+#define MISCFUNCTIONS_H
+
+entity players;
+entity teams;
+float team_count; // real teams
+
+void AuditLists();
+
+float RegisterPlayer(entity player);
+
+void RemovePlayer(entity player);
+
+void MoveToLast(entity e);
+
+float RegisterTeam(entity Team);
+
+void RemoveTeam(entity Team);
+
+entity GetTeam(int Team, bool add);
+
+vector HUD_GetFontsize(string cvarname);
+
+float PreviewExists(string name);
+
+vector rotate(vector v, float a);
+
+int ColorTranslateMode;
+
+string ColorTranslateRGB(string s);
+
+// decolorizes and team colors the player name when needed
+string playername(string thename, float teamid);
+
+float cvar_or(string cv, float v);
+
+vector project_3d_to_2d(vector vec);
+
+void dummyfunction(float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8);
+
+float expandingbox_sizefactor_from_fadelerp(float fadelerp);
+
+vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor);
+
+void drawborderlines(float thickness, vector pos, vector dim, vector color, float theAlpha, float drawflag);
+
+void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color, float theAlpha, float drawflag);
+
+// drawpic wrapper to draw an image as large as possible with preserved aspect ratio into a box
+float _drawpic_imgaspect;
+vector _drawpic_imgsize;
+vector _drawpic_sz;
+float _drawpic_oldsz;
+string _drawpic_picpath;
+#define drawpic_aspect(pos,pic,mySize,color,theAlpha,drawflag)\
+       do {\
+               _drawpic_imgsize = draw_getimagesize(pic);\
+               if(_drawpic_imgsize != '0 0 0') {\
+                       _drawpic_imgaspect = _drawpic_imgsize.x/_drawpic_imgsize.y;\
+                       _drawpic_sz = mySize;\
+                       if(_drawpic_sz.x/_drawpic_sz.y > _drawpic_imgaspect) {\
+                               _drawpic_oldsz = _drawpic_sz.x;\
+                               _drawpic_sz.x = _drawpic_sz.y * _drawpic_imgaspect;\
+                               if(_drawpic_sz.x)\
+                                       drawpic(pos + eX * (_drawpic_oldsz - _drawpic_sz.x) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
+                       } else {\
+                               _drawpic_oldsz = _drawpic_sz.y;\
+                               _drawpic_sz.y = _drawpic_sz.x / _drawpic_imgaspect;\
+                               if(_drawpic_sz.y)\
+                                       drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz.y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
+                       }\
+               }\
+       } while(0)
+
+// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
+#define drawpic_aspect_skin(pos,pic,sz,color,theAlpha,drawflag)\
+       do{\
+               _drawpic_picpath = strcat(hud_skin_path, "/", pic);\
+               if(precache_pic(_drawpic_picpath) == "") {\
+                       _drawpic_picpath = strcat("gfx/hud/default/", pic);\
+               }\
+               drawpic_aspect(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
+               _drawpic_picpath = string_null;\
+       } while(0)
+
+// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
+#define drawpic_skin(pos,pic,sz,color,theAlpha,drawflag)\
+       do{\
+               _drawpic_picpath = strcat(hud_skin_path, "/", pic);\
+               if(precache_pic(_drawpic_picpath) == "") {\
+                       _drawpic_picpath = strcat("gfx/hud/default/", pic);\
+               }\
+               drawpic(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
+               _drawpic_picpath = string_null;\
+       } while(0)
+
+void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
+
+void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
+
+#define SET_POS_AND_SZ_Y_ASPECT(allow_colors) do {                                                                                                                                     \
+       float textaspect, oldsz;                                                                                                                                                                                \
+       textaspect = stringwidth(text, allow_colors, '1 1 1' * sz.y) / sz.y;                                                                                    \
+       if(sz.x/sz.y > textaspect) {                                                                                                                                                                    \
+               oldsz = sz.x;                                                                                                                                                                                           \
+               sz.x = sz.y * textaspect;                                                                                                                                                                       \
+               pos.x += (oldsz - sz.x) * 0.5;                                                                                                                                                          \
+       } else {                                                                                                                                                                                                                \
+               oldsz = sz.y;                                                                                                                                                                                           \
+               sz.y = sz.x / textaspect;                                                                                                                                                                       \
+               pos.y += (oldsz - sz.y) * 0.5;                                                                                                                                                          \
+       }                                                                                                                                                                                                                               \
+} while(0)
+
+// drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
+void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag);
+
+// drawstring wrapper to draw a colorcodedstring as large as possible with preserved aspect ratio into a box
+void drawcolorcodedstring_aspect(vector pos, string text, vector sz, float theAlpha, float drawflag);
+
+vector drawfontscale;
+void drawstring_expanding(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
+
+// drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
+void drawstring_aspect_expanding(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag, float fadelerp);
+
+void drawcolorcodedstring_expanding(vector position, string text, vector theScale, float theAlpha, float flag, float fadelerp);
+
+void drawcolorcodedstring_aspect_expanding(vector pos, string text, vector sz, float theAlpha, float drawflag, float fadelerp);
+
+// this draws the triangles of a model DIRECTLY. Don't expect high performance, really...
+float PolyDrawModelSurface(entity e, float i_s);
+void PolyDrawModel(entity e);
+
+void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vector rgb, float a, float drawflag);
+
+const vector GETPLAYERORIGIN_ERROR = '1123581321 2357111317 3141592653'; // way out of bounds for anything on the map
+vector getplayerorigin(int pl);
+
+float getplayeralpha(float pl);
+
+vector getcsqcplayercolor(float pl);
+
+float getplayerisdead(float pl);
+
+void URI_Get_Callback(int id, float status, string data);
+
+void draw_beginBoldFont();
+
+void draw_endBoldFont();
+
+
+const int MAX_ACCURACY_LEVELS = 10;
+float acc_lev[MAX_ACCURACY_LEVELS];
+vector acc_col[MAX_ACCURACY_LEVELS];
+float acc_col_loadtime;
+int acc_levels;
+string acc_color_levels;
+void Accuracy_LoadLevels();
+
+void Accuracy_LoadColors();
+
+vector Accuracy_GetColor(float accuracy);
+
+#endif
index 0508a8669a984ab102530a5403c1e59a7aa20667..c376085e07aaea1aa3b105e90ec7f06942014d91 100644 (file)
@@ -1,7 +1,4 @@
-.float frame1time;
-.float lifetime, fadetime;
-.float teleport_time;
-.float scale1, scale2;
+#include "modeleffects.qh"
 
 void ModelEffect_Draw()
 {
@@ -22,16 +19,13 @@ void ModelEffect_Draw()
        }
 }
 
-void Ent_ModelEffect(float isNew)
+void Ent_ModelEffect(bool isNew)
 {
-       float f;
-       entity e;
-
        self.classname = "modeleffect_spawner";
 
-       f = ReadByte();
+       int f = ReadByte();
 
-       e = spawn();
+       entity e = spawn();
        e.classname = "modeleffect";
        e.model = "from network";
        e.modelindex = ReadShort();
diff --git a/qcsrc/client/modeleffects.qh b/qcsrc/client/modeleffects.qh
new file mode 100644 (file)
index 0000000..f40cfef
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef MODELEFFECTS_H
+#define MODELEFFECTS_H
+
+.float frame1time;
+.float lifetime, fadetime;
+.float teleport_time;
+.float scale1, scale2;
+
+void ModelEffect_Draw();
+
+void Ent_ModelEffect(bool isNew);
+#endif
index 868f05e2697b8b009a04655b8400ad784dde1ef4..2f62ae6dcf77741849bde451f5a5cc8189a9f415 100644 (file)
@@ -1,4 +1,17 @@
-const float MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE = 4;
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "defs.qh"
+       #include "../common/stats.qh"
+       #include "../common/util.qh"
+       #include "movetypes.qh"
+       #include "../csqcmodellib/common.qh"
+       #include "../server/t_items.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
+
+const int MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE = 4;
 #define GRAVITY_UNAFFECTED_BY_TICRATE (getstati(STAT_MOVEFLAGS) & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
 
 .entity move_groundentity; // FIXME add move_groundnetworkentity?
@@ -11,14 +24,10 @@ void _Movetype_CheckVelocity() // SV_CheckVelocity
 
 float _Movetype_CheckWater(entity ent) // SV_CheckWater
 {
-       float supercontents;
-       float nativecontents;
-       vector point;
+       vector point = ent.move_origin;
+       point.z += (ent.mins.z + 1);
 
-       point = ent.move_origin;
-       point_z += (ent.mins_z + 1);
-
-       nativecontents = pointcontents(point);
+       int nativecontents = pointcontents(point);
 
        if(ent.move_watertype)
        if(ent.move_watertype != nativecontents)
@@ -31,16 +40,16 @@ float _Movetype_CheckWater(entity ent) // SV_CheckWater
        ent.move_waterlevel = 0;
        ent.move_watertype = CONTENT_EMPTY;
 
-       supercontents = Mod_Q1BSP_SuperContentsFromNativeContents(nativecontents);
+       int supercontents = Mod_Q1BSP_SuperContentsFromNativeContents(nativecontents);
        if(supercontents & DPCONTENTS_LIQUIDSMASK)
        {
                ent.move_watertype = nativecontents;
                ent.move_waterlevel = 1;
-               point_y = (ent.origin_y + ((ent.mins_z + ent.maxs_y) * 0.5));
+               point.y = (ent.origin.y + ((ent.mins.z + ent.maxs.y) * 0.5));
                if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & DPCONTENTS_LIQUIDSMASK)
                {
                        ent.move_waterlevel = 2;
-                       point_y = ent.origin_y + ent.view_ofs_y;
+                       point.y = ent.origin.y + ent.view_ofs.y;
                        if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & DPCONTENTS_LIQUIDSMASK)
                                ent.move_waterlevel = 3;
                }
@@ -52,7 +61,7 @@ float _Movetype_CheckWater(entity ent) // SV_CheckWater
 void _Movetype_CheckWaterTransition(entity ent) // SV_CheckWaterTransition
 {
        float contents = pointcontents(ent.move_origin);
-       
+
        if(!ent.move_watertype)
        {
                // just spawned here
@@ -125,11 +134,11 @@ void _Movetype_LinkEdict_TouchAreaGrid() // SV_LinkEdict_TouchAreaGrid
                        self = e;
                        other = oldself;
 
-                       trace_allsolid = FALSE;
-                       trace_startsolid = FALSE;
+                       trace_allsolid = false;
+                       trace_startsolid = false;
                        trace_fraction = 1;
-                       trace_inwater = FALSE;
-                       trace_inopen = TRUE;
+                       trace_inwater = false;
+                       trace_inopen = true;
                        trace_endpos = e.origin;
                        trace_plane_normal = '0 0 1';
                        trace_plane_dist = 0;
@@ -162,21 +171,21 @@ void _Movetype_LinkEdict(float touch_triggers) // SV_LinkEdict
 
        if(self.move_flags & FL_ITEM)
        {
-               mi_x -= 15;
-               mi_y -= 15;
-               mi_z -= 1;
-               ma_x += 15;
-               ma_y += 15;
-               ma_z += 1;
+               mi.x -= 15;
+               mi.y -= 15;
+               mi.z -= 1;
+               ma.x += 15;
+               ma.y += 15;
+               ma.z += 1;
        }
        else
        {
-               mi_x -= 1;
-               mi_y -= 1;
-               mi_z -= 1;
-               ma_x += 1;
-               ma_y += 1;
-               ma_z += 1;
+               mi.x -= 1;
+               mi.y -= 1;
+               mi.z -= 1;
+               ma.x += 1;
+               ma.y += 1;
+               ma.z += 1;
        }
 
        self.absmin = mi;
@@ -189,26 +198,25 @@ void _Movetype_LinkEdict(float touch_triggers) // SV_LinkEdict
 float _Movetype_TestEntityPosition(vector ofs) // SV_TestEntityPosition
 {
        vector org;
-       float cont;
        org = self.move_origin + ofs;
 
-       cont = self.dphitcontentsmask;
+       int cont = self.dphitcontentsmask;
        self.dphitcontentsmask = DPCONTENTS_SOLID;
        tracebox(self.move_origin, self.mins, self.maxs, self.move_origin, MOVE_NOMONSTERS, self);
        self.dphitcontentsmask = cont;
 
        if(trace_startsolid)
-               return TRUE;
+               return true;
 
        if(vlen(trace_endpos - self.move_origin) > 0.0001)
                self.move_origin = trace_endpos;
-       return FALSE;
+       return false;
 }
 
 float _Movetype_UnstickEntity() // SV_UnstickEntity
 {
        if(!_Movetype_TestEntityPosition('0 0 0'))
-               return TRUE;
+               return true;
        if(!_Movetype_TestEntityPosition('-1 0 0')) goto success;
        if(!_Movetype_TestEntityPosition('1 0 0')) goto success;
        if(!_Movetype_TestEntityPosition('0 -1 0')) goto success;
@@ -224,20 +232,20 @@ float _Movetype_UnstickEntity() // SV_UnstickEntity
                if(!_Movetype_TestEntityPosition('0 0 1' * i)) goto success;
        }
        dprintf("Can't unstick an entity (edict: %d, classname: %s, origin: %s)\n", num_for_edict(self), self.classname, vtos(self.move_origin));
-       return FALSE;
+       return false;
 :success
        dprintf("Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)\n", num_for_edict(self), self.classname, vtos(self.move_origin));
-       _Movetype_LinkEdict(TRUE);
-       return TRUE;
+       _Movetype_LinkEdict(true);
+       return true;
 }
 
 vector _Movetype_ClipVelocity(vector vel, vector norm, float f) // SV_ClipVelocity
 {
        vel = vel - ((vel * norm) * norm) * f;
 
-       if(vel_x > -0.1 && vel_x < 0.1) vel_x = 0;
-       if(vel_y > -0.1 && vel_y < 0.1) vel_y = 0;
-       if(vel_z > -0.1 && vel_z < 0.1) vel_z = 0;
+       if(vel.x > -0.1 && vel.x < 0.1) vel.x = 0;
+       if(vel.y > -0.1 && vel.y < 0.1) vel.y = 0;
+       if(vel.z > -0.1 && vel.z < 0.1) vel.z = 0;
 
        return vel;
 }
@@ -277,12 +285,12 @@ float _Movetype_PushEntity(vector push, float failonstartsolid) // SV_PushEntity
        return trace_fraction;
 }
 
-#define MAX_CLIP_PLANES 5
+const float MAX_CLIP_PLANES = 5;
 void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss
 {
        if(self.move_flags & FL_ONGROUND)
        {
-               if(self.move_velocity_z >= 1/32)
+               if(self.move_velocity.z >= 1/32)
                        self.move_flags &= ~FL_ONGROUND;
                else if(!self.move_groundentity)
                        return;
@@ -293,7 +301,7 @@ void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss
                }
        }
 
-       self.move_suspendedinair = FALSE;
+       self.move_suspendedinair = false;
 
        _Movetype_CheckVelocity();
 
@@ -324,14 +332,14 @@ void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss
        {
                vector move;
                move = self.move_velocity * movetime;
-               _Movetype_PushEntity(move, TRUE);
+               _Movetype_PushEntity(move, true);
                if(wasfreed(self))
                        return;
 
                if(trace_startsolid)
                {
                        _Movetype_UnstickEntity();
-                       _Movetype_PushEntity(move, FALSE);
+                       _Movetype_PushEntity(move, false);
                        if(wasfreed(self))
                                return;
                }
@@ -360,7 +368,7 @@ void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss
                        self.move_velocity = _Movetype_ClipVelocity(self.move_velocity, trace_plane_normal, 1 + bouncefac);
 
                        d = trace_plane_normal * self.move_velocity;
-                       if(trace_plane_normal_z > 0.7 && d < bouncestop && d > -bouncestop)
+                       if(trace_plane_normal.z > 0.7 && d < bouncestop && d > -bouncestop)
                        {
                                self.move_flags |= FL_ONGROUND;
                                self.move_groundentity = trace_ent;
@@ -373,12 +381,12 @@ void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss
                else
                {
                        self.move_velocity = _Movetype_ClipVelocity(self.move_velocity, trace_plane_normal, 1.0);
-                       if(trace_plane_normal_z > 0.7)
+                       if(trace_plane_normal.z > 0.7)
                        {
                                self.move_flags |= FL_ONGROUND;
                                self.move_groundentity = trace_ent;
                                if(trace_ent.solid == SOLID_BSP)
-                                       self.move_suspendedinair = TRUE;
+                                       self.move_suspendedinair = true;
                                self.move_velocity = '0 0 0';
                                self.move_avelocity = '0 0 0';
                        }
@@ -426,7 +434,7 @@ void _Movetype_Physics_Frame(float movedt)
                        _Movetype_CheckWater(self);
                        self.move_origin = self.move_origin + ticrate * self.move_velocity;
                        self.move_angles = self.move_angles + ticrate * self.move_avelocity;
-                       _Movetype_LinkEdict(FALSE);
+                       _Movetype_LinkEdict(false);
                        break;
                case MOVETYPE_STEP:
                        error("SV_Physics_Step not implemented");
@@ -461,12 +469,12 @@ void Movetype_Physics_NoMatchServer() // optimized
        setorigin(self, self.move_origin);
 }
 
-void Movetype_Physics_MatchServer(float sloppy)
+void Movetype_Physics_MatchServer(bool sloppy)
 {
        Movetype_Physics_MatchTicrate(ticrate, sloppy);
 }
 
-void Movetype_Physics_MatchTicrate(float tr, float sloppy) // SV_Physics_Entity
+void Movetype_Physics_MatchTicrate(float tr, bool sloppy) // SV_Physics_Entity
 {
        float n, i, dt, movedt;
 
index 287226e53b7f918cbf4e788f99bcbf2e7252edb0..3294ce4271f7f63f95d9103102363532c58e28d8 100644 (file)
@@ -1,12 +1,15 @@
+#ifndef MOVETYPES_H
+#define MOVETYPES_H
+
 .float move_movetype;
 .float move_time;
 .vector move_origin;
 .vector move_angles;
 .vector move_velocity;
 .vector move_avelocity;
-.float move_flags;
-.float move_watertype;
-.float move_waterlevel;
+.int move_flags;
+.int move_watertype;
+.int move_waterlevel;
 .void(void) move_touch;
 .void(float, float) contentstransition;
 .float move_bounce_factor;
 .float move_nomonsters; // -1 for MOVE_NORMAL, otherwise a MOVE_ constant
 
 // should match sv_gameplayfix_fixedcheckwatertransition
-var float autocvar_cl_gameplayfix_fixedcheckwatertransition = 1;
+float autocvar_cl_gameplayfix_fixedcheckwatertransition = 1;
 
-void Movetype_Physics_MatchTicrate(float tr, float sloppy);
-void Movetype_Physics_MatchServer(float sloppy);
+void Movetype_Physics_MatchTicrate(float tr, bool sloppy);
+void Movetype_Physics_MatchServer(bool sloppy);
 void Movetype_Physics_NoMatchServer();
 
-const float    MOVETYPE_NONE                           = 0;
-const float    MOVETYPE_ANGLENOCLIP                    = 1;
-const float    MOVETYPE_ANGLECLIP                      = 2;
-const float    MOVETYPE_WALK                           = 3;
-const float    MOVETYPE_STEP                           = 4;
-const float    MOVETYPE_FLY                            = 5;
-const float    MOVETYPE_TOSS                           = 6;
-const float    MOVETYPE_PUSH                           = 7;
-const float    MOVETYPE_NOCLIP                         = 8;
-const float    MOVETYPE_FLYMISSILE                     = 9;
-const float    MOVETYPE_BOUNCE                         = 10;
-const float    MOVETYPE_BOUNCEMISSILE  = 11;   // Like bounce but doesn't lose speed on bouncing
-const float MOVETYPE_FOLLOW = 12;
-const float MOVETYPE_FAKEPUSH = 13;
-const float MOVETYPE_FLY_WORLDONLY = 33;
+const int MOVETYPE_NONE                                = 0;
+const int MOVETYPE_ANGLENOCLIP     = 1;
+const int MOVETYPE_ANGLECLIP       = 2;
+const int MOVETYPE_WALK                                = 3;
+const int MOVETYPE_STEP                                = 4;
+const int MOVETYPE_FLY                         = 5;
+const int MOVETYPE_TOSS                                = 6;
+const int MOVETYPE_PUSH                                = 7;
+const int MOVETYPE_NOCLIP                  = 8;
+const int MOVETYPE_FLYMISSILE      = 9;
+const int MOVETYPE_BOUNCE                  = 10;
+const int MOVETYPE_BOUNCEMISSILE       = 11;   // Like bounce but doesn't lose speed on bouncing
+const int MOVETYPE_FOLLOW           = 12;
+const int MOVETYPE_FAKEPUSH         = 13;
+const int MOVETYPE_FLY_WORLDONLY    = 33;
 
-const float   FL_ITEM                 = 256;
-const float    FL_ONGROUND                             = 512;
+const int FL_ITEM                   = 256;
+const int FL_ONGROUND                          = 512;
+#endif
index ef9b8555234bb9d596106354538a86e014dbee30..5635f3f99b44d51cf04af689f36849344c58ee2a 100644 (file)
@@ -1,3 +1,10 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "noise.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
 .float noise_baccum;
 .float noise_paccum;
 .float noise_paccum2;
index 30ce4d0ee42a31bd43ecc2f206149e8dd56f98ea..2b18adee5d9172396ec6e339169fbf96383c0aff 100644 (file)
@@ -1,5 +1,9 @@
+#ifndef NOISE_H
+#define NOISE_H
+
 // noises "usually" start in the range -1..1
 float Noise_Brown(entity e, float dt);
 float Noise_Pink(entity e, float dt);
 float Noise_White(entity e, float dt);
 float Noise_Burst(entity e, float dt, float p); // +1 or -1
+#endif
index f16519ab5c71dbcc7e726ef26c4342e90c3330de..6d2ddf87d5a431b3cf4c901b60881d868fb0e25b 100644 (file)
@@ -1,15 +1,4 @@
-.float dphitcontentsmask;
-
-.float cnt; // effect number
-.vector velocity; // particle velocity
-.float waterlevel; // direction jitter
-.float count; // count multiplier
-.float impulse; // density
-.string noise; // sound
-.float atten;
-.float volume;
-.float absolute; // 1 = count per second is absolute, 2 = only spawn at toggle
-.vector movedir; // trace direction
+#include "particles.qh"
 
 void Draw_PointParticles()
 {
@@ -40,9 +29,9 @@ void Draw_PointParticles()
        for(i = random(); i <= n && fail <= 64*n; ++i)
        {
                p = o + self.mins;
-               p_x += random() * sz_x;
-               p_y += random() * sz_y;
-               p_z += random() * sz_z;
+               p.x += random() * sz.x;
+               p.y += random() * sz.y;
+               p.z += random() * sz.z;
                if(WarpZoneLib_BoxTouchesBrush(p, p, self, world))
                {
                        if(self.movedir != '0 0 0')
@@ -83,9 +72,9 @@ void Ent_PointParticles_Remove()
 
 void Ent_PointParticles()
 {
-       float f, i;
+       float i;
        vector v;
-       f = ReadByte();
+       int f = ReadByte();
        if(f & 2)
        {
                i = ReadCoord(); // density (<0: point, >0: volume)
@@ -174,7 +163,7 @@ void Ent_PointParticles()
                if(!self.absolute)
                {
                        v = self.maxs - self.mins;
-                       self.impulse *= -v_x * v_y * v_z / 262144; // relative: particles per 64^3 cube
+                       self.impulse *= -v.x * v.y * v.z / 262144; // relative: particles per 64^3 cube
                }
        }
 
@@ -188,7 +177,6 @@ void Ent_PointParticles()
        self.entremove = Ent_PointParticles_Remove;
 }
 
-.float glow_color; // palette index
 void Draw_Rain()
 {
     te_particlerain(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color);
@@ -229,8 +217,8 @@ void Net_ReadVortexBeamParticle()
 {
        vector shotorg, endpos;
        float charge;
-       shotorg_x = ReadCoord(); shotorg_y = ReadCoord(); shotorg_z = ReadCoord();
-       endpos_x = ReadCoord(); endpos_y = ReadCoord(); endpos_z = ReadCoord();
+       shotorg.x = ReadCoord(); shotorg.y = ReadCoord(); shotorg.z = ReadCoord();
+       endpos.x = ReadCoord(); endpos.y = ReadCoord(); endpos.z = ReadCoord();
        charge = ReadByte() / 255.0;
 
        pointparticles(particleeffectnum("nex_muzzleflash"), shotorg, normalize(endpos - shotorg) * 1000, 1);
diff --git a/qcsrc/client/particles.qh b/qcsrc/client/particles.qh
new file mode 100644 (file)
index 0000000..12c999b
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef PARTICLES_H
+#define PARTICLES_H
+
+.int dphitcontentsmask;
+
+.int cnt; // effect number
+.vector velocity; // particle velocity
+.float waterlevel; // direction jitter
+.int count; // count multiplier
+.int impulse; // density
+.string noise; // sound
+.float atten;
+.float volume;
+.float absolute; // 1 = count per second is absolute, 2 = only spawn at toggle
+.vector movedir; // trace direction
+
+void Draw_PointParticles();
+
+void Ent_PointParticles_Remove();
+
+void Ent_PointParticles();
+
+.float glow_color; // palette index
+
+void Draw_Rain();
+
+void Draw_Snow();
+
+void Ent_RainOrSnow();
+
+void Net_ReadVortexBeamParticle();
+#endif
index ad5e23aa88335e382a221201828870ad848af471..0a9ac8cacb9167ddf05fc7eb762aafc8b02b26ff 100644 (file)
@@ -1,14 +1,18 @@
+#include "player_skeleton.qh"
+
+#include "../warpzonelib/anglestransform.qh"
+
 .float skeleton_info_modelindex;
 .float skeleton_info_skin;
-#define BONETYPE_LOWER 0
-#define BONETYPE_UPPER 1
-#define MAX_BONES 128
+const int BONETYPE_LOWER = 0;
+const int BONETYPE_UPPER = 1;
+const int MAX_BONES = 128;
 .float skeleton_bonetype[MAX_BONES];
 .float skeleton_numbones;
 
 void skeleton_loadinfo(entity e)
 {
-       float i;
+       int i;
        if(e.skeleton_info_modelindex == e.modelindex && e.skeleton_info_skin == e.skin)
                return;
        e.bone_upperbody = 0;
@@ -56,11 +60,11 @@ void skeleton_markbones(entity e)
 {
        float s = e.skeletonindex;
        float n = (e.skeleton_numbones = skel_get_numbones(s));
-       float i;
+       int i;
        for(i = 1; i <= n; ++i)
        {
                float t = BONETYPE_LOWER;
-               float p = skel_get_boneparent(s, i);
+               int p = skel_get_boneparent(s, i);
                if(p > 0)
                        t = e.(skeleton_bonetype[p-1]);
                if(i == e.bone_upperbody)
@@ -100,7 +104,6 @@ void free_skeleton_from_frames(entity e)
 
 void skeleton_from_frames(entity e, float is_dead)
 {
-       float i;
        float m = e.modelindex;
        if(!e.skeletonindex)
        {
@@ -110,7 +113,6 @@ void skeleton_from_frames(entity e, float is_dead)
        float s = e.skeletonindex;
        if(!s)
                return;
-       float bone;
        float n = e.skeleton_numbones;
        float savelerpfrac = e.lerpfrac;
        float savelerpfrac3 = e.lerpfrac3;
@@ -129,7 +131,7 @@ void skeleton_from_frames(entity e, float is_dead)
                skel_get_boneabs(s, e.bone_upperbody);
                fixbone_oldangles = fixedvectoangles2(v_forward, v_up);
        }
-
+       int bone;
        for(bone = 0; bone < n; )
        {
                float firstbone = bone;
@@ -168,11 +170,12 @@ void skeleton_from_frames(entity e, float is_dead)
 
        if(!is_dead)
        {
+               int i;
                for(i = 0; i < MAX_AIM_BONES; ++i)
                {
                        if(e.(bone_aim[i]))
                        {
-                               vector aim = '1 0 0' * bound(-90, self.v_angle_x, 90) * e.(bone_aimweight[i]);
+                               vector aim = '1 0 0' * bound(-90, self.v_angle.x, 90) * e.(bone_aimweight[i]);
                                vector org = skel_get_boneabs(s, e.(bone_aim[i]));
                                vector ang_cur = fixedvectoangles2(v_forward, v_up);
                                vector ang = AnglesTransform_Multiply(aim, ang_cur);
index d369bac4ec192db99f04978d17c38c28128015b4..6c95ce231051fad1b7315e50476e82c7b280aa94 100644 (file)
@@ -1,9 +1,13 @@
+#ifndef PLAYER_SKELETON
+#define PLAYER_SKELETON
+
 void free_skeleton_from_frames(entity e);
 void skeleton_from_frames(entity e, float is_dead);
 void skeleton_loadinfo(entity e);
 
 .float bone_upperbody;
-.float bone_weapon;
+.int bone_weapon;
 .float bone_aim[MAX_AIM_BONES];
 .float bone_aimweight[MAX_AIM_BONES];
 .float fixbone;
+#endif
index 1132d06a325278b6d238e0a97ffece43d647fd79..935f1421ed1379f26ce486ce56747fc8cf80385c 100644 (file)
@@ -1,3 +1,11 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "../warpzonelib/mathlib.qh"
+       #include "prandom.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
 // prandom - PREDICTABLE random number generator (not seeded yet)
 
 #ifdef USE_PRANDOM
@@ -5,7 +13,7 @@ float prandom_seed;
 float prandom()
 {
        float c;
-       c = crc16(FALSE, strcat(ftos(prandom_seed), ftos(prandom_seed + M_PI)));
+       c = crc16(false, strcat(ftos(prandom_seed), ftos(prandom_seed + M_PI)));
        prandom_seed = c;
 
 #ifdef USE_PRANDOM_DEBUG
@@ -21,9 +29,9 @@ vector prandomvec()
 
        do
        {
-               v_x = prandom();
-               v_y = prandom();
-               v_z = prandom();
+               v.x = prandom();
+               v.y = prandom();
+               v.z = prandom();
        }
        while(v * v > 1);
 
index 7d5df6f8248cda6d10cb3baa7b0598dc3c260b99..a7653a505ad52099ba6a033260b5a60beb88c8c2 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef PRANDOM_H
+#define PRANDOM_H
+
 // prandom - PREDICTABLE random number generator
 
 #define USE_PRANDOM
@@ -18,3 +21,4 @@ void prandom_debug();
 #define psrandom(x)
 #define prandom_debug()
 #endif
+#endif
index d14edd5d3625d08a5c185beafaad2e8c56473fe7..cdd0b09d1fbade0c6fe08e79b7053add507da7e3 100644 (file)
 ../../csprogs.dat
 
 ../common/util-pre.qh
-sys-pre.qh
-../dpdefs/csprogsdefs.qc
-sys-post.qh
+../dpdefs/csprogsdefs.qh
 
-Defs.qc
-../dpdefs/keycodes.qc
-../common/constants.qh
-../common/stats.qh
-
-../warpzonelib/anglestransform.qh
-../warpzonelib/mathlib.qh
-../warpzonelib/common.qh
-../warpzonelib/client.qh
-
-../common/playerstats.qh
-../common/teams.qh
-../common/util.qh
-../common/nades.qh
-../common/buffs.qh
-../common/test.qh
-../common/counting.qh
-../common/weapons/weapons.qh // TODO
-../common/mapinfo.qh
-../common/command/markup.qh
-../common/command/rpn.qh
-../common/command/generic.qh
-../common/command/shared_defs.qh
-../common/urllib.qh
-../common/animdecide.qh
-command/cl_cmd.qh
-
-../common/monsters/monsters.qh
-
-autocvars.qh
-
-../common/notifications.qh // must be after autocvars
-../common/deathtypes.qh // must be after notifications
-
-../common/turrets/turrets.qh
-../common/turrets/cl_turrets.qh
-
-damage.qh
-
-../csqcmodellib/interpolate.qh
-teamradar.qh
-hud.qh
-scoreboard.qh
-waypointsprites.qh
-movetypes.qh
-prandom.qh
-bgmscript.qh
-noise.qh
-../server/movelib.qc
-main.qh
-vehicles/vehicles.qh
-../common/csqcmodel_settings.qh
-../csqcmodellib/common.qh
-../csqcmodellib/cl_model.qh
-../csqcmodellib/cl_player.qh
-weapons/projectile.qh // TODO
-player_skeleton.qh
-
-sortlist.qc
-miscfunctions.qc
-../server/t_items.qh
-../server/t_items.qc
-
-teamradar.qc
-hud_config.qc
-hud.qc
-scoreboard.qc
-mapvoting.qc
+announcer.qc
+bgmscript.qc
+casings.qc
 csqcmodel_hooks.qc
-../common/net_notice.qc
-
-rubble.qc
-hook.qc
-particles.qc
-laser.qc
-weapons/projectile.qc // TODO
-gibs.qc
 damage.qc
-casings.qc
-../csqcmodellib/cl_model.qc
-../csqcmodellib/cl_player.qc
 effects.qc
-wall.qc
+gibs.qc
+hook.qc
+hud_config.qc
+hud.qc
+laser.qc
+main.qc
+mapvoting.qc
+miscfunctions.qc
 modeleffects.qc
-tuba.qc
+movetypes.qc
+noise.qc
+particles.qc
+player_skeleton.qc
+prandom.qc
+rubble.qc
+scoreboard.qc
+shownames.qc
+sortlist.qc
 target_music.qc
-
+teamradar.qc
+tuba.qc
 vehicles/vehicles.qc
-../server/vehicles/bumblebee.qc
-shownames.qh
-shownames.qc
-
-announcer.qc
-Main.qc
-View.qc
-../csqcmodellib/interpolate.qc
+view.qc
+wall.qc
 waypointsprites.qc
-movetypes.qc
-prandom.qc
-bgmscript.qc
-noise.qc
 
+command/cl_cmd.qc
+
+weapons/projectile.qc // TODO
+
+../common/animdecide.qc
+../common/buffs.qc
+../common/mapinfo.qc
+../common/nades.qc
+../common/net_notice.qc
+../common/notifications.qc
+../common/playerstats.qc
 ../common/test.qc
+../common/urllib.qc
 ../common/util.qc
-../common/playerstats.qc
-../common/notifications.qc
+
+../common/command/generic.qc
 ../common/command/markup.qc
 ../common/command/rpn.qc
-../common/command/generic.qc
-../common/mapinfo.qc
-../common/weapons/weapons.qc // TODO
-../common/urllib.qc
-command/cl_cmd.qc
 
 ../common/monsters/monsters.qc
 
-../common/nades.qc
-../common/buffs.qc
+../common/turrets/cl_turrets.qc
+../common/turrets/turrets.qc
+
+../common/weapons/weapons.qc // TODO
+
+../csqcmodellib/cl_model.qc
+../csqcmodellib/cl_player.qc
+../csqcmodellib/interpolate.qc
+
+../server/movelib.qc
+../server/t_items.qc
+../server/vehicles/bumblebee.qc
 
 ../warpzonelib/anglestransform.qc
-../warpzonelib/mathlib.qc
-../warpzonelib/common.qc
 ../warpzonelib/client.qc
 
-../common/turrets/cl_turrets.qc
-../common/turrets/turrets.qc
-
-player_skeleton.qc
-../common/animdecide.qc
+../warpzonelib/common.qc
+../warpzonelib/mathlib.qc
index 7bf9e57ea67bc237041a28f1fc278c1c6daf7a1e..c09dd18aed4ed8bfe1cc3cc78256e869489efcc1 100644 (file)
@@ -1,4 +1,8 @@
-.float creationtime;
+#if defined(CSQC)
+       #include "rubble.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
 
 // LordHavoc: rewrote this file, it was really bad code
 
diff --git a/qcsrc/client/rubble.qh b/qcsrc/client/rubble.qh
new file mode 100644 (file)
index 0000000..5ff1b55
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef RUBBLE_H
+#define RUBBLE_H
+.float creationtime;
+void RubbleLimit(string cname, float limit, void() deleteproc);
+entity RubbleNew(string cname);
+#endif
index f5b3206ba3bbbb6bc259df0d920675a01a96d7a3..c6d871807f2e7c190af068a4ff192b760d3de57b 100644 (file)
@@ -1,3 +1,5 @@
+#include "scoreboard.qh"
+
 float scoreboard_alpha_bg;
 float scoreboard_alpha_fg;
 float scoreboard_highlight;
@@ -54,10 +56,9 @@ string TranslateScoresLabel(string l)
        }
 }
 
-void Cmd_HUD_SetFields(float argc);
 void HUD_InitScores()
 {
-       float i, f;
+       int i, f;
 
        ps_primary = ps_secondary = ts_primary = ts_secondary = -1;
        for(i = 0; i < MAX_SCORE; ++i)
@@ -85,7 +86,6 @@ void HUD_InitScores()
        Cmd_HUD_SetFields(0);
 }
 
-void HUD_UpdatePlayerPos(entity pl);
 float SetTeam(entity pl, float Team);
 //float lastpnum;
 void HUD_UpdatePlayerTeams()
@@ -116,7 +116,7 @@ void HUD_UpdatePlayerTeams()
        */
 }
 
-float HUD_CompareScore(float vl, float vr, float f)
+int HUD_CompareScore(float vl, float vr, int f)
 {
        if(f & SFL_ZERO_IS_WORST)
        {
@@ -134,7 +134,7 @@ float HUD_CompareScore(float vl, float vr, float f)
 
 float HUD_ComparePlayerScores(entity left, entity right)
 {
-       float vl, vr, r, i;
+       float vl, vr, r;
        vl = GetPlayerColor(left.sv_entnum);
        vr = GetPlayerColor(right.sv_entnum);
 
@@ -165,6 +165,7 @@ float HUD_ComparePlayerScores(entity left, entity right)
        if (r >= 0)
                return r;
 
+       int i;
        for(i = 0; i < MAX_SCORE; ++i)
        {
                r = HUD_CompareScore(left.scores[i], right.scores[i], scores_flags[i]);
@@ -192,7 +193,7 @@ void HUD_UpdatePlayerPos(entity player)
 
 float HUD_CompareTeamScores(entity left, entity right)
 {
-       float i, r;
+       int i, r;
 
        if(left.team == NUM_SPECTATOR)
                return 1;
@@ -299,7 +300,7 @@ void Cmd_HUD_Help()
 
 void Cmd_HUD_SetFields(float argc)
 {
-       float i, j, slash;
+       int i, j, slash;
        string str, pattern;
        float have_name = 0, have_primary = 0, have_secondary = 0, have_separator = 0;
        float missing;
@@ -354,10 +355,10 @@ void Cmd_HUD_SetFields(float argc)
                float nocomplain;
                str = argv(i+1);
 
-               nocomplain = FALSE;
+               nocomplain = false;
                if(substring(str, 0, 1) == "?")
                {
-                       nocomplain = TRUE;
+                       nocomplain = true;
                        str = substring(str, 1, strlen(str) - 1);
                }
 
@@ -367,13 +368,13 @@ void Cmd_HUD_SetFields(float argc)
                        pattern = substring(str, 0, slash);
                        str = substring(str, slash + 1, strlen(str) - (slash + 1));
 
-                       if (!isGametypeInFilter(gametype, teamplay, FALSE, pattern))
+                       if (!isGametypeInFilter(gametype, teamplay, false, pattern))
                                continue;
                }
 
                strunzone(hud_title[hud_num_fields]);
                hud_title[hud_num_fields] = strzone(TranslateScoresLabel(str));
-               hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], FALSE, hud_fontsize);
+               hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], false, hud_fontsize);
                str = strtolower(str);
 
                if(str == "ping") {
@@ -452,7 +453,7 @@ void Cmd_HUD_SetFields(float argc)
                                }
                                hud_title[1] = strzone("|");
                                hud_field[1] = SP_SEPARATOR;
-                               hud_size[1] = stringwidth("|", FALSE, hud_fontsize);
+                               hud_size[1] = stringwidth("|", false, hud_fontsize);
                                ++hud_num_fields;
                                print("fixed missing field '|'\n");
                        }
@@ -461,7 +462,7 @@ void Cmd_HUD_SetFields(float argc)
                {
                        strunzone(hud_title[hud_num_fields]);
                        hud_title[hud_num_fields] = strzone("|");
-                       hud_size[hud_num_fields] = stringwidth("|", FALSE, hud_fontsize);
+                       hud_size[hud_num_fields] = stringwidth("|", false, hud_fontsize);
                        hud_field[hud_num_fields] = SP_SEPARATOR;
                        ++hud_num_fields;
                        print("fixed missing field '|'\n");
@@ -470,7 +471,7 @@ void Cmd_HUD_SetFields(float argc)
                {
                        strunzone(hud_title[hud_num_fields]);
                        hud_title[hud_num_fields] = strzone(TranslateScoresLabel(scores_label[ps_secondary]));
-                       hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], FALSE, hud_fontsize);
+                       hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], false, hud_fontsize);
                        hud_field[hud_num_fields] = ps_secondary;
                        ++hud_num_fields;
                        printf("fixed missing field '%s'\n", scores_label[ps_secondary]);
@@ -479,7 +480,7 @@ void Cmd_HUD_SetFields(float argc)
                {
                        strunzone(hud_title[hud_num_fields]);
                        hud_title[hud_num_fields] = strzone(TranslateScoresLabel(scores_label[ps_primary]));
-                       hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], FALSE, hud_fontsize);
+                       hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], false, hud_fontsize);
                        hud_field[hud_num_fields] = ps_primary;
                        ++hud_num_fields;
                        printf("fixed missing field '%s'\n", scores_label[ps_primary]);
@@ -501,9 +502,10 @@ vector hud_field_icon2_rgb;
 float hud_field_icon0_alpha;
 float hud_field_icon1_alpha;
 float hud_field_icon2_alpha;
-string HUD_GetField(entity pl, float field)
+string HUD_GetField(entity pl, int field)
 {
-       float tmp, num, denom, f;
+       float tmp, num, denom;
+       int f;
        string str;
        hud_field_rgb = '1 1 1';
        hud_field_icon0 = "";
@@ -606,12 +608,11 @@ string HUD_GetField(entity pl, float field)
        //return "error";
 }
 
-float xmin, xmax, ymin, ymax, sbwidth;
 float hud_fixscoreboardcolumnwidth_len;
 float hud_fixscoreboardcolumnwidth_iconlen;
 float hud_fixscoreboardcolumnwidth_marginlen;
 
-string HUD_FixScoreboardColumnWidth(float i, string str)
+string HUD_FixScoreboardColumnWidth(int i, string str)
 {
        float field, f;
        vector sz;
@@ -622,7 +623,7 @@ string HUD_FixScoreboardColumnWidth(float i, string str)
        if(hud_field_icon0 != "")
        {
                sz = draw_getimagesize(hud_field_icon0);
-               f = sz_x / sz_y;
+               f = sz.x / sz.y;
                if(hud_fixscoreboardcolumnwidth_iconlen < f)
                        hud_fixscoreboardcolumnwidth_iconlen = f;
        }
@@ -630,7 +631,7 @@ string HUD_FixScoreboardColumnWidth(float i, string str)
        if(hud_field_icon1 != "")
        {
                sz = draw_getimagesize(hud_field_icon1);
-               f = sz_x / sz_y;
+               f = sz.x / sz.y;
                if(hud_fixscoreboardcolumnwidth_iconlen < f)
                        hud_fixscoreboardcolumnwidth_iconlen = f;
        }
@@ -638,36 +639,37 @@ string HUD_FixScoreboardColumnWidth(float i, string str)
        if(hud_field_icon2 != "")
        {
                sz = draw_getimagesize(hud_field_icon2);
-               f = sz_x / sz_y;
+               f = sz.x / sz.y;
                if(hud_fixscoreboardcolumnwidth_iconlen < f)
                        hud_fixscoreboardcolumnwidth_iconlen = f;
        }
 
-       hud_fixscoreboardcolumnwidth_iconlen *= hud_fontsize_y / hud_fontsize_x; // fix icon aspect
+       hud_fixscoreboardcolumnwidth_iconlen *= hud_fontsize.y / hud_fontsize.x; // fix icon aspect
 
        if(hud_fixscoreboardcolumnwidth_iconlen != 0)
-               hud_fixscoreboardcolumnwidth_marginlen = stringwidth(" ", FALSE, hud_fontsize);
+               hud_fixscoreboardcolumnwidth_marginlen = stringwidth(" ", false, hud_fontsize);
        else
                hud_fixscoreboardcolumnwidth_marginlen = 0;
 
        if(field == SP_NAME) // name gets all remaining space
        {
-               float namesize, j;
+               int j;
+               float namesize;
                namesize = sbwidth;// / hud_fontsize_x;
                for(j = 0; j < hud_num_fields; ++j)
                        if(j != i)
                                if (hud_field[i] != SP_SEPARATOR)
-                                       namesize -= hud_size[j] + hud_fontsize_x;
-               namesize += hud_fontsize_x;
+                                       namesize -= hud_size[j] + hud_fontsize.x;
+               namesize += hud_fontsize.x;
                hud_size[i] = namesize;
 
                if (hud_fixscoreboardcolumnwidth_iconlen != 0)
                        namesize -= hud_fixscoreboardcolumnwidth_marginlen + hud_fixscoreboardcolumnwidth_iconlen;
                str = textShortenToWidth(str, namesize, hud_fontsize, stringwidth_colors);
-               hud_fixscoreboardcolumnwidth_len = stringwidth(str, TRUE, hud_fontsize);
+               hud_fixscoreboardcolumnwidth_len = stringwidth(str, true, hud_fontsize);
        }
        else
-               hud_fixscoreboardcolumnwidth_len = stringwidth(str, FALSE, hud_fontsize);
+               hud_fixscoreboardcolumnwidth_len = stringwidth(str, false, hud_fontsize);
 
        f = hud_fixscoreboardcolumnwidth_len + hud_fixscoreboardcolumnwidth_marginlen + hud_fixscoreboardcolumnwidth_iconlen;
        if(hud_size[i] < f)
@@ -676,19 +678,19 @@ string HUD_FixScoreboardColumnWidth(float i, string str)
        return str;
 }
 
-void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_self, float pl_number)
+void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_self, int pl_number)
 {
        vector tmp, rgb;
        rgb = Team_ColorRGB(pl.team);
        string str;
-       float i, field;
+       int field;
        float is_spec;
        is_spec = (GetPlayerColor(pl.sv_entnum) == NUM_SPECTATOR);
 
        if((rgb == '1 1 1') && (!is_spec)) {
-               rgb_x = autocvar_scoreboard_color_bg_r + 0.5;
-               rgb_y = autocvar_scoreboard_color_bg_g + 0.5;
-               rgb_z = autocvar_scoreboard_color_bg_b + 0.5; }
+               rgb.x = autocvar_scoreboard_color_bg_r + 0.5;
+               rgb.y = autocvar_scoreboard_color_bg_g + 0.5;
+               rgb.z = autocvar_scoreboard_color_bg_b + 0.5; }
 
        vector h_pos = pos - '1 1 0';
        vector h_size = item_size + '2 0 0';
@@ -698,10 +700,10 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
        else if((scoreboard_highlight) && (!(pl_number % 2)))
                drawfill(h_pos, h_size, rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
 
-       tmp_x = item_size_x;
-       tmp_y = 0;
-       tmp_z = 0;
-
+       tmp.x = item_size.x;
+       tmp.y = 0;
+       tmp.z = 0;
+       int i;
        for(i = 0; i < hud_num_fields; ++i)
        {
                field = hud_field[i];
@@ -709,49 +711,49 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
                        break;
 
                if(is_spec && field != SP_NAME && field != SP_PING) {
-                       pos_x += hud_size[i] + hud_fontsize_x;
+                       pos.x += hud_size[i] + hud_fontsize.x;
                        continue;
                }
                str = HUD_GetField(pl, field);
                str = HUD_FixScoreboardColumnWidth(i, str);
 
-               pos_x += hud_size[i] + hud_fontsize_x;
+               pos.x += hud_size[i] + hud_fontsize.x;
 
                if(field == SP_NAME) {
-                       tmp_x = hud_size[i] - hud_fontsize_x*hud_fixscoreboardcolumnwidth_iconlen - hud_fixscoreboardcolumnwidth_marginlen + hud_fontsize_x;
+                       tmp.x = hud_size[i] - hud_fontsize.x*hud_fixscoreboardcolumnwidth_iconlen - hud_fixscoreboardcolumnwidth_marginlen + hud_fontsize.x;
                        if (is_self)
                                drawcolorcodedstring(pos - tmp, str, hud_fontsize, scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                        else
                                drawcolorcodedstring(pos - tmp, str, hud_fontsize, scoreboard_alpha_name, DRAWFLAG_NORMAL);
                } else {
-                       tmp_x = hud_fixscoreboardcolumnwidth_len + hud_fontsize_x;
+                       tmp.x = hud_fixscoreboardcolumnwidth_len + hud_fontsize.x;
                        if (is_self)
                                drawstring(pos - tmp, str, hud_fontsize, hud_field_rgb, scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                        else
                                drawstring(pos - tmp, str, hud_fontsize, hud_field_rgb, scoreboard_alpha_name, DRAWFLAG_NORMAL);
                }
 
-               tmp_x = hud_size[i] + hud_fontsize_x;
+               tmp.x = hud_size[i] + hud_fontsize.x;
                if(hud_field_icon0 != "")
                        if (is_self)
-                               drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
+                               drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                        else
-                               drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
+                               drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
                if(hud_field_icon1 != "")
                        if (is_self)
-                               drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
+                               drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                        else
-                               drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
+                               drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
                if(hud_field_icon2 != "")
                        if (is_self)
-                               drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
+                               drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                        else
-                               drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
+                               drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
        }
 
        if(hud_field[i] == SP_SEPARATOR)
        {
-               pos_x = xmax;
+               pos.x = xmax;
                for(i = hud_num_fields-1; i > 0; --i)
                {
                        field = hud_field[i];
@@ -759,7 +761,7 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
                                break;
 
                        if(is_spec && field != SP_NAME && field != SP_PING) {
-                               pos_x -= hud_size[i] + hud_fontsize_x;
+                               pos.x -= hud_size[i] + hud_fontsize.x;
                                continue;
                        }
 
@@ -767,36 +769,36 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
                        str = HUD_FixScoreboardColumnWidth(i, str);
 
                        if(field == SP_NAME) {
-                               tmp_x = hud_fixscoreboardcolumnwidth_len; // left or right aligned? let's put it right...
+                               tmp.x = hud_fixscoreboardcolumnwidth_len; // left or right aligned? let's put it right...
                                if(is_self)
                                        drawcolorcodedstring(pos - tmp, str, hud_fontsize, scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                                else
                                        drawcolorcodedstring(pos - tmp, str, hud_fontsize, scoreboard_alpha_name, DRAWFLAG_NORMAL);
                        } else {
-                               tmp_x = hud_fixscoreboardcolumnwidth_len;
+                               tmp.x = hud_fixscoreboardcolumnwidth_len;
                                if(is_self)
                                        drawstring(pos - tmp, str, hud_fontsize, hud_field_rgb, scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                                else
                                        drawstring(pos - tmp, str, hud_fontsize, hud_field_rgb, scoreboard_alpha_name, DRAWFLAG_NORMAL);
                        }
 
-                       tmp_x = hud_size[i];
+                       tmp.x = hud_size[i];
                        if(hud_field_icon0 != "")
                                if (is_self)
-                                       drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
+                                       drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                                else
-                                       drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
+                                       drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
                        if(hud_field_icon1 != "")
                                if (is_self)
-                                       drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
+                                       drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                                else
-                                       drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
+                                       drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
                        if(hud_field_icon2 != "")
                                if (is_self)
-                                       drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
+                                       drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                                else
-                                       drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
-                       pos_x -= hud_size[i] + hud_fontsize_x;
+                                       drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
+                       pos.x -= hud_size[i] + hud_fontsize.x;
                }
        }
 
@@ -812,17 +814,17 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
 
 vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_size)
 {
-       float body_table_height, i;
+       float body_table_height;
        vector tmp = '0 0 0', column_dim = '0 0 0';
        entity pl;
 
-       body_table_height = 1.25 * hud_fontsize_y * max(1, tm.team_size); // no player? show 1 empty line
+       body_table_height = 1.25 * hud_fontsize.y * max(1, tm.team_size); // no player? show 1 empty line
 
-       pos_y += autocvar_scoreboard_border_thickness;
+       pos.y += autocvar_scoreboard_border_thickness;
        pos -= '1 1 0';
 
-       tmp_x = sbwidth + 2;
-       tmp_y = 1.25 * hud_fontsize_y;
+       tmp.x = sbwidth + 2;
+       tmp.y = 1.25 * hud_fontsize.y;
 
        // rounded header
        if (teamplay)
@@ -831,19 +833,19 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
                drawpic(pos, "gfx/scoreboard/scoreboard_tableheader", tmp, rgb + '0.5 0.5 0.5', scoreboard_alpha_bg, DRAWFLAG_NORMAL);
 
        // table border
-       tmp_y += autocvar_scoreboard_border_thickness;
-       tmp_y += body_table_height;
+       tmp.y += autocvar_scoreboard_border_thickness;
+       tmp.y += body_table_height;
        drawborderlines(autocvar_scoreboard_border_thickness, pos, tmp, '0 0 0', scoreboard_alpha_bg, DRAWFLAG_NORMAL); // more transparency for the scoreboard
 
        // separator header/table
-       pos_y += 1.25 * hud_fontsize_y;
-       tmp_y = autocvar_scoreboard_border_thickness;
+       pos.y += 1.25 * hud_fontsize.y;
+       tmp.y = autocvar_scoreboard_border_thickness;
        drawfill(pos, tmp, '0 0 0', scoreboard_alpha_bg, DRAWFLAG_NORMAL);
 
-       pos_y += autocvar_scoreboard_border_thickness;
+       pos.y += autocvar_scoreboard_border_thickness;
 
        // table background
-       tmp_y = body_table_height;
+       tmp.y = body_table_height;
        if (teamplay)
                drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb * autocvar_scoreboard_color_bg_team, scoreboard_alpha_bg, DRAWFLAG_NORMAL);
        else
@@ -853,71 +855,72 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
        //drawfill(pos, tmp + '2 0 0', rgb, 0.1, DRAWFLAG_NORMAL);
 
        // go back to the top to make alternated columns highlighting and to print the strings
-       pos_y -= 1.25 * hud_fontsize_y;
-       pos_y -= autocvar_scoreboard_border_thickness;
+       pos.y -= 1.25 * hud_fontsize.y;
+       pos.y -= autocvar_scoreboard_border_thickness;
 
        pos += '1 1 0';
 
        if (scoreboard_highlight)
        {
-               column_dim_y = 1.25 * hud_fontsize_y; // header
-               column_dim_y += autocvar_scoreboard_border_thickness;
-               column_dim_y += body_table_height;
+               column_dim.y = 1.25 * hud_fontsize.y; // header
+               column_dim.y += autocvar_scoreboard_border_thickness;
+               column_dim.y += body_table_height;
        }
 
        // print the strings of the columns headers and draw the columns
        draw_beginBoldFont();
+       int i;
        for(i = 0; i < hud_num_fields; ++i)
        {
                if(hud_field[i] == SP_SEPARATOR)
                        break;
-               column_dim_x = hud_size[i] + hud_fontsize_x;
+               column_dim.x = hud_size[i] + hud_fontsize.x;
                if (scoreboard_highlight)
                {
                        if (i % 2)
-                               drawfill(pos - '0 1 0' - hud_fontsize_x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
+                               drawfill(pos - '0 1 0' - hud_fontsize.x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
                }
                drawstring(pos, hud_title[i], hud_fontsize, rgb * 1.5, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-               pos_x += column_dim_x;
+               pos.x += column_dim.x;
        }
        if(hud_field[i] == SP_SEPARATOR)
        {
-               pos_x = xmax;
-               tmp_y = 0;
+               pos.x = xmax;
+               tmp.y = 0;
                for(i = hud_num_fields-1; i > 0; --i)
                {
                        if(hud_field[i] == SP_SEPARATOR)
                                break;
 
-                       pos_x -= hud_size[i];
+                       pos.x -= hud_size[i];
 
                        if (scoreboard_highlight)
                        {
                                if (!(i % 2))
                                {
                                        if (i == hud_num_fields-1)
-                                               column_dim_x = hud_size[i] + hud_fontsize_x / 2 + 1;
+                                               column_dim.x = hud_size[i] + hud_fontsize.x / 2 + 1;
                                        else
-                                               column_dim_x = hud_size[i] + hud_fontsize_x;
-                                       drawfill(pos - '0 1 0' - hud_fontsize_x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
+                                               column_dim.x = hud_size[i] + hud_fontsize.x;
+                                       drawfill(pos - '0 1 0' - hud_fontsize.x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
                                }
                        }
 
-                       tmp_x = stringwidth(hud_title[i], FALSE, hud_fontsize);
-                       tmp_x = (hud_size[i] - tmp_x);
+                       tmp.x = stringwidth(hud_title[i], false, hud_fontsize);
+                       tmp.x = (hud_size[i] - tmp.x);
                        drawstring(pos + tmp, hud_title[i], hud_fontsize, rgb * 1.5, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-                       pos_x -= hud_fontsize_x;
+                       pos.x -= hud_fontsize.x;
                }
        }
        draw_endBoldFont();
 
-       pos_x = xmin;
-       pos_y += 1.25 * hud_fontsize_y; // skip the header
-       pos_y += autocvar_scoreboard_border_thickness;
+       pos.x = xmin;
+       pos.y += 1.25 * hud_fontsize.y; // skip the header
+       pos.y += autocvar_scoreboard_border_thickness;
 
        // item size
-       tmp_x = sbwidth;
-       tmp_y = hud_fontsize_y * 1.25;
+       tmp.x = sbwidth;
+       tmp.y = hud_fontsize.y * 1.25;
 
        // fill the table and draw the rows
        i = 0;
@@ -927,7 +930,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
                        if(pl.team != tm.team)
                                continue;
                        HUD_PrintScoreboardItem(pos, tmp, pl, (pl.sv_entnum == player_localnum), i);
-                       pos_y += 1.25 * hud_fontsize_y;
+                       pos.y += 1.25 * hud_fontsize.y;
                        ++i;
                }
        else
@@ -936,13 +939,13 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
                        if(pl.team == NUM_SPECTATOR)
                                continue;
                        HUD_PrintScoreboardItem(pos, tmp, pl, (pl.sv_entnum == player_localnum), i);
-                       pos_y += 1.25 * hud_fontsize_y;
+                       pos.y += 1.25 * hud_fontsize.y;
                        ++i;
                }
 
        if (i == 0)
-               pos_y += 1.25 * hud_fontsize_y; // move to the end of the table
-       pos_y += 1.25 * hud_fontsize_y; // move empty row (out of the table)
+               pos.y += 1.25 * hud_fontsize.y; // move to the end of the table
+       pos.y += 1.25 * hud_fontsize.y; // move empty row (out of the table)
 
        return pos;
 }
@@ -966,8 +969,8 @@ float HUD_WouldDrawScoreboard() {
 float average_accuracy;
 vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
 {
-       float i;
-       float weapon_cnt = WEP_COUNT - 3; // either vaporizer/vortex are hidden, no port-o-launch, no tuba
+       int i;
+       int weapon_cnt = WEP_COUNT - 3; // either vaporizer/vortex are hidden, no port-o-launch, no tuba
        float rows;
        if(autocvar_scoreboard_accuracy_doublerows)
                rows = 2;
@@ -980,10 +983,10 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        float g_instagib = 0;
 
        drawstring(pos, sprintf(_("Accuracy stats (average %d%%)"), average_accuracy), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-       pos_y += 1.25 * hud_fontsize_y + autocvar_scoreboard_border_thickness;
+       pos.y += 1.25 * hud_fontsize.y + autocvar_scoreboard_border_thickness;
        vector tmp = '0 0 0';
-       tmp_x = sbwidth;
-       tmp_y = height * rows;
+       tmp.x = sbwidth;
+       tmp.y = height * rows;
 
        if (teamplay)
                drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb * autocvar_scoreboard_color_bg_team, scoreboard_alpha_bg, DRAWFLAG_NORMAL);
@@ -1008,7 +1011,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        float weapons_with_stats;
        weapons_with_stats = 0;
        if(rows == 2)
-               pos_x += weapon_width / 2;
+               pos.x += weapon_width / 2;
 
        if(switchweapon == WEP_VAPORIZER)
                g_instagib = 1; // TODO: real detection for instagib?
@@ -1045,17 +1048,17 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
                        s = sprintf("%d%%", weapon_stats*100);
 
                        float padding;
-                       padding = (weapon_width - stringwidth(s, FALSE, '1 0 0' * fontsize)) / 2; // center the accuracy value
+                       padding = (weapon_width - stringwidth(s, false, '1 0 0' * fontsize)) / 2; // center the accuracy value
 
                        if(!autocvar_scoreboard_accuracy_nocolors)
                                rgb = Accuracy_GetColor(weapon_stats);
 
                        drawstring(pos + '1 0 0' * padding + '0 1 0' * weapon_height, s, '1 1 0' * fontsize, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
                }
-               pos_x += weapon_width * rows;
+               pos.x += weapon_width * rows;
                if(rows == 2 && i == 6) {
-                       pos_x -= sbwidth;
-                       pos_y += height;
+                       pos.x -= sbwidth;
+                       pos.y += height;
                }
        }
 
@@ -1063,22 +1066,22 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
                average_accuracy = floor((average_accuracy * 100 / weapons_with_stats) + 0.5);
 
        if(rows == 2)
-               pos_x -= weapon_width / 2;
-       pos_x -= sbwidth;
-       pos_y += height;
+               pos.x -= weapon_width / 2;
+       pos.x -= sbwidth;
+       pos.y += height;
 
-       pos_y +=  1.25 * hud_fontsize_y;
+       pos.y +=  1.25 * hud_fontsize.y;
        return pos;
 }
 
 vector HUD_DrawKeyValue(vector pos, string key, string value) {
-       float px = pos_x;
-       pos_x += hud_fontsize_x * 0.25;
+       float px = pos.x;
+       pos.x += hud_fontsize.x * 0.25;
        drawstring(pos, key, hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-       pos_x = xmax - stringwidth(value, FALSE, hud_fontsize) - hud_fontsize_x * 0.25;
+       pos.x = xmax - stringwidth(value, false, hud_fontsize) - hud_fontsize.x * 0.25;
        drawstring(pos, value, hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-       pos_x = px;
-       pos_y+= hud_fontsize_y;
+       pos.x = px;
+       pos.y+= hud_fontsize.y;
 
        return pos;
 }
@@ -1109,12 +1112,12 @@ vector HUD_DrawMapStats(vector pos, vector rgb, vector bg_size) {
 
        //  draw table header
        drawstring(pos, _("Map stats:"), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-       pos_y += 1.25 * hud_fontsize_y + autocvar_scoreboard_border_thickness;
+       pos.y += 1.25 * hud_fontsize.y + autocvar_scoreboard_border_thickness;
 
        // draw table
        vector tmp = '0 0 0';
-       tmp_x = sbwidth;
-       tmp_y = hud_fontsize_y * rows;
+       tmp.x = sbwidth;
+       tmp.y = hud_fontsize.y * rows;
 
        if (teamplay)
                drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb * autocvar_scoreboard_color_bg_team, scoreboard_alpha_bg, DRAWFLAG_NORMAL);
@@ -1137,14 +1140,14 @@ vector HUD_DrawMapStats(vector pos, vector rgb, vector bg_size) {
        }
 
        // update position
-       pos_y += 1.25 * hud_fontsize_y;
+       pos.y += 1.25 * hud_fontsize.y;
        return pos;
 }
 
 
 vector HUD_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg_size)
 {
-       float i;
+       int i;
        RANKINGS_RECEIVED_CNT = 0;
        for (i=RANKINGS_CNT-1; i>=0; --i)
                if (grecordtime[i])
@@ -1156,16 +1159,16 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg_
        float is_spec;
        is_spec = (GetPlayerColor(pl.sv_entnum) == NUM_SPECTATOR);
        vector hl_rgb;
-       hl_rgb_x = autocvar_scoreboard_color_bg_r + 0.5;
-       hl_rgb_y = autocvar_scoreboard_color_bg_g + 0.5;
-       hl_rgb_z = autocvar_scoreboard_color_bg_b + 0.5;
+       hl_rgb.x = autocvar_scoreboard_color_bg_r + 0.5;
+       hl_rgb.y = autocvar_scoreboard_color_bg_g + 0.5;
+       hl_rgb.z = autocvar_scoreboard_color_bg_b + 0.5;
 
-       pos_y += hud_fontsize_y;
+       pos.y += hud_fontsize.y;
        drawstring(pos, _("Rankings"), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-       pos_y += hud_fontsize_y + autocvar_scoreboard_border_thickness;
+       pos.y += hud_fontsize.y + autocvar_scoreboard_border_thickness;
        vector tmp = '0 0 0';
-       tmp_x = sbwidth;
-       tmp_y = 1.25 * hud_fontsize_y * RANKINGS_RECEIVED_CNT;
+       tmp.x = sbwidth;
+       tmp.y = 1.25 * hud_fontsize.y * RANKINGS_RECEIVED_CNT;
 
        if (teamplay)
                drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb * autocvar_scoreboard_color_bg_team, scoreboard_alpha_bg, DRAWFLAG_NORMAL);
@@ -1184,15 +1187,15 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg_
                n = grecordholder[i];
                p = count_ordinal(i+1);
                if(grecordholder[i] == GetPlayerName(player_localnum))
-                       drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
+                       drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize.y, hl_rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
                else if(!(i % 2) && scoreboard_highlight)
-                       drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
-               drawstring(pos, p, '1 1 0' * hud_fontsize_y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-               drawstring(pos + '3 0 0' * hud_fontsize_y, TIME_ENCODED_TOSTRING(t), '1 1 0' * hud_fontsize_y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-               drawcolorcodedstring(pos + '8 0 0' * hud_fontsize_y, n, '1 1 0' * hud_fontsize_y, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-               pos_y += 1.25 * hud_fontsize_y;
+                       drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize.y, hl_rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
+               drawstring(pos, p, '1 1 0' * hud_fontsize.y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+               drawstring(pos + '3 0 0' * hud_fontsize.y, TIME_ENCODED_TOSTRING(t), '1 1 0' * hud_fontsize.y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(pos + '8 0 0' * hud_fontsize.y, n, '1 1 0' * hud_fontsize.y, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+               pos.y += 1.25 * hud_fontsize.y;
        }
-       pos_y += autocvar_scoreboard_border_thickness;
+       pos.y += autocvar_scoreboard_border_thickness;
 
        return pos;
 }
@@ -1249,9 +1252,9 @@ void HUD_DrawScoreboard()
        sbwidth = xmax - xmin;
 
        // Initializes position
-       pos_x = xmin;
-       pos_y = ymin;
-       pos_z = 0;
+       pos.x = xmin;
+       pos.y = ymin;
+       pos.z = 0;
 
        // Heading
        vector sb_heading_fontsize;
@@ -1260,7 +1263,7 @@ void HUD_DrawScoreboard()
        drawstring(pos, _("Scoreboard"), sb_heading_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
        draw_endBoldFont();
 
-       pos_y += sb_heading_fontsize_y + hud_fontsize_y * 0.25;
+       pos.y += sb_heading_fontsize.y + hud_fontsize.y * 0.25;
 
        // Draw the scoreboard
        vector bg_size = draw_getimagesize("gfx/scoreboard/scoreboard_bg") * autocvar_scoreboard_bg_scale;
@@ -1268,7 +1271,7 @@ void HUD_DrawScoreboard()
        if(teamplay)
        {
                vector team_score_baseoffset;
-               team_score_baseoffset = eY * (2 * autocvar_scoreboard_border_thickness + hud_fontsize_y) - eX * (autocvar_scoreboard_border_thickness + hud_fontsize_x * 0.25);
+               team_score_baseoffset = eY * (2 * autocvar_scoreboard_border_thickness + hud_fontsize.y) - eX * (autocvar_scoreboard_border_thickness + hud_fontsize.x * 0.25);
                for(tm = teams.sort_next; tm; tm = tm.sort_next)
                {
                        if(tm.team == NUM_SPECTATOR)
@@ -1277,33 +1280,26 @@ void HUD_DrawScoreboard()
                        draw_beginBoldFont();
                        rgb = Team_ColorRGB(tm.team);
                        str = ftos(tm.(teamscores[ts_primary]));
-                       drawstring(pos + team_score_baseoffset - eX * stringwidth(str, FALSE, hud_fontsize * 1.5), str, hud_fontsize * 1.5, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+                       drawstring(pos + team_score_baseoffset - eX * stringwidth(str, false, hud_fontsize * 1.5), str, hud_fontsize * 1.5, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
 
                        if(ts_primary != ts_secondary)
                        {
                                str = ftos(tm.(teamscores[ts_secondary]));
-                               drawstring(pos + team_score_baseoffset - eX * stringwidth(str, FALSE, hud_fontsize) + eY * hud_fontsize_y * 1.5, str, hud_fontsize, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+                               drawstring(pos + team_score_baseoffset - eX * stringwidth(str, false, hud_fontsize) + eY * hud_fontsize.y * 1.5, str, hud_fontsize, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
                        }
                        draw_endBoldFont();
 
                        pos = HUD_Scoreboard_MakeTable(pos, tm, rgb, bg_size);
                }
-
-#ifdef GMQCC
-               rgb = '0 0 0';
-#endif
-               rgb_x = autocvar_scoreboard_color_bg_r;
-               rgb_y = autocvar_scoreboard_color_bg_g;
-               rgb_z = autocvar_scoreboard_color_bg_b;
+               rgb.x = autocvar_scoreboard_color_bg_r;
+               rgb.y = autocvar_scoreboard_color_bg_g;
+               rgb.z = autocvar_scoreboard_color_bg_b;
        }
        else
        {
-#ifdef GMQCC
-               rgb = '0 0 0';
-#endif
-               rgb_x = autocvar_scoreboard_color_bg_r;
-               rgb_y = autocvar_scoreboard_color_bg_g;
-               rgb_z = autocvar_scoreboard_color_bg_b;
+               rgb.x = autocvar_scoreboard_color_bg_r;
+               rgb.y = autocvar_scoreboard_color_bg_g;
+               rgb.z = autocvar_scoreboard_color_bg_b;
 
                for(tm = teams.sort_next; tm; tm = tm.sort_next)
                {
@@ -1317,11 +1313,11 @@ void HUD_DrawScoreboard()
        if(gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE) {
                if(race_speedaward) {
                        drawcolorcodedstring(pos, sprintf(_("Speed award: %d ^7(%s^7)"), race_speedaward, race_speedaward_holder), hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-                       pos_y += 1.25 * hud_fontsize_y;
+                       pos.y += 1.25 * hud_fontsize.y;
                }
                if(race_speedaward_alltimebest) {
                        drawcolorcodedstring(pos, sprintf(_("All-time fastest: %d ^7(%s^7)"), race_speedaward_alltimebest, race_speedaward_alltimebest_holder), hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-                       pos_y += 1.25 * hud_fontsize_y;
+                       pos.y += 1.25 * hud_fontsize.y;
                }
                pos = HUD_DrawScoreboardRankings(pos, playerslots[player_localnum], rgb, bg_size);
        }
@@ -1343,14 +1339,14 @@ void HUD_DrawScoreboard()
        specs = 0;
        tmp = pos;
        vector item_size;
-       item_size_x = sbwidth;
-       item_size_y = hud_fontsize_y * 1.25;
-       item_size_z = 0;
+       item_size.x = sbwidth;
+       item_size.y = hud_fontsize.y * 1.25;
+       item_size.z = 0;
        for(pl = players.sort_next; pl; pl = pl.sort_next)
        {
                if(pl.team != NUM_SPECTATOR)
                        continue;
-               pos_y += 1.25 * hud_fontsize_y;
+               pos.y += 1.25 * hud_fontsize.y;
                HUD_PrintScoreboardItem(pos, item_size, pl, (pl.sv_entnum == player_localnum), specs);
                ++specs;
        }
@@ -1360,7 +1356,7 @@ void HUD_DrawScoreboard()
                draw_beginBoldFont();
                drawstring(tmp, _("Spectators"), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
                draw_endBoldFont();
-               pos_y += 1.25 * hud_fontsize_y;
+               pos.y += 1.25 * hud_fontsize.y;
        }
 
        // Print info string
@@ -1418,8 +1414,8 @@ void HUD_DrawScoreboard()
                }
        }
 
-       pos_y += 1.2 * hud_fontsize_y;
-       drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, TRUE, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+       pos.y += 1.2 * hud_fontsize.y;
+       drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, true, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
 
        // print information about respawn status
        float respawn_time = getstatf(STAT_RESPAWN_TIME);
@@ -1453,9 +1449,9 @@ void HUD_DrawScoreboard()
                else if(time >= respawn_time)
                        str = sprintf(_("You are dead, press ^2%s^7 to respawn"), getcommandkey("jump", "+jump"));
 
-               pos_y += 1.2 * hud_fontsize_y;
-               drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, TRUE, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+               pos.y += 1.2 * hud_fontsize.y;
+               drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, true, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
        }
 
-       scoreboard_bottom = pos_y + 2 * hud_fontsize_y;
+       scoreboard_bottom = pos.y + 2 * hud_fontsize.y;
 }
index 3e5de00f2dfba9b5e9df2141097cdf0f96febb16..c0326eb786a854bb2fe69655614752d7dcd67953 100644 (file)
@@ -1,3 +1,14 @@
-float HUD_WouldDrawScoreboard(void);
+#ifndef SCOREBOARD_H
+#define SCOREBOARD_H
+
+float xmin, xmax, ymin, ymax, sbwidth;
+
 float scoreboard_active;
 float scoreboard_fade_alpha;
+
+void Cmd_HUD_SetFields(float argc);
+void HUD_InitScores();
+void HUD_UpdatePlayerPos(entity pl);
+void HUD_UpdateTeamPos(entity Team);
+float HUD_WouldDrawScoreboard(void);
+#endif
index 4a948ca2e845b804d586f44d997bb5e8b419e308..c6edf5040dbd1056b6f639fb4123bdcd0514ffe6 100644 (file)
@@ -1,3 +1,19 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "defs.qh"
+       #include "../common/constants.qh"
+       #include "../common/teams.qh"
+       #include "../common/util.qh"
+       #include "../common/mapinfo.qh"
+       #include "autocvars.qh"
+       #include "main.qh"
+       #include "../csqcmodellib/cl_model.qh"
+       #include "shownames.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
+
 // self.isactive = player is in range and coordinates/status (health and armor) are up to date
 // self.origin = player origin TODO: should maybe move this so it's the origin of the shownames tag already in SSQC for culling?
 // self.healthvalue
@@ -37,7 +53,7 @@ void Draw_ShowNames(entity ent)
                }
 
                // handle tag fading
-               float overlap = FALSE, onscreen, crosshairdistance;
+               float overlap = false, onscreen, crosshairdistance;
                vector o, eo;
 
                o = project_3d_to_2d(ent.origin);
@@ -51,30 +67,30 @@ void Draw_ShowNames(entity ent)
                                if(e == ent)
                                        continue;
                                eo = project_3d_to_2d(e.origin);
-                               if (!(eo_z < 0 || eo_x < 0 || eo_y < 0 || eo_x > vid_conwidth || eo_y > vid_conheight))
+                               if (!(eo.z < 0 || eo.x < 0 || eo.y < 0 || eo.x > vid_conwidth || eo.y > vid_conheight))
                                {
-                                       eo_z = 0;
-                                       if(vlen((eX * o_x + eY * o_y) - eo) < autocvar_hud_shownames_antioverlap_distance && vlen(ent.origin - view_origin) > vlen(e.origin - view_origin))
+                                       eo.z = 0;
+                                       if(vlen((eX * o.x + eY * o.y) - eo) < autocvar_hud_shownames_antioverlap_distance && vlen(ent.origin - view_origin) > vlen(e.origin - view_origin))
                                        {
-                                               overlap = TRUE;
+                                               overlap = true;
                                                break;
                                        }
                                }
                        }
                }
 
-               onscreen = (o_z >= 0 && o_x >= 0 && o_y >= 0 && o_x <= vid_conwidth && o_y <= vid_conheight);
-               crosshairdistance = sqrt( pow(o_x - vid_conwidth/2, 2) + pow(o_y - vid_conheight/2, 2) );
+               onscreen = (o.z >= 0 && o.x >= 0 && o.y >= 0 && o.x <= vid_conwidth && o.y <= vid_conheight);
+               crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) );
 
                if(autocvar_hud_shownames_crosshairdistance)
                {
                        if(autocvar_hud_shownames_crosshairdistance > crosshairdistance)
                                ent.pointtime = time;
 
-                       if (!(ent.pointtime + autocvar_hud_shownames_crosshairdistance_time > time))
-                               overlap = TRUE;
+                       if (ent.pointtime + autocvar_hud_shownames_crosshairdistance_time <= time)
+                               overlap = true;
                        else
-                               overlap = (autocvar_hud_shownames_crosshairdistance_antioverlap ? overlap : FALSE); // override what antioverlap says unless allowed by cvar.
+                               overlap = (autocvar_hud_shownames_crosshairdistance_antioverlap ? overlap : false); // override what antioverlap says unless allowed by cvar.
                }
 
                if(!ent.fadedelay)
@@ -123,26 +139,26 @@ void Draw_ShowNames(entity ent)
                        resize = 0.5 + 0.5 * ((autocvar_hud_shownames_maxdistance - autocvar_hud_shownames_mindistance) - max(0, dist - autocvar_hud_shownames_mindistance)) / (autocvar_hud_shownames_maxdistance - autocvar_hud_shownames_mindistance);
 
                // draw the sprite image
-               if(o_z >= 0)
+               if(o.z >= 0)
                {
-                       o_z = 0;
+                       o.z = 0;
 
                        vector myPos, mySize;
                        mySize = (eX * autocvar_hud_shownames_aspect + eY) * autocvar_hud_shownames_fontsize;
-                       myPos = o - '0.5 0 0' * mySize_x - '0 1 0' * mySize_y;
+                       myPos = o - '0.5 0 0' * mySize.x - '0 1 0' * mySize.y;
 
                        // size scaling
-                       mySize_x *= resize;
-                       mySize_y *= resize;
+                       mySize.x *= resize;
+                       mySize.y *= resize;
 
-                       myPos_x += 0.5 * (mySize_x / resize - mySize_x);
-                       myPos_y += (mySize_y / resize - mySize_y);
+                       myPos.x += 0.5 * (mySize.x / resize - mySize.x);
+                       myPos.y += (mySize.y / resize - mySize.y);
 
                        vector namepos; // this is where the origin of the string
                        float namewidth;
 
                        namepos = myPos;
-                       namewidth = mySize_x;
+                       namewidth = mySize.x;
 
                        if(autocvar_hud_shownames_status && teamplay)
                        {
@@ -150,10 +166,10 @@ void Draw_ShowNames(entity ent)
                                {
                                        if(ent.healthvalue > 0)
                                        {
-                                               HUD_Panel_DrawProgressBar(namepos + '0 1 0' * autocvar_hud_shownames_fontsize * resize, eX * 0.5 * mySize_x + eY * resize * autocvar_hud_shownames_statusbar_height, "nametag_statusbar", ent.healthvalue/autocvar_hud_panel_healtharmor_maxhealth, 0, 1, '1 0 0', a, DRAWFLAG_NORMAL);
+                                               HUD_Panel_DrawProgressBar(namepos + '0 1 0' * autocvar_hud_shownames_fontsize * resize, eX * 0.5 * mySize.x + eY * resize * autocvar_hud_shownames_statusbar_height, "nametag_statusbar", ent.healthvalue/autocvar_hud_panel_healtharmor_maxhealth, 0, 1, '1 0 0', a, DRAWFLAG_NORMAL);
 
                                                if(ent.armorvalue > 0)
-                                                       HUD_Panel_DrawProgressBar(namepos + '0 1 0' * autocvar_hud_shownames_fontsize * resize + eX * 0.5 * mySize_x, eX * 0.5 * mySize_x + eY * resize * autocvar_hud_shownames_statusbar_height, "nametag_statusbar", ent.armorvalue/autocvar_hud_panel_healtharmor_maxarmor, 0, 0, '0 1 0', a, DRAWFLAG_NORMAL);
+                                                       HUD_Panel_DrawProgressBar(namepos + '0 1 0' * autocvar_hud_shownames_fontsize * resize + eX * 0.5 * mySize.x, eX * 0.5 * mySize.x + eY * resize * autocvar_hud_shownames_statusbar_height, "nametag_statusbar", ent.armorvalue/autocvar_hud_panel_healtharmor_maxarmor, 0, 0, '0 1 0', a, DRAWFLAG_NORMAL);
                                        }
                                }
                        }
@@ -167,10 +183,10 @@ void Draw_ShowNames(entity ent)
                        s = textShortenToWidth(s, namewidth, '1 1 0' * autocvar_hud_shownames_fontsize, stringwidth_colors);
 
                        float width;
-                       width = stringwidth(s, TRUE, '1 1 0' * autocvar_hud_shownames_fontsize);
+                       width = stringwidth(s, true, '1 1 0' * autocvar_hud_shownames_fontsize);
 
                        if (width != namewidth)
-                               namepos_x += (namewidth - width) / 2;
+                               namepos.x += (namewidth - width) / 2;
                        drawcolorcodedstring(namepos, s, '1 1 0' * autocvar_hud_shownames_fontsize, a, DRAWFLAG_NORMAL);
                        drawfontscale = '1 1 0';
                }
@@ -180,7 +196,7 @@ void Draw_ShowNames(entity ent)
 entity shownames_ent[255];
 void Draw_ShowNames_All()
 {
-       float i;
+       int i;
        for(i = 0; i < maxclients; ++i)
        {
                float t;
index adbfa57120376e5091f3c957d05557b9873de870..f196f8f83340c75dfcffa464534dd2e61f5ca385 100644 (file)
@@ -1,5 +1,9 @@
+#ifndef SHOWNAMES_H
+#define SHOWNAMES_H
+
 .float healthvalue;
 .float armorvalue;
 .float sameteam;
 .float fadedelay;
 .float pointtime;
+#endif
index 225df0ce032a87b5e924c6495d3fcb6a265df1a4..4d05d2c5ff21ace01c3beefc42e70e45287a6c05 100644 (file)
@@ -1,5 +1,4 @@
-//.float(entity,entity) sort_cmp;
-.entity sort_next, sort_prev;
+#include "sortlist.qh"
 
 entity Sort_Spawn()
 {
@@ -92,25 +91,12 @@ void Sort_Finish(entity sort)
 
 entity Sort_Get(entity sort, float i)
 {
-       for(; sort.sort_next && i > 0; --i)
+       for (; sort.sort_next && i > 0; --i)
                sort = sort.sort_next;
        return sort;
 }
 */
 
-/**
- * Swap two neighbours in a sortlist.
- * @param a FIRST entity
- * @param b entity after a
- */
-#define SORT_SWAP(a,b)                                                                 \
-       b.sort_prev = a.sort_prev;                                                      \
-       a.sort_next = b.sort_next;                                                      \
-       if(b.sort_next) b.sort_next.sort_prev = a;                      \
-       if(a.sort_prev) a.sort_prev.sort_next = b;                      \
-       a.sort_prev = b;                                                                        \
-       b.sort_next = a
-
 /*
 void Sort_Erase(entity ent)
 {
diff --git a/qcsrc/client/sortlist.qh b/qcsrc/client/sortlist.qh
new file mode 100644 (file)
index 0000000..1b84287
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef SORTLIST_H
+#define SORTLIST_H
+
+//.float(entity,entity) sort_cmp;
+.entity sort_next, sort_prev;
+
+entity Sort_Spawn();
+
+/**
+ * Swap two neighbours in a sortlist.
+ * @param a FIRST entity
+ * @param b entity after a
+ */
+#define SORT_SWAP(a,b)                                                                 \
+       b.sort_prev = a.sort_prev;                                                      \
+       a.sort_next = b.sort_next;                                                      \
+       if(b.sort_next) b.sort_next.sort_prev = a;                      \
+       if(a.sort_prev) a.sort_prev.sort_next = b;                      \
+       a.sort_prev = b;                                                                        \
+       b.sort_next = a
+
+#endif
diff --git a/qcsrc/client/sys-post.qh b/qcsrc/client/sys-post.qh
deleted file mode 100644 (file)
index ec4e31a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#pragma noref 0
-
-#undef ATTEN_NORM
diff --git a/qcsrc/client/sys-pre.qh b/qcsrc/client/sys-pre.qh
deleted file mode 100644 (file)
index 3b4fc14..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#define CSQC
-
-#define ATTEN_NORM builtin_ATTEN_NORM
-
-#pragma noref 1
index 1d90a664c30c22ba29e37836437bea62ab87185d..662a673d7999f901922507b07bc2fe8b974564d3 100644 (file)
@@ -1,11 +1,4 @@
-float music_disabled;
-entity music_default;
-entity music_target;
-entity music_trigger;
-// FIXME also control bgmvolume here, to not require a target_music for the default track.
-
-.float state;
-.float lastvol;
+#include "target_music.qh"
 
 void TargetMusic_Advance()
 {
@@ -60,17 +53,14 @@ void TargetMusic_Advance()
 
 void Net_TargetMusic()
 {
-       float vol, fai, fao, tim, id;
-       string noi;
-       entity e;
-
-       id = ReadShort();
-       vol = ReadByte() / 255.0;
-       fai = ReadByte() / 16.0;
-       fao = ReadByte() / 16.0;
-       tim = ReadByte();
-       noi = ReadString();
+       int id = ReadShort();
+       float vol = ReadByte() / 255.0;
+       float fai = ReadByte() / 16.0;
+       float fao = ReadByte() / 16.0;
+       float tim = ReadByte();
+       string noi = ReadString();
 
+       entity e;
        for(e = world; (e = findfloat(e, enttype, ENT_CLIENT_TRIGGER_MUSIC)); )
        {
                if(e.count == id)
@@ -138,9 +128,7 @@ void Ent_TriggerMusic_Remove()
 
 void Ent_ReadTriggerMusic()
 {
-       float f;
-       string s;
-       f = ReadByte();
+       int f = ReadByte();
        if(f & 4)
        {
                self.origin_x = ReadCoord();
@@ -170,7 +158,7 @@ void Ent_ReadTriggerMusic()
                self.volume = ReadByte() / 255.0;
                self.fade_time = ReadByte() / 16.0;
                self.fade_rate = ReadByte() / 16.0;
-               s = self.noise;
+               string s = self.noise;
                if(self.noise)
                        strunzone(self.noise);
                self.noise = strzone(ReadString());
diff --git a/qcsrc/client/target_music.qh b/qcsrc/client/target_music.qh
new file mode 100644 (file)
index 0000000..c685214
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef TARGET_MUSIC_H
+#define TARGET_MUSIC_H
+
+float music_disabled;
+entity music_default;
+entity music_target;
+entity music_trigger;
+// FIXME also control bgmvolume here, to not require a target_music for the default track.
+
+.int state;
+.float lastvol;
+
+void TargetMusic_Advance();
+
+void Net_TargetMusic();
+
+void Ent_TriggerMusic_Think();
+
+void Ent_TriggerMusic_Remove();
+
+void Ent_ReadTriggerMusic();
+#endif
index 0c0f10204a4773c2da21e2aa6669a46a88d4740a..1822acb5e467a2934b7c60aa80353d5c7d019636 100644 (file)
@@ -1,33 +1,30 @@
-float teamradar_angle; // player yaw angle
-vector teamradar_origin3d_in_texcoord; // player origin
-vector teamradar_origin2d; // 2D origin
-vector teamradar_size2d; // 2D size
-vector teamradar_extraclip_mins, teamradar_extraclip_maxs; // for non-centered radar display
-float teamradar_size; // 2D scale factor
-float hud_panel_radar_scale; // window size = ...qu
-float v_flipped;
+#if defined(CSQC)
+       #include "teamradar.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
 
 float vlen2d(vector v)
 {
-       return sqrt(v_x * v_x + v_y * v_y);
+       return sqrt(v.x * v.x + v.y * v.y);
 }
 
 float vlen_maxnorm2d(vector v)
 {
-       return max(v_x, v_y, -v_x, -v_y);
+       return max(v.x, v.y, -v.x, -v.y);
 }
 
 float vlen_minnorm2d(vector v)
 {
-       return min(max(v_x, -v_x), max(v_y, -v_y));
+       return min(max(v.x, -v.x), max(v.y, -v.y));
 }
 
 vector teamradar_3dcoord_to_texcoord(vector in)
 {
        vector out;
-       out_x = (in_x - mi_picmin_x) / (mi_picmax_x - mi_picmin_x);
-       out_y = (in_y - mi_picmin_y) / (mi_picmax_y - mi_picmin_y);
-       out_z = 0;
+       out.x = (in.x - mi_picmin.x) / (mi_picmax.x - mi_picmin.x);
+       out.y = (in.y - mi_picmin.y) / (mi_picmax.y - mi_picmin.y);
+       out.z = 0;
        return out;
 }
 
@@ -37,18 +34,18 @@ vector teamradar_texcoord_to_2dcoord(vector in)
        in -= teamradar_origin3d_in_texcoord;
 
        out = rotate(in, teamradar_angle * DEG2RAD);
-       out_y = - out_y; // screen space is reversed
+       out.y = - out.y; // screen space is reversed
 
        out = out * teamradar_size;
        if(v_flipped)
-               out_x = -out_x;
+               out.x = -out.x;
        out += teamradar_origin2d;
        return out;
 }
 
 vector yinvert(vector v)
 {
-       v_y = 1 - v_y;
+       v.y = 1 - v.y;
        return v;
 }
 
@@ -89,15 +86,15 @@ void draw_teamradar_player(vector coord3d, vector pangles, vector rgb)
        makevectors(pangles - '0 1 0' * teamradar_angle);
        if(v_flipped)
        {
-               v_forward_x = -v_forward_x;
-               v_right_x = -v_right_x;
-               v_up_x = -v_up_x;
+               v_forward.x = -v_forward.x;
+               v_right.x = -v_right.x;
+               v_up.x = -v_up.x;
        }
-       v_forward_z = 0;
+       v_forward.z = 0;
        v_forward = normalize(v_forward);
-       v_forward_y *= -1.0;
-       v_right_x = -v_forward_y;
-       v_right_y = v_forward_x;
+       v_forward.y *= -1.0;
+       v_right.x = -v_forward.y;
+       v_right.y = v_forward.x;
 
        if(rgb == '1 1 1')
                rgb2 = '0 0 0';
@@ -121,43 +118,39 @@ void draw_teamradar_player(vector coord3d, vector pangles, vector rgb)
 
 void draw_teamradar_icon(vector coord, float icon, entity pingdata, vector rgb, float a)
 {
-       float dt;
-       vector v;
-       float i;
-
        coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(coord));
        drawpic(coord - '4 4 0', strcat("gfx/teamradar_icon_", ftos(icon)), '8 8 0', rgb, a, 0);
 
        if(pingdata)
        {
-               for(i = 0; i < MAX_TEAMRADAR_TIMES; ++i)
+               for(int i = 0; i < MAX_TEAMRADAR_TIMES; ++i)
                {
-                       dt = pingdata.(teamradar_times[i]);
+                       float dt = pingdata.(teamradar_times[i]);
                        if(dt == 0)
                                continue;
                        dt = time - dt;
                        if(dt >= 1 || dt <= 0)
                                continue;
-                       v = '2 2 0' * teamradar_size * dt;
+                       vector v = '2 2 0' * teamradar_size * dt;
                        drawpic(coord - 0.5 * v, "gfx/teamradar_ping", v, '1 1 1', (1 - dt) * a, DRAWFLAG_ADDITIVE);
                }
        }
 }
 
-void draw_teamradar_link(vector start, vector end, float colors)
+void draw_teamradar_link(vector start, vector end, int colors)
 {
        vector c0, c1, norm;
 
        start = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(start));
        end = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(end));
        norm = normalize(start - end);
-       norm_z = norm_x;
-       norm_x = -norm_y;
-       norm_y = norm_z;
-       norm_z = 0;
+       norm.z = norm.x;
+       norm.x = -norm.y;
+       norm.y = norm.z;
+       norm.z = 0;
 
-       c0 = colormapPaletteColor(colors & 0x0F, FALSE);
-       c1 = colormapPaletteColor((colors & 0xF0) / 0x10, FALSE);
+       c0 = colormapPaletteColor(colors & 0x0F, false);
+       c1 = colormapPaletteColor((colors & 0xF0) / 0x10, false);
 
        R_BeginPolygon("", 0);
        R_PolygonVertex(start - norm, '0 0 0', c0, panel_fg_alpha);
@@ -167,14 +160,6 @@ void draw_teamradar_link(vector start, vector end, float colors)
        R_EndPolygon();
 }
 
-float hud_panel_radar_scale;
-float hud_panel_radar_foreground_alpha;
-float hud_panel_radar_rotation;
-noref vector hud_panel_radar_size; // fteqcc sucks
-float hud_panel_radar_zoommode;
-float hud_panel_radar_maximized_zoommode;
-float hud_panel_radar_maximized_rotation;
-
 void teamradar_loadcvars()
 {
        v_flipped = autocvar_v_flipped;
@@ -194,16 +179,15 @@ void teamradar_loadcvars()
        // match this to defaultXonotic.cfg!
        if(!hud_panel_radar_scale) hud_panel_radar_scale = 4096;
        if(!hud_panel_radar_foreground_alpha) hud_panel_radar_foreground_alpha = 0.8 * panel_fg_alpha;
-       if(!hud_panel_radar_size_x) hud_panel_radar_size_x = 128;
-       if(!hud_panel_radar_size_y) hud_panel_radar_size_y = hud_panel_radar_size_x;
+       if(!hud_panel_radar_size.x) hud_panel_radar_size.x = 128;
+       if(!hud_panel_radar_size.y) hud_panel_radar_size.y = hud_panel_radar_size.x;
 }
 
 // radar links
 
 void Ent_RadarLink()
 {
-       float sendflags;
-       sendflags = ReadByte();
+       int sendflags = ReadByte();
 
        InterpolateOrigin_Undo();
 
index 2dbdf89658898f756af81d33cf6c57d80e12c664..31defc8efbd6c3b3bb8f78d03eaf71fa7ee07da6 100644 (file)
@@ -1,7 +1,55 @@
-#define MAX_TEAMRADAR_TIMES 32
+#ifndef TEAMRADAR_H
+#define TEAMRADAR_H
+
+const int MAX_TEAMRADAR_TIMES = 32;
 
 // to make entities have dots on the team radar
 .float teamradar_icon;
 .float teamradar_times[MAX_TEAMRADAR_TIMES];
-.float teamradar_time_index;
+.int teamradar_time_index;
 .vector teamradar_color;
+
+float teamradar_angle; // player yaw angle
+vector teamradar_origin3d_in_texcoord; // player origin
+vector teamradar_origin2d; // 2D origin
+vector teamradar_size2d; // 2D size
+vector teamradar_extraclip_mins, teamradar_extraclip_maxs; // for non-centered radar display
+float teamradar_size; // 2D scale factor
+float v_flipped;
+
+float hud_panel_radar_scale; // window size = ...qu
+float hud_panel_radar_foreground_alpha;
+float hud_panel_radar_rotation;
+vector hud_panel_radar_size;
+float hud_panel_radar_zoommode;
+float hud_panel_radar_maximized_zoommode;
+float hud_panel_radar_maximized_rotation;
+
+
+float vlen2d(vector v);
+
+float vlen_maxnorm2d(vector v);
+
+float vlen_minnorm2d(vector v);
+
+vector teamradar_3dcoord_to_texcoord(vector in);
+
+vector teamradar_texcoord_to_2dcoord(vector in);
+
+vector yinvert(vector v);
+
+void draw_teamradar_background(float fg);
+
+void draw_teamradar_player(vector coord3d, vector pangles, vector rgb);
+
+void draw_teamradar_icon(vector coord, float icon, entity pingdata, vector rgb, float a);
+
+void draw_teamradar_link(vector start, vector end, int colors);
+
+void teamradar_loadcvars();
+
+// radar links
+
+void Ent_RadarLink();
+
+#endif
diff --git a/qcsrc/client/tturrets.qc b/qcsrc/client/tturrets.qc
deleted file mode 100644 (file)
index ba64006..0000000
+++ /dev/null
@@ -1,685 +0,0 @@
-string tid2info_base;
-string tid2info_head;
-string tid2info_name;
-vector  tid2info_min;
-vector  tid2info_max;
-
-void turret_tid2info(float _tid);
-void turret_precache(float _tid);
-float turret_is_precache[TID_LAST];
-
-void turrets_precache()
-{
-    turret_precache(TID_COMMON);
-}
-
-void turret_precache(float _tid)
-{
-    if (!turret_is_precache[TID_COMMON])
-    {
-        precache_sound ("weapons/rocket_impact.wav");
-        precache_model ("models/turrets/base-gib1.md3");
-        precache_model ("models/turrets/base-gib2.md3");
-        precache_model ("models/turrets/base-gib3.md3");
-        precache_model ("models/turrets/base-gib4.md3");
-        precache_model ("models/turrets/head-gib1.md3");
-        precache_model ("models/turrets/head-gib2.md3");
-        precache_model ("models/turrets/head-gib3.md3");
-        precache_model ("models/turrets/head-gib4.md3");
-        precache_model ("models/turrets/terrainbase.md3");
-        precache_model ("models/turrets/base.md3");
-        precache_model ("models/turrets/rocket.md3");
-    }
-    turret_tid2info(_tid);
-    if(turret_is_precache[_tid])
-        return;
-
-    switch(_tid)
-    {
-        case TID_EWHEEL:
-            precache_model ("models/turrets/ewheel-base2.md3");
-            precache_model ("models/turrets/ewheel-gun1.md3");
-            break;
-        case TID_FLAC:
-            precache_model ("models/turrets/flac.md3");
-            break;
-        case TID_FUSION:
-            precache_model ("models/turrets/reactor.md3");
-            break;
-        case TID_HELLION:
-            precache_model ("models/turrets/hellion.md3");
-            break;
-        case TID_HK:
-            precache_model ("models/turrets/hk.md3");
-            break;
-        case TID_MACHINEGUN:
-            precache_model ("models/turrets/machinegun.md3");
-            precache_sound ("weapons/uzi_fire.wav");
-            break;
-        case TID_MLRS:
-            precache_model ("models/turrets/mlrs.md3");
-            break;
-        case TID_PHASER:
-            precache_model ("models/turrets/phaser.md3");
-            precache_model ("models/turrets/phaser_beam.md3");
-            precache_sound ("turrets/phaser.wav");
-            break;
-        case TID_PLASMA:
-            precache_model ("models/turrets/plasma.md3");
-            break;
-        case TID_PLASMA_DUAL:
-            precache_model ("models/turrets/plasmad.md3");
-            break;
-        case TID_TESLA:
-            precache_model ("models/turrets/tesla_head.md3");
-            precache_model ("models/turrets/tesla_base.md3");
-            break;
-        case TID_WALKER:
-            precache_model ("models/turrets/walker_head_minigun.md3");
-            precache_model ("models/turrets/walker_body.md3");
-            precache_sound ("weapons/uzi_fire.wav");
-            break;
-    }
-    turret_is_precache[_tid] = TRUE;
-}
-
-void turret_tid2info(float _tid)
-{
-    tid2info_base = "models/turrets/base.md3";
-    tid2info_min = '-32 -32 0';
-    tid2info_max = '32 32 64';
-
-    switch(_tid)
-    {
-        case TID_EWHEEL:
-            tid2info_base = "models/turrets/ewheel-base2.md3";
-            tid2info_head = "models/turrets/ewheel-gun1.md3";
-            tid2info_name = "eWheel";
-            break;
-        case TID_FLAC:
-            tid2info_head = "models/turrets/flac.md3";
-            tid2info_name = "Flac Cannon";
-            break;
-        case TID_FUSION:
-            tid2info_head = "models/turrets/reactor.md3";
-            tid2info_name = "Fusion Reactor";
-            tid2info_min = '-34 -34 0';
-            tid2info_max = '34 34 90';
-            break;
-        case TID_HELLION:
-            tid2info_head = "models/turrets/hellion.md3";
-            tid2info_name = "Hellion";
-            break;
-        case TID_HK:
-            tid2info_head = "models/turrets/hk.md3";
-            tid2info_name = "Hunter-Killer";
-            break;
-        case TID_MACHINEGUN:
-            tid2info_head = "models/turrets/machinegun.md3";
-            tid2info_name = "Machinegun";
-            break;
-        case TID_MLRS:
-            tid2info_head = "models/turrets/mlrs.md3";
-            tid2info_name = "MLRS";
-            break;
-        case TID_PHASER:
-            tid2info_head = "models/turrets/phaser.md3";
-            tid2info_name = "Phaser";
-            break;
-        case TID_PLASMA:
-            tid2info_head = "models/turrets/plasma.md3";
-            tid2info_name = "Plasma";
-            break;
-        case TID_PLASMA_DUAL:
-            tid2info_head = "models/turrets/plasmad.md3";
-            tid2info_name = "Dual Plasma";
-            break;
-        case TID_TESLA:
-            tid2info_base = "models/turrets/tesla_base.md3";
-            tid2info_head = "models/turrets/tesla_head.md3";
-            tid2info_name = "Tesla coil";
-            tid2info_min = '-60 -60 0';
-            tid2info_max  ='60 60 128';
-            break;
-        case TID_WALKER:
-            tid2info_base = "models/turrets/walker_body.md3";
-            tid2info_head = "models/turrets/walker_head_minigun.md3";
-            tid2info_name = "Walker";
-            tid2info_min = '-70 -70 0';
-            tid2info_max = '70 70 95';
-            break;
-    }
-}
-
-void turret_remove()
-{
-    remove(self.tur_head);
-    //remove(self.enemy);
-    self.tur_head = world;
-}
-
-.vector glowmod;
-void turret_changeteam()
-{
-       switch(self.team - 1)
-       {
-        case NUM_TEAM_1: // Red
-            self.glowmod = '2 0 0';
-            self.teamradar_color = '1 0 0';
-            break;
-
-        case NUM_TEAM_2: // Blue
-            self.glowmod = '0 0 2';
-            self.teamradar_color = '0 0 1';
-            break;
-
-        case NUM_TEAM_3: // Yellow
-            self.glowmod = '1 1 0';
-            self.teamradar_color = '1 1 0';
-            break;
-
-        case NUM_TEAM_4: // Pink
-            self.glowmod = '1 0 1';
-            self.teamradar_color = '1 0 1';
-            break;
-       }
-
-       if(self.team)
-        self.colormap = 1024 + (self.team - 1) * 17;
-
-       self.tur_head.colormap = self.colormap;
-       self.tur_head.glowmod = self.glowmod;
-
-}
-
-void turret_head_draw()
-{
-    self.drawmask = MASK_NORMAL;
-}
-
-void turret_draw()
-{
-    float dt;
-
-    dt = time - self.move_time;
-    self.move_time = time;
-    if(dt <= 0)
-        return;
-
-    self.tur_head.angles += dt * self.tur_head.move_avelocity;
-
-    if (self.health < 127)
-    {
-        dt = random();
-
-        if(dt < 0.03)
-            te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
-    }
-
-    if(self.health < 85)
-    if(dt < 0.01)
-        pointparticles(particleeffectnum("smoke_large"), (self.origin + (randomvec() * 80)), '0 0 0', 1);
-
-    if(self.health < 32)
-    if(dt < 0.015)
-        pointparticles(particleeffectnum("smoke_small"), (self.origin + (randomvec() * 80)), '0 0 0', 1);
-
-}
-
-void turret_draw2d()
-{
-       if(self.netname == "")
-           return;
-
-       if(!autocvar_g_waypointsprite_turrets)
-               return;
-
-    if(autocvar_cl_hidewaypoints)
-        return;
-
-       float dist = vlen(self.origin - view_origin);
-    float t = (GetPlayerColor(player_localnum) + 1);
-
-       vector o;
-       string txt;
-
-       if(autocvar_cl_vehicles_hud_tactical)
-       if(dist < 10240 && t != self.team)
-       {
-        // TODO: Vehicle tactical hud
-        o = project_3d_to_2d(self.origin + '0 0 32');
-        if(o_z < 0
-        || o_x < (vid_conwidth * waypointsprite_edgeoffset_left)
-        || o_y < (vid_conheight * waypointsprite_edgeoffset_top)
-        || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
-        || o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
-            return; // Dont draw wp's for turrets out of view
-        o_z = 0;
-        if(hud != HUD_NORMAL)
-        {
-            switch(hud)
-            {
-                case HUD_SPIDERBOT:
-                case HUD_WAKIZASHI:
-                case HUD_RAPTOR:
-                case HUD_BUMBLEBEE:
-                    if(self.turret_type == TID_EWHEEL || self.turret_type == TID_WALKER)
-                        txt = "gfx/vehicles/vth-mover.tga";
-                    else
-                        txt = "gfx/vehicles/vth-stationary.tga";
-
-                    vector pz = drawgetimagesize(txt) * 0.25;
-                    drawpic(o - pz * 0.5, txt, pz , '1 1 1', 0.75, DRAWFLAG_NORMAL);
-                    break;
-            }
-        }
-       }
-
-       if(dist > self.maxdistance)
-        return;
-
-       string spriteimage = self.netname;
-       float a = self.alpha * autocvar_hud_panel_fg_alpha;
-       vector rgb = spritelookupcolor(spriteimage, self.teamradar_color);
-
-
-       if(self.maxdistance > waypointsprite_normdistance)
-               a *= pow(bound(0, (self.maxdistance - dist) / (self.maxdistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent);
-       else if(self.maxdistance > 0)
-               a *= pow(bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha;
-
-       if(rgb == '0 0 0')
-       {
-               self.teamradar_color = '1 0 1';
-               printf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage);
-       }
-
-       txt = self.netname;
-       if(autocvar_g_waypointsprite_spam && waypointsprite_count >= autocvar_g_waypointsprite_spam)
-               txt = _("Spam");
-       else
-               txt = spritelookuptext(spriteimage);
-
-       if(time - floor(time) > 0.5 && t == self.team)
-       {
-               if(self.helpme && time < self.helpme)
-               {
-                   a *= SPRITE_HELPME_BLINK;
-                   txt = sprintf(_("%s under attack!"), txt);
-               }
-               else
-                       a *= spritelookupblinkvalue(spriteimage);
-       }
-
-       if(autocvar_g_waypointsprite_uppercase)
-               txt = strtoupper(txt);
-
-       if(a > 1)
-       {
-               rgb *= a;
-               a = 1;
-       }
-
-       if(a <= 0)
-           return;
-
-       rgb = fixrgbexcess(rgb);
-
-       o = project_3d_to_2d(self.origin + '0 0 64');
-       if(o_z < 0
-       || o_x < (vid_conwidth * waypointsprite_edgeoffset_left)
-       || o_y < (vid_conheight * waypointsprite_edgeoffset_top)
-       || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
-       || o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
-           return; // Dont draw wp's for turrets out of view
-
-       o_z = 0;
-
-       float edgedistance_min, crosshairdistance;
-               edgedistance_min = min((o_y - (vid_conheight * waypointsprite_edgeoffset_top)),
-       (o_x - (vid_conwidth * waypointsprite_edgeoffset_left)),
-       (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x,
-       (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o_y);
-
-       float vidscale = max(vid_conwidth / vid_width, vid_conheight / vid_height);
-
-       crosshairdistance = sqrt( pow(o_x - vid_conwidth/2, 2) + pow(o_y - vid_conheight/2, 2) );
-
-       t = waypointsprite_scale * vidscale;
-       a *= waypointsprite_alpha;
-
-       {
-               a = a * (1 - (1 - waypointsprite_distancefadealpha) * (bound(0, dist/waypointsprite_distancefadedistance, 1)));
-               t = t * (1 - (1 - waypointsprite_distancefadescale) * (bound(0, dist/waypointsprite_distancefadedistance, 1)));
-       }
-       if (edgedistance_min < waypointsprite_edgefadedistance) {
-               a = a * (1 - (1 - waypointsprite_edgefadealpha) * (1 - bound(0, edgedistance_min/waypointsprite_edgefadedistance, 1)));
-               t = t * (1 - (1 - waypointsprite_edgefadescale) * (1 - bound(0, edgedistance_min/waypointsprite_edgefadedistance, 1)));
-       }
-       if(crosshairdistance < waypointsprite_crosshairfadedistance) {
-               a = a * (1 - (1 - waypointsprite_crosshairfadealpha) * (1 - bound(0, crosshairdistance/waypointsprite_crosshairfadedistance, 1)));
-               t = t * (1 - (1 - waypointsprite_crosshairfadescale) * (1 - bound(0, crosshairdistance/waypointsprite_crosshairfadedistance, 1)));
-       }
-
-       o = drawspritearrow(o, M_PI, rgb, a, SPRITE_ARROW_SCALE * t);
-    o = drawspritetext(o, M_PI, (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t, rgb, a, waypointsprite_fontsize * '1 1 0', txt);
-    drawhealthbar(
-            o,
-            0,
-            self.health / 255,
-            '0 0 0',
-            '0 0 0',
-            0.5 * SPRITE_HEALTHBAR_WIDTH * t,
-            0.5 * SPRITE_HEALTHBAR_HEIGHT * t,
-            SPRITE_HEALTHBAR_MARGIN * t + 0.5 * waypointsprite_fontsize,
-            SPRITE_HEALTHBAR_BORDER * t,
-            0,
-            rgb,
-            a * SPRITE_HEALTHBAR_BORDERALPHA,
-            rgb,
-            a * SPRITE_HEALTHBAR_HEALTHALPHA,
-            DRAWFLAG_NORMAL
-            );
-}
-
-void turret_walker_draw()
-{
-    float dt;
-
-    dt = time - self.move_time;
-    self.move_time = time;
-    if(dt <= 0)
-        return;
-
-    fixedmakevectors(self.angles);
-    movelib_groundalign4point(300, 100, 0.25, 45);
-    setorigin(self, self.origin + self.velocity * dt);
-    self.tur_head.angles += dt * self.tur_head.move_avelocity;
-    self.angles_y = self.move_angles_y;
-
-    if (self.health < 127)
-    if(random() < 0.15)
-        te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
-}
-
-void turret_ewheel_draw()
-{
-    float dt;
-
-    dt = time - self.move_time;
-    self.move_time = time;
-    if(dt <= 0)
-        return;
-
-    fixedmakevectors(self.angles);
-    setorigin(self, self.origin + self.velocity * dt);
-    self.tur_head.angles += dt * self.tur_head.move_avelocity;
-    self.angles_y = self.move_angles_y;
-
-    if (self.health < 127)
-    if(random() < 0.05)
-        te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
-}
-
-void(entity e, entity tagentity, string tagname) setattachment = #443;
-void turret_construct()
-{
-    if(self.tur_head == world)
-        self.tur_head = spawn();
-
-    turret_tid2info(self.turret_type);
-    self.netname = tid2info_name;
-
-    setorigin(self, self.origin);
-    setmodel(self, tid2info_base);
-    setmodel(self.tur_head, tid2info_head);
-    setsize(self, tid2info_min, tid2info_max);
-    setsize(self.tur_head, '0 0 0', '0 0 0');
-
-    if(self.turret_type == TID_EWHEEL)
-        setattachment(self.tur_head, self, "");
-    else
-        setattachment(self.tur_head, self, "tag_head");
-
-    self.tur_head.classname     = "turret_head";
-    self.tur_head.owner         = self;
-    self.tur_head.move_movetype = MOVETYPE_NOCLIP;
-    self.move_movetype          = MOVETYPE_NOCLIP;
-    self.tur_head.angles        = self.angles;
-    self.health                 = 255;
-    self.solid                  = SOLID_BBOX;
-    self.tur_head.solid         = SOLID_NOT;
-    self.movetype               = MOVETYPE_NOCLIP;
-    self.tur_head.movetype      = MOVETYPE_NOCLIP;
-    self.draw                   = turret_draw;
-    self.entremove              = turret_remove;
-    self.drawmask               = MASK_NORMAL;
-    self.tur_head.drawmask      = MASK_NORMAL;
-    self.anim_start_time        = 0;
-    self.draw2d = turret_draw2d;
-    self.maxdistance = autocvar_g_waypointsprite_turrets_maxdist;
-    self.teamradar_color = '1 0 0';
-    self.alpha = 1;
-
-    if(self.turret_type == TID_EWHEEL || self.turret_type == TID_WALKER)
-    {
-        self.gravity            = 1;
-        self.movetype           = MOVETYPE_BOUNCE;
-        self.move_movetype      = MOVETYPE_BOUNCE;
-        self.move_origin        = self.origin;
-        self.move_time          = time;
-        switch(self.turret_type)
-        {
-            case TID_EWHEEL:
-                self.draw               = turret_ewheel_draw;
-                break;
-            case TID_WALKER:
-                self.draw               = turret_walker_draw;
-                break;
-
-        }
-    }
-}
-
-entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode);
-void turret_gibboom();
-void turret_gib_draw()
-{
-    Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
-
-    self.drawmask = MASK_NORMAL;
-
-       if(self.cnt)
-       {
-           if(time >= self.nextthink)
-           {
-            turret_gibboom();
-            remove(self);
-           }
-       }
-       else
-       {
-        self.alpha = bound(0, self.nextthink - time, 1);
-        if(self.alpha < ALPHA_MIN_VISIBLE)
-            remove(self);
-       }
-}
-
-void turret_gibboom()
-{
-    float i;
-
-    sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
-    pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
-
-    for (i = 1; i < 5; i = i + 1)
-        turret_gibtoss(strcat("models/turrets/head-gib", ftos(i), ".md3"), self.origin + '0 0 2', self.velocity + randomvec() * 700, '0 0 0', FALSE);
-}
-
-entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode)
-{
-    entity gib;
-
-    traceline(_from, _to, MOVE_NOMONSTERS, world);
-    if(trace_startsolid)
-        return world;
-
-    gib = spawn();
-    setorigin(gib, _from);
-    setmodel(gib, _model);
-    gib.colormod    = _cmod;
-       gib.solid       = SOLID_CORPSE;
-    gib.draw        = turret_gib_draw;
-    gib.cnt         = _explode;
-    setsize(gib, '-1 -1 -1', '1 1 1');
-    if(_explode)
-    {
-        gib.nextthink = time + 0.2 * (autocvar_cl_gibs_lifetime * (1 + prandom() * 0.15));
-        gib.effects = EF_FLAME;
-    }
-    else
-        gib.nextthink = time + autocvar_cl_gibs_lifetime * (1 + prandom() * 0.15);
-
-    gib.gravity         = 1;
-       gib.move_movetype   = MOVETYPE_BOUNCE;
-       gib.move_origin     = _from;
-       setorigin(gib,        _from);
-       gib.move_velocity   = _to;
-       gib.move_avelocity  = prandomvec() * 32;
-       gib.move_time       = time;
-       gib.damageforcescale = 1;
-       gib.classname = "turret_gib";
-
-       return gib;
-}
-
-void turret_die()
-{
-
-    sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
-    pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
-    turret_tid2info(self.turret_type);
-    if (!autocvar_cl_nogibs)
-    {
-        // Base
-        if(self.turret_type == TID_EWHEEL)
-            turret_gibtoss(tid2info_base, self.origin + '0 0 18', self.velocity + '0 0 400' + '0.1 0.1 1' * (random() * 400), '-1 -1 -1', TRUE);
-        else if (self.turret_type == TID_WALKER)
-            turret_gibtoss(tid2info_base, self.origin + '0 0 18', self.velocity + '0 0 300' + '0.1 0.1 1' * (random() * 200), '-1 -1 -1', TRUE);
-        else if (self.turret_type == TID_TESLA)
-            turret_gibtoss(tid2info_base, self.origin + '0 0 18', '0 0 200', '-1 -1 -1', FALSE);
-        else
-        {
-            if (random() > 0.5)
-            {
-                turret_gibtoss("models/turrets/base-gib2.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', FALSE);
-                turret_gibtoss("models/turrets/base-gib3.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', FALSE);
-                turret_gibtoss("models/turrets/base-gib4.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', FALSE);
-            }
-            else
-                turret_gibtoss("models/turrets/base-gib1.md3", self.origin + '0 0 8', '0 0 0', '0 0 0', TRUE);
-
-            entity headgib = turret_gibtoss(tid2info_head, self.origin + '0 0 32', '0 0 200' + randomvec() * 200, '-1 -1 -1', TRUE);
-            if(headgib)
-            {
-                headgib.angles = headgib.move_angles = self.tur_head.angles;
-                headgib.avelocity = headgib.move_avelocity = self.tur_head.move_avelocity + randomvec() * 45;
-                headgib.avelocity_y = headgib.move_avelocity_y = headgib.move_avelocity_y * 5;
-                headgib.gravity = 0.5;
-            }
-        }
-    }
-
-    setmodel(self, "null");
-    setmodel(self.tur_head, "null");
-}
-
-void ent_turret()
-{
-    float sf;
-    sf = ReadByte();
-
-       if(sf & TNSF_SETUP)
-       {
-           self.turret_type = ReadByte();
-
-           self.origin_x = ReadCoord();
-           self.origin_y = ReadCoord();
-           self.origin_z = ReadCoord();
-           setorigin(self, self.origin);
-
-           self.angles_x = ReadAngle();
-           self.angles_y = ReadAngle();
-
-           turret_precache(self.turret_type);
-           turret_construct();
-           self.colormap = 1024;
-           self.glowmod = '0 1 1';
-           self.tur_head.colormap = self.colormap;
-           self.tur_head.glowmod = self.glowmod;
-    }
-
-    if(sf & TNSF_ANG)
-    {
-        if(self.tur_head == world) // aparenly this can happpen before TNSF_SETUP. great.
-            self.tur_head = spawn();
-
-        self.tur_head.move_angles_x = ReadShort();
-        self.tur_head.move_angles_y = ReadShort();
-        //self.tur_head.angles = self.angles + self.tur_head.move_angles;
-        self.tur_head.angles = self.tur_head.move_angles;
-    }
-
-    if(sf & TNSF_AVEL)
-    {
-        if(self.tur_head == world) // aparenly this can happpen before TNSF_SETUP. great.
-            self.tur_head = spawn();
-
-        self.tur_head.move_avelocity_x = ReadShort();
-        self.tur_head.move_avelocity_y = ReadShort();
-    }
-
-    if(sf & TNSF_MOVE)
-    {
-        self.origin_x = ReadShort();
-        self.origin_y = ReadShort();
-        self.origin_z = ReadShort();
-        setorigin(self, self.origin);
-
-        self.velocity_x = ReadShort();
-        self.velocity_y = ReadShort();
-        self.velocity_z = ReadShort();
-
-        self.move_angles_y = ReadShort();
-
-        self.move_time     = time;
-        self.move_velocity = self.velocity;
-        self.move_origin   = self.origin;
-    }
-
-    if(sf & TNSF_ANIM)
-    {
-        self.frame1time = ReadCoord();
-        self.frame      = ReadByte();
-    }
-
-    if(sf & TNSF_STATUS)
-    {
-        float _tmp;
-        _tmp = ReadByte();
-        if(_tmp != self.team)
-        {
-            self.team = _tmp;
-            turret_changeteam();
-        }
-
-        _tmp = ReadByte();
-        if(_tmp == 0 && self.health != 0)
-            turret_die();
-        else if(self.health && self.health != _tmp)
-            self.helpme = servertime + 10;
-
-        self.health = _tmp;
-    }
-    //self.enemy.health = self.health / 255;
-}
index 73d72b61e716c5ad200630d46b05365f217f74eb..cd518e091d3c2ecdd3677aaf7c2ca50a5f6217aa 100644 (file)
-#define TUBA_MIN -18
-#define TUBA_MAX  27
-#define TUBA_INSTRUMENTS 3
+#include "tuba.qh"
 
-#define TUBA_STARTNOTE(i,n) strcat("weapons/tuba", (i ? ftos(i) : ""), "_loopnote", ftos(n), ".wav")
-.float note; // note
-.float attenuate; // if set, attenuate it
-.float cnt; // current volume
-.float count; // initial volume
-.float tuba_instrument;
+#define TUBA_STARTNOTE(i, n) strcat("weapons/tuba", (i ? ftos(i) : ""), "_loopnote", ftos(n), ".wav")
 
-float Tuba_PitchStep;
+const int TUBA_MIN = -18;
+const int TUBA_MAX = 27;
+const int TUBA_INSTRUMENTS = 3;
 
-void tubasound(entity e, float restart)
+.int note;
+.bool tuba_attenuate;
+.float tuba_volume;
+.float tuba_volume_initial;
+.int tuba_instrument;
+
+int Tuba_PitchStep;
+
+void tubasound(entity e, bool restart)
 {
-       string snd1;
-
-       snd1 = string_null;
-
-       if(Tuba_PitchStep)
-       {
-               string snd2;
-               float f1, f2;
-               float p1, p2;
-               float m;
-
-               f1 = 1;
-               p1 = 1;
-               snd2 = string_null;
-               f2 = 0;
-               p2 = 1;
-
-               m = e.note % Tuba_PitchStep;
-               if(m)
-               {
-                       if(e.note - m < TUBA_MIN)
-                       {
-                               if(restart)
+       string snd1 = string_null;
+       if (Tuba_PitchStep) {
+               float vol1 = 1;
+               float speed1 = 1;
+               string snd2 = string_null;
+               float vol2 = 0;
+               float speed2 = 1;
+
+               int m = pymod(e.note, Tuba_PitchStep);
+               if (m) {
+                       if (e.note - m < TUBA_MIN) {
+                               if (restart) {
                                        snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note - m + Tuba_PitchStep);
-                               p1 = pow(2.0, (m - Tuba_PitchStep) / 12.0);
-                       }
-                       else if(e.note - m + Tuba_PitchStep > TUBA_MAX)
-                       {
-                               if(restart)
+                               }
+                               speed1 = pow(2.0, (m - Tuba_PitchStep) / 12.0);
+                       } else if (e.note - m + Tuba_PitchStep > TUBA_MAX) {
+                               if (restart) {
                                        snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note - m);
-                               p1 = pow(2.0, m / 12.0);
-                       }
-                       else
-                       {
-                               if(restart)
+                               }
+                               speed1 = pow(2.0, m / 12.0);
+                       } else {
+                               if (restart) {
                                        snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note - m);
-                               f1 = cos(M_PI_2 * m / Tuba_PitchStep);
-                               p1 = pow(2.0, m / 12.0);
-                               if(restart)
+                               }
+                               vol1 = cos(M_PI_2 * m / Tuba_PitchStep);
+                               speed1 = pow(2.0, m / 12.0);
+                               if (restart) {
                                        snd2 = TUBA_STARTNOTE(e.tuba_instrument, e.note - m + Tuba_PitchStep);
-                               f2 = sin(M_PI_2 * m / Tuba_PitchStep);
-                               p2 = pow(2.0, (m - Tuba_PitchStep) / 12.0);
+                               }
+                               vol2 = sin(M_PI_2 * m / Tuba_PitchStep);
+                               speed2 = pow(2.0, (m - Tuba_PitchStep) / 12.0);
                        }
-               }
-               else
-               {
-                       if(restart)
-                               snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note);
+               } else if (restart) {
+                       snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note);
                }
 
-               sound7(e, CH_TUBA_SINGLE, snd1, e.cnt * f1, e.attenuate * autocvar_g_balance_tuba_attenuation, 100 * p1, 0);
-               if(f2)
-                       sound7(e.enemy, CH_TUBA_SINGLE, snd2, e.cnt * f2, e.attenuate * autocvar_g_balance_tuba_attenuation, 100 * p2, 0);
-       }
-       else
-       {
-               if(restart)
+               sound7(e, CH_TUBA_SINGLE, snd1, e.tuba_volume * vol1, e.tuba_attenuate * autocvar_g_balance_tuba_attenuation, 100 * speed1, 0);
+               if (vol2) {
+                       sound7(e.enemy, CH_TUBA_SINGLE, snd2, e.tuba_volume * vol2, e.tuba_attenuate * autocvar_g_balance_tuba_attenuation, 100 * speed2, 0);
+               }
+       } else {
+               if (restart) {
                        snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note);
-               sound(e, CH_TUBA_SINGLE, snd1, e.cnt, e.attenuate * autocvar_g_balance_tuba_attenuation);
+               }
+               sound(e, CH_TUBA_SINGLE, snd1, e.tuba_volume, e.tuba_attenuate * autocvar_g_balance_tuba_attenuation);
        }
 }
 
 void Ent_TubaNote_Think()
 {
-       float f;
-       f = autocvar_g_balance_tuba_fadetime;
-       if(f > 0)
-               self.cnt -= frametime * self.count / f;
-       else
-               self.cnt = 0;
+       float f = autocvar_g_balance_tuba_fadetime;
+       if (f > 0) {
+               self.tuba_volume -= frametime * self.tuba_volume_initial / f;
+       } else {
+               self.tuba_volume = 0;
+       }
        self.nextthink = time;
-       if(self.cnt <= 0)
-       {
+       if (self.tuba_volume <= 0) {
                sound(self, CH_TUBA_SINGLE, "misc/null.wav", 0, 0);
-               if(self.enemy)
-               {
+               if (self.enemy) {
                        sound(self.enemy, CH_TUBA_SINGLE, "misc/null.wav", 0, 0);
                        remove(self.enemy);
                }
                remove(self);
-       }
-       else
-       {
+       } else {
                tubasound(self, 0);
        }
 }
 
 void Ent_TubaNote_UpdateSound()
 {
-       self.enemy.cnt = bound(0, VOL_BASE * autocvar_g_balance_tuba_volume, 1);
-       self.enemy.count = self.enemy.cnt;
+       self.enemy.tuba_volume = bound(0, VOL_BASE * autocvar_g_balance_tuba_volume, 1);
+       self.enemy.tuba_volume_initial = self.enemy.tuba_volume;
        self.enemy.note = self.note;
        self.enemy.tuba_instrument = self.tuba_instrument;
        tubasound(self.enemy, 1);
@@ -115,56 +100,47 @@ void Ent_TubaNote_StopSound()
        self.enemy = world;
 }
 
-void Ent_TubaNote(float bIsNew)
+void Ent_TubaNote(bool isNew)
 {
-       float f, n, i, att, upd;
-       f = ReadByte();
-
-       upd = 0;
-
-       if(f & 1)
-       {
-               n = ReadChar();
-               i = ReadByte();
-               att = (i & 1);
-               i = floor(i / 2);
-
-               if(n != self.note || i != self.tuba_instrument || bIsNew)
-               {
-                       if(self.enemy)
+       bool upd = false;
+       int f = ReadByte();
+       if (f & 1) {
+               int n = ReadChar();
+               int i = ReadByte();
+               bool att = (i & 1);
+               i >>= 1;
+
+               if (self.enemy) {
+                       if (n != self.note || i != self.tuba_instrument || isNew) {
                                Ent_TubaNote_StopSound();
-               }
-
-               if(!self.enemy)
-               {
+                       }
+               } else {
                        self.enemy = spawn();
                        self.enemy.classname = "tuba_note";
-                       if(Tuba_PitchStep)
-                       {
+                       if (Tuba_PitchStep) {
                                self.enemy.enemy = spawn();
                                self.enemy.enemy.classname = "tuba_note_2";
                        }
-                       bIsNew = TRUE;
+                       isNew = true;
                }
 
-               self.enemy.attenuate = att;
+               self.enemy.tuba_attenuate = att;
 
-               if(bIsNew)
-               {
+               if (isNew) {
                        self.note = n;
                        self.tuba_instrument = i;
-                       upd = 1;
+                       upd = true;
                }
        }
 
-       if(f & 2)
-       {
+       if (f & 2) {
                self.enemy.origin_x = ReadCoord();
                self.enemy.origin_y = ReadCoord();
                self.enemy.origin_z = ReadCoord();
                setorigin(self.enemy, self.enemy.origin);
-               if(self.enemy.enemy)
+               if (self.enemy.enemy) {
                        setorigin(self.enemy.enemy, self.enemy.origin);
+               }
        }
 
        self.think = Ent_TubaNote_StopSound;
@@ -172,28 +148,25 @@ void Ent_TubaNote(float bIsNew)
        self.enemy.think = Ent_TubaNote_Think;
        self.enemy.nextthink = time + 10;
 
-       if(upd)
+       if (upd) {
                Ent_TubaNote_UpdateSound();
+       }
 }
 
 void Tuba_Precache()
 {
-       float i, n;
        Tuba_PitchStep = autocvar_g_balance_tuba_pitchstep;
-       if(Tuba_PitchStep)
-       {
-               if(!checkextension("DP_SND_SOUND7_WIP2") && !checkextension("DP_SND_SOUND7"))
-               {
+       if (Tuba_PitchStep) {
+               if (!checkextension("DP_SND_SOUND7_WIP2") && !checkextension("DP_SND_SOUND7")) {
                        print("^1NOTE:^7 requested pitch shifting, but not supported by this engine build\n");
                        Tuba_PitchStep = 0;
                }
        }
-       for(n = TUBA_MIN; n <= TUBA_MAX; ++n)
-       {
-               if(!Tuba_PitchStep || ((n % Tuba_PitchStep) == 0))
-               {
-                       for(i = 0; i < TUBA_INSTRUMENTS; ++i)
+       for (int n = TUBA_MIN; n <= TUBA_MAX; ++n) {
+               if (!Tuba_PitchStep || pymod(n, Tuba_PitchStep) == 0) {
+                       for (int i = 0; i < TUBA_INSTRUMENTS; ++i) {
                                precache_sound(TUBA_STARTNOTE(i, n));
+                       }
                }
        }
 }
diff --git a/qcsrc/client/tuba.qh b/qcsrc/client/tuba.qh
new file mode 100644 (file)
index 0000000..bdc1386
--- /dev/null
@@ -0,0 +1,5 @@
+#ifndef TUBA_H
+#define TUBA_H
+void Ent_TubaNote(bool isNew);
+void Tuba_Precache();
+#endif
diff --git a/qcsrc/client/vehicles/racer.qc b/qcsrc/client/vehicles/racer.qc
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/qcsrc/client/vehicles/raptor.qc b/qcsrc/client/vehicles/raptor.qc
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/qcsrc/client/vehicles/spiderbot.qc b/qcsrc/client/vehicles/spiderbot.qc
deleted file mode 100644 (file)
index e69de29..0000000
index d8727e1760b4a05941246d7a96a5c0dcf13fb8de..290385e495fcdd389aa4629b22fbe773a159d961 100644 (file)
@@ -1,36 +1,54 @@
-#define hud_bg "gfx/vehicles/frame.tga"
-#define hud_sh "gfx/vehicles/vh-shield.tga"
-
-#define hud_hp_bar "gfx/vehicles/bar_up_left.tga"
-#define hud_hp_ico "gfx/vehicles/health.tga"
-#define hud_sh_bar "gfx/vehicles/bar_dwn_left.tga"
-#define hud_sh_ico "gfx/vehicles/shield.tga"
-
-#define hud_ammo1_bar "gfx/vehicles/bar_up_right.tga"
-#define hud_ammo1_ico "gfx/vehicles/bullets.tga"
-#define hud_ammo2_bar "gfx/vehicles/bar_dwn_right.tga"
-#define hud_ammo2_ico "gfx/vehicles/rocket.tga"
-#define hud_energy "gfx/vehicles/energy.tga"
-
-#define SBRM_FIRST 1
-#define SBRM_VOLLY 1
-#define SBRM_GUIDE 2
-#define SBRM_ARTILLERY 3
-#define SBRM_LAST 3
-
-#define RSM_FIRST 1
-#define RSM_BOMB 1
-#define RSM_FLARE 2
-#define RSM_LAST 2
+#if defined(CSQC)
+    #include "../../dpdefs/csprogsdefs.qh"
+    #include "../defs.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/stats.qh"
+    #include "../../common/util.qh"
+    #include "../../common/buffs.qh"
+    #include "../autocvars.qh"
+    #include "../movetypes.qh"
+    #include "../prandom.qh"
+    #include "../main.qh"
+    #include "vehicles.qh"
+    #include "../../csqcmodellib/cl_model.qh"
+    #include "../../server/t_items.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
+const string hud_bg = "gfx/vehicles/frame.tga";
+const string hud_sh = "gfx/vehicles/vh-shield.tga";
+
+const string hud_hp_bar = "gfx/vehicles/bar_up_left.tga";
+const string hud_hp_ico = "gfx/vehicles/health.tga";
+const string hud_sh_bar = "gfx/vehicles/bar_dwn_left.tga";
+const string hud_sh_ico = "gfx/vehicles/shield.tga";
+
+const string hud_ammo1_bar = "gfx/vehicles/bar_up_right.tga";
+const string hud_ammo1_ico = "gfx/vehicles/bullets.tga";
+const string hud_ammo2_bar = "gfx/vehicles/bar_dwn_right.tga";
+const string hud_ammo2_ico = "gfx/vehicles/rocket.tga";
+const string hud_energy = "gfx/vehicles/energy.tga";
+
+const int SBRM_FIRST = 1;
+const int SBRM_VOLLY = 1;
+const int SBRM_GUIDE = 2;
+const int SBRM_ARTILLERY = 3;
+const int SBRM_LAST = 3;
+
+const int RSM_FIRST = 1;
+const int RSM_BOMB = 1;
+const int RSM_FLARE = 2;
+const int RSM_LAST = 2;
 
 entity dropmark;
-var float autocvar_cl_vehicles_hudscale = 0.5;
-var float autocvar_cl_vehicles_hudalpha = 0.75;
+float autocvar_cl_vehicles_hudscale = 0.5;
+float autocvar_cl_vehicles_hudalpha = 0.75;
 
-#define raptor_ico  "gfx/vehicles/raptor.tga"
-#define raptor_gun  "gfx/vehicles/raptor_guns.tga"
-#define raptor_bomb "gfx/vehicles/raptor_bombs.tga"
-#define raptor_drop "gfx/vehicles/axh-dropcross.tga"
+const string raptor_ico =  "gfx/vehicles/raptor.tga";
+const string raptor_gun =  "gfx/vehicles/raptor_guns.tga";
+const string raptor_bomb = "gfx/vehicles/raptor_bombs.tga";
+const string raptor_drop = "gfx/vehicles/axh-dropcross.tga";
 string raptor_xhair;
 
 void CSQC_WAKIZASHI_HUD();
@@ -39,7 +57,7 @@ void CSQC_RAPTOR_HUD();
 void CSQC_BUMBLE_HUD();
 void CSQC_BUMBLE_GUN_HUD();
 
-#define MAX_AXH 4
+const int MAX_AXH = 4;
 entity AuxiliaryXhair[MAX_AXH];
 
 .string axh_image;
@@ -47,27 +65,27 @@ entity AuxiliaryXhair[MAX_AXH];
 .float  axh_drawflag;
 .float  axh_scale;
 
-#define bumb_ico  "gfx/vehicles/bumb.tga"
-#define bumb_lgun  "gfx/vehicles/bumb_lgun.tga"
-#define bumb_rgun  "gfx/vehicles/bumb_rgun.tga"
+const string bumb_ico =  "gfx/vehicles/bumb.tga";
+const string bumb_lgun =  "gfx/vehicles/bumb_lgun.tga";
+const string bumb_rgun =  "gfx/vehicles/bumb_rgun.tga";
 
-#define bumb_gun_ico  "gfx/vehicles/bumb_side.tga"
-#define bumb_gun_gun  "gfx/vehicles/bumb_side_gun.tga"
+const string bumb_gun_ico =  "gfx/vehicles/bumb_side.tga";
+const string bumb_gun_gun =  "gfx/vehicles/bumb_side_gun.tga";
 
-#define spider_ico  "gfx/vehicles/sbot.tga"
-#define spider_rkt  "gfx/vehicles/sbot_rpods.tga"
-#define spider_mgun "gfx/vehicles/sbot_mguns.tga"
+const string spider_ico =  "gfx/vehicles/sbot.tga";
+const string spider_rkt =  "gfx/vehicles/sbot_rpods.tga";
+const string spider_mgun = "gfx/vehicles/sbot_mguns.tga";
 string spider_xhair; // = "gfx/vehicles/axh-special1.tga";
 
-#define waki_ico "gfx/vehicles/waki.tga"
-#define waki_eng "gfx/vehicles/waki_e.tga"
-#define waki_gun "gfx/vehicles/waki_guns.tga"
-#define waki_rkt "gfx/vehicles/waki_rockets.tga"
-#define waki_xhair "gfx/vehicles/axh-special1.tga"
+const string waki_ico = "gfx/vehicles/waki.tga";
+const string waki_eng = "gfx/vehicles/waki_e.tga";
+const string waki_gun = "gfx/vehicles/waki_guns.tga";
+const string waki_rkt = "gfx/vehicles/waki_rockets.tga";
+const string waki_xhair = "gfx/vehicles/axh-special1.tga";
 
 float alarm1time;
 float alarm2time;
-float weapon2mode;
+int weapon2mode;
 
 void AuxiliaryXhair_Draw2D()
 {
@@ -75,10 +93,10 @@ void AuxiliaryXhair_Draw2D()
 
     psize = self.axh_scale * draw_getimagesize(self.axh_image);
     loc = project_3d_to_2d(self.move_origin) - 0.5 * psize;
-    if (!(loc_z < 0 || loc_x < 0 || loc_y < 0 || loc_x > vid_conwidth || loc_y > vid_conheight))
+    if (!(loc.z < 0 || loc.x < 0 || loc.y < 0 || loc.x > vid_conwidth || loc.y > vid_conheight))
     {
-        loc_z = 0;
-        psize_z = 0;
+        loc.z = 0;
+        psize.z = 0;
         drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
     }
 
@@ -86,9 +104,9 @@ void AuxiliaryXhair_Draw2D()
         self.draw2d = func_null;
 }
 
-void Net_AuXair2(float bIsNew)
+void Net_AuXair2(bool bIsNew)
 {
-    float axh_id       = bound(0, ReadByte(), MAX_AXH);
+    int axh_id = bound(0, ReadByte(), MAX_AXH);
     entity axh                 = AuxiliaryXhair[axh_id];
 
     if(axh == world || wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
@@ -104,22 +122,19 @@ void Net_AuXair2(float bIsNew)
                AuxiliaryXhair[axh_id] = axh;
     }
 
-       axh.move_origin_x       = ReadCoord();
-       axh.move_origin_y       = ReadCoord();
-       axh.move_origin_z       = ReadCoord();
-       axh.colormod_x          = ReadByte() / 255;
-       axh.colormod_y          = ReadByte() / 255;
-       axh.colormod_z          = ReadByte() / 255;
+       axh.move_origin_x = ReadCoord();
+       axh.move_origin_y = ReadCoord();
+       axh.move_origin_z = ReadCoord();
+       axh.colormod_x = ReadByte() / 255;
+       axh.colormod_y = ReadByte() / 255;
+       axh.colormod_z = ReadByte() / 255;
     axh.cnt                    = time;
     axh.draw2d                 = AuxiliaryXhair_Draw2D;
 }
 
 void Net_VehicleSetup()
 {
-
-    float i;
-
-    float hud_id = ReadByte();
+    int hud_id = ReadByte();
 
     // Weapon update?
     if(hud_id > HUD_VEHICLE_LAST)
@@ -139,10 +154,10 @@ void Net_VehicleSetup()
     hud_id  = bound(HUD_VEHICLE_FIRST, hud_id, HUD_VEHICLE_LAST);
 
     // Init auxiliary crosshairs
-    entity axh;
+    int i;
     for(i = 0; i < MAX_AXH; ++i)
     {
-        axh = AuxiliaryXhair[i];
+        entity axh = AuxiliaryXhair[i];
         if(axh != world && !wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
             remove(axh);
 
@@ -211,13 +226,13 @@ void Net_VehicleSetup()
     }
 }
 #define HUD_GETSTATS \
-    local noref float vh_health    = getstati(STAT_VEHICLESTAT_HEALTH);  \
-       local noref float shield    = getstati(STAT_VEHICLESTAT_SHIELD);  \
-       local noref float energy    = getstati(STAT_VEHICLESTAT_ENERGY);  \
-       local noref float ammo1     = getstati(STAT_VEHICLESTAT_AMMO1);   \
-       local noref float reload1   = getstati(STAT_VEHICLESTAT_RELOAD1); \
-       local noref float ammo2     = getstati(STAT_VEHICLESTAT_AMMO2);   \
-       local noref float reload2   = getstati(STAT_VEHICLESTAT_RELOAD2);
+    int vh_health       = getstati(STAT_VEHICLESTAT_HEALTH);  \
+       float shield        = getstati(STAT_VEHICLESTAT_SHIELD);  \
+       noref int energy    = getstati(STAT_VEHICLESTAT_ENERGY);  \
+       noref float ammo1   = getstati(STAT_VEHICLESTAT_AMMO1);   \
+       noref float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
+       noref int ammo2     = getstati(STAT_VEHICLESTAT_AMMO2);   \
+       noref int reload2   = getstati(STAT_VEHICLESTAT_RELOAD2);
 
 void CSQC_BUMBLE_HUD()
 {
@@ -236,8 +251,8 @@ void CSQC_BUMBLE_HUD()
        HUD_GETSTATS
 
     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc_y = vid_conheight - picsize_y;
-    hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
+    hudloc.y = vid_conheight - picsize.y;
+    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
 
     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
 
@@ -261,7 +276,7 @@ void CSQC_BUMBLE_HUD()
 // Health bar
     picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
     drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -290,7 +305,7 @@ void CSQC_BUMBLE_HUD()
 // Shield bar
     picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
     drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -321,16 +336,16 @@ void CSQC_BUMBLE_HUD()
 // Gunner1 bar
     picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * ammo1, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight);
     drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 
 // Right gunner slot occupied?
        if(!AuxiliaryXhair[1].draw2d)
        {
-               shield = (picsize_x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), FALSE, '1 0 0' * picsize_y + '0 1 0' * picsize_y));
+               shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), false, '1 0 0' * picsize.y + '0 1 0' * picsize.y));
                drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
-               drawstring(hudloc + picloc + '1 0 0' * shield, _("No right gunner!"), '1 0 0' * picsize_y + '0 1 0' * picsize_y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL);
+               drawstring(hudloc + picloc + '1 0 0' * shield, _("No right gunner!"), '1 0 0' * picsize.y + '0 1 0' * picsize.y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL);
        }
 
 // ..  and icon
@@ -344,15 +359,15 @@ void CSQC_BUMBLE_HUD()
 // Gunner2 bar
     picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * ammo2, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo2, vid_conheight);
     drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 // Left gunner slot occupied?
        if(!AuxiliaryXhair[2].draw2d)
        {
-               shield = (picsize_x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), FALSE, '1 0 0' * picsize_y + '0 1 0' * picsize_y));
+               shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), false, '1 0 0' * picsize.y + '0 1 0' * picsize.y));
                drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
-               drawstring(hudloc + picloc + '1 0 0' * shield, _("No left gunner!"), '1 0 0' * picsize_y + '0 1 0' * picsize_y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL);
+               drawstring(hudloc + picloc + '1 0 0' * shield, _("No left gunner!"), '1 0 0' * picsize.y + '0 1 0' * picsize.y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL);
        }
 
 // ..  and icon
@@ -368,9 +383,9 @@ void CSQC_BUMBLE_HUD()
     else
     {
         picsize = draw_getimagesize(waki_xhair);
-        picsize_x *= 0.5;
-        picsize_y *= 0.5;
-        drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        picsize.x *= 0.5;
+        picsize.y *= 0.5;
+        drawpic('0.5 0 0' * (vid_conwidth - picsize.x) + '0 0.5 0' * (vid_conheight - picsize.y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     }
 
 }
@@ -387,8 +402,8 @@ void CSQC_BUMBLE_GUN_HUD()
        HUD_GETSTATS
 
     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc_y = vid_conheight - picsize_y;
-    hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
+    hudloc.y = vid_conheight - picsize.y;
+    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
 
     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
 
@@ -411,7 +426,7 @@ void CSQC_BUMBLE_GUN_HUD()
 // Health bar
     picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
     drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -440,7 +455,7 @@ void CSQC_BUMBLE_GUN_HUD()
 // Shield bar
     picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
     drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -468,7 +483,7 @@ void CSQC_BUMBLE_GUN_HUD()
 // Gun bar
     picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
     drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 
@@ -503,14 +518,14 @@ void CSQC_SPIDER_HUD()
         return;
 
     vector picsize, hudloc = '0 0 0', pic2size, picloc;
-    float i;
+    int i;
 
     // Fetch health & ammo stats
        HUD_GETSTATS
 
     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc_y = vid_conheight - picsize_y;
-    hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
+    hudloc.y = vid_conheight - picsize.y;
+    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
 
     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
 
@@ -532,7 +547,7 @@ void CSQC_SPIDER_HUD()
 // Health bar
     picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
     drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -559,7 +574,7 @@ void CSQC_SPIDER_HUD()
 // Shield bar
     picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
     drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -587,7 +602,7 @@ void CSQC_SPIDER_HUD()
 // Minigun bar
     picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * ammo1, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight);
     drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -600,21 +615,21 @@ void CSQC_SPIDER_HUD()
 
 // Rocket ammo bar
     picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
-    ammo1 = picsize_x / 8;
+    ammo1 = picsize.x / 8;
     picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x, hudloc_y + picloc_y, picsize_x * reload2, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload2, vid_conheight);
     drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 
 // ..  and icons
     pic2size = 0.35 * draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
-    picloc_x -= pic2size_x;
-    picloc_y += pic2size_y * 2.25;
+    picloc.x -= pic2size.x;
+    picloc.y += pic2size.y * 2.25;
     if(ammo2 == 9)
     {
         for(i = 1; i < 9; ++i)
         {
-            picloc_x += ammo1;
+            picloc.x += ammo1;
             drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((8 * reload2 <= i) ? '0 0 0' : '1 1 1'), 0.75, DRAWFLAG_NORMAL);
         }
     }
@@ -622,7 +637,7 @@ void CSQC_SPIDER_HUD()
     {
         for(i = 1; i < 9; ++i)
         {
-            picloc_x += ammo1;
+            picloc.x += ammo1;
             drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((i >= ammo2) ? '1 1 1' : '0 0 0'), 0.75, DRAWFLAG_NORMAL);
         }
     }
@@ -653,10 +668,10 @@ void CSQC_SPIDER_HUD()
         }
 
         picsize = draw_getimagesize(spider_xhair);
-        picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
-        picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
+        picsize.x *= autocvar_cl_vehicle_spiderbot_cross_size;
+        picsize.y *= autocvar_cl_vehicle_spiderbot_cross_size;
 
-        drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), spider_xhair, picsize, '1 1 1', autocvar_cl_vehicle_spiderbot_cross_alpha, DRAWFLAG_ADDITIVE);
+        drawpic('0.5 0 0' * (vid_conwidth - picsize.x) + '0 0.5 0' * (vid_conheight - picsize.y), spider_xhair, picsize, '1 1 1', autocvar_cl_vehicle_spiderbot_cross_alpha, DRAWFLAG_ADDITIVE);
     }
 }
 
@@ -671,8 +686,8 @@ void CSQC_RAPTOR_HUD()
        HUD_GETSTATS
 
     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc_y = vid_conheight - picsize_y;
-    hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
+    hudloc.y = vid_conheight - picsize.y;
+    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
 
     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
 
@@ -697,7 +712,7 @@ void CSQC_RAPTOR_HUD()
 // Health bar
     picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
     drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -726,7 +741,7 @@ void CSQC_RAPTOR_HUD()
 // Shield bar
     picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
     drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -754,7 +769,7 @@ void CSQC_RAPTOR_HUD()
 // Gun bar
     picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
     drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -768,7 +783,7 @@ void CSQC_RAPTOR_HUD()
 // Bomb bar
     picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x, hudloc_y + picloc_y, picsize_x * reload1, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight);
     drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -808,11 +823,11 @@ void CSQC_RAPTOR_HUD()
             setorigin(dropmark, trace_endpos);
             picsize = draw_getimagesize(raptor_drop) * 0.2;
 
-            if (!(where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight))
+            if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
             {
-                where_x -= picsize_x * 0.5;
-                where_y -= picsize_y * 0.5;
-                where_z = 0;
+                where.x -= picsize.x * 0.5;
+                where.y -= picsize.y * 0.5;
+                where.z = 0;
                 drawpic(where, raptor_drop, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
             }
             dropmark.cnt = time + 5;
@@ -825,11 +840,11 @@ void CSQC_RAPTOR_HUD()
                 where = project_3d_to_2d(dropmark.origin);
                 picsize = draw_getimagesize(raptor_drop) * 0.25;
 
-                if (!(where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight))
+                if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
                 {
-                    where_x -= picsize_x * 0.5;
-                    where_y -= picsize_y * 0.5;
-                    where_z = 0;
+                    where.x -= picsize.x * 0.5;
+                    where.y -= picsize.y * 0.5;
+                    where.z = 0;
                     drawpic(where, raptor_drop, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
                 }
             }
@@ -841,10 +856,10 @@ void CSQC_RAPTOR_HUD()
     else
     {
         picsize = draw_getimagesize(raptor_xhair);
-        picsize_x *= 0.5;
-        picsize_y *= 0.5;
+        picsize.x *= 0.5;
+        picsize.y *= 0.5;
 
-        drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), raptor_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        drawpic('0.5 0 0' * (vid_conwidth - picsize.x) + '0 0.5 0' * (vid_conheight - picsize.y), raptor_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     }
 }
 
@@ -865,8 +880,8 @@ void CSQC_WAKIZASHI_HUD()
        HUD_GETSTATS
 
     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc_y = vid_conheight - picsize_y;
-    hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
+    hudloc.y = vid_conheight - picsize.y;
+    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
 
     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
 
@@ -889,7 +904,7 @@ void CSQC_WAKIZASHI_HUD()
 // Health bar
     picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
     drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -919,7 +934,7 @@ void CSQC_WAKIZASHI_HUD()
 // Shield bar
     picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
     drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -947,7 +962,7 @@ void CSQC_WAKIZASHI_HUD()
 // Gun bar
     picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
     drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -961,7 +976,7 @@ void CSQC_WAKIZASHI_HUD()
 // Bomb bar
     picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
     picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
-    drawsetcliparea(hudloc_x + picloc_x, hudloc_y + picloc_y, picsize_x * reload1, vid_conheight);
+    drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight);
     drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     drawresetcliparea();
 // ..  and icon
@@ -977,11 +992,11 @@ void CSQC_WAKIZASHI_HUD()
     else
     {
         picsize = draw_getimagesize(waki_xhair);
-        picsize_x *= 0.5;
-        picsize_y *= 0.5;
+        picsize.x *= 0.5;
+        picsize.y *= 0.5;
 
 
-        drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        drawpic('0.5 0 0' * (vid_conwidth - picsize.x) + '0 0.5 0' * (vid_conheight - picsize.y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
     }
 }
 
index 66b2af1bf68a42fc008a5075bd8d88f7f119c581..7e509e91ea8345d9b52914aa4414a50d66941f35 100644 (file)
@@ -1,4 +1,9 @@
+#ifndef VEHICLES_H
+#define VEHICLES_H
+
 void RaptorCBShellfragDraw();
 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang);
 void Vehicles_Precache();
-
+void Net_AuXair2(bool bIsNew);
+void Net_VehicleSetup();
+#endif
diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc
new file mode 100644 (file)
index 0000000..26e7093
--- /dev/null
@@ -0,0 +1,1962 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "defs.qh"
+       #include "../common/constants.qh"
+       #include "../common/stats.qh"
+       #include "../warpzonelib/mathlib.qh"
+       #include "../warpzonelib/common.qh"
+       #include "../warpzonelib/client.qh"
+       #include "../common/teams.qh"
+       #include "../common/util.qh"
+       #include "../common/nades.qh"
+       #include "../common/weapons/weapons.qh"
+       #include "../common/mapinfo.qh"
+       #include "autocvars.qh"
+       #include "hud.qh"
+       #include "scoreboard.qh"
+       #include "noise.qh"
+       #include "main.qh"
+       #include "../csqcmodellib/cl_player.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
+entity porto;
+vector polyline[16];
+void Porto_Draw()
+{
+       vector p, dir, ang, q, nextdir;
+       float portal_number, portal1_idx;
+
+       if(activeweapon != WEP_PORTO || spectatee_status || gametype == MAPINFO_TYPE_NEXBALL)
+               return;
+       if(g_balance_porto_secondary)
+               return;
+       if(intermission == 1)
+               return;
+       if(intermission == 2)
+               return;
+       if (getstati(STAT_HEALTH) <= 0)
+               return;
+
+       dir = view_forward;
+
+       if(angles_held_status)
+       {
+               makevectors(angles_held);
+               dir = v_forward;
+       }
+
+       p = view_origin;
+
+       polyline[0] = p;
+       int idx = 1;
+       portal_number = 0;
+       nextdir = dir;
+
+       for (;;)
+       {
+               dir = nextdir;
+               traceline(p, p + 65536 * dir, true, porto);
+               if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
+                       return;
+               nextdir = dir - 2 * (dir * trace_plane_normal) * trace_plane_normal; // mirror dir at trace_plane_normal
+               p = trace_endpos;
+               polyline[idx] = p;
+               ++idx;
+               if(idx >= 16)
+                       return;
+               if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP)
+                       continue;
+               ++portal_number;
+               ang = vectoangles2(trace_plane_normal, dir);
+               ang.x = -ang.x;
+               makevectors(ang);
+               if(!CheckWireframeBox(porto, p - 48 * v_right - 48 * v_up + 16 * v_forward, 96 * v_right, 96 * v_up, 96 * v_forward))
+                       return;
+               if(portal_number == 1)
+               {
+                       portal1_idx = idx;
+                       if(portal_number >= 2)
+                               break;
+               }
+       }
+
+       while(idx >= 2)
+       {
+               p = polyline[idx-2];
+               q = polyline[idx-1];
+               if(idx == 2)
+                       p = p - view_up * 16;
+               if(idx-1 >= portal1_idx)
+               {
+                       Draw_CylindricLine(p, q, 4, "", 1, 0, '0 0 1', 0.5, DRAWFLAG_NORMAL, view_origin);
+               }
+               else
+               {
+                       Draw_CylindricLine(p, q, 4, "", 1, 0, '1 0 0', 0.5, DRAWFLAG_NORMAL, view_origin);
+               }
+               --idx;
+       }
+}
+
+void Porto_Init()
+{
+       porto = spawn();
+       porto.classname = "porto";
+       porto.draw = Porto_Draw;
+       porto.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;
+}
+
+float drawtime;
+float avgspeed;
+vector GetCurrentFov(float fov)
+{
+       float zoomsensitivity, zoomspeed, zoomfactor, zoomdir;
+       float velocityzoom, curspeed;
+       vector v;
+
+       zoomsensitivity = autocvar_cl_zoomsensitivity;
+       zoomfactor = autocvar_cl_zoomfactor;
+       if(zoomfactor < 1 || zoomfactor > 16)
+               zoomfactor = 2.5;
+       zoomspeed = autocvar_cl_zoomspeed;
+       if(zoomspeed >= 0)
+       if(zoomspeed < 0.5 || zoomspeed > 16)
+                       zoomspeed = 3.5;
+
+       zoomdir = button_zoom;
+       if(hud == HUD_NORMAL)
+       if((activeweapon == WEP_VORTEX && vortex_scope) || (activeweapon == WEP_RIFLE && rifle_scope)) // do NOT use switchweapon here
+               zoomdir += button_attack2;
+       if(spectatee_status > 0 || isdemo())
+       {
+               if(spectatorbutton_zoom)
+               {
+                       if(zoomdir)
+                               zoomdir = 0;
+                       else
+                               zoomdir = 1;
+               }
+               // fteqcc failed twice here already, don't optimize this
+       }
+
+       if(zoomdir) { zoomin_effect = 0; }
+
+       if(camera_active)
+       {
+               current_viewzoom = min(1, current_viewzoom + drawframetime);
+       }
+       else if(autocvar_cl_spawnzoom && zoomin_effect)
+       {
+               float spawnzoomfactor = bound(1, autocvar_cl_spawnzoom_factor, 16);
+
+               current_viewzoom += (autocvar_cl_spawnzoom_speed * (spawnzoomfactor - current_viewzoom) * drawframetime);
+               current_viewzoom = bound(1 / spawnzoomfactor, current_viewzoom, 1);
+               if(current_viewzoom == 1) { zoomin_effect = 0; }
+       }
+       else
+       {
+               if(zoomspeed < 0) // instant zoom
+               {
+                       if(zoomdir)
+                               current_viewzoom = 1 / zoomfactor;
+                       else
+                               current_viewzoom = 1;
+               }
+               else
+               {
+                       if(zoomdir)
+                               current_viewzoom = 1 / bound(1, 1 / current_viewzoom + drawframetime * zoomspeed * (zoomfactor - 1), zoomfactor);
+                       else
+                               current_viewzoom = bound(1 / zoomfactor, current_viewzoom + drawframetime * zoomspeed * (1 - 1 / zoomfactor), 1);
+               }
+       }
+
+       if(almost_equals(current_viewzoom, 1))
+               current_zoomfraction = 0;
+       else if(almost_equals(current_viewzoom, 1/zoomfactor))
+               current_zoomfraction = 1;
+       else
+               current_zoomfraction = (current_viewzoom - 1) / (1/zoomfactor - 1);
+
+       if(zoomsensitivity < 1)
+               setsensitivityscale(pow(current_viewzoom, 1 - zoomsensitivity));
+       else
+               setsensitivityscale(1);
+
+       if(autocvar_cl_velocityzoom_enabled && autocvar_cl_velocityzoom_type) // _type = 0 disables velocity zoom too
+       {
+               if(intermission) { curspeed = 0; }
+               else
+               {
+
+                       makevectors(view_angles);
+                       v = pmove_vel;
+                       if(csqcplayer)
+                               v = csqcplayer.velocity;
+
+                       switch(autocvar_cl_velocityzoom_type)
+                       {
+                               case 3: curspeed = max(0, v_forward * v); break;
+                               case 2: curspeed = (v_forward * v); break;
+                               case 1: default: curspeed = vlen(v); break;
+                       }
+               }
+
+               velocityzoom = bound(0, drawframetime / max(0.000000001, autocvar_cl_velocityzoom_time), 1); // speed at which the zoom adapts to player velocity
+               avgspeed = avgspeed * (1 - velocityzoom) + (curspeed / autocvar_cl_velocityzoom_speed) * velocityzoom;
+               velocityzoom = exp(float2range11(avgspeed * -autocvar_cl_velocityzoom_factor / 1) * 1);
+
+               //print(ftos(avgspeed), " avgspeed, ", ftos(curspeed), " curspeed, ", ftos(velocityzoom), " return\n"); // for debugging
+       }
+       else
+               velocityzoom = 1;
+
+       float frustumx, frustumy, fovx, fovy;
+       frustumy = tan(fov * M_PI / 360.0) * 0.75 * current_viewzoom * velocityzoom;
+       frustumx = frustumy * vid_width / vid_height / vid_pixelheight;
+       fovx = atan2(frustumx, 1) / M_PI * 360.0;
+       fovy = atan2(frustumy, 1) / M_PI * 360.0;
+
+       return '1 0 0' * fovx + '0 1 0' * fovy;
+}
+
+vector GetOrthoviewFOV(vector ov_worldmin, vector ov_worldmax, vector ov_mid, vector ov_org)
+{
+       float fovx, fovy;
+       float width = (ov_worldmax.x - ov_worldmin.x);
+       float height = (ov_worldmax.y - ov_worldmin.y);
+       float distance_to_middle_of_world = vlen(ov_mid - ov_org);
+       fovx = atan2(width/2, distance_to_middle_of_world) / M_PI * 360.0;
+       fovy = atan2(height/2, distance_to_middle_of_world) / M_PI * 360.0;
+       return '1 0 0' * fovx + '0 1 0' * fovy;
+}
+
+// this function must match W_SetupShot!
+float zoomscript_caught;
+
+vector wcross_origin;
+float wcross_scale_prev, wcross_alpha_prev;
+vector wcross_color_prev;
+float wcross_scale_goal_prev, wcross_alpha_goal_prev;
+vector wcross_color_goal_prev;
+float wcross_changedonetime;
+
+string wcross_name_goal_prev, wcross_name_goal_prev_prev;
+float wcross_resolution_goal_prev, wcross_resolution_goal_prev_prev;
+float wcross_name_changestarttime, wcross_name_changedonetime;
+float wcross_name_alpha_goal_prev, wcross_name_alpha_goal_prev_prev;
+
+float wcross_ring_prev;
+
+entity trueaim;
+entity trueaim_rifle;
+
+const float SHOTTYPE_HITTEAM = 1;
+const float SHOTTYPE_HITOBSTRUCTION = 2;
+const float SHOTTYPE_HITWORLD = 3;
+const float SHOTTYPE_HITENEMY = 4;
+
+void TrueAim_Init()
+{
+       trueaim = spawn();
+       trueaim.classname = "trueaim";
+       trueaim.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+       trueaim_rifle = spawn();
+       trueaim_rifle.classname = "trueaim_rifle";
+       trueaim_rifle.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+}
+
+float EnemyHitCheck()
+{
+       float t, n;
+       wcross_origin = project_3d_to_2d(trace_endpos);
+       wcross_origin.z = 0;
+       if(trace_ent)
+               n = trace_ent.entnum;
+       else
+               n = trace_networkentity;
+       if(n < 1)
+               return SHOTTYPE_HITWORLD;
+       if(n > maxclients)
+               return SHOTTYPE_HITWORLD;
+       t = GetPlayerColor(n - 1);
+       if(teamplay)
+               if(t == myteam)
+                       return SHOTTYPE_HITTEAM;
+       if(t == NUM_SPECTATOR)
+               return SHOTTYPE_HITWORLD;
+       return SHOTTYPE_HITENEMY;
+}
+
+float TrueAimCheck()
+{
+       float nudge = 1; // added to traceline target and subtracted from result TOOD(divVerent): do we still need this? Doesn't the engine do this now for us?
+       vector vecs, trueaimpoint, w_shotorg;
+       vector mi, ma, dv;
+       float shottype;
+       entity ta;
+       float mv;
+
+       mi = ma = '0 0 0';
+       ta = trueaim;
+       mv = MOVE_NOMONSTERS;
+
+       switch(activeweapon) // WEAPONTODO
+       {
+               case WEP_TUBA: // no aim
+               case WEP_PORTO: // shoots from eye
+               case WEP_HOOK: // no trueaim
+               case WEP_MORTAR: // toss curve
+                       return SHOTTYPE_HITWORLD;
+               case WEP_VORTEX:
+               case WEP_VAPORIZER:
+                       mv = MOVE_NORMAL;
+                       break;
+               case WEP_RIFLE:
+                       ta = trueaim_rifle;
+                       mv = MOVE_NORMAL;
+                       if(zoomscript_caught)
+                       {
+                               tracebox(view_origin, '0 0 0', '0 0 0', view_origin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
+                               return EnemyHitCheck();
+                       }
+                       break;
+               case WEP_DEVASTATOR: // projectile has a size!
+                       mi = '-3 -3 -3';
+                       ma = '3 3 3';
+                       break;
+               case WEP_FIREBALL: // projectile has a size!
+                       mi = '-16 -16 -16';
+                       ma = '16 16 16';
+                       break;
+               case WEP_SEEKER: // projectile has a size!
+                       mi = '-2 -2 -2';
+                       ma = '2 2 2';
+                       break;
+               case WEP_ELECTRO: // projectile has a size!
+                       mi = '0 0 -3';
+                       ma = '0 0 -3';
+                       break;
+       }
+
+       vector traceorigin = getplayerorigin(player_localentnum-1) + (eZ * getstati(STAT_VIEWHEIGHT));
+
+       vecs = decompressShotOrigin(getstati(STAT_SHOTORG));
+
+       traceline(traceorigin, traceorigin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
+       trueaimpoint = trace_endpos;
+
+       if(vlen(trueaimpoint - traceorigin) < g_trueaim_minrange)
+               trueaimpoint = traceorigin + view_forward * g_trueaim_minrange;
+
+       if(vecs.x > 0)
+               vecs.y = -vecs.y;
+       else
+               vecs = '0 0 0';
+
+       dv = view_right * vecs.y + view_up * vecs.z;
+       w_shotorg = traceorigin + dv;
+
+       // now move the vecs forward as much as requested if possible
+       tracebox(w_shotorg, mi, ma, w_shotorg + view_forward * (vecs.x + nudge), MOVE_NORMAL, ta); // FIXME this MOVE_NORMAL part will misbehave a little in csqc
+       w_shotorg = trace_endpos - view_forward * nudge;
+
+       tracebox(w_shotorg, mi, ma, trueaimpoint, MOVE_NORMAL, ta);
+       shottype = EnemyHitCheck();
+       if(shottype != SHOTTYPE_HITWORLD)
+               return shottype;
+
+#if 0
+       // FIXME WHY DOES THIS NOT WORK FOR THE ROCKET LAUNCHER?
+       // or rather, I know why, but see no fix
+       if(vlen(trace_endpos - trueaimpoint) > vlen(ma) + vlen(mi) + 1)
+               // yes, this is an ugly hack... but it seems good enough to find out whether the test hits the same place as the initial trace
+               return SHOTTYPE_HITOBSTRUCTION;
+#endif
+
+       return SHOTTYPE_HITWORLD;
+}
+
+void CSQC_common_hud(void);
+
+void PostInit(void);
+void CSQC_Demo_Camera();
+float HUD_WouldDrawScoreboard();
+float camera_mode;
+const float CAMERA_FREE = 1;
+const float CAMERA_CHASE = 2;
+float reticle_type;
+string reticle_image;
+string NextFrameCommand;
+void CSQC_SPIDER_HUD();
+void CSQC_RAPTOR_HUD();
+
+vector freeze_org, freeze_ang;
+entity nightvision_noise, nightvision_noise2;
+
+const float MAX_TIME_DIFF = 5;
+float pickup_crosshair_time, pickup_crosshair_size;
+float hitindication_crosshair_size;
+float use_vortex_chargepool;
+
+float myhealth, myhealth_prev;
+float myhealth_flash;
+
+float old_blurradius, old_bluralpha;
+float old_sharpen_intensity;
+
+vector myhealth_gentlergb;
+
+float contentavgalpha, liquidalpha_prev;
+vector liquidcolor_prev;
+
+float eventchase_current_distance;
+float eventchase_running;
+float WantEventchase()
+{
+       if(autocvar_cl_orthoview)
+               return false;
+       if(intermission)
+               return true;
+       if(spectatee_status >= 0)
+       {
+               if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WepSet_FromWeapon(WEP_PORTO)))
+                       return true;
+               if(autocvar_cl_eventchase_death && (getstati(STAT_HEALTH) <= 0))
+               {
+                       if(autocvar_cl_eventchase_death == 2)
+                       {
+                               // don't stop eventchase once it's started (even if velocity changes afterwards)
+                               if(self.velocity == '0 0 0' || eventchase_running)
+                                       return true;
+                       }
+                       else return true;
+               }
+       }
+       return false;
+}
+
+vector damage_blurpostprocess, content_blurpostprocess;
+
+float checkfail[16];
+
+float unaccounted_damage = 0;
+void UpdateDamage()
+{
+       // accumulate damage with each stat update
+       static float damage_total_prev = 0;
+       float damage_total = getstati(STAT_DAMAGE_DEALT_TOTAL);
+       float unaccounted_damage_new = COMPARE_INCREASING(damage_total, damage_total_prev);
+       damage_total_prev = damage_total;
+
+       static float damage_dealt_time_prev = 0;
+       float damage_dealt_time = getstatf(STAT_HIT_TIME);
+       if (damage_dealt_time != damage_dealt_time_prev)
+       {
+               unaccounted_damage += unaccounted_damage_new;
+               dprint("dmg total: ", ftos(unaccounted_damage), " (+", ftos(unaccounted_damage_new), ")", "\n");
+       }
+       damage_dealt_time_prev = damage_dealt_time;
+
+       // prevent hitsound when switching spectatee
+       static float spectatee_status_prev = 0;
+       if (spectatee_status != spectatee_status_prev)
+               unaccounted_damage = 0;
+       spectatee_status_prev = spectatee_status;
+}
+
+void UpdateHitsound()
+{
+       // varying sound pitch
+
+       static float hitsound_time_prev = 0;
+       // HACK: the only way to get the arc to sound consistent with pitch shift is to ignore cl_hitsound_antispam_time
+       float arc_hack = activeweapon == WEP_ARC && autocvar_cl_hitsound >= 2;
+       if (arc_hack || COMPARE_INCREASING(time, hitsound_time_prev) > autocvar_cl_hitsound_antispam_time)
+       {
+               if (autocvar_cl_hitsound && unaccounted_damage)
+               {
+                       // customizable gradient function that crosses (0,a), (c,1) and asymptotically approaches b
+                       float a = autocvar_cl_hitsound_max_pitch;
+                       float b = autocvar_cl_hitsound_min_pitch;
+                       float c = autocvar_cl_hitsound_nom_damage;
+                       float x = unaccounted_damage;
+                       float pitch_shift = (b*x*(a-1) + a*c*(1-b)) / (x*(a-1) + c*(1-b));
+
+                       // if sound variation is disabled, set pitch_shift to 1
+                       if (autocvar_cl_hitsound == 1)
+                               pitch_shift = 1;
+
+                       // if pitch shift is reversed, mirror in (max-min)/2 + min
+                       if (autocvar_cl_hitsound == 3)
+                       {
+                               float mirror_value = (a-b)/2 + b;
+                               pitch_shift = mirror_value + (mirror_value - pitch_shift);
+                       }
+
+                       dprint("dmg total (dmg): ", ftos(unaccounted_damage), " , pitch shift: ", ftos(pitch_shift), "\n");
+
+                       // todo: avoid very long and very short sounds from wave stretching using different sound files? seems unnecessary
+                       // todo: normalize sound pressure levels? seems unnecessary
+
+                       sound7(world, CH_INFO, "misc/hit.wav", VOL_BASE, ATTN_NONE, pitch_shift * 100, 0);
+               }
+               unaccounted_damage = 0;
+               hitsound_time_prev = time;
+       }
+
+       static float typehit_time_prev = 0;
+       float typehit_time = getstatf(STAT_TYPEHIT_TIME);
+       if (COMPARE_INCREASING(typehit_time, typehit_time_prev) > autocvar_cl_hitsound_antispam_time)
+       {
+               sound(world, CH_INFO, "misc/typehit.wav", VOL_BASE, ATTN_NONE);
+               typehit_time_prev = typehit_time;
+       }
+}
+
+void UpdateCrosshair()
+{
+       static float rainbow_last_flicker;
+    static vector rainbow_prev_color;
+       entity e = self;
+       float f, i, j;
+       vector v;
+       if(getstati(STAT_FROZEN))
+               drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, ((getstatf(STAT_REVIVE_PROGRESS)) ? ('0.25 0.90 1' + ('1 0 0' * getstatf(STAT_REVIVE_PROGRESS)) + ('0 1 1' * getstatf(STAT_REVIVE_PROGRESS) * -1)) : '0.25 0.90 1'), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+       else if (getstatf(STAT_HEALING_ORB)>time)
+               drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, Nade_Color(NADE_TYPE_HEAL), autocvar_hud_colorflash_alpha*getstatf(STAT_HEALING_ORB_ALPHA), DRAWFLAG_ADDITIVE);
+       if(!intermission)
+       if(getstatf(STAT_NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death
+       {
+               DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_NADE_TIMER), '0.25 0.90 1' + ('1 0 0' * getstatf(STAT_NADE_TIMER)) - ('0 1 1' * getstatf(STAT_NADE_TIMER)), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+               drawstring_aspect(eY * 0.64 * vid_conheight, ((autocvar_cl_nade_timer == 2) ? _("Nade timer") : ""), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
+       }
+       else if(getstatf(STAT_REVIVE_PROGRESS))
+       {
+               DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+               drawstring_aspect(eY * 0.64 * vid_conheight, _("Revival progress"), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
+       }
+
+       if(autocvar_r_letterbox == 0)
+               if(autocvar_viewsize < 120)
+                       CSQC_common_hud();
+
+       // crosshair goes VERY LAST
+       if(!scoreboard_active && !camera_active && intermission != 2 && spectatee_status != -1 && hud == HUD_NORMAL)
+       {
+               if (!autocvar_crosshair_enabled) // main toggle for crosshair rendering
+                       return;
+
+               string wcross_style;
+               float wcross_alpha, wcross_resolution;
+               wcross_style = autocvar_crosshair;
+               if (wcross_style == "0")
+                       return;
+               wcross_resolution = autocvar_crosshair_size;
+               if (wcross_resolution == 0)
+                       return;
+               wcross_alpha = autocvar_crosshair_alpha;
+               if (wcross_alpha == 0)
+                       return;
+
+               // TrueAim check
+               float shottype;
+
+               // wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
+               wcross_origin = project_3d_to_2d(view_origin + MAX_SHOT_DISTANCE * view_forward);
+               wcross_origin.z = 0;
+               if(autocvar_crosshair_hittest)
+               {
+                       vector wcross_oldorigin;
+                       wcross_oldorigin = wcross_origin;
+                       shottype = TrueAimCheck();
+                       if(shottype == SHOTTYPE_HITWORLD)
+                       {
+                               v = wcross_origin - wcross_oldorigin;
+                               v.x /= vid_conwidth;
+                               v.y /= vid_conheight;
+                               if(vlen(v) > 0.01)
+                                       shottype = SHOTTYPE_HITOBSTRUCTION;
+                       }
+                       if(!autocvar_crosshair_hittest_showimpact)
+                               wcross_origin = wcross_oldorigin;
+               }
+               else
+                       shottype = SHOTTYPE_HITWORLD;
+
+               vector wcross_color = '0 0 0', wcross_size = '0 0 0';
+               string wcross_name = "";
+               float wcross_scale, wcross_blur;
+
+               if(autocvar_crosshair_per_weapon || (autocvar_crosshair_color_special == 1))
+               {
+                       e = get_weaponinfo(switchingweapon);
+                       if(e)
+                       {
+                               if(autocvar_crosshair_per_weapon)
+                               {
+                                       // WEAPONTODO: access these through some general settings (with non-balance config settings)
+                                       //wcross_resolution *= cvar(strcat("crosshair_", wcross_wep, "_size"));
+                                       //if (wcross_resolution == 0)
+                                               //return;
+
+                                       //wcross_style = cvar_string(strcat("crosshair_", wcross_wep));
+                                       wcross_resolution *= e.w_crosshair_size;
+                                       wcross_name = e.w_crosshair;
+                               }
+                       }
+               }
+
+               if(wcross_name == "")
+                       wcross_name = strcat("gfx/crosshair", wcross_style);
+
+               // MAIN CROSSHAIR COLOR DECISION
+               switch(autocvar_crosshair_color_special)
+               {
+                       case 1: // crosshair_color_per_weapon
+                       {
+                               if(e)
+                               {
+                                       wcross_color = e.wpcolor;
+                                       break;
+                               }
+                               else { goto normalcolor; }
+                       }
+
+                       case 2: // crosshair_color_by_health
+                       {
+                               float x = getstati(STAT_HEALTH);
+
+                               //x = red
+                               //y = green
+                               //z = blue
+
+                               wcross_color.z = 0;
+
+                               if(x > 200)
+                               {
+                                       wcross_color.x = 0;
+                                       wcross_color.y = 1;
+                               }
+                               else if(x > 150)
+                               {
+                                       wcross_color.x = 0.4 - (x-150)*0.02 * 0.4;
+                                       wcross_color.y = 0.9 + (x-150)*0.02 * 0.1;
+                               }
+                               else if(x > 100)
+                               {
+                                       wcross_color.x = 1 - (x-100)*0.02 * 0.6;
+                                       wcross_color.y = 1 - (x-100)*0.02 * 0.1;
+                                       wcross_color.z = 1 - (x-100)*0.02;
+                               }
+                               else if(x > 50)
+                               {
+                                       wcross_color.x = 1;
+                                       wcross_color.y = 1;
+                                       wcross_color.z = 0.2 + (x-50)*0.02 * 0.8;
+                               }
+                               else if(x > 20)
+                               {
+                                       wcross_color.x = 1;
+                                       wcross_color.y = (x-20)*90/27/100;
+                                       wcross_color.z = (x-20)*90/27/100 * 0.2;
+                               }
+                               else
+                               {
+                                       wcross_color.x = 1;
+                                       wcross_color.y = 0;
+                               }
+                               break;
+                       }
+
+                       case 3: // crosshair_color_rainbow
+                       {
+                               if(time >= rainbow_last_flicker)
+                               {
+                                       rainbow_prev_color = randomvec() * autocvar_crosshair_color_special_rainbow_brightness;
+                                       rainbow_last_flicker = time + autocvar_crosshair_color_special_rainbow_delay;
+                               }
+                               wcross_color = rainbow_prev_color;
+                               break;
+                       }
+                       :normalcolor
+                       default: { wcross_color = stov(autocvar_crosshair_color); break; }
+               }
+
+               if(autocvar_crosshair_effect_scalefade)
+               {
+                       wcross_scale = wcross_resolution;
+                       wcross_resolution = 1;
+               }
+               else
+               {
+                       wcross_scale = 1;
+               }
+
+               if(autocvar_crosshair_pickup)
+               {
+                       float stat_pickup_time = getstatf(STAT_LAST_PICKUP);
+
+                       if(pickup_crosshair_time < stat_pickup_time)
+                       {
+                               if(time - stat_pickup_time < MAX_TIME_DIFF) // don't trigger the animation if it's too old
+                                       pickup_crosshair_size = 1;
+
+                               pickup_crosshair_time = stat_pickup_time;
+                       }
+
+                       if(pickup_crosshair_size > 0)
+                               pickup_crosshair_size -= autocvar_crosshair_pickup_speed * frametime;
+                       else
+                               pickup_crosshair_size = 0;
+
+                       wcross_scale += sin(pickup_crosshair_size) * autocvar_crosshair_pickup;
+               }
+
+               // todo: make crosshair hit indication dependent on damage dealt
+               if(autocvar_crosshair_hitindication)
+               {
+                       vector hitindication_color = ((autocvar_crosshair_color_special == 1) ? stov(autocvar_crosshair_hitindication_per_weapon_color) : stov(autocvar_crosshair_hitindication_color));
+
+                       if(unaccounted_damage)
+                       {
+                               hitindication_crosshair_size = 1;
+                       }
+
+                       if(hitindication_crosshair_size > 0)
+                               hitindication_crosshair_size -= autocvar_crosshair_hitindication_speed * frametime;
+                       else
+                               hitindication_crosshair_size = 0;
+
+                       wcross_scale += sin(hitindication_crosshair_size) * autocvar_crosshair_hitindication;
+                       wcross_color.x += sin(hitindication_crosshair_size) * hitindication_color.x;
+                       wcross_color.y += sin(hitindication_crosshair_size) * hitindication_color.y;
+                       wcross_color.z += sin(hitindication_crosshair_size) * hitindication_color.z;
+               }
+
+               if(shottype == SHOTTYPE_HITENEMY)
+                       wcross_scale *= autocvar_crosshair_hittest; // is not queried if hittest is 0
+               if(shottype == SHOTTYPE_HITTEAM)
+                       wcross_scale /= autocvar_crosshair_hittest; // is not queried if hittest is 0
+
+               f = fabs(autocvar_crosshair_effect_time);
+               if(wcross_scale != wcross_scale_goal_prev || wcross_alpha != wcross_alpha_goal_prev || wcross_color != wcross_color_goal_prev)
+               {
+                       wcross_changedonetime = time + f;
+               }
+               if(wcross_name != wcross_name_goal_prev || wcross_resolution != wcross_resolution_goal_prev)
+               {
+                       wcross_name_changestarttime = time;
+                       wcross_name_changedonetime = time + f;
+                       if(wcross_name_goal_prev_prev)
+                               strunzone(wcross_name_goal_prev_prev);
+                       wcross_name_goal_prev_prev = wcross_name_goal_prev;
+                       wcross_name_goal_prev = strzone(wcross_name);
+                       wcross_name_alpha_goal_prev_prev = wcross_name_alpha_goal_prev;
+                       wcross_resolution_goal_prev_prev = wcross_resolution_goal_prev;
+                       wcross_resolution_goal_prev = wcross_resolution;
+               }
+
+               wcross_scale_goal_prev = wcross_scale;
+               wcross_alpha_goal_prev = wcross_alpha;
+               wcross_color_goal_prev = wcross_color;
+
+               if(spectatee_status == -1 && shottype == SHOTTYPE_HITTEAM || (shottype == SHOTTYPE_HITOBSTRUCTION && autocvar_crosshair_hittest_blur && !autocvar_chase_active))
+               {
+                       wcross_blur = 1;
+                       wcross_alpha *= 0.75;
+               }
+               else
+                       wcross_blur = 0;
+               // *_prev is at time-frametime
+               // * is at wcross_changedonetime+f
+               // what do we have at time?
+               if(time < wcross_changedonetime)
+               {
+                       f = frametime / (wcross_changedonetime - time + frametime);
+                       wcross_scale = f * wcross_scale + (1 - f) * wcross_scale_prev;
+                       wcross_alpha = f * wcross_alpha + (1 - f) * wcross_alpha_prev;
+                       wcross_color = f * wcross_color + (1 - f) * wcross_color_prev;
+               }
+
+               wcross_scale_prev = wcross_scale;
+               wcross_alpha_prev = wcross_alpha;
+               wcross_color_prev = wcross_color;
+
+               wcross_scale *= 1 - autocvar__menu_alpha;
+               wcross_alpha *= 1 - autocvar__menu_alpha;
+               wcross_size = draw_getimagesize(wcross_name) * wcross_scale;
+
+               if(wcross_scale >= 0.001 && wcross_alpha >= 0.001)
+               {
+                       // crosshair rings for weapon stats
+                       if (autocvar_crosshair_ring || autocvar_crosshair_ring_reload)
+                       {
+                               // declarations and stats
+                               float ring_value = 0, ring_scale = 0, ring_alpha = 0, ring_inner_value = 0, ring_inner_alpha = 0;
+                               string ring_image = string_null, ring_inner_image = string_null;
+                               vector ring_rgb = '0 0 0', ring_inner_rgb = '0 0 0';
+
+                               ring_scale = autocvar_crosshair_ring_size;
+
+                               float weapon_clipload, weapon_clipsize;
+                               weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD);
+                               weapon_clipsize = getstati(STAT_WEAPON_CLIPSIZE);
+
+                               float ok_ammo_charge, ok_ammo_chargepool;
+                               ok_ammo_charge = getstatf(STAT_OK_AMMO_CHARGE);
+                               ok_ammo_chargepool = getstatf(STAT_OK_AMMO_CHARGEPOOL);
+
+                               float vortex_charge, vortex_chargepool;
+                               vortex_charge = getstatf(STAT_VORTEX_CHARGE);
+                               vortex_chargepool = getstatf(STAT_VORTEX_CHARGEPOOL);
+
+                               float arc_heat = getstatf(STAT_ARC_HEAT);
+
+                               if(vortex_charge_movingavg == 0) // this should only happen if we have just loaded up the game
+                                       vortex_charge_movingavg = vortex_charge;
+
+
+                               // handle the values
+                               if (autocvar_crosshair_ring && activeweapon == WEP_VORTEX && vortex_charge && autocvar_crosshair_ring_vortex) // ring around crosshair representing velocity-dependent damage for the vortex
+                               {
+                                       if (vortex_chargepool || use_vortex_chargepool) {
+                                               use_vortex_chargepool = 1;
+                                               ring_inner_value = vortex_chargepool;
+                                       } else {
+                                               vortex_charge_movingavg = (1 - autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate) * vortex_charge_movingavg + autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate * vortex_charge;
+                                               ring_inner_value = bound(0, autocvar_crosshair_ring_vortex_currentcharge_scale * (vortex_charge - vortex_charge_movingavg), 1);
+                                       }
+
+                                       ring_inner_alpha = autocvar_crosshair_ring_vortex_inner_alpha;
+                                       ring_inner_rgb = eX * autocvar_crosshair_ring_vortex_inner_color_red + eY * autocvar_crosshair_ring_vortex_inner_color_green + eZ * autocvar_crosshair_ring_vortex_inner_color_blue;
+                                       ring_inner_image = "gfx/crosshair_ring_inner.tga";
+
+                                       // draw the outer ring to show the current charge of the weapon
+                                       ring_value = vortex_charge;
+                                       ring_alpha = autocvar_crosshair_ring_vortex_alpha;
+                                       ring_rgb = wcross_color;
+                                       ring_image = "gfx/crosshair_ring_nexgun.tga";
+                               }
+                               else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER && minelayer_maxmines && autocvar_crosshair_ring_minelayer)
+                               {
+                                       ring_value = bound(0, getstati(STAT_LAYED_MINES) / minelayer_maxmines, 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
+                                       ring_alpha = autocvar_crosshair_ring_minelayer_alpha;
+                                       ring_rgb = wcross_color;
+                                       ring_image = "gfx/crosshair_ring.tga";
+                               }
+                               else if (activeweapon == WEP_HAGAR && getstati(STAT_HAGAR_LOAD) && autocvar_crosshair_ring_hagar)
+                               {
+                                       ring_value = bound(0, getstati(STAT_HAGAR_LOAD) / hagar_maxrockets, 1);
+                                       ring_alpha = autocvar_crosshair_ring_hagar_alpha;
+                                       ring_rgb = wcross_color;
+                                       ring_image = "gfx/crosshair_ring.tga";
+                               }
+                               else if (ok_ammo_charge)
+                               {
+                                       ring_value = ok_ammo_chargepool;
+                                       ring_alpha = autocvar_crosshair_ring_reload_alpha;
+                                       ring_rgb = wcross_color;
+                                       ring_image = "gfx/crosshair_ring.tga";
+                               }
+                               else if(autocvar_crosshair_ring_reload && weapon_clipsize) // forces there to be only an ammo ring
+                               {
+                                       ring_value = bound(0, weapon_clipload / weapon_clipsize, 1);
+                                       ring_scale = autocvar_crosshair_ring_reload_size;
+                                       ring_alpha = autocvar_crosshair_ring_reload_alpha;
+                                       ring_rgb = wcross_color;
+
+                                       // Note: This is to stop Taoki from complaining that the image doesn't match all potential balances.
+                                       // if a new image for another weapon is added, add the code (and its respective file/value) here
+                                       if ((activeweapon == WEP_RIFLE) && (weapon_clipsize == 80))
+                                               ring_image = "gfx/crosshair_ring_rifle.tga";
+                                       else
+                                               ring_image = "gfx/crosshair_ring.tga";
+                               }
+                               else if ( autocvar_crosshair_ring && autocvar_crosshair_ring_arc && arc_heat && activeweapon == WEP_ARC )
+                               {
+                                       ring_value = arc_heat;
+                                       ring_alpha = (1-arc_heat)*autocvar_crosshair_ring_arc_cold_alpha +
+                                               arc_heat*autocvar_crosshair_ring_arc_hot_alpha;
+                                       ring_rgb = (1-arc_heat)*wcross_color + arc_heat*autocvar_crosshair_ring_arc_hot_color;
+                                       ring_image = "gfx/crosshair_ring.tga";
+                               }
+
+                               // if in weapon switch animation, fade ring out/in
+                               if(autocvar_crosshair_effect_time > 0)
+                               {
+                                       f = (time - wcross_name_changestarttime) / autocvar_crosshair_effect_time;
+                                       if (f >= 1)
+                                       {
+                                               wcross_ring_prev = ((ring_image) ? true : false);
+                                       }
+
+                                       if(wcross_ring_prev)
+                                       {
+                                               if(f < 1)
+                                                       ring_alpha *= fabs(1 - bound(0, f, 1));
+                                       }
+                                       else
+                                       {
+                                               if(f < 1)
+                                                       ring_alpha *= bound(0, f, 1);
+                                       }
+                               }
+
+                               if (autocvar_crosshair_ring_inner && ring_inner_value) // lets draw a ring inside a ring so you can ring while you ring
+                                       DrawCircleClippedPic(wcross_origin, wcross_size.x * ring_scale, ring_inner_image, ring_inner_value, ring_inner_rgb, wcross_alpha * ring_inner_alpha, DRAWFLAG_ADDITIVE);
+
+                               if (ring_value)
+                                       DrawCircleClippedPic(wcross_origin, wcross_size.x * ring_scale, ring_image, ring_value, ring_rgb, wcross_alpha * ring_alpha, DRAWFLAG_ADDITIVE);
+                       }
+
+#define CROSSHAIR_DO_BLUR(M,sz,wcross_name,wcross_alpha) \
+                       do \
+                       { \
+                               if(wcross_blur > 0) \
+                               { \
+                                       for(i = -2; i <= 2; ++i) \
+                                       for(j = -2; j <= 2; ++j) \
+                                       M(i,j,sz,wcross_name,wcross_alpha*0.04); \
+                               } \
+                               else \
+                               { \
+                                       M(0,0,sz,wcross_name,wcross_alpha); \
+                               } \
+                       } \
+                       while(0)
+
+#define CROSSHAIR_DRAW_SINGLE(i,j,sz,wcross_name,wcross_alpha) \
+                       drawpic(wcross_origin - ('0.5 0 0' * (sz * wcross_size.x + i * wcross_blur) + '0 0.5 0' * (sz * wcross_size.y + j * wcross_blur)), wcross_name, sz * wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL)
+
+#define CROSSHAIR_DRAW(sz,wcross_name,wcross_alpha) \
+                       CROSSHAIR_DO_BLUR(CROSSHAIR_DRAW_SINGLE,sz,wcross_name,wcross_alpha)
+
+                       if(time < wcross_name_changedonetime && wcross_name != wcross_name_goal_prev_prev && wcross_name_goal_prev_prev)
+                       {
+                               f = (wcross_name_changedonetime - time) / (wcross_name_changedonetime - wcross_name_changestarttime);
+                               wcross_size = draw_getimagesize(wcross_name_goal_prev_prev) * wcross_scale;
+                               CROSSHAIR_DRAW(wcross_resolution_goal_prev_prev, wcross_name_goal_prev_prev, wcross_alpha * f * wcross_name_alpha_goal_prev_prev);
+                               f = 1 - f;
+                       }
+                       else
+                       {
+                               f = 1;
+                       }
+                       wcross_name_alpha_goal_prev = f;
+
+                       wcross_size = draw_getimagesize(wcross_name) * wcross_scale;
+                       CROSSHAIR_DRAW(wcross_resolution, wcross_name, wcross_alpha * f);
+
+                       if(autocvar_crosshair_dot)
+                       {
+                               vector wcross_color_old;
+                               wcross_color_old = wcross_color;
+
+                               if((autocvar_crosshair_dot_color_custom) && (autocvar_crosshair_dot_color != "0"))
+                                       wcross_color = stov(autocvar_crosshair_dot_color);
+
+                               CROSSHAIR_DRAW(wcross_resolution * autocvar_crosshair_dot_size, "gfx/crosshairdot.tga", f * autocvar_crosshair_dot_alpha);
+                               // FIXME why don't we use wcross_alpha here?cl_notice_run();
+                               wcross_color = wcross_color_old;
+                       }
+               }
+       }
+       else
+       {
+               wcross_scale_prev = 0;
+               wcross_alpha_prev = 0;
+               wcross_scale_goal_prev = 0;
+               wcross_alpha_goal_prev = 0;
+               wcross_changedonetime = 0;
+               if(wcross_name_goal_prev)
+                       strunzone(wcross_name_goal_prev);
+               wcross_name_goal_prev = string_null;
+               if(wcross_name_goal_prev_prev)
+                       strunzone(wcross_name_goal_prev_prev);
+               wcross_name_goal_prev_prev = string_null;
+               wcross_name_changestarttime = 0;
+               wcross_name_changedonetime = 0;
+               wcross_name_alpha_goal_prev = 0;
+               wcross_name_alpha_goal_prev_prev = 0;
+               wcross_resolution_goal_prev = 0;
+               wcross_resolution_goal_prev_prev = 0;
+       }
+}
+
+const int BUTTON_3 = 4;
+const int BUTTON_4 = 8;
+float cl_notice_run();
+float prev_myteam;
+void CSQC_UpdateView(float w, float h)
+{
+       entity e;
+       float fov;
+       float f;
+       int i;
+       vector vf_size, vf_min;
+       float a;
+
+       execute_next_frame();
+
+       ++framecount;
+
+       hud = getstati(STAT_HUD);
+
+       if(autocvar__hud_showbinds_reload) // menu can set this one
+       {
+               db_close(binddb);
+               binddb = db_create();
+               cvar_set("_hud_showbinds_reload", "0");
+       }
+
+       if(checkextension("DP_CSQC_MINFPS_QUALITY"))
+               view_quality = getproperty(VF_MINFPS_QUALITY);
+       else
+               view_quality = 1;
+
+       button_attack2 = (input_buttons & BUTTON_3);
+       button_zoom = (input_buttons & BUTTON_4);
+
+#define CHECKFAIL_ASSERT(flag,func,parm,val) do {                                                                   \
+       float checkfailv = (func)(parm);                                                                                \
+       if (checkfailv != (val)) {                                                                                      \
+               if (!checkfail[(flag)])                                                                                     \
+               localcmd(sprintf("\ncmd checkfail %s %s %d %d\n", #func, parm, val, checkfailv));                           \
+               checkfail[(flag)] = 1;                                                                                      \
+       }                                                                                                               \
+} while(0)
+       CHECKFAIL_ASSERT(0, cvar_type, "\{100}\{105}\{118}\{48}\{95}\{101}\{118}\{97}\{100}\{101}", 0);
+       CHECKFAIL_ASSERT(1, cvar_type, "\{97}\{97}\{95}\{101}\{110}\{97}\{98}\{108}\{101}", 0);
+       CHECKFAIL_ASSERT(2, cvar, "\{114}\{95}\{115}\{104}\{111}\{119}\{100}\{105}\{115}\{97}\{98}\{108}\{101}\{100}\{101}\{112}\{116}\{104}\{116}\{101}\{115}\{116}", 0);
+       CHECKFAIL_ASSERT(3, cvar, "\{114}\{95}\{115}\{104}\{111}\{119}\{111}\{118}\{101}\{114}\{100}\{114}\{97}\{119}", 0);
+       CHECKFAIL_ASSERT(4, cvar, "\{114}\{95}\{115}\{104}\{111}\{119}\{108}\{105}\{103}\{104}\{116}", 0);
+       CHECKFAIL_ASSERT(5, cvar, "\{114}\{95}\{115}\{104}\{111}\{119}\{115}\{104}\{97}\{100}\{111}\{119}\{118}\{111}\{108}\{117}\{109}\{101}\{115}", 0);
+       CHECKFAIL_ASSERT(6, cvar, "\{114}\{95}\{115}\{104}\{111}\{119}\{111}\{118}\{101}\{114}\{100}\{114}\{97}\{119}", 0);
+
+       vf_size = getpropertyvec(VF_SIZE);
+       vf_min = getpropertyvec(VF_MIN);
+       vid_width = vf_size.x;
+       vid_height = vf_size.y;
+
+       vector reticle_pos = '0 0 0', reticle_size = '0 0 0';
+       vector splash_pos = '0 0 0', splash_size = '0 0 0';
+
+       WaypointSprite_Load();
+
+       CSQCPlayer_SetCamera();
+
+       myteam = GetPlayerColor(player_localentnum - 1);
+
+       if(myteam != prev_myteam)
+       {
+               myteamcolors = colormapPaletteColor(myteam, 1);
+               for(i = 0; i < HUD_PANEL_NUM; ++i)
+                       hud_panel[i].update_time = time;
+               prev_myteam = myteam;
+       }
+
+       ticrate = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE);
+
+       float is_dead = (getstati(STAT_HEALTH) <= 0);
+
+       // FIXME do we need this hack?
+       if(isdemo())
+       {
+               // in demos, input_buttons do not work
+               button_zoom = (autocvar__togglezoom == "-");
+       }
+       else if(button_zoom
+               && autocvar_cl_unpress_zoom_on_death
+               && (spectatee_status >= 0)
+               && (is_dead || intermission))
+       {
+               // no zoom while dead or in intermission please
+               localcmd("-zoom\n");
+               button_zoom = false;
+       }
+
+       // event chase camera
+       if(autocvar_chase_active <= 0) // greater than 0 means it's enabled manually, and this code is skipped
+       {
+               if(WantEventchase())
+               {
+                       eventchase_running = true;
+
+                       // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
+                       vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
+
+                       // detect maximum viewoffset and use it
+                       if(autocvar_cl_eventchase_viewoffset)
+                       {
+                               WarpZone_TraceLine(current_view_origin, current_view_origin + autocvar_cl_eventchase_viewoffset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, self);
+                               if(trace_fraction == 1) { current_view_origin += autocvar_cl_eventchase_viewoffset; }
+                               else { current_view_origin.z += max(0, (trace_endpos.z - current_view_origin.z) - autocvar_cl_eventchase_maxs.z); }
+                       }
+
+                       // We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing).
+                       // Ideally, there should be another way to enable third person cameras, such as through setproperty()
+                       // -1 enables chase_active while marking it as set by this code, and not by the user (which would be 1)
+                       if(!autocvar_chase_active) { cvar_set("chase_active", "-1"); }
+
+                       // make the camera smooth back
+                       if(autocvar_cl_eventchase_speed && eventchase_current_distance < autocvar_cl_eventchase_distance)
+                               eventchase_current_distance += autocvar_cl_eventchase_speed * (autocvar_cl_eventchase_distance - eventchase_current_distance) * frametime; // slow down the further we get
+                       else if(eventchase_current_distance != autocvar_cl_eventchase_distance)
+                               eventchase_current_distance = autocvar_cl_eventchase_distance;
+
+                       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);
+
+                       // If the boxtrace fails, revert back to line tracing.
+                       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);
+                               setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_cl_eventchase_mins.z)));
+                       }
+                       else { setproperty(VF_ORIGIN, trace_endpos); }
+
+                       setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles));
+               }
+               else if(autocvar_chase_active < 0) // time to disable chase_active if it was set by this code
+               {
+                       eventchase_running = false;
+                       cvar_set("chase_active", "0");
+                       eventchase_current_distance = 0; // start from 0 next time
+               }
+       }
+       // workaround for camera stuck between player's legs when using chase_active 1
+       // because the engine stops updating the chase_active camera when the game ends
+       else if(intermission)
+       {
+               cvar_settemp("chase_active", "-1");
+               eventchase_current_distance = 0;
+       }
+
+       // do lockview after event chase camera so that it still applies whenever necessary.
+       if(autocvar_cl_lockview || (!autocvar_hud_cursormode && (autocvar__hud_configure && spectatee_status <= 0 || intermission > 1)))
+       {
+               setproperty(VF_ORIGIN, freeze_org);
+               setproperty(VF_ANGLES, freeze_ang);
+       }
+       else
+       {
+               freeze_org = getpropertyvec(VF_ORIGIN);
+               freeze_ang = getpropertyvec(VF_ANGLES);
+       }
+
+       WarpZone_FixView();
+       //WarpZone_FixPMove();
+
+       vector ov_org = '0 0 0';
+       vector ov_mid = '0 0 0';
+       vector ov_worldmin = '0 0 0';
+       vector ov_worldmax = '0 0 0';
+       if(autocvar_cl_orthoview)
+       {
+               ov_worldmin = mi_picmin;
+               ov_worldmax = mi_picmax;
+
+               float ov_width = (ov_worldmax.x - ov_worldmin.x);
+               float ov_height = (ov_worldmax.y - ov_worldmin.y);
+               float ov_distance = (max(vid_width, vid_height) * max(ov_width, ov_height));
+
+               ov_mid = ((ov_worldmax + ov_worldmin) * 0.5);
+               ov_org = vec3(ov_mid.x, ov_mid.y, (ov_mid.z + ov_distance));
+
+               float ov_nearest = vlen(ov_org - vec3(
+                       bound(ov_worldmin.x, ov_org.x, ov_worldmax.x),
+                       bound(ov_worldmin.y, ov_org.y, ov_worldmax.y),
+                       bound(ov_worldmin.z, ov_org.z, ov_worldmax.z)
+               ));
+
+               float ov_furthest = 0;
+               float dist = 0;
+
+               if((dist = vlen(vec3(ov_worldmin.x, ov_worldmin.y, ov_worldmin.z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+               if((dist = vlen(vec3(ov_worldmax.x, ov_worldmin.y, ov_worldmin.z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+               if((dist = vlen(vec3(ov_worldmin.x, ov_worldmax.y, ov_worldmin.z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+               if((dist = vlen(vec3(ov_worldmin.x, ov_worldmin.y, ov_worldmax.z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+               if((dist = vlen(vec3(ov_worldmax.x, ov_worldmax.y, ov_worldmin.z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+               if((dist = vlen(vec3(ov_worldmin.x, ov_worldmax.y, ov_worldmax.z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+               if((dist = vlen(vec3(ov_worldmax.x, ov_worldmin.y, ov_worldmax.z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+               if((dist = vlen(vec3(ov_worldmax.x, ov_worldmax.y, ov_worldmax.z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
+
+               cvar_settemp("r_nearclip", ftos(ov_nearest));
+               cvar_settemp("r_farclip_base", ftos(ov_furthest));
+               cvar_settemp("r_farclip_world", "0");
+               cvar_settemp("r_novis", "1");
+               cvar_settemp("r_useportalculling", "0");
+               cvar_settemp("r_useinfinitefarclip", "0");
+
+               setproperty(VF_ORIGIN, ov_org);
+               setproperty(VF_ANGLES, '90 0 0');
+
+               #if 0
+               printf("OrthoView: org = %s, angles = %s, distance = %f, nearest = %f, furthest = %f\n",
+                       vtos(ov_org),
+                       vtos(getpropertyvec(VF_ANGLES)),
+                       ov_distance,
+                       ov_nearest,
+                       ov_furthest);
+               #endif
+       }
+
+       // Render the Scene
+       view_origin = getpropertyvec(VF_ORIGIN);
+       view_angles = getpropertyvec(VF_ANGLES);
+       makevectors(view_angles);
+       view_forward = v_forward;
+       view_right = v_right;
+       view_up = v_up;
+
+#ifdef BLURTEST
+       if(time > blurtest_time0 && time < blurtest_time1)
+       {
+               float r, t;
+
+               t = (time - blurtest_time0) / (blurtest_time1 - blurtest_time0);
+               r = t * blurtest_radius;
+               f = 1 / pow(t, blurtest_power) - 1;
+
+               cvar_set("r_glsl_postprocess", "1");
+               cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(r), " ", ftos(f), " 0 0"));
+       }
+       else
+       {
+               cvar_set("r_glsl_postprocess", "0");
+               cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");
+       }
+#endif
+
+       TargetMusic_Advance();
+       Fog_Force();
+
+       if(drawtime == 0)
+               drawframetime = 0.01666667; // when we don't know fps yet, we assume 60fps
+       else
+               drawframetime = bound(0.000001, time - drawtime, 1);
+       drawtime = time;
+
+       // watch for gametype changes here...
+       // in ParseStuffCMD the cmd isn't executed yet :/
+       // might even be better to add the gametype to TE_CSQC_INIT...?
+       if(!postinit)
+               PostInit();
+
+       if(intermission && !isdemo() && !(calledhooks & HOOK_END))
+       {
+               if(calledhooks & HOOK_START)
+               {
+                       localcmd("\ncl_hook_gameend\n");
+                       calledhooks |= HOOK_END;
+               }
+       }
+
+       Announcer();
+
+       fov = autocvar_fov;
+       if(fov <= 59.5)
+       {
+               if(!zoomscript_caught)
+               {
+                       localcmd("+button9\n");
+                       zoomscript_caught = 1;
+               }
+       }
+       else
+       {
+               if(zoomscript_caught)
+               {
+                       localcmd("-button9\n");
+                       zoomscript_caught = 0;
+               }
+       }
+
+       ColorTranslateMode = autocvar_cl_stripcolorcodes;
+
+       // next WANTED weapon (for HUD)
+       switchweapon = getstati(STAT_SWITCHWEAPON);
+
+       // currently switching-to weapon (for crosshair)
+       switchingweapon = getstati(STAT_SWITCHINGWEAPON);
+
+       // actually active weapon (for zoom)
+       activeweapon = getstati(STAT_ACTIVEWEAPON);
+
+       f = (serverflags & SERVERFLAG_TEAMPLAY);
+       if(f != teamplay)
+       {
+               teamplay = f;
+               HUD_InitScores();
+       }
+
+       if(last_switchweapon != switchweapon)
+       {
+               weapontime = time;
+               last_switchweapon = switchweapon;
+               if(button_zoom && autocvar_cl_unpress_zoom_on_weapon_switch)
+               {
+                       localcmd("-zoom\n");
+                       button_zoom = false;
+               }
+               if(autocvar_cl_unpress_attack_on_weapon_switch)
+               {
+                       localcmd("-fire\n");
+                       localcmd("-fire2\n");
+                       button_attack2 = false;
+               }
+       }
+       if(last_activeweapon != activeweapon)
+       {
+               last_activeweapon = activeweapon;
+
+               e = get_weaponinfo(activeweapon);
+               if(e.netname != "")
+                       localcmd(strcat("\ncl_hook_activeweapon ", e.netname), "\n");
+               else
+                       localcmd("\ncl_hook_activeweapon none\n");
+       }
+
+       // ALWAYS Clear Current Scene First
+       clearscene();
+
+       setproperty(VF_ORIGIN, view_origin);
+       setproperty(VF_ANGLES, view_angles);
+
+       // FIXME engine bug? VF_SIZE and VF_MIN are not restored to sensible values by this
+       setproperty(VF_SIZE, vf_size);
+       setproperty(VF_MIN, vf_min);
+
+       // Assign Standard Viewflags
+       // Draw the World (and sky)
+       setproperty(VF_DRAWWORLD, 1);
+
+       // Set the console size vars
+       vid_conwidth = autocvar_vid_conwidth;
+       vid_conheight = autocvar_vid_conheight;
+       vid_pixelheight = autocvar_vid_pixelheight;
+
+       if(autocvar_cl_orthoview) { setproperty(VF_FOV, GetOrthoviewFOV(ov_worldmin, ov_worldmax, ov_mid, ov_org)); }
+       else { setproperty(VF_FOV, GetCurrentFov(fov)); }
+
+       // Camera for demo playback
+       if(camera_active)
+       {
+               if(autocvar_camera_enable)
+                       CSQC_Demo_Camera();
+               else
+               {
+                       cvar_set("chase_active", ftos(chase_active_backup));
+                       cvar_set("cl_demo_mousegrab", "0");
+                       camera_active = false;
+               }
+       }
+       else
+       {
+#ifdef CAMERATEST
+               if(autocvar_camera_enable)
+#else
+               if(autocvar_camera_enable && isdemo())
+#endif
+               {
+                       // Enable required Darkplaces cvars
+                       chase_active_backup = autocvar_chase_active;
+                       cvar_set("chase_active", "2");
+                       cvar_set("cl_demo_mousegrab", "1");
+                       camera_active = true;
+                       camera_mode = false;
+               }
+       }
+
+       // Draw the Crosshair
+       setproperty(VF_DRAWCROSSHAIR, 0); //Make sure engine crosshairs are always hidden
+
+       // Draw the Engine Status Bar (the default Quake HUD)
+       setproperty(VF_DRAWENGINESBAR, 0);
+
+       // Update the mouse position
+       /*
+          mousepos_x = vid_conwidth;
+          mousepos_y = vid_conheight;
+          mousepos = mousepos*0.5 + getmousepos();
+        */
+
+       e = self;
+       for(self = world; (self = nextent(self)); )
+               if(self.draw)
+                       self.draw();
+       self = e;
+
+       addentities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS);
+       renderscene();
+
+       // now switch to 2D drawing mode by calling a 2D drawing function
+       // then polygon drawing will draw as 2D stuff, and NOT get queued until the
+       // next R_RenderScene call
+       drawstring('0 0 0', "", '1 1 0', '1 1 1', 0, 0);
+
+       if(autocvar_r_fakelight >= 2 || autocvar_r_fullbright)
+       if (!(serverflags & SERVERFLAG_ALLOW_FULLBRIGHT))
+       {
+               // apply night vision effect
+               vector tc_00, tc_01, tc_10, tc_11;
+               vector rgb = '0 0 0';
+
+               if(!nightvision_noise)
+               {
+                       nightvision_noise = spawn();
+                       nightvision_noise.classname = "nightvision_noise";
+               }
+               if(!nightvision_noise2)
+               {
+                       nightvision_noise2 = spawn();
+                       nightvision_noise2.classname = "nightvision_noise2";
+               }
+
+               // color tint in yellow
+               drawfill('0 0 0', autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', '0.5 1 0.3', 1, DRAWFLAG_MODULATE);
+
+               // draw BG
+               a = Noise_Pink(nightvision_noise, frametime * 1.5) * 0.05 + 0.15;
+               rgb = '1 1 1';
+               tc_00 = '0 0 0' + '0.2 0 0' * sin(time * 0.3) + '0 0.3 0' * cos(time * 0.7);
+               tc_01 = '0 2.25 0' + '0.6 0 0' * cos(time * 1.2) - '0 0.3 0' * sin(time * 2.2);
+               tc_10 = '1.5 0 0' - '0.2 0 0' * sin(time * 0.5) + '0 0.5 0' * cos(time * 1.7);
+               //tc_11 = '1 1 0' + '0.6 0 0' * sin(time * 0.6) + '0 0.3 0' * cos(time * 0.1);
+               tc_11 = tc_01 + tc_10 - tc_00;
+               R_BeginPolygon("gfx/nightvision-bg.tga", DRAWFLAG_ADDITIVE);
+               R_PolygonVertex('0 0 0', tc_00, rgb, a);
+               R_PolygonVertex(autocvar_vid_conwidth * '1 0 0', tc_10, rgb, a);
+               R_PolygonVertex(autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', tc_11, rgb, a);
+               R_PolygonVertex(autocvar_vid_conheight * '0 1 0', tc_01, rgb, a);
+               R_EndPolygon();
+
+               // draw FG
+               a = Noise_Pink(nightvision_noise2, frametime * 0.1) * 0.05 + 0.12;
+               rgb = '0.3 0.6 0.4' + '0.1 0.4 0.2' * Noise_White(nightvision_noise2, frametime);
+               tc_00 = '0 0 0' + '1 0 0' * Noise_White(nightvision_noise2, frametime) + '0 1 0' * Noise_White(nightvision_noise2, frametime);
+               tc_01 = tc_00 + '0 3 0' * (1 + Noise_White(nightvision_noise2, frametime) * 0.2);
+               tc_10 = tc_00 + '2 0 0' * (1 + Noise_White(nightvision_noise2, frametime) * 0.3);
+               tc_11 = tc_01 + tc_10 - tc_00;
+               R_BeginPolygon("gfx/nightvision-fg.tga", DRAWFLAG_ADDITIVE);
+               R_PolygonVertex('0 0 0', tc_00, rgb, a);
+               R_PolygonVertex(autocvar_vid_conwidth * '1 0 0', tc_10, rgb, a);
+               R_PolygonVertex(autocvar_vid_conwidth * '1 0 0' + autocvar_vid_conheight * '0 1 0', tc_11, rgb, a);
+               R_PolygonVertex(autocvar_vid_conheight * '0 1 0', tc_01, rgb, a);
+               R_EndPolygon();
+       }
+
+       if(autocvar_cl_reticle)
+       {
+               // Draw the aiming reticle for weapons that use it
+               // reticle_type is changed to the item we are zooming / aiming with, to decide which reticle to use
+               // It must be a persisted float for fading out to work properly (you let go of the zoom button for
+               // the view to go back to normal, so reticle_type would become 0 as we fade out)
+               if(spectatee_status || is_dead || hud != HUD_NORMAL)
+               {
+                       // no zoom reticle while dead
+                       reticle_type = 0;
+               }
+               else if(WEP_ACTION(activeweapon, WR_ZOOMRETICLE) && autocvar_cl_reticle_weapon)
+               {
+                       if(reticle_image != "") { reticle_type = 2; }
+                       else { reticle_type = 0; }
+               }
+               else if(button_zoom || zoomscript_caught)
+               {
+                       // normal zoom
+                       reticle_type = 1;
+               }
+
+               if(reticle_type)
+               {
+                       if(autocvar_cl_reticle_stretch)
+                       {
+                               reticle_size.x = vid_conwidth;
+                               reticle_size.y = vid_conheight;
+                               reticle_pos.x = 0;
+                               reticle_pos.y = 0;
+                       }
+                       else
+                       {
+                               reticle_size.x = max(vid_conwidth, vid_conheight);
+                               reticle_size.y = max(vid_conwidth, vid_conheight);
+                               reticle_pos.x = (vid_conwidth - reticle_size.x) / 2;
+                               reticle_pos.y = (vid_conheight - reticle_size.y) / 2;
+                       }
+
+                       if(zoomscript_caught)
+                               f = 1;
+                       else
+                               f = current_zoomfraction;
+
+                       if(f)
+                       {
+                               switch(reticle_type)
+                               {
+                                       case 1: drawpic(reticle_pos, "gfx/reticle_normal", reticle_size, '1 1 1', f * autocvar_cl_reticle_normal_alpha, DRAWFLAG_NORMAL); break;
+                                       case 2: drawpic(reticle_pos, reticle_image, reticle_size, '1 1 1', f * autocvar_cl_reticle_weapon_alpha, DRAWFLAG_NORMAL); break;
+                               }
+                       }
+               }
+       }
+       else
+       {
+               if(reticle_type != 0) { reticle_type = 0; }
+       }
+
+
+       // improved polyblend
+       if(autocvar_hud_contents)
+       {
+               float contentalpha_temp, incontent, liquidalpha, contentfadetime;
+               vector liquidcolor;
+
+               switch(pointcontents(view_origin))
+               {
+                       case CONTENT_WATER:
+                               liquidalpha = autocvar_hud_contents_water_alpha;
+                               liquidcolor = stov(autocvar_hud_contents_water_color);
+                               incontent = 1;
+                               break;
+
+                       case CONTENT_LAVA:
+                               liquidalpha = autocvar_hud_contents_lava_alpha;
+                               liquidcolor = stov(autocvar_hud_contents_lava_color);
+                               incontent = 1;
+                               break;
+
+                       case CONTENT_SLIME:
+                               liquidalpha = autocvar_hud_contents_slime_alpha;
+                               liquidcolor = stov(autocvar_hud_contents_slime_color);
+                               incontent = 1;
+                               break;
+
+                       default:
+                               liquidalpha = 0;
+                               liquidcolor = '0 0 0';
+                               incontent = 0;
+                               break;
+               }
+
+               if(incontent) // fade in/out at different speeds so you can do e.g. instant fade when entering water and slow when leaving it.
+               { // also lets delcare previous values for blending properties, this way it isn't reset until after you have entered a different content
+                       contentfadetime = autocvar_hud_contents_fadeintime;
+                       liquidalpha_prev = liquidalpha;
+                       liquidcolor_prev = liquidcolor;
+               }
+               else
+                       contentfadetime = autocvar_hud_contents_fadeouttime;
+
+               contentalpha_temp = bound(0, drawframetime / max(0.0001, contentfadetime), 1);
+               contentavgalpha = contentavgalpha * (1 - contentalpha_temp) + incontent * contentalpha_temp;
+
+               if(contentavgalpha)
+                       drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, liquidcolor_prev, contentavgalpha * liquidalpha_prev, DRAWFLAG_NORMAL);
+
+               if(autocvar_hud_postprocessing)
+               {
+                       if(autocvar_hud_contents_blur && contentavgalpha)
+                       {
+                               content_blurpostprocess.x = 1;
+                               content_blurpostprocess.y = contentavgalpha * autocvar_hud_contents_blur;
+                               content_blurpostprocess.z = contentavgalpha * autocvar_hud_contents_blur_alpha;
+                       }
+                       else
+                       {
+                               content_blurpostprocess.x = 0;
+                               content_blurpostprocess.y = 0;
+                               content_blurpostprocess.z = 0;
+                       }
+               }
+       }
+
+       if(autocvar_hud_damage && !getstati(STAT_FROZEN))
+       {
+               splash_size.x = max(vid_conwidth, vid_conheight);
+               splash_size.y = max(vid_conwidth, vid_conheight);
+               splash_pos.x = (vid_conwidth - splash_size.x) / 2;
+               splash_pos.y = (vid_conheight - splash_size.y) / 2;
+
+               float myhealth_flash_temp;
+               myhealth = getstati(STAT_HEALTH);
+
+               // fade out
+               myhealth_flash = max(0, myhealth_flash - autocvar_hud_damage_fade_rate * frametime);
+               // add new damage
+               myhealth_flash = bound(0, myhealth_flash + dmg_take * autocvar_hud_damage_factor, autocvar_hud_damage_maxalpha);
+
+               float pain_threshold, pain_threshold_lower, pain_threshold_lower_health;
+               pain_threshold = autocvar_hud_damage_pain_threshold;
+               pain_threshold_lower = autocvar_hud_damage_pain_threshold_lower;
+               pain_threshold_lower_health = autocvar_hud_damage_pain_threshold_lower_health;
+
+               if(pain_threshold_lower && myhealth < pain_threshold_lower_health)
+               {
+                       pain_threshold = pain_threshold - max(autocvar_hud_damage_pain_threshold_pulsating_min, fabs(sin(M_PI * time / autocvar_hud_damage_pain_threshold_pulsating_period))) * pain_threshold_lower * (1 - max(0, myhealth)/pain_threshold_lower_health);
+               }
+
+               myhealth_flash_temp = bound(0, myhealth_flash - pain_threshold, 1);
+
+               if(myhealth_prev < 1)
+               {
+                       if(myhealth >= 1)
+                       {
+                               myhealth_flash = 0; // just spawned, clear the flash immediately
+                               myhealth_flash_temp = 0;
+                       }
+                       else
+                       {
+                               myhealth_flash += autocvar_hud_damage_fade_rate * frametime; // dead
+                       }
+               }
+
+               if(spectatee_status == -1 || intermission)
+               {
+                       myhealth_flash = 0; // observing, or match ended
+                       myhealth_flash_temp = 0;
+               }
+
+               myhealth_prev = myhealth;
+
+               // IDEA: change damage color/picture based on player model for robot/alien species?
+               // pro: matches model better
+               // contra: it's not red because blood is red, but because red is an alarming color, so red should stay
+               // maybe different reddish pics?
+               if(autocvar_cl_gentle_damage || autocvar_cl_gentle)
+               {
+                       if(autocvar_cl_gentle_damage == 2)
+                       {
+                               if(myhealth_flash < pain_threshold) // only randomize when the flash is gone
+                               {
+                                       myhealth_gentlergb = eX * random() + eY * random() + eZ * random();
+                               }
+                       }
+                       else
+                               myhealth_gentlergb = stov(autocvar_hud_damage_gentle_color);
+
+                       drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, myhealth_gentlergb, autocvar_hud_damage_gentle_alpha_multiplier * bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
+               }
+               else
+                       drawpic(splash_pos, "gfx/blood", splash_size, stov(autocvar_hud_damage_color), bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
+
+               if(autocvar_hud_postprocessing) // we still need to set this anyway even when chase_active is set, this way it doesn't get stuck on.
+               {
+                       if(autocvar_hud_damage_blur && myhealth_flash_temp)
+                       {
+                               damage_blurpostprocess.x = 1;
+                               damage_blurpostprocess.y = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur;
+                               damage_blurpostprocess.z = bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage_blur_alpha;
+                       }
+                       else
+                       {
+                               damage_blurpostprocess.x = 0;
+                               damage_blurpostprocess.y = 0;
+                               damage_blurpostprocess.z = 0;
+                       }
+               }
+       }
+
+       float e1 = (autocvar_hud_postprocessing_maxbluralpha != 0);
+       float e2 = (autocvar_hud_powerup != 0);
+       if(autocvar_hud_postprocessing && (e1 || e2)) // TODO: Remove this code and re-do the postprocess handling in the engine, where it properly belongs.
+       {
+               // enable or disable rendering types if they are used or not
+               if(cvar("r_glsl_postprocess_uservec1_enable") != e1) { cvar_set("r_glsl_postprocess_uservec1_enable", ftos(e1)); }
+               if(cvar("r_glsl_postprocess_uservec2_enable") != e2) { cvar_set("r_glsl_postprocess_uservec2_enable", ftos(e2)); }
+
+               // blur postprocess handling done first (used by hud_damage and hud_contents)
+               if((damage_blurpostprocess.x || content_blurpostprocess.x))
+               {
+                       float blurradius = bound(0, damage_blurpostprocess.y + content_blurpostprocess.y, autocvar_hud_postprocessing_maxblurradius);
+                       float bluralpha = bound(0, damage_blurpostprocess.z + content_blurpostprocess.z, autocvar_hud_postprocessing_maxbluralpha);
+                       if(blurradius != old_blurradius || bluralpha != old_bluralpha) // reduce cvar_set spam as much as possible
+                       {
+                               cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(blurradius), " ", ftos(bluralpha), " 0 0"));
+                               old_blurradius = blurradius;
+                               old_bluralpha = bluralpha;
+                       }
+               }
+               else if(cvar_string("r_glsl_postprocess_uservec1") != "0 0 0 0") // reduce cvar_set spam as much as possible
+               {
+                       cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");
+                       old_blurradius = 0;
+                       old_bluralpha = 0;
+               }
+
+               // edge detection postprocess handling done second (used by hud_powerup)
+               float sharpen_intensity = 0, strength_finished = getstatf(STAT_STRENGTH_FINISHED), invincible_finished = getstatf(STAT_INVINCIBLE_FINISHED);
+               if (strength_finished - time > 0) { sharpen_intensity += (strength_finished - time); }
+               if (invincible_finished - time > 0) { sharpen_intensity += (invincible_finished - time); }
+
+               sharpen_intensity = bound(0, ((getstati(STAT_HEALTH) > 0) ? sharpen_intensity : 0), 5); // Check to see if player is alive (if not, set 0) - also bound to fade out starting at 5 seconds.
+
+               if(autocvar_hud_powerup && sharpen_intensity > 0)
+               {
+                       if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible
+                       {
+                               cvar_set("r_glsl_postprocess_uservec2", strcat(ftos((sharpen_intensity / 5) * autocvar_hud_powerup), " ", ftos(-sharpen_intensity * autocvar_hud_powerup), " 0 0"));
+                               old_sharpen_intensity = sharpen_intensity;
+                       }
+               }
+               else if(cvar_string("r_glsl_postprocess_uservec2") != "0 0 0 0") // reduce cvar_set spam as much as possible
+               {
+                       cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");
+                       old_sharpen_intensity = 0;
+               }
+
+               if(cvar("r_glsl_postprocess") == 0)
+                       cvar_set("r_glsl_postprocess", "2");
+       }
+       else if(cvar("r_glsl_postprocess") == 2)
+               cvar_set("r_glsl_postprocess", "0");
+
+       if(menu_visible)
+               menu_show();
+
+       /*if(gametype == MAPINFO_TYPE_CTF)
+         {
+         ctf_view();
+         } else */
+
+       // draw 2D entities
+       e = self;
+       for(self = world; (self = nextent(self)); )
+               if(self.draw2d)
+                       self.draw2d();
+       self = e;
+       Draw_ShowNames_All();
+
+       scoreboard_active = HUD_WouldDrawScoreboard();
+
+       UpdateDamage();
+       UpdateCrosshair();
+       UpdateHitsound();
+
+       if(NextFrameCommand)
+       {
+               localcmd("\n", NextFrameCommand, "\n");
+               NextFrameCommand = string_null;
+       }
+
+       // we must do this check AFTER a frame was rendered, or it won't work
+       if(cs_project_is_b0rked == 0)
+       {
+               string w0, h0;
+               w0 = ftos(autocvar_vid_conwidth);
+               h0 = ftos(autocvar_vid_conheight);
+               //setproperty(VF_VIEWPORT, '0 0 0', '640 480 0');
+               //setproperty(VF_FOV, '90 90 0');
+               setproperty(VF_ORIGIN, '0 0 0');
+               setproperty(VF_ANGLES, '0 0 0');
+               setproperty(VF_PERSPECTIVE, 1);
+               makevectors('0 0 0');
+               vector v1, v2;
+               cvar_set("vid_conwidth", "800");
+               cvar_set("vid_conheight", "600");
+               v1 = cs_project(v_forward);
+               cvar_set("vid_conwidth", "640");
+               cvar_set("vid_conheight", "480");
+               v2 = cs_project(v_forward);
+               if(v1 == v2)
+                       cs_project_is_b0rked = 1;
+               else
+                       cs_project_is_b0rked = -1;
+               cvar_set("vid_conwidth", w0);
+               cvar_set("vid_conheight", h0);
+       }
+
+       if(autocvar__hud_configure)
+               HUD_Panel_Mouse();
+
+    if(hud && !intermission)
+    {
+        if(hud == HUD_SPIDERBOT)
+            CSQC_SPIDER_HUD();
+        else if(hud == HUD_WAKIZASHI)
+            CSQC_WAKIZASHI_HUD();
+        else if(hud == HUD_RAPTOR)
+            CSQC_RAPTOR_HUD();
+        else if(hud == HUD_BUMBLEBEE)
+            CSQC_BUMBLE_HUD();
+        else if(hud == HUD_BUMBLEBEE_GUN)
+            CSQC_BUMBLE_GUN_HUD();
+    }
+
+       cl_notice_run();
+
+       // let's reset the view back to normal for the end
+       setproperty(VF_MIN, '0 0 0');
+       setproperty(VF_SIZE, '1 0 0' * w + '0 1 0' * h);
+}
+
+
+void CSQC_common_hud(void)
+{
+       if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS))
+               Accuracy_LoadLevels();
+
+       HUD_Main(); // always run these functions for alpha checks
+       HUD_DrawScoreboard();
+
+       if (scoreboard_active) // scoreboard/accuracy
+               HUD_Reset();
+       else if (intermission == 2) // map voting screen
+       {
+               MapVote_Draw();
+               HUD_Reset();
+       }
+}
+
+
+// following vectors must be global to allow seamless switching between camera modes
+vector camera_offset, current_camera_offset, mouse_angles, current_angles, current_origin, current_position;
+void CSQC_Demo_Camera()
+{
+       float speed, attenuation, dimensions;
+       vector tmp, delta;
+
+       if( autocvar_camera_reset || !camera_mode )
+       {
+               camera_offset = '0 0 0';
+               current_angles = '0 0 0';
+               camera_direction = '0 0 0';
+               camera_offset.z += 30;
+               camera_offset.x += 30 * -cos(current_angles.y * DEG2RAD);
+               camera_offset.y += 30 * -sin(current_angles.y * DEG2RAD);
+               current_origin = view_origin;
+               current_camera_offset  = camera_offset;
+               cvar_set("camera_reset", "0");
+               camera_mode = CAMERA_CHASE;
+       }
+
+       // Camera angles
+       if( camera_roll )
+               mouse_angles.z += camera_roll * autocvar_camera_speed_roll;
+
+       if(autocvar_camera_look_player)
+       {
+               vector dir;
+               float n;
+
+               dir = normalize(view_origin - current_position);
+               n = mouse_angles.z;
+               mouse_angles = vectoangles(dir);
+               mouse_angles.x = mouse_angles.x * -1;
+               mouse_angles.z = n;
+       }
+       else
+       {
+               tmp = getmousepos() * 0.1;
+               if(vlen(tmp)>autocvar_camera_mouse_threshold)
+               {
+                       mouse_angles.x += tmp.y * cos(mouse_angles.z * DEG2RAD) + (tmp.x * sin(mouse_angles.z * DEG2RAD));
+                       mouse_angles.y -= tmp.x * cos(mouse_angles.z * DEG2RAD) + (tmp.y * -sin(mouse_angles.z * DEG2RAD));
+               }
+       }
+
+       while (mouse_angles.x < -180) mouse_angles.x = mouse_angles.x + 360;
+       while (mouse_angles.x > 180) mouse_angles.x = mouse_angles.x - 360;
+       while (mouse_angles.y < -180) mouse_angles.y = mouse_angles.y + 360;
+       while (mouse_angles.y > 180) mouse_angles.y = mouse_angles.y - 360;
+
+       // Fix difference when angles don't have the same sign
+       delta = '0 0 0';
+       if(mouse_angles.y < -60 && current_angles.y > 60)
+               delta = '0 360 0';
+       if(mouse_angles.y > 60 && current_angles.y < -60)
+               delta = '0 -360 0';
+
+       if(autocvar_camera_look_player)
+               attenuation = autocvar_camera_look_attenuation;
+       else
+               attenuation = autocvar_camera_speed_attenuation;
+
+       attenuation = 1 / max(1, attenuation);
+       current_angles += (mouse_angles - current_angles + delta) * attenuation;
+
+       while (current_angles.x < -180) current_angles.x = current_angles.x + 360;
+       while (current_angles.x > 180) current_angles.x = current_angles.x - 360;
+       while (current_angles.y < -180) current_angles.y = current_angles.y + 360;
+       while (current_angles.y > 180) current_angles.y = current_angles.y - 360;
+
+       // Camera position
+       tmp = '0 0 0';
+       dimensions = 0;
+
+       if( camera_direction.x )
+       {
+               tmp.x = camera_direction.x * cos(current_angles.y * DEG2RAD);
+               tmp.y = camera_direction.x * sin(current_angles.y * DEG2RAD);
+               if( autocvar_camera_forward_follows && !autocvar_camera_look_player )
+                       tmp.z = camera_direction.x * -sin(current_angles.x * DEG2RAD);
+               ++dimensions;
+       }
+
+       if( camera_direction.y )
+       {
+               tmp.x += camera_direction.y * -sin(current_angles.y * DEG2RAD);
+               tmp.y += camera_direction.y * cos(current_angles.y * DEG2RAD) * cos(current_angles.z * DEG2RAD);
+               tmp.z += camera_direction.y * sin(current_angles.z * DEG2RAD);
+               ++dimensions;
+       }
+
+       if( camera_direction.z )
+       {
+               tmp.z += camera_direction.z * cos(current_angles.z * DEG2RAD);
+               ++dimensions;
+       }
+
+       if(autocvar_camera_free)
+               speed = autocvar_camera_speed_free;
+       else
+               speed = autocvar_camera_speed_chase;
+
+       if(dimensions)
+       {
+               speed = speed * sqrt(1 / dimensions);
+               camera_offset += tmp * speed;
+       }
+
+       current_camera_offset += (camera_offset - current_camera_offset) * attenuation;
+
+       // Camera modes
+       if( autocvar_camera_free )
+       {
+               if ( camera_mode == CAMERA_CHASE )
+               {
+                       current_camera_offset = current_origin + current_camera_offset;
+                       camera_offset = current_origin + camera_offset;
+               }
+
+               camera_mode = CAMERA_FREE;
+               current_position = current_camera_offset;
+       }
+       else
+       {
+               if ( camera_mode == CAMERA_FREE )
+               {
+                       current_origin = view_origin;
+                       camera_offset = camera_offset - current_origin;
+                       current_camera_offset = current_camera_offset - current_origin;
+               }
+
+               camera_mode = CAMERA_CHASE;
+
+               if(autocvar_camera_chase_smoothly)
+                       current_origin += (view_origin - current_origin) * attenuation;
+               else
+                       current_origin = view_origin;
+
+               current_position = current_origin + current_camera_offset;
+       }
+
+       setproperty(VF_ANGLES, current_angles);
+       setproperty(VF_ORIGIN, current_position);
+}
index 211af4cb0889593380acdfa9785149ae76a5d52d..1ae8fa85a311dccebaecdce7af6fd1216521d0b3 100644 (file)
@@ -1,8 +1,4 @@
-.float lip;
-.float bgmscriptangular;
-.float lodmodelindex0, lodmodelindex1, lodmodelindex2;
-.float loddistance1, loddistance2;
-.vector saved;
+#include "wall.qh"
 
 void Ent_Wall_Draw()
 {
@@ -71,7 +67,7 @@ void Ent_Wall_Remove()
 
 void Ent_Wall()
 {
-       float f;
+       int f;
        var .vector fld;
 
        InterpolateOrigin_Undo();
diff --git a/qcsrc/client/wall.qh b/qcsrc/client/wall.qh
new file mode 100644 (file)
index 0000000..984b54c
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef WALL_H
+#define WALL_H
+
+.float lip;
+.float bgmscriptangular;
+.int lodmodelindex0, lodmodelindex1, lodmodelindex2;
+.float loddistance1, loddistance2;
+.vector saved;
+
+void Ent_Wall_Draw();
+
+void Ent_Wall_Remove();
+
+void Ent_Wall();
+#endif
index 2df3dd411bc6d9f4da76ef4124a81fa51658c8fc..788dd871eed84f74e2050375211ef9eca122ee20 100644 (file)
@@ -1,51 +1,4 @@
-float waypointsprite_initialized;
-float waypointsprite_fadedistance;
-float waypointsprite_normdistance;
-float waypointsprite_minscale;
-float waypointsprite_minalpha;
-float waypointsprite_distancealphaexponent;
-float waypointsprite_timealphaexponent;
-float waypointsprite_scale;
-float waypointsprite_fontsize;
-float waypointsprite_edgefadealpha;
-float waypointsprite_edgefadescale;
-float waypointsprite_edgefadedistance;
-float waypointsprite_edgeoffset_bottom;
-float waypointsprite_edgeoffset_left;
-float waypointsprite_edgeoffset_right;
-float waypointsprite_edgeoffset_top;
-float waypointsprite_crosshairfadealpha;
-float waypointsprite_crosshairfadescale;
-float waypointsprite_crosshairfadedistance;
-float waypointsprite_distancefadealpha;
-float waypointsprite_distancefadescale;
-float waypointsprite_distancefadedistance;
-float waypointsprite_alpha;
-
-.float helpme;
-.float rule;
-.string netname; // primary picture
-.string netname2; // secondary picture
-.string netname3; // tertiary picture
-.float team; // team that gets netname2
-.float lifetime;
-.float fadetime;
-.float maxdistance;
-.float hideflags;
-.float spawntime;
-.float health;
-.float build_started;
-.float build_starthealth;
-.float build_finished;
-
-const float SPRITE_HEALTHBAR_WIDTH = 144;
-const float SPRITE_HEALTHBAR_HEIGHT = 9;
-const float SPRITE_HEALTHBAR_MARGIN = 6;
-const float SPRITE_HEALTHBAR_BORDER = 2;
-const float SPRITE_HEALTHBAR_BORDERALPHA = 1;
-const float SPRITE_HEALTHBAR_HEALTHALPHA = 0.5;
-const float SPRITE_ARROW_SCALE = 1.0;
-const float SPRITE_HELPME_BLINK = 2;
+#include "waypointsprites.qh"
 
 void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, vector rgb, float a, float f)
 {
@@ -55,9 +8,9 @@ void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, ve
 
        // hotspot-relative coordinates of the corners
        v1 = hotspot;
-       v2 = hotspot + '1 0 0' * sz_x;
-       v3 = hotspot + '1 0 0' * sz_x + '0 1 0' * sz_y;
-       v4 = hotspot                  + '0 1 0' * sz_y;
+       v2 = hotspot + '1 0 0' * sz.x;
+       v3 = hotspot + '1 0 0' * sz.x + '0 1 0' * sz.y;
+       v4 = hotspot                  + '0 1 0' * sz.y;
 
        // rotate them, and make them absolute
        rot = -rot; // rotate by the opposite angle, as our coordinate system is reversed
@@ -103,7 +56,7 @@ void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, fl
        up = rotate(up, rot);
 
        owidth = width + 2 * border;
-       o = o - up * (margin + border + height) + ri * (sz_x - owidth) * 0.5;
+       o = o - up * (margin + border + height) + ri * (sz.x - owidth) * 0.5;
 
        drawquad(o - up * border,                               ri * owidth,    up * border, "", rgb,  a,  f);
        drawquad(o + up * height,                               ri * owidth,    up * border, "", rgb,  a,  f);
@@ -149,12 +102,12 @@ vector drawspritetext(vector o, float ang, float minwidth, vector rgb, float a,
        float sw, w, h;
        float aspect, sa, ca;
 
-       sw = stringwidth(s, FALSE, fontsize);
+       sw = stringwidth(s, false, fontsize);
        if(sw > minwidth)
                w = sw;
        else
                w = minwidth;
-       h = fontsize_y;
+       h = fontsize.y;
 
        // how do corners work?
        aspect = vid_conwidth / vid_conheight;
@@ -172,25 +125,25 @@ vector drawspritetext(vector o, float ang, float minwidth, vector rgb, float a,
        }
 
        // align
-       o_x -= w * algnx;
-       o_y -= h * algny;
+       o.x -= w * algnx;
+       o.y -= h * algny;
 
        // we want to be onscreen
-       if(o_x < 0)
-               o_x = 0;
-       if(o_y < 0)
-               o_y = 0;
-       if(o_x > vid_conwidth - w)
-               o_x = vid_conwidth - w;
-       if(o_y > vid_conheight - h)
-               o_x = vid_conheight - h;
+       if(o.x < 0)
+               o.x = 0;
+       if(o.y < 0)
+               o.y = 0;
+       if(o.x > vid_conwidth - w)
+               o.x = vid_conwidth - w;
+       if(o.y > vid_conheight - h)
+               o.x = vid_conheight - h;
 
-       o_x += 0.5 * (w - sw);
+       o.x += 0.5 * (w - sw);
 
        drawstring(o, s, fontsize, rgb, a, DRAWFLAG_NORMAL);
 
-       o_x += 0.5 * sw;
-       o_y += 0.5 * h;
+       o.x += 0.5 * sw;
+       o.y += 0.5 * h;
 
        return o;
 }
@@ -297,58 +250,57 @@ vector fixrgbexcess_move(vector rgb, vector src, vector dst)
 }
 vector fixrgbexcess(vector rgb)
 {
-       if(rgb_x > 1)
+       if(rgb.x > 1)
        {
                rgb = fixrgbexcess_move(rgb, '1 0 0', '0 1 1');
-               if(rgb_y > 1)
+               if(rgb.y > 1)
                {
                        rgb = fixrgbexcess_move(rgb, '0 1 0', '0 0 1');
-                       if(rgb_z > 1)
-                               rgb_z = 1;
+                       if(rgb.z > 1)
+                               rgb.z = 1;
                }
-               else if(rgb_z > 1)
+               else if(rgb.z > 1)
                {
                        rgb = fixrgbexcess_move(rgb, '0 0 1', '0 1 0');
-                       if(rgb_y > 1)
-                               rgb_y = 1;
+                       if(rgb.y > 1)
+                               rgb.y = 1;
                }
        }
-       else if(rgb_y > 1)
+       else if(rgb.y > 1)
        {
                rgb = fixrgbexcess_move(rgb, '0 1 0', '1 0 1');
-               if(rgb_x > 1)
+               if(rgb.x > 1)
                {
                        rgb = fixrgbexcess_move(rgb, '1 0 0', '0 0 1');
-                       if(rgb_z > 1)
-                               rgb_z = 1;
+                       if(rgb.z > 1)
+                               rgb.z = 1;
                }
-               else if(rgb_z > 1)
+               else if(rgb.z > 1)
                {
                        rgb = fixrgbexcess_move(rgb, '0 0 1', '1 0 0');
-                       if(rgb_x > 1)
-                               rgb_x = 1;
+                       if(rgb.x > 1)
+                               rgb.x = 1;
                }
        }
-       else if(rgb_z > 1)
+       else if(rgb.z > 1)
        {
                rgb = fixrgbexcess_move(rgb, '0 0 1', '1 1 0');
-               if(rgb_x > 1)
+               if(rgb.x > 1)
                {
                        rgb = fixrgbexcess_move(rgb, '1 0 0', '0 1 0');
-                       if(rgb_y > 1)
-                               rgb_y = 1;
+                       if(rgb.y > 1)
+                               rgb.y = 1;
                }
-               else if(rgb_y > 1)
+               else if(rgb.y > 1)
                {
                        rgb = fixrgbexcess_move(rgb, '0 1 0', '1 0 0');
-                       if(rgb_x > 1)
-                               rgb_x = 1;
+                       if(rgb.x > 1)
+                               rgb.x = 1;
                }
        }
        return rgb;
 }
 
-float waypointsprite_count, waypointsprite_newcount;
 void Draw_WaypointSprite()
 {
        string spriteimage;
@@ -450,27 +402,27 @@ void Draw_WaypointSprite()
        float ang;
 
        o = project_3d_to_2d(self.origin);
-       if(o_z < 0
-       || o_x < (vid_conwidth * waypointsprite_edgeoffset_left)
-       || o_y < (vid_conheight * waypointsprite_edgeoffset_top)
-       || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
-       || o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
+       if(o.z < 0
+       || o.x < (vid_conwidth * waypointsprite_edgeoffset_left)
+       || o.y < (vid_conheight * waypointsprite_edgeoffset_top)
+       || o.x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
+       || o.y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
        {
                // scale it to be just in view
                vector d;
                float f1, f2;
 
                d = o - '0.5 0 0' * vid_conwidth - '0 0.5 0' * vid_conheight;
-               ang = atan2(-d_x, -d_y);
-               if(o_z < 0)
+               ang = atan2(-d.x, -d.y);
+               if(o.z < 0)
                        ang += M_PI;
 
-               f1 = d_x / vid_conwidth;
-               f2 = d_y / vid_conheight;
+               f1 = d.x / vid_conwidth;
+               f2 = d.y / vid_conheight;
 
                if(max(f1, -f1) > max(f2, -f2))
                {
-                       if(d_z * f1 > 0)
+                       if(d.z * f1 > 0)
                        {
                                // RIGHT edge
                                d = d * ((0.5 - waypointsprite_edgeoffset_right) / f1);
@@ -483,7 +435,7 @@ void Draw_WaypointSprite()
                }
                else
                {
-                       if(d_z * f2 > 0)
+                       if(d.z * f2 > 0)
                        {
                                // BOTTOM edge
                                d = d * ((0.5 - waypointsprite_edgeoffset_bottom) / f2);
@@ -504,21 +456,21 @@ void Draw_WaypointSprite()
 #else
                vector d;
                d = o - '0.5 0 0' * vid_conwidth - '0 0.5 0' * vid_conheight;
-               ang = atan2(-d_x, -d_y);
+               ang = atan2(-d.x, -d.y);
 #endif
        }
-       o_z = 0;
+       o.z = 0;
 
        float edgedistance_min, crosshairdistance;
-               edgedistance_min = min((o_y - (vid_conheight * waypointsprite_edgeoffset_top)),
-       (o_x - (vid_conwidth * waypointsprite_edgeoffset_left)),
-       (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x,
-       (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o_y);
+               edgedistance_min = min((o.y - (vid_conheight * waypointsprite_edgeoffset_top)),
+       (o.x - (vid_conwidth * waypointsprite_edgeoffset_left)),
+       (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o.x,
+       (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o.y);
 
        float vidscale;
        vidscale = max(vid_conwidth / vid_width, vid_conheight / vid_height);
 
-       crosshairdistance = sqrt( pow(o_x - vid_conwidth/2, 2) + pow(o_y - vid_conheight/2, 2) );
+       crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) );
 
        t = waypointsprite_scale * vidscale;
        a *= waypointsprite_alpha;
@@ -614,7 +566,7 @@ void Ent_RemoveWaypointSprite()
 
 void Ent_WaypointSprite()
 {
-       float sendflags, f, t;
+       int sendflags, f, t;
        sendflags = ReadByte();
 
        if(!self.spawntime)
@@ -720,7 +672,7 @@ void WaypointSprite_Load_Frames(string ext)
 {
        float dh, n, i, o, f;
        string s, sname, sframes;
-       dh = search_begin(strcat("models/sprites/*_frame*", ext), FALSE, FALSE);
+       dh = search_begin(strcat("models/sprites/*_frame*", ext), false, false);
        if (dh < 0)
                 return;
        float ext_len = strlen(ext);
index 94895083323964aeb3c3e1f6037cfb28acae90ad..3822793da1d0ef2b34260a07a850af138e9ab601 100644 (file)
@@ -1,3 +1,86 @@
+#ifndef WAYPOINTSPRITES_H
+#define WAYPOINTSPRITES_H
+
+
+float waypointsprite_initialized;
+float waypointsprite_fadedistance;
+float waypointsprite_normdistance;
+float waypointsprite_minscale;
+float waypointsprite_minalpha;
+float waypointsprite_distancealphaexponent;
+float waypointsprite_timealphaexponent;
+float waypointsprite_scale;
+float waypointsprite_fontsize;
+float waypointsprite_edgefadealpha;
+float waypointsprite_edgefadescale;
+float waypointsprite_edgefadedistance;
+float waypointsprite_edgeoffset_bottom;
+float waypointsprite_edgeoffset_left;
+float waypointsprite_edgeoffset_right;
+float waypointsprite_edgeoffset_top;
+float waypointsprite_crosshairfadealpha;
+float waypointsprite_crosshairfadescale;
+float waypointsprite_crosshairfadedistance;
+float waypointsprite_distancefadealpha;
+float waypointsprite_distancefadescale;
+float waypointsprite_distancefadedistance;
+float waypointsprite_alpha;
+
+.float helpme;
+.float rule;
+.string netname; // primary picture
+.string netname2; // secondary picture
+.string netname3; // tertiary picture
+.float team; // team that gets netname2
+.float lifetime;
+.float fadetime;
+.float maxdistance;
+.int hideflags;
+.float spawntime;
+.float health;
+.float build_started;
+.float build_starthealth;
+.float build_finished;
+
+const float SPRITE_HEALTHBAR_WIDTH = 144;
+const float SPRITE_HEALTHBAR_HEIGHT = 9;
+const float SPRITE_HEALTHBAR_MARGIN = 6;
+const float SPRITE_HEALTHBAR_BORDER = 2;
+const float SPRITE_HEALTHBAR_BORDERALPHA = 1;
+const float SPRITE_HEALTHBAR_HEALTHALPHA = 0.5;
+const float SPRITE_ARROW_SCALE = 1.0;
+const float SPRITE_HELPME_BLINK = 2;
+
+float waypointsprite_count, waypointsprite_newcount;
+
+void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, vector rgb, float a, float f);
+
+void drawquad(vector o, vector ri, vector up, string pic, vector rgb, float a, float f);
+
+void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, float width, float height, float margin, float border, float align, vector rgb, float a, vector hrgb, float ha, float f);
+
+// returns location of sprite text
+vector drawspritearrow(vector o, float ang, vector rgb, float a, float t);
+
+// returns location of sprite healthbar
+vector drawspritetext(vector o, float ang, float minwidth, vector rgb, float a, vector fontsize, string s);
+
+float spritelookupblinkvalue(string s);
+vector spritelookupcolor(string s, vector def);
+string spritelookuptext(string s);
+
+vector fixrgbexcess_move(vector rgb, vector src, vector dst);
+vector fixrgbexcess(vector rgb);
+
+void Draw_WaypointSprite();
+
 // they are drawn using a .draw function
-void Ent_WaypointSprite();
+
 void Ent_RemoveWaypointSprite();
+void Ent_WaypointSprite();
+
+void WaypointSprite_Load_Frames(string ext);
+
+void WaypointSprite_Load();
+
+#endif
index e019b6755514c10957a91c9d43042827e137de72..1d306fede6d6ce8733529821d373a7e16a371a0f 100644 (file)
@@ -1,8 +1,4 @@
-.vector iorigin1, iorigin2;
-.float spawntime;
-.vector trail_oldorigin;
-.float trail_oldtime;
-.float fade_time, fade_rate;
+#include "projectile.qh"
 
 void SUB_Stop()
 {
@@ -10,13 +6,6 @@ void SUB_Stop()
        self.move_movetype = MOVETYPE_NONE;
 }
 
-.float alphamod;
-.float count; // set if clientside projectile
-.float cnt; // sound index
-.float gravity;
-.float snd_looping;
-.float silent;
-
 void Projectile_ResetTrail(vector to)
 {
        self.trail_oldorigin = to;
@@ -36,7 +25,7 @@ void Projectile_DrawTrail(vector to)
        // force the effect even for stationary firemine
        if(self.cnt == PROJECTILE_FIREMINE)
                if(from == to)
-                       from_z += 1;
+                       from.z += 1;
 
        if (self.traileffect)
        {
@@ -49,8 +38,8 @@ void Projectile_Draw()
 {
        vector rot;
        vector trailorigin;
-       float f;
-       float drawn;
+       int f;
+       bool drawn;
        float t;
        float a;
 
@@ -116,7 +105,7 @@ void Projectile_Draw()
 
        vector ang;
        ang = self.angles;
-       ang_x = -ang_x;
+       ang.x = -ang.x;
        makevectors(ang);
 
        a = 1 - (time - self.fade_time) * self.fade_rate;
@@ -159,7 +148,7 @@ void Projectile_Draw()
        self.drawmask = MASK_NORMAL;
 }
 
-void loopsound(entity e, float ch, string samp, float vol, float attn)
+void loopsound(entity e, int ch, string samp, float vol, float attn)
 {
        if(self.silent)
                return;
@@ -179,7 +168,7 @@ void Ent_RemoveProjectile()
 
 void Ent_Projectile()
 {
-       float f;
+       int f;
 
        // projectile properties:
        //   kind (interpolated, or clientside)
@@ -444,7 +433,7 @@ void Ent_Projectile()
 
                if(Nade_IDFromProjectile(self.cnt) != 0)
                {
-                       float nade_type = Nade_IDFromProjectile(self.cnt);
+                       int nade_type = Nade_IDFromProjectile(self.cnt);
                        self.mins = '-16 -16 -16';
                        self.maxs = '16 16 16';
                        self.colormod = Nade_Color(nade_type);
index 70c8ba0dfc5df0ea78f523e9d9a6229dd5eccc36..3a4cdcb0432614006f9bd74de807dd06fdf13c21 100644 (file)
@@ -1,3 +1,35 @@
-.float traileffect;
+#ifndef PROJECTILE_H
+#define PROJECTILE_H
+
+.int traileffect;
+
+.vector iorigin1, iorigin2;
+.float spawntime;
+.vector trail_oldorigin;
+.float trail_oldtime;
+.float fade_time, fade_rate;
+
+.float alphamod;
+.int count; // set if clientside projectile
+.int cnt; // sound index
+.float gravity;
+.int snd_looping;
+.bool silent;
+
+void SUB_Stop();
+
 void Projectile_ResetTrail(vector to);
+
 void Projectile_DrawTrail(vector to);
+
+void Projectile_Draw();
+
+void loopsound(entity e, int ch, string samp, float vol, float attn);
+
+void Ent_RemoveProjectile();
+
+void Ent_Projectile();
+
+void Projectile_Precache();
+
+#endif
index d2b849f580e4832621dd5c16467dcbeb8cfb39cb..ecc840f6fbbe41358d381d26a8c12ffaac59de2d 100644 (file)
@@ -1,3 +1,15 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "animdecide.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "util.qh"
+    #include "animdecide.qh"
+    #include "../server/defs.qh"
+#endif
+
 // player animation data for this model
 // each vector is as follows:
 // _x = startframe
@@ -75,16 +87,16 @@ void animdecide_load_if_needed(entity e)
        e.anim_melee_z = 0.001;
 }
 
-#define ANIMPRIO_IDLE 0
-#define ANIMPRIO_ACTIVE 1
-#define ANIMPRIO_CROUCH 2
-#define ANIMPRIO_DEAD 3
+const float ANIMPRIO_IDLE = 0;
+const float ANIMPRIO_ACTIVE = 1;
+const float ANIMPRIO_CROUCH = 2;
+const float ANIMPRIO_DEAD = 3;
 
 vector animdecide_getupperanim(entity e)
 {
        // death etc.
        if(e.anim_state & ANIMSTATE_FROZEN)
-               return vec3(e.anim_idle_x, e.anim_time, ANIMPRIO_DEAD);
+               return vec3(e.anim_idle.x, e.anim_time, ANIMPRIO_DEAD);
        if(e.anim_state & ANIMSTATE_DEAD1)
                return vec3(e.anim_die1_x, e.anim_time, ANIMPRIO_DEAD);
        if(e.anim_state & ANIMSTATE_DEAD2)
@@ -112,25 +124,25 @@ vector animdecide_getupperanim(entity e)
                case ANIMACTION_TAUNT: outframe = e.anim_taunt; break;
                case ANIMACTION_MELEE: outframe = e.anim_melee; break;
        }
-       if(outframe_x >= 0)
+       if(outframe.x >= 0)
        {
-               if(time <= t + outframe_y / outframe_z)
+               if(time <= t + outframe.y / outframe.z)
                {
                        // animation is running!
-                       return vec3(outframe_x, t, ANIMPRIO_ACTIVE);
+                       return vec3(outframe.x, t, ANIMPRIO_ACTIVE);
                }
        }
        // or, decide the anim by state
        t = max(e.anim_time, e.anim_implicit_time);
        // but all states are for lower body!
-       return vec3(e.anim_idle_x, t, ANIMPRIO_IDLE);
+       return vec3(e.anim_idle.x, t, ANIMPRIO_IDLE);
 }
 
 vector animdecide_getloweranim(entity e)
 {
        // death etc.
        if(e.anim_state & ANIMSTATE_FROZEN)
-               return vec3(e.anim_idle_x, e.anim_time, ANIMPRIO_DEAD);
+               return vec3(e.anim_idle.x, e.anim_time, ANIMPRIO_DEAD);
        if(e.anim_state & ANIMSTATE_DEAD1)
                return vec3(e.anim_die1_x, e.anim_time, ANIMPRIO_DEAD);
        if(e.anim_state & ANIMSTATE_DEAD2)
@@ -153,12 +165,12 @@ vector animdecide_getloweranim(entity e)
        {
                case ANIMACTION_JUMP: if(e.anim_implicit_state & ANIMIMPLICITSTATE_INAIR) { if(e.anim_state & ANIMSTATE_DUCK) outframe = e.anim_duckjump; else outframe = e.anim_jump; } break;
        }
-       if(outframe_x >= 0)
+       if(outframe.x >= 0)
        {
-               if(time <= t + outframe_y / outframe_z)
+               if(time <= t + outframe.y / outframe.z)
                {
                        // animation is running!
-                       return vec3(outframe_x, t, ANIMPRIO_ACTIVE);
+                       return vec3(outframe.x, t, ANIMPRIO_ACTIVE);
                }
        }
        // or, decide the anim by state
@@ -166,71 +178,68 @@ vector animdecide_getloweranim(entity e)
        if(e.anim_state & ANIMSTATE_DUCK)
        {
                if(e.anim_implicit_state & ANIMIMPLICITSTATE_INAIR)
-                       return vec3(e.anim_duckjump_x, 0, ANIMPRIO_CROUCH); // play the END of the jump anim
+                       return vec3(e.anim_duckjump.x, 0, ANIMPRIO_CROUCH); // play the END of the jump anim
                else switch(e.anim_implicit_state & (ANIMIMPLICITSTATE_FORWARD | ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_LEFT | ANIMIMPLICITSTATE_RIGHT))
                {
                        case ANIMIMPLICITSTATE_FORWARD:
-                               return vec3(e.anim_duckwalk_x, t, ANIMPRIO_CROUCH);
+                               return vec3(e.anim_duckwalk.x, t, ANIMPRIO_CROUCH);
                        case ANIMIMPLICITSTATE_BACKWARDS:
-                               return vec3(e.anim_duckwalkbackwards_x, t, ANIMPRIO_CROUCH);
+                               return vec3(e.anim_duckwalkbackwards.x, t, ANIMPRIO_CROUCH);
                        case ANIMIMPLICITSTATE_RIGHT:
-                               return vec3(e.anim_duckwalkstraferight_x, t, ANIMPRIO_CROUCH);
+                               return vec3(e.anim_duckwalkstraferight.x, t, ANIMPRIO_CROUCH);
                        case ANIMIMPLICITSTATE_LEFT:
-                               return vec3(e.anim_duckwalkstrafeleft_x, t, ANIMPRIO_CROUCH);
+                               return vec3(e.anim_duckwalkstrafeleft.x, t, ANIMPRIO_CROUCH);
                        case ANIMIMPLICITSTATE_FORWARD | ANIMIMPLICITSTATE_RIGHT:
-                               return vec3(e.anim_duckwalkforwardright_x, t, ANIMPRIO_CROUCH);
+                               return vec3(e.anim_duckwalkforwardright.x, t, ANIMPRIO_CROUCH);
                        case ANIMIMPLICITSTATE_FORWARD | ANIMIMPLICITSTATE_LEFT:
-                               return vec3(e.anim_duckwalkforwardleft_x, t, ANIMPRIO_CROUCH);
+                               return vec3(e.anim_duckwalkforwardleft.x, t, ANIMPRIO_CROUCH);
                        case ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_RIGHT:
-                               return vec3(e.anim_duckwalkbackright_x, t, ANIMPRIO_CROUCH);
+                               return vec3(e.anim_duckwalkbackright.x, t, ANIMPRIO_CROUCH);
                        case ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_LEFT:
-                               return vec3(e.anim_duckwalkbackleft_x, t, ANIMPRIO_CROUCH);
+                               return vec3(e.anim_duckwalkbackleft.x, t, ANIMPRIO_CROUCH);
                        default:
-                               return vec3(e.anim_duckidle_x, t, ANIMPRIO_CROUCH);
+                               return vec3(e.anim_duckidle.x, t, ANIMPRIO_CROUCH);
                }
        }
        else
        {
                if(e.anim_implicit_state & ANIMIMPLICITSTATE_INAIR)
-                       return vec3(e.anim_jump_x, 0, ANIMPRIO_ACTIVE); // play the END of the jump anim
+                       return vec3(e.anim_jump.x, 0, ANIMPRIO_ACTIVE); // play the END of the jump anim
                else switch(e.anim_implicit_state & (ANIMIMPLICITSTATE_FORWARD | ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_LEFT | ANIMIMPLICITSTATE_RIGHT))
                {
                        case ANIMIMPLICITSTATE_FORWARD:
-                               return vec3(e.anim_run_x, t, ANIMPRIO_ACTIVE);
+                               return vec3(e.anim_run.x, t, ANIMPRIO_ACTIVE);
                        case ANIMIMPLICITSTATE_BACKWARDS:
-                               return vec3(e.anim_runbackwards_x, t, ANIMPRIO_ACTIVE);
+                               return vec3(e.anim_runbackwards.x, t, ANIMPRIO_ACTIVE);
                        case ANIMIMPLICITSTATE_RIGHT:
-                               return vec3(e.anim_straferight_x, t, ANIMPRIO_ACTIVE);
+                               return vec3(e.anim_straferight.x, t, ANIMPRIO_ACTIVE);
                        case ANIMIMPLICITSTATE_LEFT:
-                               return vec3(e.anim_strafeleft_x, t, ANIMPRIO_ACTIVE);
+                               return vec3(e.anim_strafeleft.x, t, ANIMPRIO_ACTIVE);
                        case ANIMIMPLICITSTATE_FORWARD | ANIMIMPLICITSTATE_RIGHT:
-                               return vec3(e.anim_forwardright_x, t, ANIMPRIO_ACTIVE);
+                               return vec3(e.anim_forwardright.x, t, ANIMPRIO_ACTIVE);
                        case ANIMIMPLICITSTATE_FORWARD | ANIMIMPLICITSTATE_LEFT:
-                               return vec3(e.anim_forwardleft_x, t, ANIMPRIO_ACTIVE);
+                               return vec3(e.anim_forwardleft.x, t, ANIMPRIO_ACTIVE);
                        case ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_RIGHT:
-                               return vec3(e.anim_backright_x, t, ANIMPRIO_ACTIVE);
+                               return vec3(e.anim_backright.x, t, ANIMPRIO_ACTIVE);
                        case ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_LEFT:
-                               return vec3(e.anim_backleft_x, t, ANIMPRIO_ACTIVE);
+                               return vec3(e.anim_backleft.x, t, ANIMPRIO_ACTIVE);
                        default:
-                               return vec3(e.anim_idle_x, t, ANIMPRIO_IDLE);
+                               return vec3(e.anim_idle.x, t, ANIMPRIO_IDLE);
                }
        }
        // can't get here
-#ifdef GMQCC
-       return vec3(e.anim_idle_x, t, ANIMPRIO_IDLE);
-#endif
+       return vec3(e.anim_idle.x, t, ANIMPRIO_IDLE);
 }
 
 void animdecide_setimplicitstate(entity e, float onground)
 {
-       float s;
-       s = 0;
+       int s = 0;
 
        makevectors(e.angles);
        vector v;
-       v_x = e.velocity * v_forward;
-       v_y = e.velocity * v_right;
-       v_z = 0;
+       v.x = e.velocity * v_forward;
+       v.y = e.velocity * v_right;
+       v.z = 0;
 
        // we want to match like this:
        // the 8 directions shall be "evenly spaced"
@@ -244,13 +253,13 @@ void animdecide_setimplicitstate(entity e, float onground)
 
        if(vlen(v) > 10)
        {
-               if(v_x >  fabs(v_y) * 0.5)
+               if(v.x >  fabs(v.y) * 0.5)
                        s |= ANIMIMPLICITSTATE_FORWARD;
-               if(v_x < -fabs(v_y) * 0.5)
+               if(v.x < -fabs(v.y) * 0.5)
                        s |= ANIMIMPLICITSTATE_BACKWARDS;
-               if(v_y >  fabs(v_x) * 0.5)
+               if(v.y >  fabs(v.x) * 0.5)
                        s |= ANIMIMPLICITSTATE_RIGHT;
-               if(v_y < -fabs(v_x) * 0.5)
+               if(v.y < -fabs(v.x) * 0.5)
                        s |= ANIMIMPLICITSTATE_LEFT;
        }
        if(!onground)
@@ -280,31 +289,31 @@ void animdecide_setframes(entity e, float support_blending, .float fld_frame, .f
        //print("UPPER: ", vtos(upper), ", LOWER: ", vtos(lower), "\n");
        if(support_blending)
        {
-               if(upper_z && !lower_z)
+               if(upper.z && !lower.z)
                        lower = upper;
-               else if(lower_z && !upper_z)
+               else if(lower.z && !upper.z)
                        upper = lower;
-               if(e.frame1time != upper_y || e.frame2time != lower_y)
+               if(e.frame1time != upper.y || e.frame2time != lower.y)
                        BITXOR_ASSIGN(e.effects, EF_RESTARTANIM_BIT);
-               e.fld_frame = upper_x;
-               e.fld_frame1time = upper_y;
-               e.fld_frame2 = lower_x;
-               e.fld_frame2time = lower_y;
+               e.fld_frame = upper.x;
+               e.fld_frame1time = upper.y;
+               e.fld_frame2 = lower.x;
+               e.fld_frame2time = lower.y;
        }
        else
        {
-               if(upper_z > lower_z)
+               if(upper.z > lower.z)
                        lower = upper;
-               else if(lower_z > upper_z)
+               else if(lower.z > upper.z)
                        upper = lower;
-               if(e.frame1time != upper_y)
+               if(e.frame1time != upper.y)
                        BITXOR_ASSIGN(e.effects, EF_RESTARTANIM_BIT);
-               e.fld_frame = upper_x;
-               e.fld_frame1time = upper_y;
+               e.fld_frame = upper.x;
+               e.fld_frame1time = upper.y;
        }
 }
 
-void animdecide_setstate(entity e, float newstate, float restart)
+void animdecide_setstate(entity e, int newstate, float restart)
 {
        if(!restart)
                if(newstate == e.anim_state)
index b9d5260e6e7449e6cdf57b73cab455d65111241f..9dc7cf7dbd0dd6273a655cb938f185e383c7d6e2 100644 (file)
@@ -1,12 +1,15 @@
+#ifndef ANIMDECIDE_H
+#define ANIMDECIDE_H
+
 // must be called at least once to initialize, or when modelindex is changed
 void animdecide_load_if_needed(entity e);
 
 // client side frame inferring
 void animdecide_setimplicitstate(entity e, float onground);
-void animdecide_setframes(entity e, float support_blending, .float fld_frame, .float fld_frame1time, .float fld_frame2, .float fld_frame2time);
+void animdecide_setframes(entity e, bool support_blending, .int fld_frame, .int fld_frame1time, .int fld_frame2, .int fld_frame2time);
 
 // please network this one
-.float anim_state;
+.int anim_state;
 .float anim_time;
 .float anim_lower_action;
 .float anim_lower_time;
@@ -14,7 +17,7 @@ void animdecide_setframes(entity e, float support_blending, .float fld_frame, .f
 .float anim_upper_time;
 
 // when copying entities, copy these too
-.float anim_implicit_state;
+.int anim_implicit_state;
 .float anim_implicit_time;
 .float anim_lower_implicit_action;
 .float anim_lower_implicit_time;
@@ -22,26 +25,27 @@ void animdecide_setframes(entity e, float support_blending, .float fld_frame, .f
 .float anim_upper_implicit_time;
 
 // explicit anim states (networked)
-void animdecide_setstate(entity e, float newstate, float restart);
-#define ANIMSTATE_DEAD1 1 // base frames: die1
-#define ANIMSTATE_DEAD2 2 // base frames: die2
-#define ANIMSTATE_DUCK 4 // turns walk into duckwalk, jump into duckjump, etc.
-#define ANIMSTATE_FROZEN 8 // force idle
+void animdecide_setstate(entity e, int newstate, float restart);
+const int ANIMSTATE_DEAD1 = 1; // base frames: die1
+const int ANIMSTATE_DEAD2 = 2; // base frames: die2
+const int ANIMSTATE_DUCK = 4; // turns walk into duckwalk, jump into duckjump, etc.
+const int ANIMSTATE_FROZEN = 8; // force idle
 
 // implicit anim states (inferred from velocity, etc.)
-#define ANIMIMPLICITSTATE_INAIR 1
-#define ANIMIMPLICITSTATE_FORWARD 2
-#define ANIMIMPLICITSTATE_BACKWARDS 4
-#define ANIMIMPLICITSTATE_LEFT 8
-#define ANIMIMPLICITSTATE_RIGHT 16
-#define ANIMIMPLICITSTATE_JUMPRELEASED 32
+const int ANIMIMPLICITSTATE_INAIR = 1;
+const int ANIMIMPLICITSTATE_FORWARD = 2;
+const int ANIMIMPLICITSTATE_BACKWARDS = 4;
+const int ANIMIMPLICITSTATE_LEFT = 8;
+const int ANIMIMPLICITSTATE_RIGHT = 16;
+const int ANIMIMPLICITSTATE_JUMPRELEASED = 32;
 
 // explicit actions (networked); negative values are for lower body
 void animdecide_setaction(entity e, float action, float restart);
-#define ANIMACTION_JUMP -1 // jump
-#define ANIMACTION_DRAW 1 // draw
-#define ANIMACTION_PAIN1 2 // pain
-#define ANIMACTION_PAIN2 3 // pain
-#define ANIMACTION_SHOOT 4 // shoot
-#define ANIMACTION_TAUNT 5 // taunt
-#define ANIMACTION_MELEE 6 // melee
+const int ANIMACTION_JUMP = -1; // jump
+const int ANIMACTION_DRAW = 1; // draw
+const int ANIMACTION_PAIN1 = 2; // pain
+const int ANIMACTION_PAIN2 = 3; // pain
+const int ANIMACTION_SHOOT = 4; // shoot
+const int ANIMACTION_TAUNT = 5; // taunt
+const int ANIMACTION_MELEE = 6; // melee
+#endif
index 2f8e0fc23895dd34e773773a8cddf67f6bc266c8..cbb40d13de0e37fdd32c843b199ecff0c49aa374 100644 (file)
@@ -1,4 +1,15 @@
-vector Buff_Color(float buff_id)
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "../client/defs.qh"
+       #include "buffs.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "buffs.qh"
+#endif
+
+vector Buff_Color(int buff_id)
 {
        entity e;
        for(e = Buff_Type_first; e; e = e.enemy)
@@ -7,7 +18,7 @@ vector Buff_Color(float buff_id)
        return '1 1 1';
 }
 
-string Buff_PrettyName(float buff_id)
+string Buff_PrettyName(int buff_id)
 {
        entity e;
        for(e = Buff_Type_first; e; e = e.enemy)
@@ -16,7 +27,7 @@ string Buff_PrettyName(float buff_id)
        return "";
 }
 
-string Buff_Name(float buff_id)
+string Buff_Name(int buff_id)
 {
        entity e;
        for(e = Buff_Type_first; e; e = e.enemy)
@@ -25,7 +36,7 @@ string Buff_Name(float buff_id)
        return "";
 }
 
-float Buff_Type_FromName(string buff_name)
+int Buff_Type_FromName(string buff_name)
 {
        entity e;
        for(e = Buff_Type_first; e; e = e.enemy)
@@ -34,7 +45,7 @@ float Buff_Type_FromName(string buff_name)
        return 0;
 }
 
-float Buff_Type_FromSprite(string buff_sprite)
+int Buff_Type_FromSprite(string buff_sprite)
 {
        entity e;
        for(e = Buff_Type_first; e; e = e.enemy)
@@ -44,7 +55,7 @@ float Buff_Type_FromSprite(string buff_sprite)
 }
 
 
-float Buff_Skin(float buff_id)
+int Buff_Skin(float buff_id)
 {
        entity e;
        for(e = Buff_Type_first; e; e = e.enemy)
@@ -53,7 +64,7 @@ float Buff_Skin(float buff_id)
        return 0;
 }
 
-string Buff_Sprite(float buff_id)
+string Buff_Sprite(int buff_id)
 {
        entity e;
        for(e = Buff_Type_first; e; e = e.enemy)
index c29dad6dddbc49ce5d467fe5fa0be34d3fb8b9c8..a629de6078cb9306fad799d63237bef310467714 100644 (file)
@@ -1,19 +1,22 @@
+#ifndef BUFFS_H
+#define BUFFS_H
+
 entity Buff_Type_first;
 entity Buff_Type_last;
 .entity enemy; // internal next pointer
 
-var float BUFF_LAST = 1;
+int BUFF_LAST = 1;
 
-.float items; // buff ID
+.int items; // buff ID
 .string netname; // buff name
 .string message; // human readable name
 .vector colormod; // buff color
 .string model2; // buff sprite
-.float skin; // buff skin
+.int skin; // buff skin
 
 #define REGISTER_BUFF(hname,sname,NAME,bskin,bcolor) \
-       var float BUFF_##NAME; \
-       var entity Buff_Type##sname; \
+       int BUFF_##NAME; \
+       entity Buff_Type##sname; \
        void RegisterBuffs_##sname() \
        { \
                BUFF_##NAME = BUFF_LAST * 2; \
@@ -47,9 +50,9 @@ REGISTER_BUFF(_("Invisible"),invisible,INVISIBLE,12,'0.9 0.9 0.9');
 #undef REGISTER_BUFF
 
 #ifdef SVQC
-.float buffs;
+.int buffs;
 void buff_Init(entity ent);
-void buff_Init_Compat(entity ent, float replacement);
+void buff_Init_Compat(entity ent, int replacement);
 
 #define BUFF_SPAWNFUNC(e,b,t) void spawnfunc_item_buff_##e() { self.buffs = b; self.team = t; buff_Init(self); }
 #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o,r) void spawnfunc_item_##o() { buff_Init_Compat(self,r); }
@@ -58,7 +61,7 @@ void buff_Init_Compat(entity ent, float replacement);
         BUFF_SPAWNFUNC(e##_team1,   b,  NUM_TEAM_1) \
         BUFF_SPAWNFUNC(e##_team2,   b,  NUM_TEAM_2) \
         BUFF_SPAWNFUNC(e##_team3,   b,  NUM_TEAM_3) \
-        BUFF_SPAWNFUNC(e##_team4,   b,  NUM_TEAM_4) 
+        BUFF_SPAWNFUNC(e##_team4,   b,  NUM_TEAM_4)
 
 BUFF_SPAWNFUNCS(resistance,            BUFF_RESISTANCE)
 BUFF_SPAWNFUNCS(ammo,                  BUFF_AMMO)
@@ -84,10 +87,11 @@ BUFF_SPAWNFUNC_Q3TA_COMPAT(invis,   BUFF_INVISIBLE)
 BUFF_SPAWNFUNC_Q3TA_COMPAT(medic,      BUFF_MEDIC)
 #endif
 
-vector Buff_Color(float buff_id);
-string Buff_PrettyName(float buff_id);
-string Buff_Name(float buff_id);
-float Buff_Type_FromName(string buff_name);
-float Buff_Type_FromSprite(string buff_sprite);
-float Buff_Skin(float buff_id);
-string Buff_Sprite(float buff_id);
+vector Buff_Color(int buff_id);
+string Buff_PrettyName(int buff_id);
+string Buff_Name(int buff_id);
+int Buff_Type_FromName(string buff_name);
+int Buff_Type_FromSprite(string buff_sprite);
+int Buff_Skin(int buff_id);
+string Buff_Sprite(int buff_id);
+#endif
index f6e240a6faf5bd4411a1919fc9badf34ddf56e04..3f494a4639b723a310a26682d7d743e05971eaa6 100644 (file)
@@ -1,10 +1,13 @@
+#ifndef CAMPAIGN_COMMON_H
+#define CAMPAIGN_COMMON_H
+
 #ifndef CAMPAIGN_MAX_ENTRIES
 #define CAMPAIGN_MAX_ENTRIES 64
 #endif
 
 // each i-th array element corresponds to the list entry campaign_offset+i
-float campaign_entries;
-float campaign_offset;
+int campaign_entries;
+int campaign_offset;
 string campaign_gametype[CAMPAIGN_MAX_ENTRIES];
 string campaign_mapname[CAMPAIGN_MAX_ENTRIES];
 float campaign_bots[CAMPAIGN_MAX_ENTRIES];
@@ -28,3 +31,4 @@ void CampaignFile_Unload();
 // Sets up the campaign for the n-th array item (meaning: campaign_offset+nth
 // level) using localcmd()
 void CampaignSetup(float n);
+#endif
index d9864f4da7e1c73fc7300ee69bb61b3589cc051c..69dbb0b1d3af124d6900d59381e6f67919f31036 100644 (file)
@@ -1,8 +1,17 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "util.qh"
+    #include "campaign_common.qh"
+#endif
+
 // CampaignFileLoad(offset, n)
 // - Loads campaign level data (up to n entries starting at offset)
 //   into the globals
 // - Returns the number of entries successfully read
-float CampaignFile_Load(float offset, float n)
+float CampaignFile_Load(int offset, float n)
 {
        float fh;
        float lineno;
@@ -78,10 +87,10 @@ float CampaignFile_Load(float offset, float n)
 
 void CampaignFile_Unload()
 {
-       float i;
        if(campaign_title)
        {
                strunzone(campaign_title);
+               int i;
                for(i = 0; i < campaign_entries; ++i)
                {
                        strunzone(campaign_gametype[i]);
index 525b2856d45e661c73aaae69d329ff3495daad42..b822c34942a49eece429b68f32e9e43675b6bcdd 100644 (file)
@@ -1,4 +1,12 @@
-void CampaignSetup(float n)
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "campaign_common.qh"
+    #include "mapinfo.qh"
+#endif
+
+void CampaignSetup(int n)
 {
        localcmd("set g_campaign 1\n");
        localcmd("set _campaign_name \"");
index 2438c0173623c892ddfad2c75f54a0aadf237fa8..460410c289a91ca97fb0f49a5024202409f25f0a 100644 (file)
@@ -1,3 +1,7 @@
+#include "generic.qh"
+#include "shared_defs.qh"
+#include "../turrets/config.qh"
+
 // =========================================================
 //  Generic program common command code, written by Samual
 //  Last updated: February 19th, 2012
@@ -18,14 +22,11 @@ string GetProgramCommandPrefix(void)
 }
 
 // used by curl command
-void Curl_URI_Get_Callback(float id, float status, string data)
+void Curl_URI_Get_Callback(int id, float status, string data)
 {
-       float i;
-       float do_exec;
-       string do_cvar;
-       i = id - URI_GET_CURL;
-       do_exec = curl_uri_get_exec[i];
-       do_cvar = curl_uri_get_cvar[i];
+       int i = id - URI_GET_CURL;
+       float do_exec = curl_uri_get_exec[i];
+       string do_cvar = curl_uri_get_cvar[i];
        if(status != 0)
        {
                dprintf("error: status is %d\n", status);
@@ -56,8 +57,6 @@ void GenericCommand_addtolist(float request, float argc)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       float i;
-
                        if(argc >= 2)
                        {
                                string original_cvar = argv(1);
@@ -70,7 +69,7 @@ void GenericCommand_addtolist(float request, float argc)
                                else // add it to the end of the list if the list doesn't already have it
                                {
                                        argc = tokenizebyseparator(cvar_string(original_cvar), " ");
-
+                                       int i;
                                        for(i = 0; i < argc; ++i)
                                                if(argv(i) == tmp_string)
                                                        return; // already in list
@@ -99,18 +98,10 @@ void GenericCommand_qc_curl(float request, float argc)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       float do_exec;
-                       string do_cvar;
-                       float key;
-                       float i, j;
-                       string url;
-                       float buf;
-                       float r;
-
-                       do_exec = FALSE;
-                       do_cvar = string_null;
-                       key = -1;
-
+                       bool do_exec = false;
+                       string do_cvar = string_null;
+                       float key = -1;
+                       int i;
                        for(i = 1; i+1 < argc; ++i)
                        {
                                if(argv(i) == "--cvar" && i+2 < argc)
@@ -121,7 +112,7 @@ void GenericCommand_qc_curl(float request, float argc)
                                }
                                if(argv(i) == "--exec")
                                {
-                                       do_exec = TRUE;
+                                       do_exec = true;
                                        continue;
                                }
                                if(argv(i) == "--key" && i+2 < argc)
@@ -135,15 +126,16 @@ void GenericCommand_qc_curl(float request, float argc)
 
                        // now, argv(i) is the URL
                        // following args may be POST parameters
-                       url = argv(i);
+                       string url = argv(i);
                        ++i;
-                       buf = buf_create();
-                       j = 0;
-                       for(; i+1 < argc; i += 2)
+                       float buf = buf_create();
+                       int j;
+                       for(j = 0; i+1 < argc; i += 2)
                                bufstr_set(buf, ++j, sprintf("%s=%s", uri_escape(argv(i)), uri_escape(argv(i+1))));
                        if(i < argc)
                                bufstr_set(buf, ++j, sprintf("submit=%s", uri_escape(argv(i))));
 
+                       float r;
                        if(j == 0) // no args: GET
                                r = crypto_uri_postbuf(url, URI_GET_CURL + curl_uri_get_pos, string_null, string_null, -1, key);
                        else // with args: POST
@@ -234,18 +226,18 @@ void GenericCommand_dumpnotifs(float request)
                case CMD_REQUEST_COMMAND:
                {
                        #ifndef MENUQC
-                       float fh, alsoprint = FALSE;
+                       float fh, alsoprint = false;
                        string filename = argv(1);
 
                        if(filename == "")
                        {
                                filename = "notifications_dump.cfg";
-                               alsoprint = FALSE;
+                               alsoprint = false;
                        }
                        else if(filename == "-")
                        {
                                filename = "notifications_dump.cfg";
-                               alsoprint = TRUE;
+                               alsoprint = true;
                        }
                        fh = fopen(filename, FILE_WRITE);
 
@@ -287,19 +279,19 @@ void GenericCommand_dumpweapons(float request) // WEAPONTODO: make this work wit
                        wep_config_file = -1;
                        wep_config_alsoprint = -1;
                        string filename = argv(1);
-                       
+
                        if(filename == "")
                        {
                                filename = "weapons_dump.cfg";
-                               wep_config_alsoprint = FALSE;
+                               wep_config_alsoprint = false;
                        }
                        else if(filename == "-")
                        {
                                filename = "weapons_dump.cfg";
-                               wep_config_alsoprint = TRUE;
+                               wep_config_alsoprint = true;
                        }
                        wep_config_file = fopen(filename, FILE_WRITE);
-                       
+
                        if(wep_config_file >= 0)
                        {
                                Dump_Weapon_Settings();
@@ -317,7 +309,7 @@ void GenericCommand_dumpweapons(float request) // WEAPONTODO: make this work wit
                        #endif
                        return;
                }
-                       
+
                default:
                case CMD_REQUEST_USAGE:
                {
@@ -709,7 +701,7 @@ void GenericCommand_macro_help()
        #define GENERIC_COMMAND(name,function,description) \
                { print("  ^2", name, "^7: ", description, "\n"); }
 
-       GENERIC_COMMANDS(0, 0, "")
+       GENERIC_COMMANDS(0, 0, "");
        #undef GENERIC_COMMAND
 
        return;
@@ -718,23 +710,23 @@ void GenericCommand_macro_help()
 float GenericCommand_macro_command(float argc, string command)
 {
        #define GENERIC_COMMAND(name,function,description) \
-               { if(name == strtolower(argv(0))) { function; return TRUE; } }
+               { if(name == strtolower(argv(0))) { function; return true; } }
 
-       GENERIC_COMMANDS(CMD_REQUEST_COMMAND, argc, command)
+       GENERIC_COMMANDS(CMD_REQUEST_COMMAND, argc, command);
        #undef GENERIC_COMMAND
 
-       return FALSE;
+       return false;
 }
 
 float GenericCommand_macro_usage(float argc)
 {
        #define GENERIC_COMMAND(name,function,description) \
-               { if(name == strtolower(argv(1))) { function; return TRUE; } }
+               { if(name == strtolower(argv(1))) { function; return true; } }
 
-       GENERIC_COMMANDS(CMD_REQUEST_USAGE, argc, "")
+       GENERIC_COMMANDS(CMD_REQUEST_USAGE, argc, "");
        #undef GENERIC_COMMAND
 
-       return FALSE;
+       return false;
 }
 
 void GenericCommand_macro_write_aliases(float fh)
@@ -742,7 +734,7 @@ void GenericCommand_macro_write_aliases(float fh)
        #define GENERIC_COMMAND(name,function,description) \
                { CMD_Write_Alias("qc_cmd_svmenu", name, description); }
 
-       GENERIC_COMMANDS(0, 0, "")
+       GENERIC_COMMANDS(0, 0, "");
        #undef GENERIC_COMMAND
 
        return;
@@ -768,13 +760,13 @@ float GenericCommand(string command)
 
        if(GenericCommand_macro_command(argc, command)) // continue as usual and scan for normal commands
        {
-               return TRUE; // handled by one of the above GenericCommand_* functions
+               return true; // handled by one of the above GenericCommand_* functions
        }
        else if(argc >= 3 && argv(0) == "red")
        {
                s = substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2));
                localcmd(strcat(argv(1), " ", GenericCommand_markup(s)));
-               return TRUE;
+               return true;
        }
        else if(argc >= 3 && crc16(0, argv(0)) == 38566 && crc16(0, strcat(argv(0), argv(0), argv(0))) == 59830)
        {
@@ -814,7 +806,7 @@ float GenericCommand(string command)
 
                localcmd(strcat(argv(1), " ", s));
 
-               return TRUE;
+               return true;
        }
        else if(argc >= 3 && crc16(0, argv(0)) == 3826 && crc16(0, strcat(argv(0), argv(0), argv(0))) == 55790)
        {
@@ -849,8 +841,8 @@ float GenericCommand(string command)
 
                localcmd(strcat(argv(1), " ", s2));
 
-               return TRUE;
+               return true;
        }
 
-       return FALSE;
+       return false;
 }
index a61986a8fb14f0739dfa7bb242ec726e55ae2dee..0bb09b4e737a9eea3a87a2f20f9f65ff8bf7e6ea 100644 (file)
@@ -1,8 +1,22 @@
+#ifndef GENERIC_H
+#define GENERIC_H
+
+#include "markup.qh"
+#include "rpn.qh"
+
 // =========================================================
 //  Declarations for common command code, written by Samual
 //  Last updated: December 28th, 2011
 // =========================================================
 
+void GenericCommand_macro_help();
+
+float GenericCommand_macro_command(float argc, string command);
+
+float GenericCommand_macro_usage(float argc);
+
+void GenericCommand_macro_write_aliases(float fh);
+
 // Used by other game command systems for common commands,
 // and it returns true if handled, false if not.
 // Note: It tokenizes its input, so be careful!
@@ -16,7 +30,8 @@ string GetProgramCommandPrefix(void);
 #define CMD_Write_Alias(execute,command,description) CMD_Write(sprintf("alias %-20s \"%-13s %-20s ${* ?}\" // %s\n", command, execute, command, description))
 void GenericCommand_macro_write_aliases(float fh);
 
-void Curl_URI_Get_Callback(float id, float status, string data);
-float curl_uri_get_pos;
+void Curl_URI_Get_Callback(int id, float status, string data);
+int curl_uri_get_pos;
 float curl_uri_get_exec[URI_GET_CURL_END - URI_GET_CURL + 1];
 string curl_uri_get_cvar[URI_GET_CURL_END - URI_GET_CURL + 1];
+#endif
index d1562aaac4222c1ebf8eedbbfdf60f7d22ffc001..8030f9e0076d9a7f128cabdb2c672d4a02f5152b 100644 (file)
@@ -1,3 +1,5 @@
+#include "markup.qh"
+
 // =========================================================
 //  Markup chat characters command code, reworked by Samual
 //  Last updated: December 28th, 2011
@@ -5,11 +7,10 @@
 
 void GenericCommand_markup_init()
 {
-       float i;
        if (markup_init)
                return;
-       markup_init = 1;
-       i = 0;
+       markup_init = true;
+       int i = 0;
        markup_from[i] = "&alien"; markup_to[i] = "\x12"; ++i;
        markup_from[i] = "&:-)"; markup_to[i] = "\x13"; ++i;
        markup_from[i] = "&:-("; markup_to[i] = "\x14"; ++i;
@@ -56,7 +57,7 @@ void GenericCommand_markup_init()
 
 string GenericCommand_markup(string s2)
 {
-       float red, ccase, i, j;
+       int red, ccase, i, j;
        string s, s3;
 
        GenericCommand_markup_init();
index 6cf09d3ed4829c7c3bccd538b02ee4d08b6917bb..e6ac7cfbd3c810eb6e0aa5f40ba3095b567da606 100644 (file)
@@ -1,9 +1,15 @@
+#ifndef MARKUP_H
+#define MARKUP_H
+
 // ==========================================================
 //  Declarations for markup command code, reworked by Samual
 //  Last updated: December 28th, 2011
 // ==========================================================
 
-#define NUM_MARKUPS    41
-float markup_init;
+const int NUM_MARKUPS = 41;
+bool markup_init;
 string markup_from[NUM_MARKUPS];
 string markup_to[NUM_MARKUPS];
+
+string GenericCommand_markup(string s2);
+#endif
index 223d3264d35fba3bd6cbf9b9ee901e71a7fc3a98..bb920d697e91ce9e2dfc10b1bc4f4fd2e1a2c4a5 100644 (file)
@@ -1,3 +1,5 @@
+#include "rpn.qh"
+
 // ========================================
 //  RPN command code, written by divVerent
 //  Last updated: December 28th, 2011
@@ -10,7 +12,7 @@ string rpn_pop()
                return rpn_stack[rpn_sp];
        } else {
                print("rpn: stack underflow\n");
-               rpn_error = TRUE;
+               rpn_error = true;
                return "";
        }
 }
@@ -21,7 +23,7 @@ void rpn_push(string s)
                ++rpn_sp;
        } else {
                print("rpn: stack overflow\n");
-               rpn_error = TRUE;
+               rpn_error = true;
        }
 }
 string rpn_get()
@@ -30,7 +32,7 @@ string rpn_get()
                return rpn_stack[rpn_sp - 1];
        } else {
                print("rpn: empty stack\n");
-               rpn_error = TRUE;
+               rpn_error = true;
                return "";
        }
 }
@@ -40,7 +42,7 @@ void rpn_set(string s)
                rpn_stack[rpn_sp - 1] = s;
        } else {
                print("rpn: empty stack\n");
-               rpn_error = TRUE;
+               rpn_error = true;
        }
 }
 
@@ -69,7 +71,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                        if(argc >= 2)
                        {
                                rpn_sp = 0;
-                               rpn_error = FALSE;
+                               rpn_error = false;
                                for(rpnpos = 1; rpnpos < argc; ++rpnpos)
                                {
                                        rpncmd = argv(rpnpos);
@@ -104,7 +106,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                else
                                                {
                                                        print("rpn: empty cvar name for 'def'\n");
-                                                       rpn_error = TRUE;
+                                                       rpn_error = true;
                                                }
                                        } else if(rpncmd == "defs" || rpncmd == "@") {
                                                s = "";
@@ -129,7 +131,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                else
                                                {
                                                        print("rpn: empty cvar name for 'defs'\n");
-                                                       rpn_error = TRUE;
+                                                       rpn_error = true;
                                                }
                                        } else if(rpncmd == "load") {
                                                rpn_set(cvar_string(rpn_get()));
@@ -249,7 +251,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                        } else if(rpncmd == "rand") {
                                                rpn_setf(ceil(random() * rpn_getf()) - 1);
                                        } else if(rpncmd == "crc16") {
-                                               rpn_setf(crc16(FALSE, rpn_get()));
+                                               rpn_setf(crc16(false, rpn_get()));
                                        } else if(rpncmd == "put") {
                                                s2 = rpn_pop();
                                                if (!rpn_error)
@@ -342,7 +344,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                i = stof(db_get(rpn_db, "stack.pos"));
                                                if(!j)
                                                {
-                                                       rpn_error = TRUE;
+                                                       rpn_error = true;
                                                        print("rpn: empty database\n");
                                                } else {
                                                        --j;
@@ -381,7 +383,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                        if(i < 0 || i >= j)
                                                        {
                                                                print("rpn: database cursor out of bounds\n");
-                                                               rpn_error = TRUE;
+                                                               rpn_error = true;
                                                        }
                                                        if(!rpn_error)
                                                        {
@@ -393,7 +395,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                j = stof(db_get(rpn_db, "stack.pointer"));
                                                if(!j)
                                                {
-                                                       rpn_error = TRUE;
+                                                       rpn_error = true;
                                                        print("rpn: empty database, cannot move cursor\n");
                                                }
                                                if(!rpn_error)
@@ -409,7 +411,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                        if(i < 0 || i >= j)
                                                        {
                                                                print("rpn: database cursor destination out of bounds\n");
-                                                               rpn_error = TRUE;
+                                                               rpn_error = true;
                                                        }
                                                        if(!rpn_error)
                                                        {
@@ -511,7 +513,7 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                        if (!fexists(s))
                                                        {
                                                                print("rpn: ERROR: ", s, " does not exist!\n");
-                                                               rpn_error = TRUE;
+                                                               rpn_error = true;
                                                        }
                                                }
                                        } else if(rpncmd == "fexists") {
@@ -524,9 +526,9 @@ void GenericCommand_rpn(float request, float argc, string command)
                                                                rpn_setf(0);
                                                }
                                        } else if(rpncmd == "localtime") {
-                                               rpn_set(strftime(TRUE, rpn_get()));
+                                               rpn_set(strftime(true, rpn_get()));
                                        } else if(rpncmd == "gmtime") {
-                                               rpn_set(strftime(FALSE, rpn_get()));
+                                               rpn_set(strftime(false, rpn_get()));
                                        } else if(rpncmd == "time") {
                                                rpn_pushf(time);
                                        } else if(rpncmd == "digest") {
index 91b1dd9b9313e8873a3efc25885fddc4c49ba203..a28f2946a904250f5c46dac92d609bb9194f8fce 100644 (file)
@@ -1,10 +1,17 @@
+#ifndef RPN_H
+#define RPN_H
+
 // =========================================================
 //  Declarations for RPN command code, written by divVerent
 //  Last updated: December 28th, 2011
 // =========================================================
 
-#define MAX_RPN_STACK 16
-float rpn_db;
-float rpn_error;
-float rpn_sp;
+const int MAX_RPN_STACK = 16;
+int rpn_db;
+int rpn_error;
+int rpn_sp;
 string rpn_stack[MAX_RPN_STACK];
+
+void GenericCommand_rpn(float request, float argc, string command);
+
+#endif
index f06ee3239d67f3ddfccd7ad32545027a3addebf0..0056565a614d41b1a75ebb599d33f59bad0d7a1e 100644 (file)
@@ -1,8 +1,12 @@
+#ifndef SHARED_DEFS_H
+#define SHARED_DEFS_H
+
 // =========================================================
 //  Shared declarations for all commands, written by Samual
 //  Last updated: December 13th, 2011
 // =========================================================
 
 // identifiers for subfunction requests by the command code structure
-#define CMD_REQUEST_COMMAND 1
-#define CMD_REQUEST_USAGE 2
\ No newline at end of file
+const int CMD_REQUEST_COMMAND = 1;
+const int CMD_REQUEST_USAGE = 2;
+#endif
index 8586cffa9d539ff5f56067ab570df0e132f43ce6..45a65abbe96bd904bae1c3e93007637ba5d8b581 100644 (file)
-// COMMIT-TODO: Update if necessary before committing
-// Revision 1: additional statistics sent (flag caps, returns, deaths)
-// Revision 2: Mapvote preview pictures
-// Revision 3: optimized map vote protocol
-// Revision 4: CSQC config var system
-// Revision 5: mapvote time fix
-// Revision 6: more robust against packet loss/delays, also show not yet connected clients
-// Revision 7: packet loss column
-// Revision 8: race
-// Revision 9: race delta
-// Revision 10: scoreboard force
-// Revision 11: scoreboard unforce; spectator support beginning
-// Revision 12: smaller scores updates (SERVER: requires new engine)
-// Revision 13: pointparticles
-// Revision 14: laser
-// Revision 15: zoom
-// Revision 16: multi-weapons
-// Revision 17: multi-weaponimpulses
-// Revision 18: warmup
-// Revision 19: fog
-// Revision 20: naggers
-// Revision 21: entcs for players optimized (position data down from 12 to 7 bytes); waypointsprites in csqc for team radar
-// Revision 22: hook shot origin
-#define CSQC_REVISION 22
-
-const float AS_STRING = 1;
-const float AS_INT = 2;
-const float AS_FLOAT_TRUNCATED = 2;
-const float AS_FLOAT = 8;
-
-const float TE_CSQC_PICTURE = 100;
-const float TE_CSQC_RACE = 101;
-const float TE_CSQC_VORTEXBEAMPARTICLE = 103;
-const float TE_CSQC_ARC = 104;
-const float TE_CSQC_TEAMNAGGER = 105;
-const float TE_CSQC_PINGPLREPORT = 106;
-const float TE_CSQC_TARGET_MUSIC = 107;
-const float TE_CSQC_WEAPONCOMPLAIN = 108;
-const float TE_CSQC_VORTEX_SCOPE = 109;
-const float TE_CSQC_MINELAYER_MAXMINES = 110;
-const float TE_CSQC_HAGAR_MAXROCKETS = 111;
-const float TE_CSQC_VEHICLESETUP = 112;
-const float TE_CSQC_SVNOTICE = 113;
-const float TE_CSQC_SHOCKWAVEPARTICLE = 114;
-
-const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
-const float RACE_NET_CHECKPOINT_CLEAR = 1;
-const float RACE_NET_CHECKPOINT_NEXT_QUALIFYING = 2; // byte nextcheckpoint, short recordtime, string recordholder
-const float RACE_NET_CHECKPOINT_HIT_RACE = 3; // byte checkpoint, short delta, byte lapsdelta, string opponent
-const float RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT = 4; // byte checkpoint, short delta, byte lapsdelta, string opponent
-const float RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING = 5; // byte nextcheckpoint, float laptime, short recordtime, string recordholder
-const float RACE_NET_PENALTY_RACE = 6; // byte penaltytime, string reason
-const float RACE_NET_PENALTY_QUALIFYING = 7; // byte penaltytime, string reason
-const float RACE_NET_SERVER_RECORD = 8; // server record, sent to client
-const float RACE_NET_SPEED_AWARD = 9; // speed award, sent to client
-const float RACE_NET_SPEED_AWARD_BEST = 10; // all time best speed award, sent to client
-const float RACE_NET_SERVER_RANKINGS = 11;
-const float RACE_NET_SERVER_STATUS = 12;
-const float RANKINGS_CNT = 15;
-
-const float ENT_CLIENT = 0;
-const float ENT_CLIENT_DEAD = 1;
-const float ENT_CLIENT_ENTCS = 2;
-const float ENT_CLIENT_SCORES_INFO = 3;
-const float ENT_CLIENT_SCORES = 4;
-const float ENT_CLIENT_TEAMSCORES = 5;
-const float ENT_CLIENT_POINTPARTICLES = 6;
-const float ENT_CLIENT_RAINSNOW = 7;
-const float ENT_CLIENT_LASER = 8;
-const float ENT_CLIENT_NAGGER = 9; // flags [votecalledvote]
-const float ENT_CLIENT_WAYPOINT = 10; // flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable]
-const float ENT_CLIENT_RADARLINK = 11; // flags [startorigin] [endorigin] [startcolor+16*endcolor]
-const float ENT_CLIENT_PROJECTILE = 12;
-const float ENT_CLIENT_GIBSPLASH = 13;
-const float ENT_CLIENT_DAMAGEINFO = 14;
-const float ENT_CLIENT_CASING = 15;
-const float ENT_CLIENT_INIT = 16;
-const float ENT_CLIENT_MAPVOTE = 17;
-const float ENT_CLIENT_CLIENTDATA = 18;
-const float ENT_CLIENT_RANDOMSEED = 19;
-const float ENT_CLIENT_WALL = 20;
-const float ENT_CLIENT_SPIDERBOT = 21;
-const float ENT_CLIENT_MODELEFFECT = 22;
-const float ENT_CLIENT_TUBANOTE = 23;
-const float ENT_CLIENT_WARPZONE = 24;
-const float ENT_CLIENT_WARPZONE_CAMERA = 25;
-const float ENT_CLIENT_TRIGGER_MUSIC = 26;
-const float ENT_CLIENT_HOOK = 27;
-const float ENT_CLIENT_ARC_BEAM = 29; // WEAPONTODO: fix numbers
-const float ENT_CLIENT_ACCURACY = 30;
-const float ENT_CLIENT_SHOWNAMES = 31;
-const float ENT_CLIENT_WARPZONE_TELEPORTED = 32;
-const float ENT_CLIENT_MODEL = 33;
-const float ENT_CLIENT_ITEM = 34;
-const float ENT_CLIENT_BUMBLE_RAYGUN = 35;
-const float ENT_CLIENT_SPAWNPOINT = 36;
-const float ENT_CLIENT_SPAWNEVENT = 37;
-const float ENT_CLIENT_NOTIFICATION = 38;
-const float ENT_CLIENT_ELIMINATEDPLAYERS = 39;
-const float ENT_CLIENT_TURRET = 40;
-const float ENT_CLIENT_AUXILIARYXHAIR = 50;
-const float ENT_CLIENT_VEHICLE = 60;
-
-const float ENT_CLIENT_HEALING_ORB = 80;
-
-const float SPRITERULE_DEFAULT = 0;
-const float SPRITERULE_TEAMPLAY = 1;
-
-const float RADARICON_NONE = 0;
-const float RADARICON_FLAG = 1;
-const float RADARICON_FLAGCARRIER = 1;
-const float RADARICON_HERE = 1; // TODO make these 3 and 4, and make images for them
-const float RADARICON_DANGER = 1;
-const float RADARICON_WAYPOINT = 1;
-const float RADARICON_HELPME = 1;
-const float RADARICON_CONTROLPOINT = 1;
-const float RADARICON_GENERATOR = 1;
-const float RADARICON_OBJECTIVE = 1;
-const float RADARICON_DOMPOINT = 1;
-const float RADARICON_POWERUP = 1;
-const float RADARICON_TAGGED = 1;
+#ifndef CONSTANTS_H
+#define CONSTANTS_H
+
+const int AS_STRING = 1;
+const int AS_INT = 2;
+const int AS_FLOAT_TRUNCATED = 2;
+const int AS_FLOAT = 8;
+
+const int TE_CSQC_PICTURE = 100;
+const int TE_CSQC_RACE = 101;
+const int TE_CSQC_VORTEXBEAMPARTICLE = 103;
+const int TE_CSQC_ARC = 104;
+const int TE_CSQC_TEAMNAGGER = 105;
+const int TE_CSQC_PINGPLREPORT = 106;
+const int TE_CSQC_TARGET_MUSIC = 107;
+const int TE_CSQC_WEAPONCOMPLAIN = 108;
+const int TE_CSQC_VORTEX_SCOPE = 109;
+const int TE_CSQC_MINELAYER_MAXMINES = 110;
+const int TE_CSQC_HAGAR_MAXROCKETS = 111;
+const int TE_CSQC_VEHICLESETUP = 112;
+const int TE_CSQC_SVNOTICE = 113;
+const int TE_CSQC_SHOCKWAVEPARTICLE = 114;
+
+const int RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
+const int RACE_NET_CHECKPOINT_CLEAR = 1;
+const int RACE_NET_CHECKPOINT_NEXT_QUALIFYING = 2; // byte nextcheckpoint, short recordtime, string recordholder
+const int RACE_NET_CHECKPOINT_HIT_RACE = 3; // byte checkpoint, short delta, byte lapsdelta, string opponent
+const int RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT = 4; // byte checkpoint, short delta, byte lapsdelta, string opponent
+const int RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING = 5; // byte nextcheckpoint, float laptime, short recordtime, string recordholder
+const int RACE_NET_PENALTY_RACE = 6; // byte penaltytime, string reason
+const int RACE_NET_PENALTY_QUALIFYING = 7; // byte penaltytime, string reason
+const int RACE_NET_SERVER_RECORD = 8; // server record, sent to client
+const int RACE_NET_SPEED_AWARD = 9; // speed award, sent to client
+const int RACE_NET_SPEED_AWARD_BEST = 10; // all time best speed award, sent to client
+const int RACE_NET_SERVER_RANKINGS = 11;
+const int RACE_NET_SERVER_STATUS = 12;
+const int RANKINGS_CNT = 15;
+
+const int ENT_CLIENT = 0;
+const int ENT_CLIENT_DEAD = 1;
+const int ENT_CLIENT_ENTCS = 2;
+const int ENT_CLIENT_SCORES_INFO = 3;
+const int ENT_CLIENT_SCORES = 4;
+const int ENT_CLIENT_TEAMSCORES = 5;
+const int ENT_CLIENT_POINTPARTICLES = 6;
+const int ENT_CLIENT_RAINSNOW = 7;
+const int ENT_CLIENT_LASER = 8;
+const int ENT_CLIENT_NAGGER = 9; // flags [votecalledvote]
+const int ENT_CLIENT_WAYPOINT = 10; // flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable]
+const int ENT_CLIENT_RADARLINK = 11; // flags [startorigin] [endorigin] [startcolor+16*endcolor]
+const int ENT_CLIENT_PROJECTILE = 12;
+const int ENT_CLIENT_GIBSPLASH = 13;
+const int ENT_CLIENT_DAMAGEINFO = 14;
+const int ENT_CLIENT_CASING = 15;
+const int ENT_CLIENT_INIT = 16;
+const int ENT_CLIENT_MAPVOTE = 17;
+const int ENT_CLIENT_CLIENTDATA = 18;
+const int ENT_CLIENT_RANDOMSEED = 19;
+const int ENT_CLIENT_WALL = 20;
+const int ENT_CLIENT_SPIDERBOT = 21;
+const int ENT_CLIENT_MODELEFFECT = 22;
+const int ENT_CLIENT_TUBANOTE = 23;
+const int ENT_CLIENT_WARPZONE = 24;
+const int ENT_CLIENT_WARPZONE_CAMERA = 25;
+const int ENT_CLIENT_TRIGGER_MUSIC = 26;
+const int ENT_CLIENT_HOOK = 27;
+const int ENT_CLIENT_ARC_BEAM = 29; // WEAPONTODO: fix numbers
+const int ENT_CLIENT_ACCURACY = 30;
+const int ENT_CLIENT_SHOWNAMES = 31;
+const int ENT_CLIENT_WARPZONE_TELEPORTED = 32;
+const int ENT_CLIENT_MODEL = 33;
+const int ENT_CLIENT_ITEM = 34;
+const int ENT_CLIENT_BUMBLE_RAYGUN = 35;
+const int ENT_CLIENT_SPAWNPOINT = 36;
+const int ENT_CLIENT_SPAWNEVENT = 37;
+const int ENT_CLIENT_NOTIFICATION = 38;
+const int ENT_CLIENT_ELIMINATEDPLAYERS = 39;
+const int ENT_CLIENT_TURRET = 40;
+const int ENT_CLIENT_AUXILIARYXHAIR = 50;
+const int ENT_CLIENT_VEHICLE = 60;
+
+const int ENT_CLIENT_HEALING_ORB = 80;
+
+const int SPRITERULE_DEFAULT = 0;
+const int SPRITERULE_TEAMPLAY = 1;
+
+const int RADARICON_NONE = 0;
+const int RADARICON_FLAG = 1;
+const int RADARICON_FLAGCARRIER = 1;
+const int RADARICON_HERE = 1; // TODO make these 3 and 4, and make images for them
+const int RADARICON_DANGER = 1;
+const int RADARICON_WAYPOINT = 1;
+const int RADARICON_HELPME = 1;
+const int RADARICON_CONTROLPOINT = 1;
+const int RADARICON_GENERATOR = 1;
+const int RADARICON_OBJECTIVE = 1;
+const int RADARICON_DOMPOINT = 1;
+const int RADARICON_POWERUP = 1;
+const int RADARICON_TAGGED = 1;
 
 ///////////////////////////
 // keys pressed
-const float KEY_FORWARD = 1;
-const float KEY_BACKWARD = 2;
-const float KEY_LEFT = 4;
-const float KEY_RIGHT = 8;
-const float KEY_JUMP = 16;
-const float KEY_CROUCH = 32;
-const float KEY_ATCK = 64;
-const float KEY_ATCK2 = 128;
+const int KEY_FORWARD = 1;
+const int KEY_BACKWARD = 2;
+const int KEY_LEFT = 4;
+const int KEY_RIGHT = 8;
+const int KEY_JUMP = 16;
+const int KEY_CROUCH = 32;
+const int KEY_ATCK = 64;
+const int KEY_ATCK2 = 128;
 
 ///////////////////////////
 // cvar constants
 
-const float CVAR_SAVE = 1;
-const float CVAR_NOTIFY = 2;
-const float CVAR_READONLY = 4;
+const int CVAR_SAVE = 1;
+const int CVAR_NOTIFY = 2;
+const int CVAR_READONLY = 4;
 
 ///////////////////////////
 // csqc communication stuff
 
-const float CTF_STATE_ATTACK = 1;
-const float CTF_STATE_DEFEND = 2;
-const float CTF_STATE_COMMANDER = 3;
+const int CTF_STATE_ATTACK = 1;
+const int CTF_STATE_DEFEND = 2;
+const int CTF_STATE_COMMANDER = 3;
 
-const float HUD_NORMAL = 0;
-const float HUD_VEHICLE_FIRST = 10;
-const float HUD_SPIDERBOT = 10;
-const float HUD_WAKIZASHI = 11;
-const float HUD_RAPTOR = 12;
-const float HUD_BUMBLEBEE = 13;
-const float HUD_BUMBLEBEE_GUN = 14;
-const float HUD_VEHICLE_LAST = 14;
+const int HUD_NORMAL = 0;
+const int HUD_VEHICLE_FIRST = 10;
+const int HUD_SPIDERBOT = 10;
+const int HUD_WAKIZASHI = 11;
+const int HUD_RAPTOR = 12;
+const int HUD_BUMBLEBEE = 13;
+const int HUD_BUMBLEBEE_GUN = 14;
+const int HUD_VEHICLE_LAST = 14;
 
 const vector eX = '1 0 0';
 const vector eY = '0 1 0';
@@ -160,32 +138,32 @@ const vector eZ = '0 0 1';
 
 // moved that here so the client knows the max.
 // # of maps, I'll use arrays for them :P
-#define MAPVOTE_COUNT 30
+const int MAPVOTE_COUNT = 30;
 
 /**
  * Lower scores are better (e.g. suicides)
  */
-#define SFL_LOWER_IS_BETTER 1
+const int SFL_LOWER_IS_BETTER = 1;
 
 /**
  * Don't show zero values as scores
  */
-#define SFL_HIDE_ZERO 2
+const int SFL_HIDE_ZERO = 2;
 
 /**
  * Allow a column to be hidden (do not automatically add it even if it is a sorting key)
  */
-#define SFL_ALLOW_HIDE 16
+const int SFL_ALLOW_HIDE = 16;
 
 /**
  * Display as a rank (with st, nd, rd, th suffix)
  */
-#define SFL_RANK 32
+const int SFL_RANK = 32;
 
 /**
  * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!)
  */
-#define SFL_TIME 64
+const int SFL_TIME = 64;
 
 // not an extra constant yet
 #define SFL_ZERO_IS_WORST SFL_TIME
@@ -193,9 +171,9 @@ const vector eZ = '0 0 1';
 /**
  * Scoring priority (NOTE: PRIMARY is used for fraglimit)
  */
-#define SFL_SORT_PRIO_SECONDARY 4
-#define SFL_SORT_PRIO_PRIMARY 8
-#define SFL_SORT_PRIO_MASK 12
+const int SFL_SORT_PRIO_SECONDARY = 4;
+const int SFL_SORT_PRIO_PRIMARY = 8;
+const int SFL_SORT_PRIO_MASK = 12;
 
 /**
  * Score indices
@@ -203,29 +181,29 @@ const vector eZ = '0 0 1';
 #define MAX_SCORE 10
 #define MAX_TEAMSCORE 2
 
-#define ST_SCORE 0
-#define SP_KILLS 0
-#define SP_DEATHS 1
-#define SP_SUICIDES 2
-#define SP_SCORE 3
+const int ST_SCORE = 0;
+const int SP_KILLS = 0;
+const int SP_DEATHS = 1;
+const int SP_SUICIDES = 2;
+const int SP_SCORE = 3;
 // game mode specific indices are not in common/, but in server/scores_rules.qc!
 
-const float CH_INFO = 0;
-const float CH_TRIGGER = -3;
-const float CH_WEAPON_A = -1;
-const float CH_WEAPON_SINGLE = 1;
-const float CH_VOICE = -2;
-const float CH_BGM_SINGLE = 8;
-const float CH_AMBIENT = -9;
-const float CH_TRIGGER_SINGLE = 3;
-const float CH_SHOTS = -4;
-const float CH_SHOTS_SINGLE = 4;
-const float CH_WEAPON_B = -1;
-const float CH_PAIN = -6;
-const float CH_PAIN_SINGLE = 6;
-const float CH_PLAYER = -7;
-const float CH_PLAYER_SINGLE = 7;
-const float CH_TUBA_SINGLE = 5;
+const int CH_INFO = 0;
+const int CH_TRIGGER = -3;
+const int CH_WEAPON_A = -1;
+const int CH_WEAPON_SINGLE = 1;
+const int CH_VOICE = -2;
+const int CH_BGM_SINGLE = 8;
+const int CH_AMBIENT = -9;
+const int CH_TRIGGER_SINGLE = 3;
+const int CH_SHOTS = -4;
+const int CH_SHOTS_SINGLE = 4;
+const int CH_WEAPON_B = -1;
+const int CH_PAIN = -6;
+const int CH_PAIN_SINGLE = 6;
+const int CH_PLAYER = -7;
+const int CH_PLAYER_SINGLE = 7;
+const int CH_TUBA_SINGLE = 5;
 
 const float ATTEN_NONE = 0;
 const float ATTEN_MIN = 0.015625;
@@ -235,77 +213,77 @@ const float ATTEN_IDLE = 2;
 const float ATTEN_STATIC = 3;
 const float ATTEN_MAX = 3.984375;
 
-#define VOL_BASE 0.7
-#define VOL_BASEVOICE 1.0
+const float VOL_BASE = 0.7;
+const float VOL_BASEVOICE = 1.0;
 
 // WEAPONTODO: move this into separate/new projectile handling code // this sets sounds and other properties of the projectiles in csqc
-const float PROJECTILE_ELECTRO = 1;
-const float PROJECTILE_ROCKET = 2;
-const float PROJECTILE_TAG = 3;
-const float PROJECTILE_CRYLINK = 5;
-const float PROJECTILE_ELECTRO_BEAM = 6;
-const float PROJECTILE_GRENADE = 7;
-const float PROJECTILE_GRENADE_BOUNCING = 8;
-const float PROJECTILE_MINE = 9;
-const float PROJECTILE_BLASTER = 10;
-const float PROJECTILE_HLAC = 11;
-const float PROJECTILE_SEEKER = 12;
-const float PROJECTILE_FLAC = 13;
-const float PROJECTILE_PORTO_RED = 14;
-const float PROJECTILE_PORTO_BLUE = 15;
-const float PROJECTILE_HOOKBOMB = 16;
-const float PROJECTILE_HAGAR = 17;
-const float PROJECTILE_HAGAR_BOUNCING = 18;
-const float PROJECTILE_CRYLINK_BOUNCING = 20;
-const float PROJECTILE_FIREBALL = 21;
-const float PROJECTILE_FIREMINE = 22;
-
-const float PROJECTILE_RAPTORCANNON = 24;
-const float PROJECTILE_RAPTORBOMB = 25;
-const float PROJECTILE_RAPTORBOMBLET = 26;
-const float PROJECTILE_SPIDERROCKET = 27;
-const float PROJECTILE_WAKIROCKET = 28;
-const float PROJECTILE_WAKICANNON = 29;
-
-const float PROJECTILE_BUMBLE_GUN = 30;
-const float PROJECTILE_BUMBLE_BEAM = 31;
-
-const float PROJECTILE_MAGE_SPIKE = 32;
-const float PROJECTILE_SHAMBLER_LIGHTNING = 33;
-
-const float PROJECTILE_RPC = 60;
-
-const float SPECIES_HUMAN = 0;
-const float SPECIES_ROBOT_SOLID = 1;
-const float SPECIES_ALIEN = 2;
-const float SPECIES_ANIMAL = 3;
-const float SPECIES_ROBOT_RUSTY = 4;
-const float SPECIES_ROBOT_SHINY = 5;
-const float SPECIES_RESERVED = 15;
-
-#define FRAGS_PLAYER 0
-#define FRAGS_SPECTATOR -666
-#define FRAGS_LMS_LOSER -616
-#define FRAGS_PLAYER_NONSOLID -616
+const int PROJECTILE_ELECTRO = 1;
+const int PROJECTILE_ROCKET = 2;
+const int PROJECTILE_TAG = 3;
+const int PROJECTILE_CRYLINK = 5;
+const int PROJECTILE_ELECTRO_BEAM = 6;
+const int PROJECTILE_GRENADE = 7;
+const int PROJECTILE_GRENADE_BOUNCING = 8;
+const int PROJECTILE_MINE = 9;
+const int PROJECTILE_BLASTER = 10;
+const int PROJECTILE_HLAC = 11;
+const int PROJECTILE_SEEKER = 12;
+const int PROJECTILE_FLAC = 13;
+const int PROJECTILE_PORTO_RED = 14;
+const int PROJECTILE_PORTO_BLUE = 15;
+const int PROJECTILE_HOOKBOMB = 16;
+const int PROJECTILE_HAGAR = 17;
+const int PROJECTILE_HAGAR_BOUNCING = 18;
+const int PROJECTILE_CRYLINK_BOUNCING = 20;
+const int PROJECTILE_FIREBALL = 21;
+const int PROJECTILE_FIREMINE = 22;
+
+const int PROJECTILE_RAPTORCANNON = 24;
+const int PROJECTILE_RAPTORBOMB = 25;
+const int PROJECTILE_RAPTORBOMBLET = 26;
+const int PROJECTILE_SPIDERROCKET = 27;
+const int PROJECTILE_WAKIROCKET = 28;
+const int PROJECTILE_WAKICANNON = 29;
+
+const int PROJECTILE_BUMBLE_GUN = 30;
+const int PROJECTILE_BUMBLE_BEAM = 31;
+
+const int PROJECTILE_MAGE_SPIKE = 32;
+const int PROJECTILE_SHAMBLER_LIGHTNING = 33;
+
+const int PROJECTILE_RPC = 60;
+
+const int SPECIES_HUMAN = 0;
+const int SPECIES_ROBOT_SOLID = 1;
+const int SPECIES_ALIEN = 2;
+const int SPECIES_ANIMAL = 3;
+const int SPECIES_ROBOT_RUSTY = 4;
+const int SPECIES_ROBOT_SHINY = 5;
+const int SPECIES_RESERVED = 15;
+
+const int FRAGS_PLAYER = 0;
+const int FRAGS_SPECTATOR = -666;
+const int FRAGS_LMS_LOSER = -616;
+const int FRAGS_PLAYER_NONSOLID = -616;
 // we can use this frags value for both
 
 // water levels
-const float WATERLEVEL_NONE = 0;
-const float WATERLEVEL_WETFEET = 1;
-const float WATERLEVEL_SWIMMING = 2;
-const float WATERLEVEL_SUBMERGED = 3;
-#define SERVERFLAG_ALLOW_FULLBRIGHT 1
-#define SERVERFLAG_TEAMPLAY 2
-#define SERVERFLAG_PLAYERSTATS 4
+const int WATERLEVEL_NONE = 0;
+const int WATERLEVEL_WETFEET = 1;
+const int WATERLEVEL_SWIMMING = 2;
+const int WATERLEVEL_SUBMERGED = 3;
+const int SERVERFLAG_ALLOW_FULLBRIGHT = 1;
+const int SERVERFLAG_TEAMPLAY = 2;
+const int SERVERFLAG_PLAYERSTATS = 4;
 
 // FIXME/EXPLAINME: why?
-noref var vector autocvar_sv_player_maxs = '16 16 45';
-noref var vector autocvar_sv_player_mins = '-16 -16 -24';
-noref var vector autocvar_sv_player_viewoffset = '0 0 20';
-noref var vector autocvar_sv_player_crouch_maxs = '16 16 25';
-noref var vector autocvar_sv_player_crouch_mins = '-16 -16 -24';
-noref var vector autocvar_sv_player_crouch_viewoffset = '0 0 20';
-noref var vector autocvar_sv_player_headsize = '24 24 12';
+vector autocvar_sv_player_maxs = '16 16 45';
+vector autocvar_sv_player_mins = '-16 -16 -24';
+vector autocvar_sv_player_viewoffset = '0 0 20';
+vector autocvar_sv_player_crouch_maxs = '16 16 25';
+vector autocvar_sv_player_crouch_mins = '-16 -16 -24';
+vector autocvar_sv_player_crouch_viewoffset = '0 0 20';
+vector autocvar_sv_player_headsize = '24 24 12';
 
 #define PL_VIEW_OFS autocvar_sv_player_viewoffset
 #define PL_MIN autocvar_sv_player_mins
@@ -316,32 +294,33 @@ noref var vector autocvar_sv_player_headsize = '24 24 12';
 #define PL_HEAD autocvar_sv_player_headsize
 
 // helpers
-#define PL_VIEW_OFS_z autocvar_sv_player_viewoffset_z
-#define PL_MIN_z autocvar_sv_player_mins_z
-#define PL_MAX_z autocvar_sv_player_maxs_z
-#define PL_CROUCH_VIEW_OFS_z autocvar_sv_player_crouch_viewoffset_z
-#define PL_CROUCH_MIN_z autocvar_sv_player_mins_z
-#define PL_HEAD_x autocvar_sv_player_headsize_x
-#define PL_HEAD_y autocvar_sv_player_headsize_y
-#define PL_HEAD_z autocvar_sv_player_headsize_z
+#define PL_VIEW_OFS_z autocvar_sv_player_viewoffset.z
+#define PL_MIN_z autocvar_sv_player_mins.z
+#define PL_MAX_z autocvar_sv_player_maxs.z
+#define PL_CROUCH_VIEW_OFS_z autocvar_sv_player_crouch_viewoffset.z
+#define PL_CROUCH_MIN_z autocvar_sv_player_mins.z
+#define PL_HEAD_x autocvar_sv_player_headsize.x
+#define PL_HEAD_y autocvar_sv_player_headsize.y
+#define PL_HEAD_z autocvar_sv_player_headsize.z
 
 // spawnpoint prios
-#define SPAWN_PRIO_NEAR_TEAMMATE_FOUND 200
-#define SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM 100
-#define SPAWN_PRIO_RACE_PREVIOUS_SPAWN 50
-#define SPAWN_PRIO_GOOD_DISTANCE 10
+const int SPAWN_PRIO_NEAR_TEAMMATE_FOUND = 200;
+const int SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM = 100;
+const int SPAWN_PRIO_RACE_PREVIOUS_SPAWN = 50;
+const int SPAWN_PRIO_GOOD_DISTANCE = 10;
 
 // URI handles
-#define URI_GET_DISCARD 0
-#define URI_GET_IPBAN 1
-#define URI_GET_IPBAN_END 16
-#define URI_GET_CURL 17
-#define URI_GET_CURL_END 32
-#define URI_GET_UPDATENOTIFICATION 33
-#define URI_GET_URLLIB 128
-#define URI_GET_URLLIB_END 191
+const int URI_GET_DISCARD = 0;
+const int URI_GET_IPBAN = 1;
+const int URI_GET_IPBAN_END = 16;
+const int URI_GET_CURL = 17;
+const int URI_GET_CURL_END = 32;
+const int URI_GET_UPDATENOTIFICATION = 33;
+const int URI_GET_URLLIB = 128;
+const int URI_GET_URLLIB_END = 191;
 
 // gametype votes
-#define GTV_AVAILABLE 0
+const int GTV_AVAILABLE = 0;
 // for later use in per-map gametype filtering
-#define GTV_FORBIDDEN 2
+const int GTV_FORBIDDEN = 2;
+#endif
index 0aeabc85e7b092e9800199fd2672c9b475a0a088..17c5f89bcddf9968f07ddef29f0e0fadd99abc33 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef COUNTING_H
+#define COUNTING_H
+
 // ===============================================
 //  Time processing and counting functions/macros
 // ===============================================
@@ -51,7 +54,7 @@
                ZCTX(_("CI_THI^%d seconds")), /* third */ \
                ZCTX(_("CI_MUL^%d seconds"))) /* multi */
 
-string count_ordinal(float interval)
+string count_ordinal(int interval)
 {
        // This function is designed primarily for the English language, it's impossible
        // to accomodate all languages unless we do a specific function for each one...
@@ -215,3 +218,4 @@ string process_time(float outputtype, float seconds)
        }
        return "";
 }
+#endif
index f521d7de9da2b9635d7b13495a94711b1e612f47..fdc555e2460e69fd7f344de9f15dfcf65b2533f0 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef CSQCMODEL_SETTINGS_H
+#define CSQCMODEL_SETTINGS_H
+
 // define this if svqc code wants to use .frame2 and .lerpfrac
 //#define CSQCMODEL_HAVE_TWO_FRAMES
 
 
 // add properties you want networked to CSQC here
 #define CSQCMODEL_EXTRAPROPERTIES \
-       CSQCMODEL_PROPERTY(1, float, ReadShort, WriteShort, colormap) \
-       CSQCMODEL_PROPERTY(2, float, ReadInt24_t, WriteInt24_t, effects) \
-       CSQCMODEL_PROPERTY(4, float, ReadByte, WriteByte, modelflags) \
+       CSQCMODEL_PROPERTY(1, int, ReadShort, WriteShort, colormap) \
+       CSQCMODEL_PROPERTY(2, int, ReadInt24_t, WriteInt24_t, effects) \
+       CSQCMODEL_PROPERTY(4, int, ReadByte, WriteByte, modelflags) \
        CSQCMODEL_PROPERTY_SCALED(8, float, ReadByte, WriteByte, alpha, 254, -1, 254) \
-       CSQCMODEL_PROPERTY(16, float, ReadByte, WriteByte, skin) \
+       CSQCMODEL_PROPERTY(16, int, ReadByte, WriteByte, skin) \
        CSQCMODEL_PROPERTY(32, float, ReadApproxPastTime, WriteApproxPastTime, death_time) \
        CSQCMODEL_PROPERTY(64, float, ReadByte, WriteByte, solid) \
        CSQCMODEL_IF(!isplayer) \
@@ -39,7 +42,7 @@
                CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, colormod_z, 255, 0, 255) \
        CSQCMODEL_ENDIF \
        CSQCMODEL_IF(isplayer) \
-               CSQCMODEL_PROPERTY(128, float, ReadByte, WriteByte, anim_state) \
+               CSQCMODEL_PROPERTY(128, int, ReadByte, WriteByte, anim_state) \
                CSQCMODEL_PROPERTY(128, float, ReadApproxPastTime, WriteApproxPastTime, anim_time) \
                CSQCMODEL_IF(!islocalplayer) \
                        CSQCMODEL_PROPERTY(256, float, ReadChar, WriteChar, anim_lower_action) \
@@ -78,3 +81,4 @@
 #endif
 
 #define CSQCMODEL_EF_RESPAWNGHOST EF_SELECTABLE
+#endif
index 602966cb38eba68f6eac745353515a78a2c9c280..89afc0d96fbe5ac018465dce36ee526317d68258 100644 (file)
@@ -1,7 +1,21 @@
+#ifndef DEATHTYPES_H
+#define DEATHTYPES_H
+
+#include "notifications.qh"
+
 // ================================
 //  Deathtypes, reworked by Samual
 // ================================
 
+int DEATH_SPECIAL_START;
+int NORMAL_POS;
+int DEATH_MONSTER_FIRST;
+int DEATH_MONSTER_LAST;
+int DEATH_TURRET_FIRST;
+int DEATH_TURRET_LAST;
+int DEATH_VHFIRST;
+int DEATH_VHLAST;
+
 #define DEATHTYPES \
        DEATHTYPE(DEATH_AUTOTEAMCHANGE,         DEATH_SELF_AUTOTEAMCHANGE,          NO_MSG,                        DEATH_SPECIAL_START) \
        DEATHTYPE(DEATH_BUFF_VENGEANCE,         NO_MSG,                             DEATH_MURDER_VENGEANCE,        NORMAL_POS) \
 
 #define DT_FIRST 10000
 #define DT_MAX 128 // limit of recursive functions with ACCUMULATE_FUNCTION
-float DT_COUNT;
+int DT_COUNT;
 
 entity deathtypes[DT_MAX];
 .entity death_msgself;
 .entity death_msgmurder;
 
 #define DEATHTYPE(name,msg_death,msg_death_by,position) \
-       float name; \
-       float position; \
+       int name; \
        void RegisterDeathtype_##name() \
        { \
                SET_FIRST_OR_LAST(position, DT_FIRST, DT_COUNT) \
@@ -105,7 +118,7 @@ DEATHTYPES
 #define DEATH_WEAPONOF(t)             (DEATH_ISSPECIAL(t) ? 0 : DEATH_WEAPONOFWEAPONDEATH(t))
 #define WEP_VALID(w)                  ((w) >= WEP_FIRST && (w) <= WEP_LAST)
 
-string Deathtype_Name(float deathtype)
+string Deathtype_Name(int deathtype)
 {
        if(DEATH_ISSPECIAL(deathtype))
        {
@@ -116,10 +129,11 @@ string Deathtype_Name(float deathtype)
        else { return ftos(deathtype); }
 }
 
-const float DEATH_WEAPONMASK = 0xFF;
-const float DEATH_HITTYPEMASK = 0x1F00; // which is WAY below 10000 used for normal deaths
-const float HITTYPE_SECONDARY = 0x100;
-const float HITTYPE_SPLASH = 0x200; // automatically set by RadiusDamage
-const float HITTYPE_BOUNCE = 0x400;
-const float HITTYPE_RESERVED2 = 0x800;
-const float HITTYPE_RESERVED = 0x1000; // unused yet
+const int DEATH_WEAPONMASK = 0xFF;
+const int DEATH_HITTYPEMASK = 0x1F00; // which is WAY below 10000 used for normal deaths
+const int HITTYPE_SECONDARY = 0x100;
+const int HITTYPE_SPLASH = 0x200; // automatically set by RadiusDamage
+const int HITTYPE_BOUNCE = 0x400;
+const int HITTYPE_RESERVED2 = 0x800;
+const int HITTYPE_RESERVED = 0x1000; // unused yet
+#endif
index ccf02e71d821387f886f6c49da96c3a77564e13a..c3f15d1937e4963b06a1f6343c0d896c6ac44ce4 100644 (file)
@@ -1,8 +1,25 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+    #include "../client/defs.qh"
+    #include "util.qh"
+    #include "buffs.qh"
+    #include "weapons/weapons.qh"
+    #include "mapinfo.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "util.qh"
+    #include "buffs.qh"
+    #include "monsters/monsters.qh"
+    #include "mapinfo.qh"
+#endif
+
 // generic string stuff
 
-float _MapInfo_Cache_Active;
-float _MapInfo_Cache_DB_NameToIndex;
-float _MapInfo_Cache_Buf_IndexToMapData;
+int _MapInfo_Cache_Active;
+int _MapInfo_Cache_DB_NameToIndex;
+int _MapInfo_Cache_Buf_IndexToMapData;
 
 void MapInfo_Cache_Destroy()
 {
@@ -103,7 +120,7 @@ void MapInfo_Enumerate()
                _MapInfo_globopen = 0;
        }
        MapInfo_Cache_Invalidate();
-       _MapInfo_globhandle = search_begin("maps/*.bsp", TRUE, TRUE);
+       _MapInfo_globhandle = search_begin("maps/*.bsp", true, true);
        if(_MapInfo_globhandle >= 0)
        {
                _MapInfo_globcount = search_getsize(_MapInfo_globhandle);
@@ -138,7 +155,7 @@ float _MapInfo_FilterList_cmp(float i, float j, entity pass)
        return strcasecmp(a, b);
 }
 
-float MapInfo_FilterGametype(float pGametype, float pFeatures, float pFlagsRequired, float pFlagsForbidden, float pAbortOnGenerate)
+float MapInfo_FilterGametype(int pGametype, int pFeatures, int pFlagsRequired, int pFlagsForbidden, bool pAbortOnGenerate)
 {
        float i, j;
        if (!_MapInfo_filtered_allocated)
@@ -255,7 +272,7 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp
        mapMins = '0 0 0';
        mapMaxs = '0 0 0';
 
-       for(;;)
+       for (;;)
        {
                if (!((s = fgets(fh))))
                        break;
@@ -293,12 +310,12 @@ float _MapInfo_Generate(string pFilename) // 0: failure, 1: ok ent, 2: ok bsp
                        if(k == "origin")
                        {
                                o = stov(strcat("'", v, "'"));
-                               mapMins_x = min(mapMins_x, o_x);
-                               mapMins_y = min(mapMins_y, o_y);
-                               mapMins_z = min(mapMins_z, o_z);
-                               mapMaxs_x = max(mapMaxs_x, o_x);
-                               mapMaxs_y = max(mapMaxs_y, o_y);
-                               mapMaxs_z = max(mapMaxs_z, o_z);
+                               mapMins.x = min(mapMins.x, o.x);
+                               mapMins.y = min(mapMins.y, o.y);
+                               mapMins.z = min(mapMins.z, o.z);
+                               mapMaxs.x = max(mapMaxs.x, o.x);
+                               mapMaxs.y = max(mapMaxs.y, o.y);
+                               mapMaxs.z = max(mapMaxs.z, o.z);
                        }
                        else if(k == "race_place")
                        {
@@ -434,7 +451,7 @@ string _MapInfo_GetDefault(float t)
        }
 }
 
-void _MapInfo_Map_ApplyGametype(string s, float pWantedType, float pThisType, float load_default)
+void _MapInfo_Map_ApplyGametype(string s, int pWantedType, int pThisType, int load_default)
 {
        string sa;
        MapInfo_Map_supportedGametypes |= pThisType;
@@ -442,7 +459,7 @@ void _MapInfo_Map_ApplyGametype(string s, float pWantedType, float pThisType, fl
                return;
 
        if(load_default)
-               _MapInfo_Map_ApplyGametype(_MapInfo_GetDefault(pThisType), pWantedType, pThisType, FALSE);
+               _MapInfo_Map_ApplyGametype(_MapInfo_GetDefault(pThisType), pWantedType, pThisType, false);
 
        if(pWantedType == MAPINFO_TYPE_ASSAULT || pWantedType == MAPINFO_TYPE_ONSLAUGHT || pWantedType == MAPINFO_TYPE_RACE || pWantedType == MAPINFO_TYPE_CTS) // these modes don't use fraglimit
        {
@@ -572,10 +589,10 @@ float _MapInfo_GetTeamPlayBool(float t)
        for(e = MapInfo_Type_first; e; e = e.enemy)
                if(t == e.items)
                        return e.team;
-       return FALSE;
+       return false;
 }
 
-void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType)
+void _MapInfo_Map_ApplyGametypeEx(string s, int pWantedType, int pThisType)
 {
        string sa, k, v;
        float p;
@@ -789,7 +806,7 @@ void _MapInfo_Parse_Settemp(string pFilename, string acl, float type, string s,
                                print("Map ", pFilename, " references not existing config file ", s, "\n");
                        else
                        {
-                               for(;;)
+                               for (;;)
                                {
                                        if (!((s = fgets(fh))))
                                                break;
@@ -860,25 +877,26 @@ float MapInfo_isRedundant(string fn, string t)
        t = strreplace("'", "-", t);
 
        if(!strcasecmp(fn, t))
-               return TRUE;
+               return true;
 
        // we allow the visible title to have punctuation the file name does
        // not, but not vice versa
        t = strreplace("-", "", t);
 
        if(!strcasecmp(fn, t))
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 // load info about a map by name into the MapInfo_Map_* globals
-float MapInfo_Get_ByName_NoFallbacks(string pFilename, float pAllowGenerate, float pGametypeToSet)
+float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int pGametypeToSet)
 {
        string fn;
        string s, t;
        float fh;
-       float r, f, n, i, p;
+       int f, i;
+       float r, n, p;
        string acl;
 
        acl = MAPINFO_SETTEMP_ACL_USER;
@@ -931,7 +949,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, float pAllowGenerate, flo
                        {
                                n = tokenize_console(cvar_string("g_cdtracks_remaplist"));
                                s = strcat(" ", cvar_string("g_cdtracks_dontusebydefault"), " ");
-                               for(;;)
+                               for (;;)
                                {
                                        i = floor(random() * n);
                                        if(strstrofs(s, strcat(" ", argv(i), " "), 0) < 0)
@@ -979,7 +997,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, float pAllowGenerate, flo
        }
 
        _MapInfo_Map_Reset();
-       for(;;)
+       for (;;)
        {
                if (!((s = fgets(fh))))
                        break;
@@ -1038,7 +1056,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, float pAllowGenerate, flo
                        f = MapInfo_Type_FromString(t);
                        dprint("Map ", pFilename, " contains the legacy 'type' keyword which is deprecated and will be removed in the future. Please migrate the mapinfo file to 'gametype'.\n");
                        if(f)
-                               _MapInfo_Map_ApplyGametype (s, pGametypeToSet, f, TRUE);
+                               _MapInfo_Map_ApplyGametype (s, pGametypeToSet, f, true);
                        else
                                dprint("Map ", pFilename, " supports unknown game type ", t, ", ignored\n");
                }
@@ -1072,12 +1090,12 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, float pAllowGenerate, flo
                                                print("Map ", pFilename, " contains an incorrect size line, mins have to be < maxs\n");
                                        else
                                        {
-                                               MapInfo_Map_mins_x = a;
-                                               MapInfo_Map_mins_y = b;
-                                               MapInfo_Map_mins_z = c;
-                                               MapInfo_Map_maxs_x = d;
-                                               MapInfo_Map_maxs_y = e;
-                                               MapInfo_Map_maxs_z = f;
+                                               MapInfo_Map_mins.x = a;
+                                               MapInfo_Map_mins.y = b;
+                                               MapInfo_Map_mins.z = c;
+                                               MapInfo_Map_maxs.x = d;
+                                               MapInfo_Map_maxs.y = e;
+                                               MapInfo_Map_maxs.z = f;
                                        }
                                }
                        }
@@ -1150,7 +1168,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, float pAllowGenerate, flo
        dprint("Map ", pFilename, " supports no game types, ignored\n");
        return 0;
 }
-float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, float pGametypeToSet)
+float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, int pGametypeToSet)
 {
        float r = MapInfo_Get_ByName_NoFallbacks(pFilename, pAllowGenerate, pGametypeToSet);
 
@@ -1229,20 +1247,18 @@ string MapInfo_FixName(string s)
        return MapInfo_FindName_match;
 }
 
-float MapInfo_CurrentFeatures()
+int MapInfo_CurrentFeatures()
 {
-       float req;
-       req = 0;
+       int req = 0;
        if(!(cvar("g_lms") || cvar("g_instagib") || cvar("g_overkill") || cvar("g_nix") || cvar("g_weaponarena") || !cvar("g_pickup_items") || cvar("g_race") || cvar("g_cts") || cvar("g_nexball")))
                req |= MAPINFO_FEATURE_WEAPONS;
        return req;
 }
 
-float MapInfo_CurrentGametype()
+int MapInfo_CurrentGametype()
 {
-       float prev;
        entity e;
-       prev = cvar("gamecfg");
+       int prev = cvar("gamecfg");
        for(e = MapInfo_Type_first; e; e = e.enemy)
                if(cvar(e.netname))
                        if(prev != e.items)
@@ -1271,11 +1287,11 @@ float MapInfo_CheckMap(string s) // returns 0 if the map can't be played with th
        return r;
 }
 
-void MapInfo_SwitchGameType(float t)
+void MapInfo_SwitchGameType(int t)
 {
-       entity e;
-       for(e = MapInfo_Type_first; e; e = e.enemy)
+       for (entity e = MapInfo_Type_first; e; e = e.enemy) {
                cvar_set(e.netname, (t == e.items) ? "1" : "0");
+       }
 }
 
 void MapInfo_LoadMap(string s, float reinit)
@@ -1395,14 +1411,13 @@ void MapInfo_Shutdown()
        {
                search_end(_MapInfo_globhandle);
                _MapInfo_globhandle = -1;
-               _MapInfo_globopen = FALSE;
+               _MapInfo_globopen = false;
        }
 }
 
-float MapInfo_ForbiddenFlags()
+int MapInfo_ForbiddenFlags()
 {
-       float f;
-       f = MAPINFO_FLAG_FORBIDDEN;
+       int f = MAPINFO_FLAG_FORBIDDEN;
 
 #ifndef MENUQC
        if (!cvar("g_maplist_allow_hidden"))
@@ -1415,10 +1430,9 @@ float MapInfo_ForbiddenFlags()
        return f;
 }
 
-float MapInfo_RequiredFlags()
+int MapInfo_RequiredFlags()
 {
-       float f;
-       f = 0;
+       int f = 0;
 
        if(cvar("g_maplist_allow_frustrating") > 1)
                f |= MAPINFO_FLAG_FRUSTRATING;
index bbcc267b2bdbf5d05005155768419c357516e84c..54255ec8d2aa153abfb6da7242d08b3635c40423 100644 (file)
@@ -1,9 +1,12 @@
-float MAPINFO_TYPE_ALL;
+#ifndef MAPINFO_H
+#define MAPINFO_H
+
+int MAPINFO_TYPE_ALL;
 entity MapInfo_Type_first;
 entity MapInfo_Type_last;
 .entity enemy; // internal next pointer
 
-.float items; // game type ID
+.int items; // game type ID
 .string netname; // game type name as in cvar (with g_ prefix)
 .string mdl; // game type short name
 .string message; // human readable name
@@ -12,8 +15,8 @@ entity MapInfo_Type_last;
 .string gametype_description; // game type description
 
 #define REGISTER_GAMETYPE(hname,sname,g_name,NAME,gteamplay,defaults,gdescription) \
-       var float MAPINFO_TYPE_##NAME; \
-       var entity MapInfo_Type##g_name; \
+       int MAPINFO_TYPE_##NAME; \
+       entity MapInfo_Type##g_name; \
        void RegisterGametypes_##g_name() \
        { \
                MAPINFO_TYPE_##NAME = MAPINFO_TYPE_ALL + 1; \
@@ -37,60 +40,60 @@ entity MapInfo_Type_last;
 #define IS_GAMETYPE(NAME) \
        (MapInfo_LoadedGametype == MAPINFO_TYPE_##NAME)
 
-REGISTER_GAMETYPE(_("Deathmatch"),dm,g_dm,DEATHMATCH,FALSE,"timelimit=20 pointlimit=30 leadlimit=0",_("Kill all enemies"));
+REGISTER_GAMETYPE(_("Deathmatch"),dm,g_dm,DEATHMATCH,false,"timelimit=20 pointlimit=30 leadlimit=0",_("Kill all enemies"));
 #define g_dm IS_GAMETYPE(DEATHMATCH)
 
-REGISTER_GAMETYPE(_("Last Man Standing"),lms,g_lms,LMS,FALSE,"timelimit=20 lives=9 leadlimit=0",_("Survive and kill until the enemies have no lives left"));
+REGISTER_GAMETYPE(_("Last Man Standing"),lms,g_lms,LMS,false,"timelimit=20 lives=9 leadlimit=0",_("Survive and kill until the enemies have no lives left"));
 #define g_lms IS_GAMETYPE(LMS)
 
-REGISTER_GAMETYPE(_("Race"),rc,g_race,RACE,FALSE,"timelimit=20 qualifying_timelimit=5 laplimit=7 teamlaplimit=15 leadlimit=0",_("Race against other players to the finish line"));
+REGISTER_GAMETYPE(_("Race"),rc,g_race,RACE,false,"timelimit=20 qualifying_timelimit=5 laplimit=7 teamlaplimit=15 leadlimit=0",_("Race against other players to the finish line"));
 #define g_race IS_GAMETYPE(RACE)
 
-REGISTER_GAMETYPE(_("Race CTS"),cts,g_cts,CTS,FALSE,"timelimit=20 skill=-1",_("Race for fastest time"));
+REGISTER_GAMETYPE(_("Race CTS"),cts,g_cts,CTS,false,"timelimit=20 skill=-1",_("Race for fastest time"));
 #define g_cts IS_GAMETYPE(CTS)
 
-REGISTER_GAMETYPE(_("Team Deathmatch"),tdm,g_tdm,TEAM_DEATHMATCH,TRUE,"timelimit=20 pointlimit=50 teams=2 leadlimit=0",_("Kill all enemy teammates"));
+REGISTER_GAMETYPE(_("Team Deathmatch"),tdm,g_tdm,TEAM_DEATHMATCH,true,"timelimit=20 pointlimit=50 teams=2 leadlimit=0",_("Kill all enemy teammates"));
 #define g_tdm IS_GAMETYPE(TEAM_DEATHMATCH)
 
-REGISTER_GAMETYPE(_("Capture the Flag"),ctf,g_ctf,CTF,TRUE,"timelimit=20 caplimit=10 leadlimit=6",_("Find and bring the enemy flag to your base to capture it"));
+REGISTER_GAMETYPE(_("Capture the Flag"),ctf,g_ctf,CTF,true,"timelimit=20 caplimit=10 leadlimit=6",_("Find and bring the enemy flag to your base to capture it"));
 #define g_ctf IS_GAMETYPE(CTF)
 
-REGISTER_GAMETYPE(_("Clan Arena"),ca,g_ca,CA,TRUE,"timelimit=20 pointlimit=10 teams=2 leadlimit=0",_("Kill all enemy teammates to win the round"));
+REGISTER_GAMETYPE(_("Clan Arena"),ca,g_ca,CA,true,"timelimit=20 pointlimit=10 teams=2 leadlimit=0",_("Kill all enemy teammates to win the round"));
 #define g_ca IS_GAMETYPE(CA)
 
-REGISTER_GAMETYPE(_("Domination"),dom,g_domination,DOMINATION,TRUE,"timelimit=20 pointlimit=200 teams=2 leadlimit=0",_("Capture all the control points to win"));
+REGISTER_GAMETYPE(_("Domination"),dom,g_domination,DOMINATION,true,"timelimit=20 pointlimit=200 teams=2 leadlimit=0",_("Capture all the control points to win"));
 #define g_domination IS_GAMETYPE(DOMINATION)
 
-REGISTER_GAMETYPE(_("Key Hunt"),kh,g_keyhunt,KEYHUNT,TRUE,"timelimit=20 pointlimit=1000 teams=3 leadlimit=0",_("Gather all the keys to win the round"));
+REGISTER_GAMETYPE(_("Key Hunt"),kh,g_keyhunt,KEYHUNT,true,"timelimit=20 pointlimit=1000 teams=3 leadlimit=0",_("Gather all the keys to win the round"));
 #define g_keyhunt IS_GAMETYPE(KEYHUNT)
 
-REGISTER_GAMETYPE(_("Assault"),as,g_assault,ASSAULT,TRUE,"timelimit=20",_("Destroy obstacles to find and destroy the enemy power core before time runs out"));
+REGISTER_GAMETYPE(_("Assault"),as,g_assault,ASSAULT,true,"timelimit=20",_("Destroy obstacles to find and destroy the enemy power core before time runs out"));
 #define g_assault IS_GAMETYPE(ASSAULT)
 
-REGISTER_GAMETYPE(_("Onslaught"),ons,g_onslaught,ONSLAUGHT,TRUE,"timelimit=20",_("Capture control points to reach and destroy the enemy generator"));
+REGISTER_GAMETYPE(_("Onslaught"),ons,g_onslaught,ONSLAUGHT,true,"timelimit=20",_("Capture control points to reach and destroy the enemy generator"));
 #define g_onslaught IS_GAMETYPE(ONSLAUGHT)
 
-REGISTER_GAMETYPE(_("Nexball"),nb,g_nexball,NEXBALL,TRUE,"timelimit=20 pointlimit=5 leadlimit=0",_("XonSports"));
+REGISTER_GAMETYPE(_("Nexball"),nb,g_nexball,NEXBALL,true,"timelimit=20 pointlimit=5 leadlimit=0",_("XonSports"));
 #define g_nexball IS_GAMETYPE(NEXBALL)
 
-REGISTER_GAMETYPE(_("Freeze Tag"),ft,g_freezetag,FREEZETAG,TRUE,"timelimit=20 pointlimit=10 teams=2 leadlimit=0",_("Kill enemies to freeze them, stand next to teammates to revive them"));
+REGISTER_GAMETYPE(_("Freeze Tag"),ft,g_freezetag,FREEZETAG,true,"timelimit=20 pointlimit=10 teams=2 leadlimit=0",_("Kill enemies to freeze them, stand next to teammates to revive them"));
 #define g_freezetag IS_GAMETYPE(FREEZETAG)
 
-REGISTER_GAMETYPE(_("Keepaway"),ka,g_keepaway,KEEPAWAY,TRUE,"timelimit=20 pointlimit=30",_("Hold the ball to get points for kills"));
+REGISTER_GAMETYPE(_("Keepaway"),ka,g_keepaway,KEEPAWAY,true,"timelimit=20 pointlimit=30",_("Hold the ball to get points for kills"));
 #define g_keepaway IS_GAMETYPE(KEEPAWAY)
 
-REGISTER_GAMETYPE(_("Invasion"),inv,g_invasion,INVASION,FALSE,"pointlimit=50 teams=0",_("Survive against waves of monsters"));
+REGISTER_GAMETYPE(_("Invasion"),inv,g_invasion,INVASION,false,"pointlimit=50 teams=0",_("Survive against waves of monsters"));
 #define g_invasion IS_GAMETYPE(INVASION)
 
-const float MAPINFO_FEATURE_WEAPONS       = 1; // not defined for instagib-only maps
-const float MAPINFO_FEATURE_VEHICLES      = 2;
-const float MAPINFO_FEATURE_TURRETS       = 4;
-const float MAPINFO_FEATURE_MONSTERS      = 8;
+const int MAPINFO_FEATURE_WEAPONS       = 1; // not defined for instagib-only maps
+const int MAPINFO_FEATURE_VEHICLES      = 2;
+const int MAPINFO_FEATURE_TURRETS       = 4;
+const int MAPINFO_FEATURE_MONSTERS      = 8;
 
-const float MAPINFO_FLAG_HIDDEN           = 1; // not in lsmaps/menu/vcall/etc., can just be changed to manually
-const float MAPINFO_FLAG_FORBIDDEN        = 2; // don't even allow the map by a cvar setting that allows hidden maps
-const float MAPINFO_FLAG_FRUSTRATING      = 4; // this map is near impossible to play, enable at your own risk
-const float MAPINFO_FLAG_NOAUTOMAPLIST    = 8; // do not include when automatically building maplist (counts as hidden for maplist building purposes)
+const int MAPINFO_FLAG_HIDDEN           = 1; // not in lsmaps/menu/vcall/etc., can just be changed to manually
+const int MAPINFO_FLAG_FORBIDDEN        = 2; // don't even allow the map by a cvar setting that allows hidden maps
+const int MAPINFO_FLAG_FRUSTRATING      = 4; // this map is near impossible to play, enable at your own risk
+const int MAPINFO_FLAG_NOAUTOMAPLIST    = 8; // do not include when automatically building maplist (counts as hidden for maplist building purposes)
 
 float MapInfo_count;
 
@@ -102,9 +105,9 @@ string MapInfo_Map_description;
 string MapInfo_Map_author;
 string MapInfo_Map_clientstuff; // not in cache, only for map load
 string MapInfo_Map_fog; // not in cache, only for map load
-float MapInfo_Map_supportedGametypes;
-float MapInfo_Map_supportedFeatures;
-float MapInfo_Map_flags;
+int MapInfo_Map_supportedGametypes;
+int MapInfo_Map_supportedFeatures;
+int MapInfo_Map_flags;
 vector MapInfo_Map_mins; // these are '0 0 0' if not supported!
 vector MapInfo_Map_maxs; // these are '0 0 0' if not specified!
 
@@ -115,10 +118,10 @@ void MapInfo_Enumerate();
 // filter the info by game type mask (updates MapInfo_count)
 float MapInfo_progress;
 float MapInfo_FilterGametype(float gametype, float features, float pFlagsRequired, float pFlagsForbidden, float pAbortOnGenerate); // 1 on success, 0 on temporary failure (call it again next frame then; use MapInfo_progress as progress indicator)
-float MapInfo_CurrentFeatures(); // retrieves currently required features from cvars
-float MapInfo_CurrentGametype(); // retrieves current gametype from cvars
-float MapInfo_ForbiddenFlags(); // retrieves current flags from cvars
-float MapInfo_RequiredFlags(); // retrieves current flags from cvars
+int MapInfo_CurrentFeatures(); // retrieves currently required features from cvars
+int MapInfo_CurrentGametype(); // retrieves current gametype from cvars
+int MapInfo_ForbiddenFlags(); // retrieves current flags from cvars
+int MapInfo_RequiredFlags(); // retrieves current flags from cvars
 
 // load info about the i-th map into the MapInfo_Map_* globals
 float MapInfo_Get_ByID(float i); // 1 on success, 0 on failure
@@ -149,7 +152,7 @@ float MapInfo_Type_FromString(string t);
 string MapInfo_Type_Description(float t);
 string MapInfo_Type_ToString(float t);
 string MapInfo_Type_ToText(float t);
-void MapInfo_SwitchGameType(float t);
+void MapInfo_SwitchGameType(int t);
 
 // to be called from worldspawn to set up cvars
 void MapInfo_LoadMapSettings(string s);
@@ -165,3 +168,4 @@ void MapInfo_Shutdown(); // call this in the shutdown handler
 
 #define MAPINFO_SETTEMP_ACL_USER cvar_string("g_mapinfo_settemp_acl")
 #define MAPINFO_SETTEMP_ACL_SYSTEM "-g_mapinfo_* -rcon_* -_* -g_ban* +*"
+#endif
index d30f29894ec12ccf4a952a11b8bb2307a8593842..c79a4e656c4033131542558bd4b49ec9a5a56869 100644 (file)
@@ -1,5 +1,11 @@
+// TODO: include once
+//#ifndef MONSTERS_ALL_H
+//#define MONSTERS_ALL_H
+
 #include "monster/zombie.qc"
 #include "monster/spider.qc"
 #include "monster/mage.qc"
 #include "monster/wyvern.qc"
 #include "monster/shambler.qc"
+
+//#endif
index 3adc59a3020c8fc7cc1c8da0341284672dbf41bd..1aab262fd0a9ea28c797cb1504dcd4efeb6acd20 100644 (file)
@@ -55,17 +55,17 @@ void() mage_shield;
 float friend_needshelp(entity e)
 {
        if(e == world)
-               return FALSE;
+               return false;
        if(e.health <= 0)
-               return FALSE;
+               return false;
        if(DIFF_TEAM(e, self) && e != self.monster_owner)
-               return FALSE;
+               return false;
        if(e.frozen)
-               return FALSE;
+               return false;
        if(!IS_PLAYER(e))
                return ((e.flags & FL_MONSTER) && e.health < e.max_health);
        if(e.items & IT_INVINCIBLE)
-               return FALSE;
+               return false;
 
        switch(self.skin)
        {
@@ -75,7 +75,7 @@ float friend_needshelp(entity e)
                case 3: return (e.health > 0);
        }
 
-       return FALSE;
+       return false;
 }
 
 void mage_spike_explode()
@@ -139,9 +139,9 @@ void mage_spike_think()
                {
                        // Is it a better idea (shorter distance) to trace to the target itself?
                        if ( vlen(self.origin + olddir * self.wait) < dist)
-                               traceline(self.origin, self.origin + olddir * self.wait, FALSE, self);
+                               traceline(self.origin, self.origin + olddir * self.wait, false, self);
                        else
-                               traceline(self.origin, eorg, FALSE, self);
+                               traceline(self.origin, eorg, false, self);
 
                        // Setup adaptive tracelength
                        self.wait = bound((autocvar_g_monster_mage_attack_spike_smart_trace_min), vlen(self.origin - trace_endpos), self.wait = (autocvar_g_monster_mage_attack_spike_smart_trace_max));
@@ -187,17 +187,17 @@ void mage_attack_spike()
 
        self.mage_spike = missile;
 
-       CSQCProjectile(missile, TRUE, PROJECTILE_MAGE_SPIKE, TRUE);
+       CSQCProjectile(missile, true, PROJECTILE_MAGE_SPIKE, true);
 }
 
 void mage_heal()
 {
        entity head;
-       float washealed = FALSE;
+       float washealed = false;
 
        for(head = findradius(self.origin, (autocvar_g_monster_mage_heal_range)); head; head = head.chain) if(friend_needshelp(head))
        {
-               washealed = TRUE;
+               washealed = true;
                string fx = "";
                if(IS_PLAYER(head))
                {
@@ -300,10 +300,10 @@ float mage_attack(float attack_type)
                        if(random() <= 0.7)
                        {
                                mage_push();
-                               return TRUE;
+                               return true;
                        }
 
-                       return FALSE;
+                       return false;
                }
                case MONSTER_ATTACK_RANGED:
                {
@@ -312,25 +312,25 @@ float mage_attack(float attack_type)
                                if(random() <= 0.4)
                                {
                                        mage_teleport();
-                                       return TRUE;
+                                       return true;
                                }
                                else
                                {
                                        self.frame = mage_anim_attack;
                                        self.attack_finished_single = time + (autocvar_g_monster_mage_attack_spike_delay);
                                        defer(0.2, mage_attack_spike);
-                                       return TRUE;
+                                       return true;
                                }
                        }
 
                        if(self.mage_spike)
-                               return TRUE;
+                               return true;
                        else
-                               return FALSE;
+                               return false;
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 void spawnfunc_monster_mage()
@@ -350,13 +350,13 @@ float m_mage(float req)
                case MR_THINK:
                {
                        entity head;
-                       float need_help = FALSE;
+                       float need_help = false;
 
                        for(head = findradius(self.origin, (autocvar_g_monster_mage_heal_range)); head; head = head.chain)
                        if(head != self)
                        if(friend_needshelp(head))
                        {
-                               need_help = TRUE;
+                               need_help = true;
                                break;
                        }
 
@@ -375,12 +375,12 @@ float m_mage(float req)
                                mage_shield();
 
                        monster_move((autocvar_g_monster_mage_speed_run), (autocvar_g_monster_mage_speed_walk), (autocvar_g_monster_mage_speed_stop), mage_anim_walk, mage_anim_run, mage_anim_idle);
-                       return TRUE;
+                       return true;
                }
                case MR_DEATH:
                {
                        self.frame = mage_anim_death;
-                       return TRUE;
+                       return true;
                }
                case MR_SETUP:
                {
@@ -390,18 +390,18 @@ float m_mage(float req)
                        self.monster_attackfunc = mage_attack;
                        self.frame = mage_anim_walk;
 
-                       return TRUE;
+                       return true;
                }
                case MR_PRECACHE:
                {
                        precache_model("models/monsters/mage.dpm");
                        precache_sound ("weapons/grenade_impact.wav");
                        precache_sound ("weapons/tagexp1.wav");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -412,11 +412,11 @@ float m_mage(float req)
        {
                case MR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index 7c46a1da15f087bf1cbf15e001bbb5f84978dafc..12ff5dc891de1be28de7d0e1e083bca4f4cd5337 100644 (file)
@@ -39,7 +39,7 @@ const float shambler_anim_death               = 8;
 void shambler_smash()
 {
        makevectors(self.angles);
-       pointparticles(particleeffectnum("explosion_medium"), (self.origin + (v_forward * 150)) - ('0 0 1' * self.maxs_z), '0 0 0', 1);
+       pointparticles(particleeffectnum("explosion_medium"), (self.origin + (v_forward * 150)) - ('0 0 1' * self.maxs.z), '0 0 0', 1);
        sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
 
        tracebox(self.origin + v_forward * 50, self.mins * 0.5, self.maxs * 0.5, self.origin + v_forward * 500, MOVE_NORMAL, self);
@@ -51,7 +51,7 @@ void shambler_smash()
 void shambler_swing()
 {
        float r = (random() < 0.5);
-       monster_melee(self.enemy, (autocvar_g_monster_shambler_attack_claw_damage), ((r) ? shambler_anim_swingr : shambler_anim_swingl), self.attack_range, 0.8, DEATH_MONSTER_SHAMBLER_CLAW, TRUE);
+       monster_melee(self.enemy, (autocvar_g_monster_shambler_attack_claw_damage), ((r) ? shambler_anim_swingr : shambler_anim_swingl), self.attack_range, 0.8, DEATH_MONSTER_SHAMBLER_CLAW, true);
        if(r)
        {
                defer(0.5, shambler_swing);
@@ -127,7 +127,7 @@ void shambler_lightning()
        gren = spawn ();
        gren.owner = gren.realowner = self;
        gren.classname = "grenade";
-       gren.bot_dodge = TRUE;
+       gren.bot_dodge = true;
        gren.bot_dodgerating = (autocvar_g_monster_shambler_attack_lightning_damage);
        gren.movetype = MOVETYPE_BOUNCE;
        PROJECTILE_MAKETRIGGER(gren);
@@ -146,14 +146,14 @@ void shambler_lightning()
        gren.health = 50;
        gren.damageforcescale = 0;
        gren.event_damage = shambler_lightning_damage;
-       gren.damagedbycontents = TRUE;
+       gren.damagedbycontents = true;
        gren.missile_flags = MIF_SPLASH | MIF_ARC;
-       W_SetupProjVelocity_Explicit(gren, v_forward, v_up, (autocvar_g_monster_shambler_attack_lightning_speed), (autocvar_g_monster_shambler_attack_lightning_speed_up), 0, 0, FALSE);
+       W_SetupProjVelocity_Explicit(gren, v_forward, v_up, (autocvar_g_monster_shambler_attack_lightning_speed), (autocvar_g_monster_shambler_attack_lightning_speed_up), 0, 0, false);
 
        gren.angles = vectoangles (gren.velocity);
        gren.flags = FL_PROJECTILE;
 
-       CSQCProjectile(gren, TRUE, PROJECTILE_SHAMBLER_LIGHTNING, TRUE);
+       CSQCProjectile(gren, true, PROJECTILE_SHAMBLER_LIGHTNING, true);
 }
 
 float shambler_attack(float attack_type)
@@ -163,7 +163,7 @@ float shambler_attack(float attack_type)
                case MONSTER_ATTACK_MELEE:
                {
                        shambler_swing();
-                       return TRUE;
+                       return true;
                }
                case MONSTER_ATTACK_RANGED:
                {
@@ -175,7 +175,7 @@ float shambler_attack(float attack_type)
                                defer(0.7, shambler_smash);
                                self.attack_finished_single = time + 1.1;
                                self.shambler_lastattack = time + 3;
-                               return TRUE;
+                               return true;
                        }
                        else if(random() <= 0.1) // small chance, don't want this spammed
                        {
@@ -183,14 +183,14 @@ float shambler_attack(float attack_type)
                                self.attack_finished_single = time + 1.1;
                                self.shambler_lastattack = time + 3;
                                defer(0.6, shambler_lightning);
-                               return TRUE;
+                               return true;
                        }
 
-                       return FALSE;
+                       return false;
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 void spawnfunc_monster_shambler()
@@ -207,12 +207,12 @@ float m_shambler(float req)
                case MR_THINK:
                {
                        monster_move((autocvar_g_monster_shambler_speed_run), (autocvar_g_monster_shambler_speed_walk), (autocvar_g_monster_shambler_speed_stop), shambler_anim_run, shambler_anim_walk, shambler_anim_stand);
-                       return TRUE;
+                       return true;
                }
                case MR_DEATH:
                {
                        self.frame = shambler_anim_death;
-                       return TRUE;
+                       return true;
                }
                case MR_SETUP:
                {
@@ -224,16 +224,16 @@ float m_shambler(float req)
                        self.frame = shambler_anim_stand;
                        self.weapon = WEP_VORTEX;
 
-                       return TRUE;
+                       return true;
                }
                case MR_PRECACHE:
                {
                        precache_model("models/monsters/shambler.mdl");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -244,11 +244,11 @@ float m_shambler(float req)
        {
                case MR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index c6c454547f4898bb96e946cb5994bd585b073e02..427f63107ff224f4b9c7d14277ca97ba81d5a480 100644 (file)
@@ -62,7 +62,7 @@ void spider_shootweb()
        proj.owner = proj.realowner = self;
        proj.use = spider_web_touch;
        proj.think = adaptor_think2use_hittype_splash;
-       proj.bot_dodge = TRUE;
+       proj.bot_dodge = true;
        proj.bot_dodgerating = 0;
        proj.nextthink = time + 5;
        PROJECTILE_MAKETRIGGER(proj);
@@ -72,7 +72,7 @@ void spider_shootweb()
        //proj.glow_size = 50;
        //proj.glow_color = 45;
        proj.movetype = MOVETYPE_BOUNCE;
-       W_SetupProjVelocity_Explicit(proj, v_forward, v_up, (autocvar_g_monster_spider_attack_web_speed), (autocvar_g_monster_spider_attack_web_speed_up), 0, 0, FALSE);
+       W_SetupProjVelocity_Explicit(proj, v_forward, v_up, (autocvar_g_monster_spider_attack_web_speed), (autocvar_g_monster_spider_attack_web_speed_up), 0, 0, false);
        proj.touch = spider_web_touch;
        setsize(proj, '-4 -4 -4', '4 4 4');
        proj.takedamage = DAMAGE_NO;
@@ -80,13 +80,13 @@ void spider_shootweb()
        proj.health = 500;
        proj.event_damage = func_null;
        proj.flags = FL_PROJECTILE;
-       proj.damagedbycontents = TRUE;
+       proj.damagedbycontents = true;
 
        proj.bouncefactor = 0.3;
        proj.bouncestop = 0.05;
        proj.missile_flags = MIF_SPLASH | MIF_ARC;
 
-       CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, TRUE);
+       CSQCProjectile(proj, true, PROJECTILE_ELECTRO, true);
 }
 
 float spider_attack(float attack_type)
@@ -95,7 +95,7 @@ float spider_attack(float attack_type)
        {
                case MONSTER_ATTACK_MELEE:
                {
-                       return monster_melee(self.enemy, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? spider_anim_attack : spider_anim_attack2), self.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER, TRUE);
+                       return monster_melee(self.enemy, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? spider_anim_attack : spider_anim_attack2), self.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER, true);
                }
                case MONSTER_ATTACK_RANGED:
                {
@@ -105,14 +105,14 @@ float spider_attack(float attack_type)
                                self.attack_finished_single = time + (autocvar_g_monster_spider_attack_web_delay);
                                spider_shootweb();
                                self.spider_web_delay = time + 3;
-                               return TRUE;
+                               return true;
                        }
 
-                       return FALSE;
+                       return false;
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 void spawnfunc_monster_spider()
@@ -129,13 +129,13 @@ float m_spider(float req)
                case MR_THINK:
                {
                        monster_move((autocvar_g_monster_spider_speed_run), (autocvar_g_monster_spider_speed_walk), (autocvar_g_monster_spider_speed_stop), spider_anim_walk, spider_anim_walk, spider_anim_idle);
-                       return TRUE;
+                       return true;
                }
                case MR_DEATH:
                {
                        self.frame = spider_anim_attack;
                        self.angles_x = 180;
-                       return TRUE;
+                       return true;
                }
                case MR_SETUP:
                {
@@ -145,17 +145,17 @@ float m_spider(float req)
                        self.monster_attackfunc = spider_attack;
                        self.frame = spider_anim_idle;
 
-                       return TRUE;
+                       return true;
                }
                case MR_PRECACHE:
                {
                        precache_model("models/monsters/spider.dpm");
                        precache_sound ("weapons/electro_fire2.wav");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -166,11 +166,11 @@ float m_spider(float req)
        {
                case MR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index a44f6d9c7ab2fe089dea4c821a8857fa3e98c0c0..b6736caa4aeaf535dd7e61f7de4bf73a048fb793 100644 (file)
@@ -71,7 +71,7 @@ void wyvern_fireball()
        missile.think = wyvern_fireball_explode;
        missile.enemy = self.enemy;
        missile.touch = wyvern_fireball_touch;
-       CSQCProjectile(missile, TRUE, PROJECTILE_FIREMINE, TRUE);
+       CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
 }
 
 float wyvern_attack(float attack_type)
@@ -85,11 +85,11 @@ float wyvern_attack(float attack_type)
 
                        wyvern_fireball();
 
-                       return TRUE;
+                       return true;
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 void spawnfunc_monster_wyvern()
@@ -109,7 +109,7 @@ float m_wyvern(float req)
                case MR_THINK:
                {
                        monster_move((autocvar_g_monster_wyvern_speed_run), (autocvar_g_monster_wyvern_speed_walk), (autocvar_g_monster_wyvern_speed_stop), wyvern_anim_fly, wyvern_anim_hover, wyvern_anim_hover);
-                       return TRUE;
+                       return true;
                }
                case MR_DEATH:
                {
@@ -117,7 +117,7 @@ float m_wyvern(float req)
                        self.velocity_x = -200 + 400 * random();
                        self.velocity_y = -200 + 400 * random();
                        self.velocity_z = 100 + 100 * random();
-                       return TRUE;
+                       return true;
                }
                case MR_SETUP:
                {
@@ -127,16 +127,16 @@ float m_wyvern(float req)
                        self.monster_attackfunc = wyvern_attack;
                        self.frame = wyvern_anim_hover;
 
-                       return TRUE;
+                       return true;
                }
                case MR_PRECACHE:
                {
                        precache_model("models/monsters/wizard.mdl");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -147,11 +147,11 @@ float m_wyvern(float req)
        {
                case MR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index 25afaf76f30b50d27c622fe6c854b5602c4df197..411e1c68674ec7a847eb1a876758c8e66979f898 100644 (file)
@@ -93,7 +93,7 @@ float zombie_block()
 
        defer(2, zombie_blockend);
 
-       return TRUE;
+       return true;
 }
 
 float zombie_attack(float attack_type)
@@ -114,7 +114,7 @@ float zombie_attack(float attack_type)
                        if(random() < 0.3 && self.health < 75 && self.enemy.health > 10)
                                return zombie_block();
 
-                       return monster_melee(self.enemy, (autocvar_g_monster_zombie_attack_melee_damage), chosen_anim, self.attack_range, (autocvar_g_monster_zombie_attack_melee_delay), DEATH_MONSTER_ZOMBIE_MELEE, TRUE);
+                       return monster_melee(self.enemy, (autocvar_g_monster_zombie_attack_melee_damage), chosen_anim, self.attack_range, (autocvar_g_monster_zombie_attack_melee_delay), DEATH_MONSTER_ZOMBIE_MELEE, true);
                }
                case MONSTER_ATTACK_RANGED:
                {
@@ -123,7 +123,7 @@ float zombie_attack(float attack_type)
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 void spawnfunc_monster_zombie()
@@ -140,14 +140,14 @@ float m_zombie(float req)
                case MR_THINK:
                {
                        monster_move((autocvar_g_monster_zombie_speed_run), (autocvar_g_monster_zombie_speed_walk), (autocvar_g_monster_zombie_speed_stop), zombie_anim_runforward, zombie_anim_runforward, zombie_anim_idle);
-                       return TRUE;
+                       return true;
                }
                case MR_DEATH:
                {
                        self.armorvalue = 0;
                        self.m_armor_blockpercent = autocvar_g_monsters_armor_blockpercent;
                        self.frame = ((random() > 0.5) ? zombie_anim_deathback1 : zombie_anim_deathfront1);
-                       return TRUE;
+                       return true;
                }
                case MR_SETUP:
                {
@@ -165,16 +165,16 @@ float m_zombie(float req)
                        self.spawnshieldtime = self.spawn_time;
                        self.respawntime = 0.2;
 
-                       return TRUE;
+                       return true;
                }
                case MR_PRECACHE:
                {
                        precache_model("models/monsters/zombie.dpm");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -185,11 +185,11 @@ float m_zombie(float req)
        {
                case MR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index 67e176cf26395b6001ca42c7090fbade0bf5040d..096c2e5ea43a864874c37b9ce437215f8ae95e88 100644 (file)
@@ -1,10 +1,12 @@
+#include "monsters.qh"
+
 #include "all.qh"
 
 // MONSTER PLUGIN SYSTEM
 entity monster_info[MON_MAXCOUNT];
 entity dummy_monster_info;
 
-void register_monster(float id, float(float) func, float monsterflags, vector min_s, vector max_s, string modelname, string shortname, string mname)
+void register_monster(int id, float(float) func, int monsterflags, vector min_s, vector max_s, string modelname, string shortname, string mname)
 {
        entity e;
        monster_info[id - 1] = e = spawn();
@@ -33,7 +35,7 @@ void register_monsters_done()
        dummy_monster_info.maxs = '0 0 0';
        dummy_monster_info.model = "";
 }
-entity get_monsterinfo(float id)
+entity get_monsterinfo(int id)
 {
        entity m;
        if(id < MON_FIRST || id > MON_LAST)
index c355e12a75a31b197fadd75476db33290f270564..6fa9dfaf71a095a69a5d0f143e090d3f4ac0d13e 100644 (file)
@@ -1,20 +1,23 @@
+#ifndef MONSTERS_H
+#define MONSTERS_H
+
 // monster requests
-#define MR_SETUP                 1 // (SERVER) setup monster data
-#define MR_THINK                 2 // (SERVER) logic to run every frame
-#define MR_DEATH                 3 // (SERVER) called when monster dies
-#define MR_PRECACHE              4 // (BOTH) precaches models/sounds used by this monster
+const int MR_SETUP = 1; // (SERVER) setup monster data
+const int MR_THINK = 2; // (SERVER) logic to run every frame
+const int MR_DEATH = 3; // (SERVER) called when monster dies
+const int MR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this monster
 
 // functions:
 entity get_monsterinfo(float id);
 
 // special spawn flags
-const float MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died
-const float MONSTER_TYPE_FLY = 32;
-const float MONSTER_TYPE_SWIM = 64;
-const float MONSTER_SIZE_BROKEN = 128; // TODO: remove when bad models are replaced
-const float MON_FLAG_SUPERMONSTER = 256; // incredibly powerful monster
-const float MON_FLAG_RANGED = 512; // monster shoots projectiles
-const float MON_FLAG_MELEE = 1024;
+const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died
+const int MONSTER_TYPE_FLY = 32;
+const int MONSTER_TYPE_SWIM = 64;
+const int MONSTER_SIZE_BROKEN = 128; // TODO: remove when bad models are replaced
+const int MON_FLAG_SUPERMONSTER = 256; // incredibly powerful monster
+const int MON_FLAG_RANGED = 512; // monster shoots projectiles
+const int MON_FLAG_MELEE = 1024;
 
 // entity properties of monsterinfo:
 .float monsterid; // MON_...
@@ -23,7 +26,7 @@ const float MON_FLAG_MELEE = 1024;
 .float(float) monster_func; // m_...
 .string mdl; // currently a copy of the model
 .string model; // full name of model
-.float spawnflags;
+.int spawnflags;
 .vector mins, maxs; // monster hitbox size
 
 // other useful macros
@@ -38,13 +41,13 @@ float m_null(float dummy);
 void register_monster(float id, float(float) func, float monsterflags, vector min_s, vector max_s, string modelname, string shortname, string mname);
 void register_monsters_done();
 
-const float MON_MAXCOUNT = 24;
-#define MON_FIRST 1
-float MON_COUNT;
-float MON_LAST;
+const int MON_MAXCOUNT = 24;
+const int MON_FIRST = 1;
+int MON_COUNT;
+int MON_LAST;
 
 #define REGISTER_MONSTER_2(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \
-       float id; \
+       int id; \
        float func(float); \
        void RegisterMonsters_##id() \
        { \
@@ -65,3 +68,4 @@ float MON_LAST;
 
 #undef REGISTER_MONSTER
 ACCUMULATE_FUNCTION(RegisterMonsters, register_monsters_done);
+#endif
index be5accf5ede2d095a2d40cc398970aa406a49a74..8aee54b98084fe36279553eb5ab761f7de4046af 100644 (file)
@@ -1,3 +1,14 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../util.qh"
+    #include "monsters.qh"
+    #include "sv_monsters.qh"
+    #include "spawn.qh"
+    #include "../../server/autocvars.qh"
+    #include "../../server/defs.qh"
+#endif
 entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag)
 {
        // ensure spawnfunc database is initialized
@@ -34,7 +45,7 @@ entity spawnmonster (string monster, float monster_id, entity spawnedby, entity
                        mon = get_monsterinfo(i);
                        if(mon.netname == monster)
                        {
-                               found = TRUE;
+                               found = true;
                                monster_id = mon.monsterid; // we have the monster, old monster id is no longer required
                                break;
                        }
@@ -64,7 +75,7 @@ entity spawnmonster (string monster, float monster_id, entity spawnedby, entity
        }
 
        //monster = strcat("$ spawnfunc_monster_", monster);
-       
+
        entity oldself = self;
        self = e;
        monster_initialize(monster_id);
index 02d308677c708f3d6e0fcc2211463e73be4cc7e0..2ebdcc54e80dadee46142c9435e10007147f9b05 100644 (file)
@@ -1 +1,5 @@
+#ifndef SPAWN_H
+#define SPAWN_H
+
 entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag);
+#endif
index fd966f5d2edf20499aa7adf681b3aebd2a88fc4a..4c443495feae22255bbaa372168611ccaa7b34ad 100644 (file)
@@ -1,3 +1,27 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../warpzonelib/common.qh"
+    #include "../constants.qh"
+    #include "../teams.qh"
+    #include "../util.qh"
+    #include "monsters.qh"
+    #include "sv_monsters.qh"
+    #include "../weapons/weapons.qh"
+    #include "../../server/autocvars.qh"
+    #include "../../server/defs.qh"
+    #include "../deathtypes.qh"
+    #include "../../server/mutators/mutators_include.qh"
+    #include "../../server/vehicles/vehicles_def.qh"
+    #include "../../server/campaign.qh"
+    #include "../../server/command/common.qh"
+    #include "../../server/command/cmd.qh"
+    #include "../../csqcmodellib/sv_model.qh"
+    #include "../../server/round_handler.qh"
+#endif
+
 // =========================
 //     SVQC Monster Properties
 // =========================
@@ -20,7 +44,7 @@ void monster_dropitem()
        if(e && e.monster_loot)
        {
                self = e;
-               e.noalign = TRUE;
+               e.noalign = true;
                e.monster_loot();
                e.gravity = 1;
                e.movetype = MOVETYPE_TOSS;
@@ -44,58 +68,58 @@ float Monster_SkillModifier()
 float monster_isvalidtarget (entity targ, entity ent)
 {
        if(!targ || !ent)
-               return FALSE; // someone doesn't exist
+               return false; // someone doesn't exist
 
        if(targ == ent)
-               return FALSE; // don't attack ourselves
+               return false; // don't attack ourselves
 
        //traceline(ent.origin, targ.origin, MOVE_NORMAL, ent);
 
        //if(trace_ent != targ)
-               //return FALSE;
+               //return false;
 
        if(targ.vehicle_flags & VHF_ISVEHICLE)
        if(!((get_monsterinfo(ent.monsterid)).spawnflags & MON_FLAG_RANGED))
-               return FALSE; // melee attacks are useless against vehicles
+               return false; // melee attacks are useless against vehicles
 
        if(time < game_starttime)
-               return FALSE; // monsters do nothing before the match has started
+               return false; // monsters do nothing before the match has started
 
        if(targ.takedamage == DAMAGE_NO)
-               return FALSE; // enemy can't be damaged
+               return false; // enemy can't be damaged
 
        if(targ.items & IT_INVISIBILITY)
-               return FALSE; // enemy is invisible
+               return false; // enemy is invisible
 
        if(substring(targ.classname, 0, 10) == "onslaught_")
-               return FALSE; // don't attack onslaught targets
+               return false; // don't attack onslaught targets
 
        if(IS_SPEC(targ) || IS_OBSERVER(targ))
-               return FALSE; // enemy is a spectator
+               return false; // enemy is a spectator
 
        if(!(targ.vehicle_flags & VHF_ISVEHICLE))
        if(targ.deadflag != DEAD_NO || ent.deadflag != DEAD_NO || targ.health <= 0 || ent.health <= 0)
-               return FALSE; // enemy/self is dead
+               return false; // enemy/self is dead
 
        if(ent.monster_owner == targ)
-               return FALSE; // don't attack our master
+               return false; // don't attack our master
 
        if(targ.monster_owner == ent)
-               return FALSE; // don't attack our pet
+               return false; // don't attack our pet
 
        if(!(targ.vehicle_flags & VHF_ISVEHICLE))
        if(targ.flags & FL_NOTARGET)
-               return FALSE; // enemy can't be targeted
+               return false; // enemy can't be targeted
 
        if(!autocvar_g_monsters_typefrag)
        if(targ.BUTTON_CHAT)
-               return FALSE; // no typefragging!
+               return false; // no typefragging!
 
        if(SAME_TEAM(targ, ent))
-               return FALSE; // enemy is on our team
+               return false; // enemy is on our team
 
        if (targ.frozen)
-               return FALSE; // ignore frozen
+               return false; // ignore frozen
 
        if(autocvar_g_monsters_target_infront || (ent.spawnflags & MONSTERFLAG_INFRONT))
        if(ent.enemy != targ)
@@ -106,10 +130,10 @@ float monster_isvalidtarget (entity targ, entity ent)
                dot = normalize (targ.origin - ent.origin) * v_forward;
 
                if(dot <= 0.3)
-                       return FALSE;
+                       return false;
        }
 
-       return TRUE;
+       return true;
 }
 
 entity FindTarget (entity ent)
@@ -118,7 +142,7 @@ entity FindTarget (entity ent)
 
        entity head, closest_target = world;
        head = findradius(ent.origin, ent.target_range);
-       //head = WarpZone_FindRadius(ent.origin, ent.target_range, TRUE);
+       //head = WarpZone_FindRadius(ent.origin, ent.target_range, true);
 
        while(head) // find the closest acceptable target to pass to
        {
@@ -198,7 +222,7 @@ void precache_monstersounds()
        float globhandle, n, i;
        string f;
 
-       globhandle = search_begin(strcat(m, "_*.sounds"), TRUE, FALSE);
+       globhandle = search_begin(strcat(m, "_*.sounds"), true, false);
        if (globhandle < 0)
                return;
        n = search_getsize(globhandle);
@@ -257,7 +281,7 @@ float LoadMonsterSounds(string f, float first)
        return 1;
 }
 
-.float skin_for_monstersound;
+.int skin_for_monstersound;
 void UpdateMonsterSounds()
 {
        entity mon = get_monsterinfo(self.monsterid);
@@ -290,7 +314,7 @@ void monster_makevectors(entity e)
 
        v = e.origin + (e.mins + e.maxs) * 0.5;
        self.v_angle = vectoangles(v - (self.origin + self.view_ofs));
-       self.v_angle_x = -self.v_angle_x;
+       self.v_angle_x = -self.v_angle.x;
 
        makevectors(self.v_angle);
 }
@@ -298,7 +322,7 @@ void monster_makevectors(entity e)
 float monster_melee(entity targ, float damg, float anim, float er, float anim_finished, float deathtype, float dostop)
 {
        if (self.health <= 0)
-               return FALSE; // attacking while dead?!
+               return false; // attacking while dead?!
 
        if(dostop)
        {
@@ -319,7 +343,7 @@ float monster_melee(entity targ, float damg, float anim, float er, float anim_fi
        if(trace_ent.takedamage)
                Damage(trace_ent, self, self, damg * Monster_SkillModifier(), deathtype, trace_ent.origin, normalize(trace_ent.origin - self.origin));
 
-       return TRUE;
+       return true;
 }
 
 void Monster_CheckMinibossFlag ()
@@ -344,18 +368,17 @@ float Monster_CanRespawn(entity ent)
        other = ent;
        if(ent.deadflag == DEAD_DEAD) // don't call when monster isn't dead
        if(MUTATOR_CALLHOOK(MonsterRespawn))
-               return TRUE; // enabled by a mutator
+               return true; // enabled by a mutator
 
        if(ent.spawnflags & MONSTERFLAG_NORESPAWN)
-               return FALSE;
+               return false;
 
        if(!autocvar_g_monsters_respawn)
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
-float monster_initialize(float mon_id);
 void monster_respawn()
 {
        // is this function really needed?
@@ -395,13 +418,13 @@ void Monster_Fade ()
 float Monster_CanJump (vector vel)
 {
        if(self.state)
-               return FALSE; // already attacking
+               return false; // already attacking
        if(!(self.flags & FL_ONGROUND))
-               return FALSE; // not on the ground
+               return false; // not on the ground
        if(self.health <= 0)
-               return FALSE; // called when dead?
+               return false; // called when dead?
        if(time < self.attack_finished_single)
-               return FALSE; // still attacking
+               return false; // still attacking
 
        vector old = self.velocity;
 
@@ -409,15 +432,15 @@ float Monster_CanJump (vector vel)
        tracetoss(self, self);
        self.velocity = old;
        if (trace_ent != self.enemy)
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 float monster_leap (float anm, void() touchfunc, vector vel, float anim_finished)
 {
        if(!Monster_CanJump(vel))
-               return FALSE;
+               return false;
 
        self.frame = anm;
        self.state = MONSTER_STATE_ATTACK_LEAP;
@@ -428,7 +451,7 @@ float monster_leap (float anm, void() touchfunc, vector vel, float anim_finished
 
        self.attack_finished_single = time + anim_finished;
 
-       return TRUE;
+       return true;
 }
 
 void monster_checkattack(entity e, entity targ)
@@ -447,14 +470,14 @@ void monster_checkattack(entity e, entity targ)
        if(vlen(targ.origin - e.origin) <= e.attack_range)
        if(e.monster_attackfunc(MONSTER_ATTACK_MELEE))
        {
-               MonsterSound(monstersound_melee, 0, FALSE, CH_VOICE);
+               MonsterSound(monstersound_melee, 0, false, CH_VOICE);
                return;
        }
 
        if(vlen(targ.origin - e.origin) > e.attack_range)
        if(e.monster_attackfunc(MONSTER_ATTACK_RANGED))
        {
-               MonsterSound(monstersound_ranged, 0, FALSE, CH_VOICE);
+               MonsterSound(monstersound_ranged, 0, false, CH_VOICE);
                return;
        }
 }
@@ -477,7 +500,7 @@ vector monster_pickmovetarget(entity targ)
                vector targ_origin = ((self.enemy.absmin + self.enemy.absmax) * 0.5);
                targ_origin = WarpZone_RefSys_TransformOrigin(self.enemy, self, targ_origin); // origin of target as seen by the monster (us)
                WarpZone_TraceLine(self.origin, targ_origin, MOVE_NOMONSTERS, self);
-               
+
                if((self.enemy == world)
                        || (self.enemy.deadflag != DEAD_NO || self.enemy.health < 1)
                        || (self.enemy.frozen)
@@ -491,19 +514,19 @@ vector monster_pickmovetarget(entity targ)
                        self.enemy = world;
                        self.pass_distance = 0;
                }
-               
+
                if(self.enemy)
                {
                        /*WarpZone_TrailParticles(world, particleeffectnum("red_pass"), self.origin, targ_origin);
                        print("Trace origin: ", vtos(targ_origin), "\n");
                        print("Target origin: ", vtos(self.enemy.origin), "\n");
                        print("My origin: ", vtos(self.origin), "\n"); */
-                       
+
                        self.monster_movestate = MONSTER_MOVE_ENEMY;
                        self.last_trace = time + 1.2;
                        return targ_origin;
                }
-       
+
                /*makevectors(self.angles);
                self.monster_movestate = MONSTER_MOVE_ENEMY;
                self.last_trace = time + 1.2;
@@ -551,9 +574,9 @@ vector monster_pickmovetarget(entity targ)
 
                                if(((self.flags & FL_FLY) && (self.spawnflags & MONSTERFLAG_FLY_VERTICAL)) || (self.flags & FL_SWIM))
                                {
-                                       pos_z = random() * 200;
+                                       pos.z = random() * 200;
                                        if(random() >= 0.5)
-                                               pos_z *= -1;
+                                               pos.z *= -1;
                                }
                        }
 
@@ -564,7 +587,7 @@ vector monster_pickmovetarget(entity targ)
 
 void monster_CalculateVelocity(entity mon, vector to, vector from, float turnrate, float movespeed)
 {
-       float current_distance = vlen((('1 0 0' * to_x) + ('0 1 0' * to_y)) - (('1 0 0' * from_x) + ('0 1 0' * from_y))); // for the sake of this check, exclude Z axis
+       float current_distance = vlen((('1 0 0' * to.x) + ('0 1 0' * to.y)) - (('1 0 0' * from.x) + ('0 1 0' * from.y))); // for the sake of this check, exclude Z axis
        float initial_height = 0; //min(50, (targ_distance * tanh(20)));
        float current_height = (initial_height * min(1, (current_distance / self.pass_distance)));
        //print("current_height = ", ftos(current_height), ", initial_height = ", ftos(initial_height), ".\n");
@@ -656,7 +679,7 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_
                {
                        if(time >= self.last_trace)
                        {
-                               self.fish_wasdrowning = TRUE;
+                               self.fish_wasdrowning = true;
                                self.last_trace = time + 0.4;
 
                                Damage (self, world, world, 2, DEATH_DROWN, self.origin, '0 0 0');
@@ -682,7 +705,7 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_
                }
                else if(self.fish_wasdrowning)
                {
-                       self.fish_wasdrowning = FALSE;
+                       self.fish_wasdrowning = false;
                        self.angles_x = 0;
                        self.movetype = MOVETYPE_WALK;
                }
@@ -728,9 +751,9 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_
                                WarpZone_RefSys_Copy(self.enemy, self);
                                WarpZone_RefSys_AddInverse(self.enemy, self); // wz1^-1 ... wzn^-1 receiver
                                self.moveto = WarpZone_RefSys_TransformOrigin(self.enemy, self, (0.5 * (self.enemy.absmin + self.enemy.absmax)));
-                               
-                               self.pass_distance = vlen((('1 0 0' * self.enemy.origin_x) + ('0 1 0' * self.enemy.origin_y)) - (('1 0 0' *  self.origin_x) + ('0 1 0' *  self.origin_y)));
-                               MonsterSound(monstersound_sight, 0, FALSE, CH_VOICE);
+
+                               self.pass_distance = vlen((('1 0 0' * self.enemy.origin.x) + ('0 1 0' * self.enemy.origin.y)) - (('1 0 0' *  self.origin.x) + ('0 1 0' *  self.origin.y)));
+                               MonsterSound(monstersound_sight, 0, false, CH_VOICE);
                        }
                }
 
@@ -745,7 +768,7 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_
                self.moveto = monster_pickmovetarget(targ);
 
        if(!self.enemy)
-               MonsterSound(monstersound_idle, 7, TRUE, CH_VOICE);
+               MonsterSound(monstersound_idle, 7, true, CH_VOICE);
 
        if(self.state == MONSTER_STATE_ATTACK_LEAP && (self.flags & FL_ONGROUND))
        {
@@ -762,13 +785,13 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_
        if(!(((self.flags & FL_FLY) && (self.spawnflags & MONSTERFLAG_FLY_VERTICAL)) || (self.flags & FL_SWIM)))
                //v_forward = normalize(self.moveto - self.origin);
        //else
-               self.moveto_z = self.origin_z;
+               self.moveto_z = self.origin.z;
 
        if(vlen(self.origin - self.moveto) > 64)
        {
                if((self.flags & FL_ONGROUND) || ((self.flags & FL_FLY) || (self.flags & FL_SWIM)))
-                       monster_CalculateVelocity(self, self.moveto, self.origin, TRUE, ((self.enemy) ? runspeed : walkspeed));
-               
+                       monster_CalculateVelocity(self, self.moveto, self.origin, true, ((self.enemy) ? runspeed : walkspeed));
+
                /*&if(self.flags & FL_FLY || self.flags & FL_SWIM)
                        movelib_move_simple(v_forward, ((self.enemy) ? runspeed : walkspeed), 0.6);
                else
@@ -795,16 +818,16 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_
                if (vlen(self.velocity) <= 30)
                        self.frame = manim_idle;
        }
-       
+
        self.steerto = steerlib_attract2(self.moveto, 0.5, 500, 0.95);
-       
+
        vector real_angle = vectoangles(self.steerto) - self.angles;
        float turny = 25;
        if(self.state == MONSTER_STATE_ATTACK_MELEE)
                turny = 0;
        if(turny)
        {
-               turny = bound(turny * -1, shortangle_f(real_angle_y, self.angles_y), turny);
+               turny = bound(turny * -1, shortangle_f(real_angle.y, self.angles.y), turny);
                self.angles_y += turny;
        }
 
@@ -859,7 +882,7 @@ void Monster_Appear()
 float Monster_CheckAppearFlags(entity ent, float monster_id)
 {
        if(!(ent.spawnflags & MONSTERFLAG_APPEAR))
-               return FALSE;
+               return false;
 
        ent.think = func_null;
        ent.monsterid = monster_id; // set so this monster is properly registered (otherwise, normal initialization is used)
@@ -867,7 +890,7 @@ float Monster_CheckAppearFlags(entity ent, float monster_id)
        ent.use = Monster_Appear;
        ent.flags = FL_MONSTER; // set so this monster can get butchered
 
-       return TRUE;
+       return true;
 }
 
 void monsters_reset()
@@ -918,7 +941,7 @@ void monster_die(entity attacker, float gibbed)
 
        monster_dropitem();
 
-       MonsterSound(monstersound_death, 0, FALSE, CH_VOICE);
+       MonsterSound(monstersound_death, 0, false, CH_VOICE);
 
        if(!(self.spawnflags & MONSTERFLAG_SPAWNED) && !(self.spawnflags & MONSTERFLAG_RESPAWNED))
                monsters_killed += 1;
@@ -975,8 +998,8 @@ void monsters_damage (entity inflictor, entity attacker, float damage, float dea
        float take, save;
 
        v = healtharmor_applydamage(self.armorvalue, self.m_armor_blockpercent, deathtype, damage);
-       take = v_x;
-       save = v_y;
+       take = v.x;
+       save = v.y;
 
        self.health -= take;
 
@@ -1001,7 +1024,7 @@ void monsters_damage (entity inflictor, entity attacker, float damage, float dea
        if(self.health <= 0)
        {
                if(deathtype == DEATH_KILL)
-                       self.candrop = FALSE; // killed by mobkill command
+                       self.candrop = false; // killed by mobkill command
 
                // TODO: fix this?
                activator = attacker;
@@ -1053,11 +1076,11 @@ void monster_setupcolors(entity mon)
 void monster_changeteam(entity ent, float newteam)
 {
        if(!teamplay) { return; }
-       
+
        ent.team = newteam;
-       ent.monster_attack = TRUE; // new team, activate attacking
+       ent.monster_attack = true; // new team, activate attacking
        monster_setupcolors(ent);
-       
+
        if(ent.sprite)
        {
                WaypointSprite_UpdateTeamRadar(ent.sprite, RADARICON_DANGER, ((newteam) ? Team_ColorRGB(newteam) : '1 0 0'));
@@ -1114,11 +1137,11 @@ float monster_spawn()
        UpdateMonsterSounds();
 
        if(teamplay)
-               self.monster_attack = TRUE; // we can have monster enemies in team games
+               self.monster_attack = true; // we can have monster enemies in team games
 
-       MonsterSound(monstersound_spawn, 0, FALSE, CH_VOICE);
+       MonsterSound(monstersound_spawn, 0, false, CH_VOICE);
 
-       WaypointSprite_Spawn(M_NAME(self.monsterid), 0, 1024, self, '0 0 1' * (self.maxs_z + 15), world, self.team, self, sprite, TRUE, RADARICON_DANGER, ((self.team) ? Team_ColorRGB(self.team) : '1 0 0'));
+       WaypointSprite_Spawn(M_NAME(self.monsterid), 0, 1024, self, '0 0 1' * (self.maxs.z + 15), world, self.team, self, sprite, true, RADARICON_DANGER, ((self.team) ? Team_ColorRGB(self.team) : '1 0 0'));
        if(!(self.spawnflags & MONSTERFLAG_INVINCIBLE))
        {
                WaypointSprite_UpdateMaxHealth(self.sprite, self.max_health);
@@ -1129,16 +1152,16 @@ float monster_spawn()
        self.nextthink = time + self.ticrate;
 
        if(MUTATOR_CALLHOOK(MonsterSpawn))
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 float monster_initialize(float mon_id)
 {
-       if(!autocvar_g_monsters) { return FALSE; }
+       if(!autocvar_g_monsters) { return false; }
        if(!(self.spawnflags & MONSTERFLAG_RESPAWNED)) { MON_ACTION(mon_id, MR_PRECACHE); }
-       if(Monster_CheckAppearFlags(self, mon_id)) { return TRUE; } // return true so the monster isn't removed
+       if(Monster_CheckAppearFlags(self, mon_id)) { return true; } // return true so the monster isn't removed
 
        entity mon = get_monsterinfo(mon_id);
 
@@ -1146,9 +1169,9 @@ float monster_initialize(float mon_id)
                self.monster_skill = cvar("g_monsters_skill");
 
        // support for quake style removing monsters based on skill
-       if(self.monster_skill == MONSTER_SKILL_EASY) if(self.spawnflags & MONSTERSKILL_NOTEASY) { return FALSE; }
-       if(self.monster_skill == MONSTER_SKILL_MEDIUM) if(self.spawnflags & MONSTERSKILL_NOTMEDIUM) { return FALSE; }
-       if(self.monster_skill == MONSTER_SKILL_HARD) if(self.spawnflags & MONSTERSKILL_NOTHARD) { return FALSE; }
+       if(self.monster_skill == MONSTER_SKILL_EASY) if(self.spawnflags & MONSTERSKILL_NOTEASY) { return false; }
+       if(self.monster_skill == MONSTER_SKILL_MEDIUM) if(self.spawnflags & MONSTERSKILL_NOTMEDIUM) { return false; }
+       if(self.monster_skill == MONSTER_SKILL_HARD) if(self.spawnflags & MONSTERSKILL_NOTHARD) { return false; }
 
        if(self.team && !teamplay)
                self.team = 0;
@@ -1161,10 +1184,10 @@ float monster_initialize(float mon_id)
        //setsize(self, mon.mins, mon.maxs);
        self.flags                              = FL_MONSTER;
        self.takedamage                 = DAMAGE_AIM;
-       self.bot_attack                 = TRUE;
-       self.iscreature                 = TRUE;
-       self.teleportable               = TRUE;
-       self.damagedbycontents  = TRUE;
+       self.bot_attack                 = true;
+       self.iscreature                 = true;
+       self.teleportable               = true;
+       self.damagedbycontents  = true;
        self.monsterid                  = mon_id;
        self.damageforcescale   = 0;
        self.event_damage               = monsters_damage;
@@ -1181,8 +1204,8 @@ float monster_initialize(float mon_id)
        self.reset                              = monsters_reset;
        self.netname                    = mon.netname;
        self.monster_name               = M_NAME(mon_id);
-       self.candrop                    = TRUE;
-       self.view_ofs                   = '0 0 1' * (self.maxs_z * 0.5);
+       self.candrop                    = true;
+       self.view_ofs                   = '0 0 1' * (self.maxs.z * 0.5);
        self.oldtarget2                 = self.target2;
        self.pass_distance              = 0;
        self.deadflag                   = DEAD_NO;
@@ -1216,7 +1239,7 @@ float monster_initialize(float mon_id)
        if(mon.spawnflags & MONSTER_SIZE_BROKEN)
        if(!(self.spawnflags & MONSTERFLAG_RESPAWNED))
                self.scale *= 1.3;
-               
+
        setsize(self, mon.mins * self.scale, mon.maxs * self.scale);
 
        if(!self.ticrate)
@@ -1244,12 +1267,12 @@ float monster_initialize(float mon_id)
        }
 
        if(!monster_spawn())
-               return FALSE;
+               return false;
 
        if(!(self.spawnflags & MONSTERFLAG_RESPAWNED))
                monster_setupcolors(self);
 
        CSQCMODEL_AUTOINIT();
 
-       return TRUE;
+       return true;
 }
index 239db02bd225cb3928453f7ca4bef8f4133209e7..f6b149816e27725278d9f781e9bf8aff956034cb 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef SV_MONSTERS_H
+#define SV_MONSTERS_H
+
 .string spawnmob;
 .float monster_attack;
 
@@ -20,8 +23,8 @@ void monsters_setstatus(); // monsters.qc
 void monster_remove(entity mon); // removes a monster
 
 .float(float attack_type) monster_attackfunc;
-const float MONSTER_ATTACK_MELEE = 1;
-const float MONSTER_ATTACK_RANGED = 2;
+const int MONSTER_ATTACK_MELEE = 1;
+const int MONSTER_ATTACK_RANGED = 2;
 
 .float monster_skill;
 const float MONSTER_SKILL_EASY = 1;
@@ -63,26 +66,36 @@ ALLMONSTERSOUNDS
 
 float GetMonsterSoundSampleField_notFound;
 
-const float MONSTERSKILL_NOTEASY = 256; // monster will not spawn on skill <= 1
-const float MONSTERSKILL_NOTMEDIUM = 512; // monster will not spawn on skill 2
-const float MONSTERSKILL_NOTHARD = 1024; // monster will not spawn on skill >= 3
+const int MONSTERSKILL_NOTEASY = 256; // monster will not spawn on skill <= 1
+const int MONSTERSKILL_NOTMEDIUM = 512; // monster will not spawn on skill 2
+const int MONSTERSKILL_NOTHARD = 1024; // monster will not spawn on skill >= 3
 
 // new flags
-const float MONSTERFLAG_APPEAR = 2; // delay spawn until triggered
-const float MONSTERFLAG_NORESPAWN = 4;
-const float MONSTERFLAG_FLY_VERTICAL = 8; // fly/swim vertically
-const float MONSTERFLAG_INFRONT = 32; // only check for enemies infront of us
-const float MONSTERFLAG_MINIBOSS = 64; // monster spawns as mini-boss (also has a chance of naturally becoming one)
-const float MONSTERFLAG_INVINCIBLE = 128; // monster doesn't take damage (may be used for map objects & temporary monsters)
-const float MONSTERFLAG_SPAWNED = 16384; // flag for spawned monsters
-const float MONSTERFLAG_RESPAWNED = 32768; // flag for re-spawned monsters
-
-.float monster_movestate; // used to tell what the monster is currently doing
-const float MONSTER_MOVE_OWNER = 1; // monster will move to owner if in range, or stand still
-const float MONSTER_MOVE_WANDER = 2; // monster will ignore owner & wander around
-const float MONSTER_MOVE_SPAWNLOC = 3; // monster will move to its spawn location when not attacking
-const float MONSTER_MOVE_NOMOVE = 4; // monster simply stands still
-const float MONSTER_MOVE_ENEMY = 5; // used only as a movestate
-
-const float MONSTER_STATE_ATTACK_LEAP = 1;
-const float MONSTER_STATE_ATTACK_MELEE = 2;
+const int MONSTERFLAG_APPEAR = 2; // delay spawn until triggered
+const int MONSTERFLAG_NORESPAWN = 4;
+const int MONSTERFLAG_FLY_VERTICAL = 8; // fly/swim vertically
+const int MONSTERFLAG_INFRONT = 32; // only check for enemies infront of us
+const int MONSTERFLAG_MINIBOSS = 64;   // monster spawns as mini-boss (also has a chance of naturally becoming one)
+const int MONSTERFLAG_INVINCIBLE = 128; // monster doesn't take damage (may be used for map objects & temporary monsters)
+const int MONSTERFLAG_SPAWNED = 16384; // flag for spawned monsters
+const int MONSTERFLAG_RESPAWNED = 32768; // flag for re-spawned monsters
+
+.int monster_movestate; // used to tell what the monster is currently doing
+const int MONSTER_MOVE_OWNER = 1; // monster will move to owner if in range, or stand still
+const int MONSTER_MOVE_WANDER = 2; // monster will ignore owner & wander around
+const int MONSTER_MOVE_SPAWNLOC = 3; // monster will move to its spawn location when not attacking
+const int MONSTER_MOVE_NOMOVE = 4; // monster simply stands still
+const int MONSTER_MOVE_ENEMY = 5; // used only as a movestate
+
+const int MONSTER_STATE_ATTACK_LEAP = 1;
+const int MONSTER_STATE_ATTACK_MELEE = 2;
+
+float monster_initialize(float mon_id);
+float monster_leap (float anm, void() touchfunc, vector vel, float anim_finished);
+void monster_makevectors(entity e);
+float monster_melee(entity targ, float damg, float anim, float er, float anim_finished, float deathtype, float dostop);
+void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_run, float manim_walk, float manim_idle);
+void monster_setupcolors(entity mon);
+float Monster_SkillModifier();
+void MonsterTouch ();
+#endif
index 03b15525cf3b90547e41bc91b8cf0da1000258c6..07a91a8ccdd7432d2fae81e76b85ced184efe8b6 100644 (file)
@@ -1,17 +1,30 @@
-.float healer_lifetime;
-.float healer_radius;
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "../client/defs.qh"
+       #include "nades.qh"
+       #include "buffs.qh"
+       #include "../client/movetypes.qh"
+       #include "../client/main.qh"
+       #include "../csqcmodellib/cl_model.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "constants.qh"
+    #include "../server/constants.qh"
+#endif
+
 
 #ifdef SVQC
-float healer_send(entity to, float sf)
+float healer_send(entity to, int sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_HEALING_ORB);
        WriteByte(MSG_ENTITY, sf);
 
        if(sf & 1)
        {
-               WriteCoord(MSG_ENTITY, self.origin_x);
-               WriteCoord(MSG_ENTITY, self.origin_y);
-               WriteCoord(MSG_ENTITY, self.origin_z);
+               WriteCoord(MSG_ENTITY, self.origin.x);
+               WriteCoord(MSG_ENTITY, self.origin.y);
+               WriteCoord(MSG_ENTITY, self.origin.z);
 
                WriteByte(MSG_ENTITY, self.healer_lifetime);
                //WriteByte(MSG_ENTITY, self.ltime - time + 1);
@@ -20,7 +33,7 @@ float healer_send(entity to, float sf)
                WriteByte(MSG_ENTITY, (self.ltime - time)*10.0+0.5);
        }
 
-       return TRUE;
+       return true;
 }
 #endif // SVQC
 
@@ -43,8 +56,8 @@ void healer_setup()
        setmodel(self, "models/ctf/shield.md3");
 
        setorigin(self, self.origin);
-       
-       float model_radius = self.maxs_x;
+
+       float model_radius = self.maxs.x;
        vector size = '1 1 1' * self.healer_radius / 2;
        setsize(self,-size,size);
        self.healer_radius = self.healer_radius/model_radius*0.6;
@@ -62,7 +75,7 @@ void healer_setup()
 
 void ent_healer()
 {
-       float sf = ReadByte();
+       int sf = ReadByte();
 
        if(sf & TNSF_SETUP)
        {
@@ -79,4 +92,4 @@ void ent_healer()
                healer_setup();
        }
 }
-#endif // CSQC
\ No newline at end of file
+#endif // CSQC
index 1004e1ecab63cf9d61ea094bc2dec2a15cf48f5f..d11e4eabfb83d75157210ac8c3e3f145b4d6304f 100644 (file)
@@ -1,29 +1,35 @@
+#ifndef NADES_H
+#define NADES_H
+
+.float healer_lifetime;
+.float healer_radius;
+
 // use slots 70-100
-const float PROJECTILE_NADE = 71;
-const float PROJECTILE_NADE_BURN = 72;
-const float PROJECTILE_NADE_NAPALM = 73;
-const float PROJECTILE_NADE_NAPALM_BURN = 74;
-const float PROJECTILE_NAPALM_FOUNTAIN = 75;
-const float PROJECTILE_NADE_ICE = 76;
-const float PROJECTILE_NADE_ICE_BURN = 77;
-const float PROJECTILE_NADE_TRANSLOCATE = 78;
-const float PROJECTILE_NADE_SPAWN = 79;
-const float PROJECTILE_NADE_HEAL = 80;
-const float PROJECTILE_NADE_HEAL_BURN = 81;
-const float PROJECTILE_NADE_MONSTER = 82;
-const float PROJECTILE_NADE_MONSTER_BURN = 83;
+const int PROJECTILE_NADE = 71;
+const int PROJECTILE_NADE_BURN = 72;
+const int PROJECTILE_NADE_NAPALM = 73;
+const int PROJECTILE_NADE_NAPALM_BURN = 74;
+const int PROJECTILE_NAPALM_FOUNTAIN = 75;
+const int PROJECTILE_NADE_ICE = 76;
+const int PROJECTILE_NADE_ICE_BURN = 77;
+const int PROJECTILE_NADE_TRANSLOCATE = 78;
+const int PROJECTILE_NADE_SPAWN = 79;
+const int PROJECTILE_NADE_HEAL = 80;
+const int PROJECTILE_NADE_HEAL_BURN = 81;
+const int PROJECTILE_NADE_MONSTER = 82;
+const int PROJECTILE_NADE_MONSTER_BURN = 83;
 
-const float NADE_TYPE_NORMAL = 1;
-const float NADE_TYPE_NAPALM = 2;
-const float NADE_TYPE_ICE = 3;
-const float NADE_TYPE_TRANSLOCATE = 4;
-const float NADE_TYPE_SPAWN = 5;
-const float NADE_TYPE_HEAL = 6;
-const float NADE_TYPE_MONSTER = 7;
+const int NADE_TYPE_NORMAL = 1;
+const int NADE_TYPE_NAPALM = 2;
+const int NADE_TYPE_ICE = 3;
+const int NADE_TYPE_TRANSLOCATE = 4;
+const int NADE_TYPE_SPAWN = 5;
+const int NADE_TYPE_HEAL = 6;
+const int NADE_TYPE_MONSTER = 7;
 
-const float NADE_TYPE_LAST = 7; // a check to prevent using higher values & crashing
+const int NADE_TYPE_LAST = 7; // a check to prevent using higher values & crashing
 
-vector Nade_Color(float nadeid)
+vector Nade_Color(int nadeid)
 {
        switch(nadeid)
        {
@@ -39,7 +45,7 @@ vector Nade_Color(float nadeid)
        return '0 0 0';
 }
 
-float Nade_IDFromProjectile(float proj)
+int Nade_IDFromProjectile(float proj)
 {
        switch(proj)
        {
@@ -60,7 +66,7 @@ float Nade_IDFromProjectile(float proj)
        return 0;
 }
 
-float Nade_ProjectileFromID(float proj, float burn)
+int Nade_ProjectileFromID(int proj, bool burn)
 {
        switch(proj)
        {
@@ -93,11 +99,16 @@ string Nade_TrailEffect(float proj, float nade_team)
                case PROJECTILE_NADE_MONSTER: return "nade_red";
                case PROJECTILE_NADE_MONSTER_BURN: return "nade_red_burn";
        }
-       
+
        return "";
 }
 
+#ifdef SVQC
+float healer_send(entity to, float sf);
+#endif
+
 #ifdef CSQC
 // misc functions
 void ent_healer();
 #endif // CSQC
+#endif
index caaae8b4967bfa70c214d998ab05efc5aeacb94b..bc520e59d57005b7547d8ddbeba0a3cd6a5b9584 100644 (file)
@@ -1,3 +1,5 @@
+#include "net_notice.qh"
+
 #ifdef SVQC
 void sv_notice_join_think()
 {
@@ -7,7 +9,7 @@ void sv_notice_join_think()
     {
         float i;
         for(i = argc - 1; i >= 0; --i)
-            sv_notice_to(self.owner, argv(i), autocvar_sv_join_notices_time, FALSE);
+            sv_notice_to(self.owner, argv(i), autocvar_sv_join_notices_time, false);
     }
     remove(self);
 }
@@ -64,11 +66,11 @@ float cl_notice_run()
 {
     entity _notes;
     string _notice;
-    float m = FALSE;
+    float m = false;
 
     _notes = findchain(classname, "sv_notice");
     if(!_notes)
-        return FALSE;
+        return false;
     #define M1 30
     #define M2 10
 
@@ -96,7 +98,7 @@ float cl_notice_run()
         OUT(_notice, 16);
 
         if(_notes.skin)
-            m = TRUE;
+            m = true;
 
         if(_notes.alpha <= time)
         {
index d94f1d98f2d8add69c1ea81f0bcd4571ba758b0b..ba3b9817b6471dfaf7fe0cd7cfd5cb6a1f9e772d 100644 (file)
@@ -1,7 +1,5 @@
-#ifdef CSQC
-void cl_notice_read();
-void sv_notice_to(entity _to, string _notice, float _howlong, float _modal);
-#endif
+#ifndef NET_NOTICE_H
+#define NET_NOTICE_H
 
 #ifdef SVQC
 string autocvar_sv_join_notices;
@@ -11,3 +9,9 @@ void sv_notice_to(entity _to, string _notice, float _howlong, float _modal);
 void sv_notice_toall(string _notice, float _howlong, float _modal);
 void sv_notice_join();
 #endif
+
+#ifdef CSQC
+void cl_notice_read();
+#endif
+
+#endif
index a5a2ff445e60d376463d1265af9ba19657cd5575..b48daec7bcec244b831d8a74129eee9bfae826a8 100644 (file)
@@ -1,9 +1,24 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "constants.qh"
+    #include "teams.qh"
+    #include "counting.qh"
+    #include "../server/autocvars.qh"
+    #include "../server/constants.qh"
+    #include "../server/defs.qh"
+    #include "notifications.qh"
+    #include "../server/mutators/mutators_include.qh"
+#endif
+
 // ================================================
 //  Unified notification system, written by Samual
 //  Last updated: August, 2013
 // ================================================
 
-string Get_Notif_TypeName(float net_type)
+string Get_Notif_TypeName(int net_type)
 {
        switch(net_type)
        {
@@ -18,7 +33,7 @@ string Get_Notif_TypeName(float net_type)
        return "";
 }
 
-entity Get_Notif_Ent(float net_type, float net_name)
+entity Get_Notif_Ent(int net_type, int net_name)
 {
        switch(net_type)
        {
@@ -139,12 +154,12 @@ float Notification_ShouldSend(float broadcast, entity to_client, entity other_cl
                                        &&
                                        (to_client.enemy == other_client)
                                )
-                       ) { return TRUE; }
+                       ) { return true; }
                        break;
                }
                case NOTIF_ONE_ONLY: // send ONLY to one client
                {
-                       if(to_client == other_client) { return TRUE; }
+                       if(to_client == other_client) { return true; }
                        break;
                }
                case NOTIF_TEAM: // send only to X team and their spectators
@@ -157,7 +172,7 @@ float Notification_ShouldSend(float broadcast, entity to_client, entity other_cl
                                        &&
                                        (to_client.enemy.team == other_client.team)
                                )
-                       ) { return TRUE; }
+                       ) { return true; }
                        break;
                }
                case NOTIF_TEAM_EXCEPT: // send only to X team and their spectators, except for Y person and their spectators
@@ -178,12 +193,12 @@ float Notification_ShouldSend(float broadcast, entity to_client, entity other_cl
                                                )
                                        )
                                )
-                       ) { return TRUE; }
+                       ) { return true; }
                        break;
                }
                case NOTIF_ALL: // send to everyone
                {
-                       return TRUE;
+                       return true;
                }
                case NOTIF_ALL_EXCEPT: // send to everyone except X person and their spectators
                {
@@ -195,11 +210,11 @@ float Notification_ShouldSend(float broadcast, entity to_client, entity other_cl
                                        &&
                                        (to_client.enemy == other_client)
                                )
-                       ) { return TRUE; }
+                       ) { return true; }
                        break;
                }
        }
-       return FALSE;
+       return false;
 }
 
 #endif
@@ -224,15 +239,16 @@ void Destroy_Notification_Entity(entity notif)
 void Destroy_All_Notifications(void)
 {
        entity notif;
-       float i;
+       int i;
 
-       #define DESTROY_LOOP(type,count) \
+       #define DESTROY_LOOP(type,count) do { \
                for(i = 1; i <= count; ++i) \
                { \
                        notif = Get_Notif_Ent(type, i); \
                        if (!notif) { backtrace("Destroy_All_Notifications(): Missing notification entity!\n"); return; } \
                        Destroy_Notification_Entity(notif); \
-               }
+               } \
+       } while(0)
 
        // kill all networked notifications and centerprints
        #ifdef SVQC
@@ -242,24 +258,24 @@ void Destroy_All_Notifications(void)
        #endif
 
        // kill all real notification entities
-       DESTROY_LOOP(MSG_ANNCE, NOTIF_ANNCE_COUNT)
-       DESTROY_LOOP(MSG_INFO, NOTIF_INFO_COUNT)
-       DESTROY_LOOP(MSG_CENTER, NOTIF_CENTER_COUNT)
-       DESTROY_LOOP(MSG_MULTI, NOTIF_MULTI_COUNT)
-       DESTROY_LOOP(MSG_CHOICE, NOTIF_CHOICE_COUNT)
+       DESTROY_LOOP(MSG_ANNCE, NOTIF_ANNCE_COUNT);
+       DESTROY_LOOP(MSG_INFO, NOTIF_INFO_COUNT);
+       DESTROY_LOOP(MSG_CENTER, NOTIF_CENTER_COUNT);
+       DESTROY_LOOP(MSG_MULTI, NOTIF_MULTI_COUNT);
+       DESTROY_LOOP(MSG_CHOICE, NOTIF_CHOICE_COUNT);
        #undef DESTROY_LOOP
 }
 
 string Process_Notif_Line(
-       float typeid,
-       float chat,
+       int typeId,
+       bool chat,
        string input,
        string notiftype,
        string notifname,
        string stringtype)
 {
        #ifdef CSQC
-       if(typeid == MSG_INFO)
+       if(typeId == MSG_INFO)
        {
                if((chat && autocvar_notification_allow_chatboxprint)
                        || (autocvar_notification_allow_chatboxprint == 2))
@@ -290,7 +306,7 @@ string Process_Notif_Line(
                        notifname,
                        stringtype
                );
-               notif_error = TRUE;
+               notif_error = true;
                input = substring(input, 1, (strlen(input) - 1));
        }
 
@@ -306,7 +322,7 @@ string Process_Notif_Args(
        string selected, remaining = args;
        float sel_num = 0;
 
-       for(;(remaining != "");)
+       for (;(remaining != "");)
        {
                selected = car(remaining); remaining = cdr(remaining);
 
@@ -325,7 +341,7 @@ string Process_Notif_Args(
                                                notifname,
                                                NOTIF_MAX_ARGS
                                        );
-                                       notif_error = TRUE;
+                                       notif_error = true;
                                        break;
                                }
 
@@ -357,7 +373,7 @@ string Process_Notif_Args(
                                                        notifname,
                                                        selected
                                                );
-                                               notif_error = TRUE;
+                                               notif_error = true;
                                                break;
                                        }
                                }
@@ -376,7 +392,7 @@ string Process_Notif_Args(
                                                notifname,
                                                NOTIF_MAX_HUDARGS
                                        );
-                                       notif_error = TRUE;
+                                       notif_error = true;
                                        break;
                                }
 
@@ -408,7 +424,7 @@ string Process_Notif_Args(
                                                        notifname,
                                                        selected
                                                );
-                                               notif_error = TRUE;
+                                               notif_error = true;
                                                break;
                                        }
                                }
@@ -427,7 +443,7 @@ string Process_Notif_Args(
                                                notifname,
                                                NOTIF_MAX_DURCNT
                                        );
-                                       notif_error = TRUE;
+                                       notif_error = true;
                                        break;
                                }
 
@@ -462,7 +478,7 @@ string Process_Notif_Args(
                                                                notifname,
                                                                selected
                                                        );
-                                                       notif_error = TRUE;
+                                                       notif_error = true;
                                                }
                                                break;
                                        }
@@ -477,11 +493,11 @@ string Process_Notif_Args(
 void Create_Notification_Entity(
        float var_default,
        float var_cvar,
-       float typeid,
-       float nameid,
+       int typeId,
+       int nameid,
        string namestring,
-       float strnum,
-       float flnum,
+       int strnum,
+       int flnum,
        /* MSG_ANNCE */
        float channel,
        string snd,
@@ -496,21 +512,21 @@ void Create_Notification_Entity(
        string normal,
        string gentle,
        /* MSG_MULTI */
-       float anncename,
-       float infoname,
-       float centername,
+       int anncename,
+       int infoname,
+       int centername,
        /* MSG_CHOICE */
        float challow_def,
        float challow_var,
-       float chtype,
-       float optiona,
-       float optionb)
+       int chtype,
+       int optiona,
+       int optionb)
 {
        // =====================
        //  Global Entity Setup
        // =====================
        entity notif = spawn();
-       switch(typeid)
+       switch(typeId)
        {
                case MSG_ANNCE:
                {
@@ -550,7 +566,7 @@ void Create_Notification_Entity(
                                        "^1NOTIFICATION WITH IMPROPER TYPE: ",
                                        "^7net_type = %d, net_name = %s.\n"
                                ),
-                               typeid,
+                               typeId,
                                namestring
                        ));
                        return; // It's not possible to recover from this one
@@ -558,19 +574,19 @@ void Create_Notification_Entity(
        }
        notif.nent_default = var_default;
        notif.nent_enabled = (1 <= var_cvar);
-       notif.nent_type = typeid;
+       notif.nent_type = typeId;
        notif.nent_id = nameid;
        notif.nent_name = strzone(namestring);
 
-       string typestring = Get_Notif_TypeName(typeid);
+       string typestring = Get_Notif_TypeName(typeId);
 
        // Other pre-notif-setup requisites
-       notif_error = FALSE;
+       notif_error = false;
 
        // ====================
        //  Notification Setup
        // ====================
-       switch(typeid)
+       switch(typeId)
        {
                case MSG_ANNCE:
                {
@@ -599,12 +615,12 @@ void Create_Notification_Entity(
                                                typestring,
                                                namestring
                                        );
-                                       notif_error = TRUE;
+                                       notif_error = true;
                                }
                        }
-                       else { notif.nent_enabled = FALSE; }
+                       else { notif.nent_enabled = false; }
                        #else
-                       notif.nent_enabled = FALSE;
+                       notif.nent_enabled = false;
                        #endif
 
                        break;
@@ -621,7 +637,7 @@ void Create_Notification_Entity(
                        #ifdef SVQC
                        float should_process_args = server_is_dedicated;
                        #else
-                       float should_process_args = TRUE;
+                       float should_process_args = true;
                        #endif
 
                        if(should_process_args)
@@ -648,7 +664,7 @@ void Create_Notification_Entity(
                                                        strnum,
                                                        flnum
                                                );
-                                               notif_error = TRUE;
+                                               notif_error = true;
                                        }
                                }
                                else if(args != "")
@@ -680,7 +696,7 @@ void Create_Notification_Entity(
                                                        typestring,
                                                        namestring
                                                );
-                                               notif_error = TRUE;
+                                               notif_error = true;
                                        }
                                }
                                else if(icon != "")
@@ -693,7 +709,7 @@ void Create_Notification_Entity(
                                                typestring,
                                                namestring
                                        );
-                                       notif_error = TRUE;
+                                       notif_error = true;
                                }
 
                                if(durcnt != "")
@@ -712,7 +728,7 @@ void Create_Notification_Entity(
                                                        typestring,
                                                        namestring
                                                );
-                                               notif_error = TRUE;
+                                               notif_error = true;
                                        }
                                }
                                else if(cpid != NO_MSG) { notif.nent_cpid = cpid; }
@@ -722,25 +738,25 @@ void Create_Notification_Entity(
                                // ======================
                                //  Process Notif String
                                // ======================
-                               #define SET_NOTIF_STRING(string,stringname) \
+                               #define SET_NOTIF_STRING(string,stringname) do { \
                                        notif.nent_string = strzone(CCR( \
                                                Process_Notif_Line( \
-                                                       typeid, \
+                                                       typeId, \
                                                        (var_cvar > 1), \
                                                        string, \
                                                        typestring, \
                                                        namestring, \
                                                        stringname \
                                                )) \
-                                       );
+                                       ); \
+                               } while(0)
 
                                if(GENTLE)
                                {
-                                       if(gentle != "") { SET_NOTIF_STRING(gentle, "GENTLE") }
-                                       else if(normal != "") { SET_NOTIF_STRING(normal, "NORMAL") }
+                                       if(gentle != "") { SET_NOTIF_STRING(gentle, "GENTLE"); }
+                                       else if(normal != "") { SET_NOTIF_STRING(normal, "NORMAL"); }
                                }
-                               else if(normal != "") { SET_NOTIF_STRING(normal, "NORMAL") }
-
+                               else if(normal != "") { SET_NOTIF_STRING(normal, "NORMAL"); }
                                #undef SET_NOTIF_STRING
 
                                // Check to make sure a string was chosen
@@ -754,7 +770,7 @@ void Create_Notification_Entity(
                                                typestring,
                                                namestring
                                        );
-                                       notif_error = TRUE;
+                                       notif_error = true;
                                }
                        }
 
@@ -774,7 +790,7 @@ void Create_Notification_Entity(
                                        typestring,
                                        namestring
                                );
-                               notif_error = TRUE;
+                               notif_error = true;
                        }
                        else
                        {
@@ -818,7 +834,7 @@ void Create_Notification_Entity(
                                        typestring,
                                        namestring
                                );
-                               notif_error = TRUE;
+                               notif_error = true;
                        }
                        else
                        {
@@ -862,10 +878,10 @@ void Create_Notification_Entity(
                                                                "^1NOTIFICATION WITH IMPROPER TYPE: ",
                                                                "^7net_type = %d, net_name = %s.\n"
                                                        ),
-                                                       typeid,
+                                                       typeId,
                                                        namestring
                                                );
-                                               notif_error = TRUE;
+                                               notif_error = true;
                                                break;
                                        }
                                }
@@ -905,10 +921,10 @@ void Create_Notification_Entity(
                                        "^1NOTIFICATION WITH IMPROPER TYPE: ",
                                        "^7net_type = %d, net_name = %s.\n"
                                ),
-                               typeid,
+                               typeId,
                                namestring
                        );
-                       notif_error = TRUE;
+                       notif_error = true;
                        break;
                }
        }
@@ -916,8 +932,8 @@ void Create_Notification_Entity(
        // now check to see if any errors happened
        if(notif_error)
        {
-               notif.nent_enabled = FALSE; // disable the notification so it can't cause trouble
-               notif_global_error = TRUE; // throw the red flag that an error happened on init
+               notif.nent_enabled = false; // disable the notification so it can't cause trouble
+               notif_global_error = true; // throw the red flag that an error happened on init
        }
 }
 
@@ -974,7 +990,7 @@ void Dump_Notifications(float fh, float alsoprint)
                NOTIF_WRITE(notif_msg) }
 
        string notif_msg;
-       float i;
+       int i;
        entity e;
 
        // Note: This warning only applies to the notifications.cfg file that is output...
@@ -1188,7 +1204,7 @@ void Debug_Notification(string input)
 string Local_Notification_sprintf(
        string input, string args,
        string s1, string s2, string s3, string s4,
-       float f1, float f2, float f3, float f4)
+       int f1, float f2, float f3, float f4)
 {
        #ifdef NOTIFICATIONS_DEBUG
        Debug_Notification(sprintf(
@@ -1201,7 +1217,7 @@ string Local_Notification_sprintf(
        #endif
 
        string selected;
-       float sel_num;
+       int sel_num;
        for(sel_num = 0; sel_num < NOTIF_MAX_ARGS; ++sel_num) { arg_slot[sel_num] = ""; }
 
        string tmp_s;
@@ -1209,7 +1225,7 @@ string Local_Notification_sprintf(
        for(sel_num = 0;(args != "");)
        {
                selected = car(args); args = cdr(args);
-               NOTIF_HIT_MAX(NOTIF_MAX_ARGS, "Local_Notification_sprintf")
+               NOTIF_HIT_MAX(NOTIF_MAX_ARGS, "Local_Notification_sprintf");
                switch(strtolower(selected))
                {
                        #ifdef CSQC
@@ -1318,13 +1334,13 @@ void Local_Notification_HUD_Notify_Push(
        float f1, float f2, float f3, float f4)
 {
        string selected;
-       float sel_num;
        arg_slot[0] = ""; arg_slot[1] = "";
 
+       int sel_num;
        for(sel_num = 0;(hudargs != "");)
        {
                selected = car(hudargs); hudargs = cdr(hudargs);
-               NOTIF_HIT_MAX(NOTIF_MAX_HUDARGS, "Local_Notification_HUD_Notify_Push")
+               NOTIF_HIT_MAX(NOTIF_MAX_HUDARGS, "Local_Notification_HUD_Notify_Push");
                switch(strtolower(selected))
                {
                        #define ARG_CASE_ARG_CS_SV_HA(selected,result) case selected: { arg_slot[sel_num] = result; ++sel_num; break; }
@@ -1360,16 +1376,14 @@ void Local_Notification_HUD_Notify_Push(
 
 void Local_Notification_centerprint_generic(
        string input, string durcnt,
-       float cpid, float f1, float f2)
+       int cpid, float f1, float f2)
 {
-       string selected;
-       float sel_num;
        arg_slot[0] = ""; arg_slot[1] = "";
 
-       for(sel_num = 0;(durcnt != "");)
+       for(int sel_num = 0;(durcnt != "");)
        {
-               selected = car(durcnt); durcnt = cdr(durcnt);
-               NOTIF_HIT_MAX(NOTIF_MAX_DURCNT, "Local_Notification_centerprint_generic")
+               string selected = car(durcnt); durcnt = cdr(durcnt);
+               NOTIF_HIT_MAX(NOTIF_MAX_DURCNT, "Local_Notification_centerprint_generic");
                switch(strtolower(selected))
                {
                        #define ARG_CASE_ARG_CS_SV_HA(selected,result)
@@ -1409,7 +1423,7 @@ void Local_Notification_centerprint_generic(
 }
 #endif
 
-void Local_Notification(float net_type, float net_name, ...count)
+void Local_Notification(int net_type, int net_name, ...count)
 {
        // check if this should be aborted
        if(net_name == NOTIF_ABORT)
@@ -1641,7 +1655,7 @@ void Local_Notification(float net_type, float net_name, ...count)
 
 // WOVA = Without Variable Arguments
 void Local_Notification_WOVA(
-       float net_type, float net_name,
+       int net_type, float net_name,
        float stringcount, float floatcount,
        string s1, string s2, string s3, string s4,
        float f1, float f2, float f3, float f4)
@@ -1662,8 +1676,8 @@ void Local_Notification_WOVA(
 #ifdef CSQC
 void Read_Notification(float is_new)
 {
-       float net_type = ReadByte();
-       float net_name = ReadShort();
+       int net_type = ReadByte();
+       int net_name = ReadShort();
 
        entity notif;
 
@@ -1764,9 +1778,9 @@ float Net_Write_Notification(entity client, float sf)
                WriteShort(MSG_ENTITY, self.nent_net_name);
                for(i = 0; i < self.nent_stringcount; ++i) { WriteString(MSG_ENTITY, self.nent_strings[i]); }
                for(i = 0; i < self.nent_floatcount; ++i) { WriteLong(MSG_ENTITY, self.nent_floats[i]); }
-               return TRUE;
+               return true;
        }
-       else { return FALSE; }
+       else { return false; }
 }
 
 void Kill_Notification(
@@ -1831,7 +1845,7 @@ void Kill_Notification(
                net_notif.nent_client = client;
                net_notif.nent_net_type = MSG_CENTER_CPID;
                net_notif.nent_net_name = killed_cpid;
-               Net_LinkEntity(net_notif, FALSE, autocvar_notification_lifetime_runtime, Net_Write_Notification);
+               Net_LinkEntity(net_notif, false, autocvar_notification_lifetime_runtime, Net_Write_Notification);
        }
 
        for(notif = world; (notif = find(notif, classname, "net_notification"));)
@@ -2026,7 +2040,7 @@ void Send_Notification(
                //   2. Manually handling each separate call on per-usage basis (See old CTF usage of verbose)
                entity found_choice;
 
-               #define RECURSE_FROM_CHOICE(ent,action) \
+               #define RECURSE_FROM_CHOICE(ent,action) do { \
                        if(notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) \
                        { \
                                switch(ent.msg_choice_choices[net_name - 1]) \
@@ -2045,22 +2059,29 @@ void Send_Notification(
                                found_choice.nent_stringcount, \
                                found_choice.nent_floatcount, \
                                s1, s2, s3, s4, \
-                               f1, f2, f3, f4);
+                               f1, f2, f3, f4); \
+               } while(0)
 
                switch(broadcast)
                {
                        case NOTIF_ONE_ONLY: // we can potentially save processing power with this broadcast method
                        {
                                if(IS_REAL_CLIENT(client))
-                                       { RECURSE_FROM_CHOICE(client, return) }
+                               {
+                                       RECURSE_FROM_CHOICE(client, return);
+                               }
                                break;
                        }
                        default:
                        {
                                entity to;
                                FOR_EACH_REALCLIENT(to)
-                                       { if(Notification_ShouldSend(broadcast, to, client))
-                                               { RECURSE_FROM_CHOICE(to, continue) } }
+                               {
+                                       if(Notification_ShouldSend(broadcast, to, client))
+                                       {
+                                               RECURSE_FROM_CHOICE(to, continue);
+                                       }
+                               }
                                break;
                        }
                }
@@ -2092,7 +2113,7 @@ void Send_Notification(
                                autocvar_notification_lifetime_mapload
                        );
 
-               Net_LinkEntity(net_notif, FALSE, 0, Net_Write_Notification);
+               Net_LinkEntity(net_notif, false, 0, Net_Write_Notification);
        }
 }
 
index 7795dc2725fad447dcb7d4122dab2ae982271b30..dd43575c3bd599cd1505e6131e14c3d0126d4fa9 100644 (file)
@@ -1,19 +1,25 @@
+#ifndef NOTIFICATIONS_H
+#define NOTIFICATIONS_H
+
+#include "constants.qh"
+#include "teams.qh"
+
 // ================================================
 //  Unified notification system, written by Samual
 //  Last updated: March, 2013
 // ================================================
 
 // main types/groups of notifications
-#define MSG_ANNCE 1 // "Global" AND "personal" announcer messages
-#define MSG_INFO 2 // "Global" information messages
-#define MSG_CENTER 3 // "Personal" centerprint messages
-#define MSG_CENTER_CPID 4 // Kill centerprint message
-#define MSG_MULTI 5 // Subcall MSG_INFO and/or MSG_CENTER notifications
-#define MSG_CHOICE 6 // Choose which subcall wrapper to activate
+const int MSG_ANNCE = 1; // "Global" AND "personal" announcer messages
+const int MSG_INFO = 2; // "Global" information messages
+const int MSG_CENTER = 3; // "Personal" centerprint messages
+const int MSG_CENTER_CPID = 4; // Kill centerprint message
+const int MSG_MULTI = 5; // Subcall MSG_INFO and/or MSG_CENTER notifications
+const int MSG_CHOICE = 6; // Choose which subcall wrapper to activate
 
 // negative confirmations
-#define NO_MSG       -12345  // allows various things to know when no information is added
-#define NOTIF_ABORT  -1234   // allows Send_Notification to safely abort sending
+const int NO_MSG = -12345;  // allows various things to know when no information is added
+const int NOTIF_ABORT = -1234;   // allows Send_Notification to safely abort sending
 
 #define EIGHT_VARS_TO_VARARGS_VARLIST \
     VARITEM(1, 0, s1) \
@@ -45,11 +51,11 @@ void Destroy_All_Notifications(void);
 void Create_Notification_Entity(
     float var_default,
     float var_cvar,
-    float typeid,
+    float typeId,
     float nameid,
     string namestring,
-    float strnum,
-    float flnum,
+    int strnum,
+    int flnum,
     /* MSG_ANNCE */
     float channel,
     string snd,
@@ -80,7 +86,7 @@ void Dump_Notifications(float fh, float alsoprint);
 void Debug_Notification(string input);
 #endif
 
-void Local_Notification(float net_type, float net_name, ...count);
+void Local_Notification(int net_type, int net_name, ...count);
 void Local_Notification_WOVA(
     float net_type, float net_name,
     float stringcount, float floatcount,
@@ -94,12 +100,12 @@ float prev_soundtime;
 #endif
 
 #ifdef SVQC // SERVER ONLY
-#define NOTIF_ONE 1
-#define NOTIF_ONE_ONLY 2
-#define NOTIF_TEAM 3
-#define NOTIF_TEAM_EXCEPT 4
-#define NOTIF_ALL 5
-#define NOTIF_ALL_EXCEPT 6
+const float NOTIF_ONE = 1;
+const float NOTIF_ONE_ONLY = 2;
+const float NOTIF_TEAM = 3;
+const float NOTIF_TEAM_EXCEPT = 4;
+const float NOTIF_ALL = 5;
+const float NOTIF_ALL_EXCEPT = 6;
 
 void Kill_Notification(
     float broadcast, entity client,
@@ -728,7 +734,7 @@ void Send_Notification_WOCOVA(
     MSG_CENTER_NOTIF(1, CENTER_TEAMCHANGE_SUICIDE,          0, 1, "",              CPID_TEAMCHANGE,       "1 f1", _("^K1Suicide in ^COUNT"), "") \
     MSG_CENTER_NOTIF(1, CENTER_TIMEOUT_BEGINNING,           0, 1, "",              CPID_TIMEOUT,          "1 f1", _("^F4Timeout begins in ^COUNT"), "") \
     MSG_CENTER_NOTIF(1, CENTER_TIMEOUT_ENDING,              0, 1, "",              CPID_TIMEOUT,          "1 f1", _("^F4Timeout ends in ^COUNT"), "") \
-    MSG_CENTER_NOTIF(1, CENTER_WEAPON_MINELAYER_LIMIT,      0, 1, "f1",            NO_CPID,               "0 0",  _("^BGYou cannot place more than ^F2%s^BG mines at a time"), "") 
+    MSG_CENTER_NOTIF(1, CENTER_WEAPON_MINELAYER_LIMIT,      0, 1, "f1",            NO_CPID,               "0 0",  _("^BGYou cannot place more than ^F2%s^BG mines at a time"), "")
 
 #define MULTITEAM_MULTI2(default,prefix,anncepre,infopre,centerpre) \
     MSG_MULTI_NOTIF(default, prefix##RED, anncepre##RED, infopre##RED, centerpre##RED) \
@@ -934,32 +940,32 @@ void Send_Notification_WOCOVA(
 // MAKE SURE THIS IS ALWAYS SYNCHRONIZED WITH THE DUMP
 // NOTIFICATIONS FUNCTION IN THE .QC FILE!
 
-#define NOTIF_ADD_AUTOCVAR(name,default) var float autocvar_notification_##name = default;
+#define NOTIF_ADD_AUTOCVAR(name,default) float autocvar_notification_##name = default;
 
-var float autocvar_notification_show_location = FALSE;
-var string autocvar_notification_show_location_string = ""; //_(" at the %s");
-var float autocvar_notification_show_sprees = TRUE;
-var float autocvar_notification_show_sprees_info = 3; // 0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker
-var float autocvar_notification_show_sprees_info_newline = TRUE;
-var float autocvar_notification_show_sprees_info_specialonly = TRUE;
-var float autocvar_notification_errors_are_fatal = TRUE;
-var float autocvar_notification_lifetime_runtime = 0.5;
-var float autocvar_notification_lifetime_mapload = 10;
-var float autocvar_notification_debug = FALSE;
+float autocvar_notification_show_location = false;
+string autocvar_notification_show_location_string = ""; //_(" at the %s");
+float autocvar_notification_show_sprees = true;
+float autocvar_notification_show_sprees_info = 3; // 0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker
+float autocvar_notification_show_sprees_info_newline = true;
+float autocvar_notification_show_sprees_info_specialonly = true;
+float autocvar_notification_errors_are_fatal = true;
+float autocvar_notification_lifetime_runtime = 0.5;
+float autocvar_notification_lifetime_mapload = 10;
+float autocvar_notification_debug = false;
 
 #ifdef SVQC
 .float FRAG_VERBOSE;
 void Notification_GetCvars(void);
-var float autocvar_notification_server_allows_location = 1; // 0 = no, 1 = yes
+float autocvar_notification_server_allows_location = 1; // 0 = no, 1 = yes
 #else
-var float autocvar_notification_item_centerprinttime = 1.5;
+float autocvar_notification_item_centerprinttime = 1.5;
 
 // 0 = no, 1 = yes, 2 = forced on for all MSG_INFO notifs
 // DISABLED IN CODE, BUT ENABLED IN CONFIG FOR COMPATIBILITY WITH OLD CLIENTS
-var float autocvar_notification_allow_chatboxprint = 0;
+float autocvar_notification_allow_chatboxprint = 0;
 
-var float autocvar_notification_show_sprees_center = TRUE;
-var float autocvar_notification_show_sprees_center_specialonly = TRUE;
+float autocvar_notification_show_sprees_center = true;
+float autocvar_notification_show_sprees_center_specialonly = true;
 #endif
 
 
@@ -1013,18 +1019,18 @@ var float autocvar_notification_show_sprees_center_specialonly = TRUE;
     death_team: show the full name of the team a player is switching from
 */
 
-#define NOTIF_MAX_ARGS 7
-#define NOTIF_MAX_HUDARGS 2
-#define NOTIF_MAX_DURCNT 2
+const float NOTIF_MAX_ARGS = 7;
+const float NOTIF_MAX_HUDARGS = 2;
+const float NOTIF_MAX_DURCNT = 2;
 
 string arg_slot[NOTIF_MAX_ARGS];
 
-#define ARG_CS_SV_HA 1 // enabled on CSQC, SVQC, and Hudargs
-#define ARG_CS_SV_DC 2 // enabled on CSQC, SVQC, and durcnt centerprint
-#define ARG_CS_SV 3 // enabled on CSQC and SVQC
-#define ARG_CS 4 // unique result to CSQC
-#define ARG_SV 5 // unique result to SVQC
-#define ARG_DC 6 // unique result to durcnt/centerprint
+const float ARG_CS_SV_HA = 1; // enabled on CSQC, SVQC, and Hudargs
+const float ARG_CS_SV_DC = 2; // enabled on CSQC, SVQC, and durcnt centerprint
+const float ARG_CS_SV = 3; // enabled on CSQC and SVQC
+const float ARG_CS = 4; // unique result to CSQC
+const float ARG_SV = 5; // unique result to SVQC
+const float ARG_DC = 6; // unique result to durcnt/centerprint
 
 // todo possible idea.... declare how many floats/strings each arg needs, and then dynamically increment the input
 // this way, we don't need to have duplicates like i.e. s2loc and s3loc?
@@ -1054,7 +1060,7 @@ string arg_slot[NOTIF_MAX_ARGS];
     ARG_CASE(ARG_CS_SV,     "race_diff",     ((f2 > f3) ? sprintf(CCR("^1[+%s]"), mmssss(f2 - f3)) : sprintf(CCR("^2[-%s]"), mmssss(f3 - f2)))) \
     ARG_CASE(ARG_CS,        "missing_teams", notif_arg_missing_teams(f1)) \
     ARG_CASE(ARG_CS,        "pass_key",      ((((tmp_s = getcommandkey("pass", "+use")) != "pass") && !(strstrofs(tmp_s, "not bound", 0) >= 0)) ? sprintf(CCR(_(" ^F1(Press %s)")), tmp_s) : "")) \
-    ARG_CASE(ARG_CS,        "frag_ping",     notif_arg_frag_ping(TRUE, f2)) \
+    ARG_CASE(ARG_CS,        "frag_ping",     notif_arg_frag_ping(true, f2)) \
     ARG_CASE(ARG_CS,        "frag_stats",    notif_arg_frag_stats(f2, f3, f4)) \
     /*ARG_CASE(ARG_CS,      "frag_pos",      ((Should_Print_Score_Pos(f1)) ? sprintf("\n^BG%s", Read_Score_Pos(f1)) : ""))*/ \
     ARG_CASE(ARG_CS,        "spree_cen",     (autocvar_notification_show_sprees ? notif_arg_spree_cen(f1) : "")) \
@@ -1068,7 +1074,9 @@ string arg_slot[NOTIF_MAX_ARGS];
     ARG_CASE(ARG_SV,        "death_team",    Team_ColoredFullName(f1)) \
     ARG_CASE(ARG_CS,        "death_team",    Team_ColoredFullName(f1 - 1))
 
-#define NOTIF_HIT_MAX(count,funcname) if(sel_num == count) { backtrace(sprintf("%s: Hit maximum arguments!\n", funcname)); break; }
+#define NOTIF_HIT_MAX(count,funcname) do { \
+    if(sel_num == count) { backtrace(sprintf("%s: Hit maximum arguments!\n", funcname)); break; } \
+} while(0)
 #define NOTIF_HIT_UNKNOWN(token,funcname) { backtrace(sprintf("%s: Hit unknown token in selected string! '%s'\n", funcname, selected)); break; }
 
 #define KILL_SPREE_LIST \
@@ -1092,9 +1100,9 @@ string notif_arg_frag_ping(float newline, float fping)
 string notif_arg_frag_stats(float fhealth, float farmor, float fping)
 {
     if (!(fhealth < 1))
-        return sprintf(CCR(_("\n(Health ^1%d^BG / Armor ^2%d^BG)%s")), fhealth, farmor, notif_arg_frag_ping(FALSE, fping));
+        return sprintf(CCR(_("\n(Health ^1%d^BG / Armor ^2%d^BG)%s")), fhealth, farmor, notif_arg_frag_ping(false, fping));
     else
-        return sprintf(CCR(_("\n(^F4Dead^BG)%s")), notif_arg_frag_ping(FALSE, fping));
+        return sprintf(CCR(_("\n(^F4Dead^BG)%s")), notif_arg_frag_ping(false, fping));
 }
 
 string notif_arg_missing_teams(float f1)
@@ -1269,21 +1277,52 @@ string notif_arg_spree_inf(float type, string input, string player, float spree)
 //  Initialization/Create Declarations
 // ====================================
 
+enum {
+    NO_CPID
+,   CPID_ASSAULT_ROLE
+,   CPID_ROUND
+,   CPID_CAMPCHECK
+,   CPID_CTF_CAPSHIELD
+,   CPID_CTF_LOWPRIO
+,   CPID_CTF_PASS
+,   CPID_STALEMATE
+,   CPID_NADES
+,   CPID_IDLING
+,   CPID_ITEM
+,   CPID_PREVENT_JOIN
+,   CPID_KEEPAWAY
+,   CPID_KEEPAWAY_WARN
+,   CPID_KEYHUNT
+,   CPID_KEYHUNT_OTHER
+,   CPID_LMS
+,   CPID_MISSING_TEAMS
+,   CPID_MISSING_PLAYERS
+,   CPID_INSTAGIB_FINDAMMO
+,   CPID_MOTD
+,   CPID_NIX
+,   CPID_ONSLAUGHT
+,   CPID_OVERTIME
+,   CPID_POWERUP
+,   CPID_RACE_FINISHLAP
+,   CPID_TEAMCHANGE
+,   CPID_TIMEOUT
+// always last
+,   NOTIF_CPID_COUNT
+};
 // notification counts
-#define NOTIF_FIRST 1
+const float NOTIF_FIRST = 1;
 float NOTIF_ANNCE_COUNT;
 float NOTIF_INFO_COUNT;
 float NOTIF_CENTER_COUNT;
 float NOTIF_MULTI_COUNT;
 float NOTIF_CHOICE_COUNT;
-float NOTIF_CPID_COUNT;
 
 // notification limits -- INCREASE AS NECESSARY
-#define NOTIF_ANNCE_MAX   100
-#define NOTIF_INFO_MAX    300
-#define NOTIF_CENTER_MAX  200
-#define NOTIF_MULTI_MAX   200
-#define NOTIF_CHOICE_MAX  20
+const float NOTIF_ANNCE_MAX   = 100;
+const float NOTIF_INFO_MAX    = 300;
+const float NOTIF_CENTER_MAX  = 200;
+const float NOTIF_MULTI_MAX   = 200;
+const float NOTIF_CHOICE_MAX  = 20;
 
 // notification entities
 entity msg_annce_notifs[NOTIF_ANNCE_MAX];
@@ -1298,8 +1337,8 @@ entity msg_choice_notifs[NOTIF_CHOICE_MAX];
 .float nent_type;
 .float nent_id;
 .string nent_name;
-.float nent_stringcount;
-.float nent_floatcount;
+.int nent_stringcount;
+.int nent_floatcount;
 
 // MSG_ANNCE entity values
 .float nent_channel;
@@ -1352,7 +1391,7 @@ float notif_global_error;
             /* COMMON ======================== */ \
             default,            /* var_default */ \
             ACVNN(name),        /* var_cvar    */ \
-            MSG_ANNCE,          /* typeid      */ \
+            MSG_ANNCE,          /* typeId      */ \
             name,               /* nameid      */ \
             strtoupper(#name),  /* namestring  */ \
             NO_MSG,             /* strnum      */ \
@@ -1385,7 +1424,7 @@ float notif_global_error;
 
 #define MSG_INFO_NOTIF(default,name,strnum,flnum,args,hudargs,icon,normal,gentle) \
     NOTIF_ADD_AUTOCVAR(name, default) \
-    float name; \
+    int name; \
     void RegisterNotification_##name() \
     { \
         SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_INFO_COUNT) \
@@ -1394,7 +1433,7 @@ float notif_global_error;
             /* COMMON ======================== */ \
             default,            /* var_default */ \
             ACVNN(name),        /* var_cvar    */ \
-            MSG_INFO,           /* typeid      */ \
+            MSG_INFO,           /* typeId      */ \
             name,               /* nameid      */ \
             strtoupper(#name),  /* namestring  */ \
             strnum,             /* strnum      */ \
@@ -1428,17 +1467,15 @@ float notif_global_error;
 #define MSG_CENTER_NOTIF(default,name,strnum,flnum,args,cpid,durcnt,normal,gentle) \
     NOTIF_ADD_AUTOCVAR(name, default) \
     float name; \
-    float cpid; \
     void RegisterNotification_##name() \
     { \
         SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_CENTER_COUNT) \
-        SET_FIELD_COUNT(cpid, NOTIF_FIRST, NOTIF_CPID_COUNT) \
         CHECK_MAX_COUNT(name, NOTIF_CENTER_MAX, NOTIF_CENTER_COUNT, "MSG_CENTER") \
         Create_Notification_Entity( \
             /* COMMON ======================== */ \
             default,            /* var_default */ \
             ACVNN(name),        /* var_cvar    */ \
-            MSG_CENTER,         /* typeid      */ \
+            MSG_CENTER,         /* typeId      */ \
             name,               /* nameid      */ \
             strtoupper(#name),  /* namestring  */ \
             strnum,             /* strnum      */ \
@@ -1471,7 +1508,7 @@ float notif_global_error;
 
 #define MSG_MULTI_NOTIF(default,name,anncename,infoname,centername) \
     NOTIF_ADD_AUTOCVAR(name, default) \
-    float name; \
+    int name; \
     void RegisterNotification_##name() \
     { \
         SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_MULTI_COUNT) \
@@ -1480,7 +1517,7 @@ float notif_global_error;
             /* COMMON ======================== */ \
             default,            /* var_default */ \
             ACVNN(name),        /* var_cvar    */ \
-            MSG_MULTI,          /* typeid      */ \
+            MSG_MULTI,          /* typeId      */ \
             name,               /* nameid      */ \
             strtoupper(#name),  /* namestring  */ \
             NO_MSG,             /* strnum      */ \
@@ -1525,7 +1562,7 @@ float notif_global_error;
             /* COMMON ======================== */ \
             default,            /* var_default */ \
             ACVNN(name),        /* var_cvar    */ \
-            MSG_CHOICE,         /* typeid      */ \
+            MSG_CHOICE,         /* typeId      */ \
             name,               /* nameid      */ \
             strtoupper(#name),  /* namestring  */ \
             NO_MSG,             /* strnum      */ \
@@ -1558,7 +1595,7 @@ float notif_global_error;
 
 void RegisterNotifications_First()
 {
-    notif_global_error = FALSE;
+    notif_global_error = false;
 
     #ifdef SVQC
     #define dedi (server_is_dedicated ? "a dedicated " : "")
@@ -1577,7 +1614,7 @@ void RegisterNotifications_First()
         #else
         if(autocvar_notification_version_mismatch_server_error)
         #endif
-            notif_global_error = TRUE;
+            notif_global_error = true;
 
         printf("^1NOTIFICATION VERSION MISMATCH: ^7program = %s, config = %d, code = %d.\n",
             PROGNAME, autocvar_notification_version, NOTIF_VERSION);
@@ -1612,3 +1649,4 @@ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_Done);
 #undef MSG_CHOICE_NOTIF
 
 #undef NOTIF_ADD_AUTOCVAR
+#endif
index 2c4a355e0a8c00a58a7c14649dde91a32b744fd4..5890fb89e17085271e6061684e3792a6bcc0a735 100644 (file)
@@ -1,3 +1,18 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "constants.qh"
+    #include "util.qh"
+    #include "urllib.qh"
+    #include "weapons/weapons.qh"
+    #include "../server/weapons/accuracy.qh"
+    #include "../server/defs.qh"
+    #include "playerstats.qh"
+    #include "../server/scores.qh"
+#endif
+
 #ifdef SVQC
 void PlayerStats_Prematch(void)
 {
@@ -15,7 +30,7 @@ void PlayerStats_GameReport_AddPlayer(entity e)
                { s = e.crypto_idfp; }
        else if(IS_BOT_CLIENT(e))
                { s = sprintf("bot#%g#%s", skill, e.cleanname); }
-               
+
        if((s == "") || find(world, playerstats_id, s)) // already have one of the ID - next one can't be tracked then!
        {
                if(IS_BOT_CLIENT(e))
@@ -23,13 +38,13 @@ void PlayerStats_GameReport_AddPlayer(entity e)
                else
                        { s = sprintf("player#%d", e.playerid); }
        }
-       
+
        e.playerstats_id = strzone(s);
 
        // now add the player to the database
        string key = sprintf("%s:*", e.playerstats_id);
        string p = db_get(PS_GR_OUT_DB, key);
-       
+
        if(p == "")
        {
                if(PS_GR_OUT_PL)
@@ -48,7 +63,7 @@ void PlayerStats_GameReport_AddTeam(float t)
 
        string key = sprintf("%d", t);
        string p = db_get(PS_GR_OUT_DB, key);
-       
+
        if(p == "")
        {
                if(PS_GR_OUT_TL)
@@ -67,7 +82,7 @@ void PlayerStats_GameReport_AddEvent(string event_id)
 
        string key = sprintf("*:%s", event_id);
        string p = db_get(PS_GR_OUT_DB, key);
-       
+
        if(p == "")
        {
                if(PS_GR_OUT_EVL)
@@ -94,12 +109,11 @@ float PlayerStats_GameReport_Event(string prefix, string event_id, float value)
 
 void PlayerStats_GameReport_Accuracy(entity p)
 {
-       entity w;
-       float i;
+       int i;
 
        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
        {
-               w = get_weaponinfo(i);
+               entity w = get_weaponinfo(i);
 
                #define ACCMAC(suffix,field) \
                        PS_GR_P_ADDVAL(p, sprintf("acc-%s-%s", w.netname, suffix), p.accuracy.(field[i-1]));
@@ -154,7 +168,7 @@ void PlayerStats_GameReport_FinalizePlayer(entity p)
 void PlayerStats_GameReport(float finished)
 {
        if(PS_GR_OUT_DB < 0) { return; }
-       
+
        PlayerScore_Sort(score_dummyfield, 0, 0, 0);
        PlayerScore_Sort(scoreboard_pos, 1, 1, 1);
        if(teamplay) { PlayerScore_TeamStats(); }
@@ -191,7 +205,7 @@ void PlayerStats_GameReport(float finished)
 
        if(autocvar_g_playerstats_gamereport_uri != "")
        {
-               PlayerStats_GameReport_DelayMapVote = TRUE;
+               PlayerStats_GameReport_DelayMapVote = true;
                url_multi_fopen(
                        autocvar_g_playerstats_gamereport_uri,
                        FILE_APPEND,
@@ -201,7 +215,7 @@ void PlayerStats_GameReport(float finished)
        }
        else
        {
-               PlayerStats_GameReport_DelayMapVote = FALSE;
+               PlayerStats_GameReport_DelayMapVote = false;
                db_close(PS_GR_OUT_DB);
                PS_GR_OUT_DB = -1;
        }
@@ -215,7 +229,7 @@ void PlayerStats_GameReport_Init() // initiated before InitGameplayMode so that
 
        if(PS_GR_OUT_DB >= 0)
        {
-               PlayerStats_GameReport_DelayMapVote = TRUE;
+               PlayerStats_GameReport_DelayMapVote = true;
 
                serverflags |= SERVERFLAG_PLAYERSTATS;
 
@@ -252,7 +266,7 @@ void PlayerStats_GameReport_Init() // initiated before InitGameplayMode so that
                PlayerStats_GameReport_AddEvent(PLAYERSTATS_ACHIEVEMENT_FIRSTBLOOD);
                PlayerStats_GameReport_AddEvent(PLAYERSTATS_ACHIEVEMENT_FIRSTVICTIM);
        }
-       else { PlayerStats_GameReport_DelayMapVote = FALSE; }
+       else { PlayerStats_GameReport_DelayMapVote = false; }
 }
 
 void PlayerStats_GameReport_Handler(entity fh, entity pass, float status)
@@ -348,7 +362,7 @@ void PlayerStats_GameReport_Handler(entity fh, entity pass, float status)
                                nn = db_get(PS_GR_OUT_DB, sprintf("%s:_playerid", p));
                                if(nn != "") { url_fputs(fh, sprintf("i %s\n", nn)); }
 
-                               // player name 
+                               // player name
                                nn = db_get(PS_GR_OUT_DB, sprintf("%s:_netname", p));
                                if(nn != "") { url_fputs(fh, sprintf("n %s\n", nn)); }
 
@@ -387,12 +401,12 @@ void PlayerStats_GameReport_Handler(entity fh, entity pass, float status)
                        url_fclose(fh);
                        break;
                }
-               
+
                case URL_READY_CLOSED:
                {
                        // url_fclose has finished
                        dprint("Player stats written\n");
-                       PlayerStats_GameReport_DelayMapVote = FALSE;
+                       PlayerStats_GameReport_DelayMapVote = false;
                        if(PS_GR_OUT_DB >= 0)
                        {
                                db_close(PS_GR_OUT_DB);
@@ -400,12 +414,12 @@ void PlayerStats_GameReport_Handler(entity fh, entity pass, float status)
                        }
                        break;
                }
-               
+
                case URL_READY_ERROR:
                default:
                {
                        print("Player stats writing failed: ", ftos(status), "\n");
-                       PlayerStats_GameReport_DelayMapVote = FALSE;
+                       PlayerStats_GameReport_DelayMapVote = false;
                        if(PS_GR_OUT_DB >= 0)
                        {
                                db_close(PS_GR_OUT_DB);
@@ -502,14 +516,14 @@ void PlayerStats_PlayerBasic_Handler(entity fh, entity p, float status)
                        #endif
                        url_fputs(fh, sprintf("l %s\n", cvar_string("_menu_prvm_language"))); // language
                        url_fputs(fh, sprintf("c %s\n", cvar_string("_menu_prvm_country"))); // country
-                       url_fputs(fh, sprintf("g %s\n", cvar_string("_menu_prvm_gender"))); // gender
+                       url_fputs(fh, sprintf("g %s\n", cvar_string("_cl_gender"))); // gender
                        url_fputs(fh, sprintf("n %s\n", cvar_string("_cl_name"))); // name
                        url_fputs(fh, sprintf("m %s %s\n", cvar_string("_cl_playermodel"), cvar_string("_cl_playerskin"))); // model/skin
                        */url_fputs(fh, "\n");
                        url_fclose(fh);
                        break;
                }
-               
+
                case URL_READY_CANREAD:
                {
                        string s = "";
@@ -578,7 +592,7 @@ void PlayerStats_PlayerBasic_Handler(entity fh, entity p, float status)
                        print("Player stats synchronized with server\n");
                        break;
                }
-               
+
                case URL_READY_ERROR:
                default:
                {
@@ -615,7 +629,7 @@ void PlayerStats_PlayerDetail_AddItem(string event, string data)
                        db_put(PS_D_IN_DB, marker, PS_D_IN_EVL);
                        strunzone(PS_D_IN_EVL);
                }
-               else { db_put(PS_D_IN_DB, marker, "#"); } 
+               else { db_put(PS_D_IN_DB, marker, "#"); }
                PS_D_IN_EVL = strzone(marker);
        }
 
@@ -703,7 +717,7 @@ void PlayerStats_PlayerDetail_Handler(entity fh, entity unused, float status)
                        url_fclose(fh);
                        break;
                }
-               
+
                case URL_READY_CANREAD:
                {
                        //print("PlayerStats_PlayerDetail_Handler(): Got response from player stats server:\n");
@@ -715,7 +729,7 @@ void PlayerStats_PlayerDetail_Handler(entity fh, entity unused, float status)
                                string key = "", event = "", data = "";
 
                                if(argv(0) == "#") { continue; }
-                               
+
                                if(count == 2)
                                {
                                        key = argv(0);
@@ -759,7 +773,7 @@ void PlayerStats_PlayerDetail_Handler(entity fh, entity unused, float status)
                                                }
                                                break;
                                        }
-                                       
+
                                        default:
                                        {
                                                printf(
@@ -902,7 +916,7 @@ void PlayerInfo_ready(entity fh, entity p, float status)
 #ifdef MENUQC
                         url_fputs(fh, sprintf("l %s\n", cvar_string("_menu_prvm_language"))); // language
                         url_fputs(fh, sprintf("c %s\n", cvar_string("_menu_prvm_country"))); // country
-                        url_fputs(fh, sprintf("g %s\n", cvar_string("_menu_prvm_gender"))); // gender
+                        url_fputs(fh, sprintf("g %s\n", cvar_string("_cl_gender"))); // gender
                         url_fputs(fh, sprintf("n %s\n", cvar_string("_cl_name"))); // name
                         url_fputs(fh, sprintf("m %s %s\n", cvar_string("_cl_playermodel"), cvar_string("_cl_playerskin"))); // model/skin
 #endif
@@ -1024,7 +1038,7 @@ void PlayerInfo_Details()
 
 #ifdef CSQC
 /*
- * FIXME - crypto_* builtin functions missing in CSQC (csprogsdefs.qc:885)
+ * FIXME - crypto_* builtin functions missing in CSQC (csprogsdefs.qh:885)
 void PlayerInfo_Details()
 {
         print("-- Getting detailed PlayerInfo for local player (CSQC)\n");
index ab4bc166f0b29f05134bf953f16a4ae75deb0c69..e77cdbff594f42c874f836d57d47ee537bcb370c 100644 (file)
@@ -1,12 +1,15 @@
+#ifndef PLAYERSTATS_H
+#define PLAYERSTATS_H
+
 #ifdef SVQC
 //float PS_PM_IN_DB = -1;   // playerstats_prematch_in_db      // db for info COLLECTED at the beginning of a match
-float PS_GR_OUT_DB = -1;  // playerstats_gamereport_out_db   // db of info SENT at the end of a match
+int PS_GR_OUT_DB = -1;  // playerstats_gamereport_out_db   // db of info SENT at the end of a match
 //float PS_GR_IN_DB = -1;   // playerstats_gamereport_in_db    // db for info COLLECTED at the end of a match
-float PS_B_IN_DB = -1;    // playerstats_playerbasic_in_db   // db for info COLLECTED for basic player info (ELO)
+int PS_B_IN_DB = -1;    // playerstats_playerbasic_in_db   // db for info COLLECTED for basic player info (ELO)
 #endif
 
 #ifdef MENUQC
-float PS_D_IN_DB = -1; // playerstats_playerdetail_in_db  // db for info COLLECTED for detailed player profile display
+int PS_D_IN_DB = -1; // playerstats_playerdetail_in_db  // db for info COLLECTED for detailed player profile display
 #endif
 
 #ifdef SVQC
@@ -85,15 +88,15 @@ void PlayerStats_GameReport_Handler(entity fh, entity pass, float status);
 //string autocvar_g_playerstats_uri;
 
 string autocvar_g_playerstats_gamereport_ladder;
-var string autocvar_g_playerstats_gamereport_uri = "http://stats.xonotic.org/stats/submit";
+string autocvar_g_playerstats_gamereport_uri = "http://stats.xonotic.org/stats/submit";
 
-#define PS_B_STATUS_ERROR -2
-#define PS_B_STATUS_IDLE -1
-#define PS_B_STATUS_WAITING 0
-#define PS_B_STATUS_RECEIVED 1
-#define PS_B_STATUS_UPDATING 2
+const float PS_B_STATUS_ERROR = -2;
+const float PS_B_STATUS_IDLE = -1;
+const float PS_B_STATUS_WAITING = 0;
+const float PS_B_STATUS_RECEIVED = 1;
+const float PS_B_STATUS_UPDATING = 2;
 .float playerstats_basicstatus;
-var string autocvar_g_playerstats_playerbasic_uri = "http://stats.xonotic.org";
+string autocvar_g_playerstats_playerbasic_uri = "http://stats.xonotic.org";
 
 void PlayerStats_PlayerBasic(entity joiningplayer, float newrequest);
 void PlayerStats_PlayerBasic_CheckUpdate(entity joiningplayer);
@@ -102,14 +105,15 @@ void PlayerStats_PlayerBasic_Handler(entity fh, entity p, float status);
 #ifdef MENUQC
 float PS_D_NEXTUPDATETIME;
 float PS_D_LASTGAMECOUNT;
-#define PS_D_STATUS_ERROR -2
-#define PS_D_STATUS_IDLE -1
-#define PS_D_STATUS_WAITING 0
-#define PS_D_STATUS_RECEIVED 1
-var float PlayerStats_PlayerDetail_Status = PS_D_STATUS_IDLE;
-var string autocvar_g_playerstats_playerdetail_uri = "http://stats.xonotic.org/player/me";
-var float autocvar_g_playerstats_playerdetail_autoupdatetime = 1800; // automatically update every 30 minutes anyway
+const float PS_D_STATUS_ERROR = -2;
+const float PS_D_STATUS_IDLE = -1;
+const float PS_D_STATUS_WAITING = 0;
+const float PS_D_STATUS_RECEIVED = 1;
+float PlayerStats_PlayerDetail_Status = PS_D_STATUS_IDLE;
+string autocvar_g_playerstats_playerdetail_uri = "http://stats.xonotic.org/player/me";
+float autocvar_g_playerstats_playerdetail_autoupdatetime = 1800; // automatically update every 30 minutes anyway
 void PlayerStats_PlayerDetail(void);
 void PlayerStats_PlayerDetail_CheckUpdate(void);
 void PlayerStats_PlayerDetail_Handler(entity fh, entity p, float status);
 #endif
+#endif
index f0570299794f72d698269b62ac7133a0951258a5..481713cc9cb8f17df86aad4be260f8fd6f5ba76a 100644 (file)
@@ -1,29 +1,32 @@
-// Full list of all stat constants, icnluded in a single location for easy reference
+#ifndef STATS_H
+#define STATS_H
+
+// Full list of all stat constants, included in a single location for easy reference
 // 255 is the current limit (MAX_CL_STATS - 1), engine will need to be modified if you wish to add more stats
 
-const float MAX_CL_STATS                = 256;
-const float STAT_HEALTH                 = 0;
+const int MAX_CL_STATS                = 256;
+const int STAT_HEALTH                 = 0;
 // 1 empty?
-const float STAT_WEAPON                 = 2;
-const float STAT_AMMO                   = 3;
-const float STAT_ARMOR                  = 4;
-const float STAT_WEAPONFRAME            = 5;
-const float STAT_SHELLS                 = 6;
-const float STAT_NAILS                  = 7;
-const float STAT_ROCKETS                = 8;
-const float STAT_CELLS                  = 9;
-const float STAT_ACTIVEWEAPON           = 10;
-const float STAT_TOTALSECRETS           = 11;
-const float STAT_TOTALMONSTERS          = 12;
-const float STAT_SECRETS                = 13;
-const float STAT_MONSTERS               = 14;
-const float STAT_ITEMS                  = 15;
-const float STAT_VIEWHEIGHT             = 16;
+const int STAT_WEAPON                 = 2;
+const int STAT_AMMO                   = 3;
+const int STAT_ARMOR                  = 4;
+const int STAT_WEAPONFRAME            = 5;
+const int STAT_SHELLS                 = 6;
+const int STAT_NAILS                  = 7;
+const int STAT_ROCKETS                = 8;
+const int STAT_CELLS                  = 9;
+const int STAT_ACTIVEWEAPON           = 10;
+const int STAT_TOTALSECRETS           = 11;
+const int STAT_TOTALMONSTERS          = 12;
+const int STAT_SECRETS                = 13;
+const int STAT_MONSTERS               = 14;
+const int STAT_ITEMS                  = 15;
+const int STAT_VIEWHEIGHT             = 16;
 // 17 empty?
 // 18 empty?
 // 19 empty?
 // 20 empty?
-const float STAT_VIEWZOOM               = 21;
+const int STAT_VIEWZOOM               = 21;
 // 22 empty?
 // 23 empty?
 // 24 empty?
@@ -34,61 +37,61 @@ const float STAT_VIEWZOOM               = 21;
 // 29 empty?
 // 30 empty?
 // 31 empty?
-const float STAT_KH_KEYS                = 32;
-const float STAT_CTF_STATE              = 33;
+const int STAT_KH_KEYS                = 32;
+const int STAT_CTF_STATE              = 33;
 // 34 empty?
-const float STAT_WEAPONS                = 35;
-const float STAT_SWITCHWEAPON           = 36;
-const float STAT_GAMESTARTTIME          = 37;
-const float STAT_STRENGTH_FINISHED      = 38;
-const float STAT_INVINCIBLE_FINISHED    = 39;
+const int STAT_WEAPONS                = 35;
+const int STAT_SWITCHWEAPON           = 36;
+const int STAT_GAMESTARTTIME          = 37;
+const int STAT_STRENGTH_FINISHED      = 38;
+const int STAT_INVINCIBLE_FINISHED    = 39;
 // 40 empty?
-const float STAT_ARC_HEAT               = 41;
-const float STAT_PRESSED_KEYS           = 42;
-const float STAT_ALLOW_OLDVORTEXBEAM    = 43; // this stat could later contain some other bits of info, like, more server-side particle config
-const float STAT_FUEL                   = 44;
-const float STAT_NB_METERSTART          = 45;
-const float STAT_SHOTORG                = 46; // compressShotOrigin
-const float STAT_LEADLIMIT              = 47;
-const float STAT_WEAPON_CLIPLOAD        = 48;
-const float STAT_WEAPON_CLIPSIZE        = 49;
-const float STAT_VORTEX_CHARGE          = 50;
-const float STAT_LAST_PICKUP            = 51;
-const float STAT_HUD                    = 52;
-const float STAT_VORTEX_CHARGEPOOL      = 53;
-const float STAT_HIT_TIME               = 54;
-const float STAT_DAMAGE_DEALT_TOTAL     = 55;
-const float STAT_TYPEHIT_TIME           = 56;
-const float STAT_LAYED_MINES            = 57;
-const float STAT_HAGAR_LOAD             = 58;
-const float STAT_SWITCHINGWEAPON        = 59;
-const float STAT_SUPERWEAPONS_FINISHED  = 60;
-const float STAT_VEHICLESTAT_HEALTH     = 61;
-const float STAT_VEHICLESTAT_SHIELD     = 62;
-const float STAT_VEHICLESTAT_ENERGY     = 63;
-const float STAT_VEHICLESTAT_AMMO1      = 64;
-const float STAT_VEHICLESTAT_RELOAD1    = 65;
-const float STAT_VEHICLESTAT_AMMO2      = 66;
-const float STAT_VEHICLESTAT_RELOAD2    = 67;
-const float STAT_VEHICLESTAT_W2MODE     = 68;
-const float STAT_NADE_TIMER             = 69;
-const float STAT_SECRETS_TOTAL          = 70;
-const float STAT_SECRETS_FOUND          = 71;
-const float STAT_RESPAWN_TIME           = 72;
-const float STAT_ROUNDSTARTTIME         = 73;
-const float STAT_WEAPONS2               = 74;
-const float STAT_WEAPONS3               = 75;
-const float STAT_MONSTERS_TOTAL         = 76;
-const float STAT_MONSTERS_KILLED        = 77;
-const float STAT_BUFFS                  = 78;
-const float STAT_NADE_BONUS             = 79;
-const float STAT_NADE_BONUS_TYPE        = 80;
-const float STAT_NADE_BONUS_SCORE       = 81;
-const float STAT_HEALING_ORB            = 82;
-const float STAT_HEALING_ORB_ALPHA      = 83;
-const float STAT_PLASMA                 = 84;
-const float STAT_OK_AMMO_CHARGE         = 85;
-const float STAT_OK_AMMO_CHARGEPOOl     = 86;
+const int STAT_ARC_HEAT               = 41;
+const int STAT_PRESSED_KEYS           = 42;
+const int STAT_ALLOW_OLDVORTEXBEAM    = 43; // this stat could later contain some other bits of info, like, more server-side particle config
+const int STAT_FUEL                   = 44;
+const int STAT_NB_METERSTART          = 45;
+const int STAT_SHOTORG                = 46; // compressShotOrigin
+const int STAT_LEADLIMIT              = 47;
+const int STAT_WEAPON_CLIPLOAD        = 48;
+const int STAT_WEAPON_CLIPSIZE        = 49;
+const int STAT_VORTEX_CHARGE          = 50;
+const int STAT_LAST_PICKUP            = 51;
+const int STAT_HUD                    = 52;
+const int STAT_VORTEX_CHARGEPOOL      = 53;
+const int STAT_HIT_TIME               = 54;
+const int STAT_DAMAGE_DEALT_TOTAL     = 55;
+const int STAT_TYPEHIT_TIME           = 56;
+const int STAT_LAYED_MINES            = 57;
+const int STAT_HAGAR_LOAD             = 58;
+const int STAT_SWITCHINGWEAPON        = 59;
+const int STAT_SUPERWEAPONS_FINISHED  = 60;
+const int STAT_VEHICLESTAT_HEALTH     = 61;
+const int STAT_VEHICLESTAT_SHIELD     = 62;
+const int STAT_VEHICLESTAT_ENERGY     = 63;
+const int STAT_VEHICLESTAT_AMMO1      = 64;
+const int STAT_VEHICLESTAT_RELOAD1    = 65;
+const int STAT_VEHICLESTAT_AMMO2      = 66;
+const int STAT_VEHICLESTAT_RELOAD2    = 67;
+const int STAT_VEHICLESTAT_W2MODE     = 68;
+const int STAT_NADE_TIMER             = 69;
+const int STAT_SECRETS_TOTAL          = 70;
+const int STAT_SECRETS_FOUND          = 71;
+const int STAT_RESPAWN_TIME           = 72;
+const int STAT_ROUNDSTARTTIME         = 73;
+const int STAT_WEAPONS2               = 74;
+const int STAT_WEAPONS3               = 75;
+const int STAT_MONSTERS_TOTAL         = 76;
+const int STAT_MONSTERS_KILLED        = 77;
+const int STAT_BUFFS                  = 78;
+const int STAT_NADE_BONUS             = 79;
+const int STAT_NADE_BONUS_TYPE        = 80;
+const int STAT_NADE_BONUS_SCORE       = 81;
+const int STAT_HEALING_ORB            = 82;
+const int STAT_HEALING_ORB_ALPHA      = 83;
+const int STAT_PLASMA                 = 84;
+const int STAT_OK_AMMO_CHARGE         = 85;
+const int STAT_OK_AMMO_CHARGEPOOL     = 86;
 // 87 empty?
 // 88 empty?
 // 89 empty?
@@ -108,36 +111,36 @@ const float STAT_OK_AMMO_CHARGEPOOl     = 86;
 // IDs 100 to 104 reserved for gamemodes
 
 // freeze tag, clan arena, jailbreak
-const float STAT_REDALIVE               = 100;
-const float STAT_BLUEALIVE              = 101;
-const float STAT_YELLOWALIVE            = 102;
-const float STAT_PINKALIVE              = 103;
+const int STAT_REDALIVE               = 100;
+const int STAT_BLUEALIVE              = 101;
+const int STAT_YELLOWALIVE            = 102;
+const int STAT_PINKALIVE              = 103;
 
 // domination
-const float STAT_DOM_TOTAL_PPS          = 100;
-const float STAT_DOM_PPS_RED            = 101;
-const float STAT_DOM_PPS_BLUE           = 102;
-const float STAT_DOM_PPS_YELLOW         = 103;
-const float STAT_DOM_PPS_PINK           = 104;
+const int STAT_DOM_TOTAL_PPS          = 100;
+const int STAT_DOM_PPS_RED            = 101;
+const int STAT_DOM_PPS_BLUE           = 102;
+const int STAT_DOM_PPS_YELLOW         = 103;
+const int STAT_DOM_PPS_PINK           = 104;
 
 // vip
-const float STAT_VIP                    = 100;
-const float STAT_VIP_RED                = 101;
-const float STAT_VIP_BLUE               = 102;
-const float STAT_VIP_YELLOW             = 103;
-const float STAT_VIP_PINK               = 104;
+const int STAT_VIP                    = 100;
+const int STAT_VIP_RED                = 101;
+const int STAT_VIP_BLUE               = 102;
+const int STAT_VIP_YELLOW             = 103;
+const int STAT_VIP_PINK               = 104;
 
 // key hunt
-const float STAT_KH_REDKEY_TEAM         = 100;
-const float STAT_KH_BLUEKEY_TEAM        = 101;
-const float STAT_KH_YELLOWKEY_TEAM      = 102;
-const float STAT_KH_PINKKEY_TEAM        = 103;
+const int STAT_KH_REDKEY_TEAM         = 100;
+const int STAT_KH_BLUEKEY_TEAM        = 101;
+const int STAT_KH_YELLOWKEY_TEAM      = 102;
+const int STAT_KH_PINKKEY_TEAM        = 103;
 
 /* Gamemode-specific stats end here */
 
 
-const float STAT_FROZEN                 = 105;
-const float STAT_REVIVE_PROGRESS        = 106;
+const int STAT_FROZEN                 = 105;
+const int STAT_REVIVE_PROGRESS        = 106;
 // 107 empty?
 // 108 empty?
 // 109 empty?
@@ -252,39 +255,40 @@ const float STAT_REVIVE_PROGRESS        = 106;
 // 217 empty?
 // 218 empty?
 // 219 empty?
-const float STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR     = 220;
-const float STAT_MOVEVARS_AIRCONTROL_PENALTY            = 221;
-const float STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW           = 222;
-const float STAT_MOVEVARS_AIRSTRAFEACCEL_QW             = 223;
-const float STAT_MOVEVARS_AIRCONTROL_POWER              = 224;
-const float STAT_MOVEFLAGS                              = 225;
-const float STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL   = 226;
-const float STAT_MOVEVARS_WARSOWBUNNY_ACCEL             = 227;
-const float STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED          = 228;
-const float STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL         = 229;
-const float STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO   = 230;
-const float STAT_MOVEVARS_AIRSTOPACCELERATE             = 231;
-const float STAT_MOVEVARS_AIRSTRAFEACCELERATE           = 232;
-const float STAT_MOVEVARS_MAXAIRSTRAFESPEED             = 233;
-const float STAT_MOVEVARS_AIRCONTROL                    = 234;
-const float STAT_FRAGLIMIT                              = 235;
-const float STAT_TIMELIMIT                              = 236;
-const float STAT_MOVEVARS_WALLFRICTION                  = 237;
-const float STAT_MOVEVARS_FRICTION                      = 238;
-const float STAT_MOVEVARS_WATERFRICTION                 = 239;
-const float STAT_MOVEVARS_TICRATE                       = 240;
-const float STAT_MOVEVARS_TIMESCALE                     = 241;
-const float STAT_MOVEVARS_GRAVITY                       = 242;
-const float STAT_MOVEVARS_STOPSPEED                     = 243;
-const float STAT_MOVEVARS_MAXSPEED                      = 244;
-const float STAT_MOVEVARS_SPECTATORMAXSPEED             = 245;
-const float STAT_MOVEVARS_ACCELERATE                    = 246;
-const float STAT_MOVEVARS_AIRACCELERATE                 = 247;
-const float STAT_MOVEVARS_WATERACCELERATE               = 248;
-const float STAT_MOVEVARS_ENTGRAVITY                    = 249;
-const float STAT_MOVEVARS_JUMPVELOCITY                  = 250;
-const float STAT_MOVEVARS_EDGEFRICTION                  = 251;
-const float STAT_MOVEVARS_MAXAIRSPEED                   = 252;
-const float STAT_MOVEVARS_STEPHEIGHT                    = 253;
-const float STAT_MOVEVARS_AIRACCEL_QW                   = 254;
-const float STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION    = 255;
+const int STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR     = 220;
+const int STAT_MOVEVARS_AIRCONTROL_PENALTY            = 221;
+const int STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW           = 222;
+const int STAT_MOVEVARS_AIRSTRAFEACCEL_QW             = 223;
+const int STAT_MOVEVARS_AIRCONTROL_POWER              = 224;
+const int STAT_MOVEFLAGS                              = 225;
+const int STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL   = 226;
+const int STAT_MOVEVARS_WARSOWBUNNY_ACCEL             = 227;
+const int STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED          = 228;
+const int STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL         = 229;
+const int STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO   = 230;
+const int STAT_MOVEVARS_AIRSTOPACCELERATE             = 231;
+const int STAT_MOVEVARS_AIRSTRAFEACCELERATE           = 232;
+const int STAT_MOVEVARS_MAXAIRSTRAFESPEED             = 233;
+const int STAT_MOVEVARS_AIRCONTROL                    = 234;
+const int STAT_FRAGLIMIT                              = 235;
+const int STAT_TIMELIMIT                              = 236;
+const int STAT_MOVEVARS_WALLFRICTION                  = 237;
+const int STAT_MOVEVARS_FRICTION                      = 238;
+const int STAT_MOVEVARS_WATERFRICTION                 = 239;
+const int STAT_MOVEVARS_TICRATE                       = 240;
+const int STAT_MOVEVARS_TIMESCALE                     = 241;
+const int STAT_MOVEVARS_GRAVITY                       = 242;
+const int STAT_MOVEVARS_STOPSPEED                     = 243;
+const int STAT_MOVEVARS_MAXSPEED                      = 244;
+const int STAT_MOVEVARS_SPECTATORMAXSPEED             = 245;
+const int STAT_MOVEVARS_ACCELERATE                    = 246;
+const int STAT_MOVEVARS_AIRACCELERATE                 = 247;
+const int STAT_MOVEVARS_WATERACCELERATE               = 248;
+const int STAT_MOVEVARS_ENTGRAVITY                    = 249;
+const int STAT_MOVEVARS_JUMPVELOCITY                  = 250;
+const int STAT_MOVEVARS_EDGEFRICTION                  = 251;
+const int STAT_MOVEVARS_MAXAIRSPEED                   = 252;
+const int STAT_MOVEVARS_STEPHEIGHT                    = 253;
+const int STAT_MOVEVARS_AIRACCEL_QW                   = 254;
+const int STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION    = 255;
+#endif
index 069904290b7d45361bdb7a1828ead5888bc3bca2..074835d5e79c4914807f79ed60ab51137525c3f4 100644 (file)
@@ -1,22 +1,25 @@
+#ifndef TEAMS_H
+#define TEAMS_H
+
 #ifdef TEAMNUMBERS_THAT_ARENT_STUPID
-const float NUM_TEAM_1 = 1;  // red
-const float NUM_TEAM_2 = 2; // blue
-const float NUM_TEAM_3 = 3; // yellow
-const float NUM_TEAM_4 = 4; // pink
-const float NUM_SPECTATOR = 5;
+const int NUM_TEAM_1 = 1;  // red
+const int NUM_TEAM_2 = 2; // blue
+const int NUM_TEAM_3 = 3; // yellow
+const int NUM_TEAM_4 = 4; // pink
+const int NUM_SPECTATOR = 5;
 #else
 #ifdef CSQC
-const float NUM_TEAM_1 = 4;  // red
-const float NUM_TEAM_2 = 13; // blue
-const float NUM_TEAM_3 = 12; // yellow
-const float NUM_TEAM_4 = 9; // pink
+const int NUM_TEAM_1 = 4;  // red
+const int NUM_TEAM_2 = 13; // blue
+const int NUM_TEAM_3 = 12; // yellow
+const int NUM_TEAM_4 = 9; // pink
 #else
-const float NUM_TEAM_1 = 5;  // red
-const float NUM_TEAM_2 = 14; // blue
-const float NUM_TEAM_3 = 13; // yellow
-const float NUM_TEAM_4 = 10; // pink
+const int NUM_TEAM_1 = 5;  // red
+const int NUM_TEAM_2 = 14; // blue
+const int NUM_TEAM_3 = 13; // yellow
+const int NUM_TEAM_4 = 10; // pink
 #endif
-const float NUM_SPECTATOR = 1337;
+const int NUM_SPECTATOR = 1337;
 #endif
 
 const string COL_TEAM_1 = "^1";
@@ -165,3 +168,4 @@ float Team_TeamToNumber(float teamid)
 #define APP_TEAM_NUM_4(num,prefix) ((num == NUM_TEAM_1) ? prefix##RED : ((num == NUM_TEAM_2) ? prefix##BLUE : ((num == NUM_TEAM_3) ? prefix##YELLOW : prefix##PINK)))
 #define APP_TEAM_ENT_2(ent,prefix) ((ent.team == NUM_TEAM_1) ? prefix##RED : prefix##BLUE)
 #define APP_TEAM_ENT_4(ent,prefix) ((ent.team == NUM_TEAM_1) ? prefix##RED : ((ent.team == NUM_TEAM_2) ? prefix##BLUE : ((ent.team == NUM_TEAM_3) ? prefix##YELLOW : prefix##PINK)))
+#endif
index ac792a387ab4e2acfce3408d0e5c819c7b781ff3..966553b27228efa1aa1f277fb73a61e335deda1e 100644 (file)
@@ -1,3 +1,12 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "test.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/dpextensions.qh"
+    #include "test.qh"
+#endif
+
 float TEST_failed;
 float TEST_ok;
 
@@ -10,15 +19,14 @@ void TEST_Fail(string cond)
 
 void TEST_OK()
 {
-       TEST_ok = TRUE;
+       TEST_ok = true;
 }
 
 float TEST_RunAll()
 {
-       float f = 0;
+       int f = 0;
        float n = numentityfields();
-       float i;
-       for(i = 0; i < n; ++i)
+       for(int i = 0; i < n; ++i)
        {
                string name = entityfieldname(i);
                if(substring(name, 0, 6) == "_TEST_")
index ff442cef9b779e87882f85dc03140fc3755766ee..edc2f5bf37ff959f3b6fe6375d29923b5f9b086b 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef TEST_H
+#define TEST_H
+
 #define TEST_Check(cond) do { if(!(cond)) TEST_Fail(#cond); } while(0)
 
 void TEST_OK();
@@ -5,3 +8,4 @@ void TEST_Fail(string cond);
 
 float TEST_RunAll();
 float TEST_Run(string test);
+#endif
index 3365b92029a82b7a176a516aaaf4675960c39dc5..2f8e77d2d20b7f2bbdb57bbc1cb267fcf48c1f8b 100644 (file)
@@ -201,7 +201,6 @@ void turret_draw2d()
                        );
 }
 
-void(entity e, entity tagentity, string tagname) setattachment = #443;
 void turret_construct()
 {
        entity tur = get_turretinfo(self.turretid);
@@ -277,7 +276,7 @@ void turret_gibboom()
        pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
 
        for (i = 1; i < 5; i = i + 1)
-               turret_gibtoss(strcat("models/turrets/head-gib", ftos(i), ".md3"), self.origin + '0 0 2', self.velocity + randomvec() * 700, '0 0 0', FALSE);
+               turret_gibtoss(strcat("models/turrets/head-gib", ftos(i), ".md3"), self.origin + '0 0 2', self.velocity + randomvec() * 700, '0 0 0', false);
 }
 
 entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode)
@@ -325,23 +324,23 @@ void turret_die()
        {
                // Base
                if(self.turretid == TUR_EWHEEL)
-                       turret_gibtoss((get_turretinfo(self.turretid)).model, self.origin + '0 0 18', self.velocity + '0 0 400' + '0.1 0.1 1' * (random() * 400), '-1 -1 -1', TRUE);
+                       turret_gibtoss((get_turretinfo(self.turretid)).model, self.origin + '0 0 18', self.velocity + '0 0 400' + '0.1 0.1 1' * (random() * 400), '-1 -1 -1', true);
                else if (self.turretid == TUR_WALKER)
-                       turret_gibtoss((get_turretinfo(self.turretid)).model, self.origin + '0 0 18', self.velocity + '0 0 300' + '0.1 0.1 1' * (random() * 200), '-1 -1 -1', TRUE);
+                       turret_gibtoss((get_turretinfo(self.turretid)).model, self.origin + '0 0 18', self.velocity + '0 0 300' + '0.1 0.1 1' * (random() * 200), '-1 -1 -1', true);
                else if (self.turretid == TUR_TESLA)
-                       turret_gibtoss((get_turretinfo(self.turretid)).model, self.origin + '0 0 18', '0 0 200', '-1 -1 -1', FALSE);
+                       turret_gibtoss((get_turretinfo(self.turretid)).model, self.origin + '0 0 18', '0 0 200', '-1 -1 -1', false);
                else
                {
                        if (random() > 0.5)
                        {
-                               turret_gibtoss("models/turrets/base-gib2.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', FALSE);
-                               turret_gibtoss("models/turrets/base-gib3.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', FALSE);
-                               turret_gibtoss("models/turrets/base-gib4.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', FALSE);
+                               turret_gibtoss("models/turrets/base-gib2.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
+                               turret_gibtoss("models/turrets/base-gib3.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
+                               turret_gibtoss("models/turrets/base-gib4.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
                        }
                        else
-                               turret_gibtoss("models/turrets/base-gib1.md3", self.origin + '0 0 8', '0 0 0', '0 0 0', TRUE);
+                               turret_gibtoss("models/turrets/base-gib1.md3", self.origin + '0 0 8', '0 0 0', '0 0 0', true);
 
-                       entity headgib = turret_gibtoss((get_turretinfo(self.turretid)).head_model, self.origin + '0 0 32', '0 0 200' + randomvec() * 200, '-1 -1 -1', TRUE);
+                       entity headgib = turret_gibtoss((get_turretinfo(self.turretid)).head_model, self.origin + '0 0 32', '0 0 200' + randomvec() * 200, '-1 -1 -1', true);
                        if(headgib)
                        {
                                headgib.angles = headgib.move_angles = self.tur_head.angles;
index b61678218725c18e354ad0dbb43281fd7a998489..0f8ff9485117807a5f7e752a54b17eba6e3f3d42 100644 (file)
@@ -1 +1,6 @@
+#ifndef CL_TURRETS_H
+#define CL_TURRETS_H
+
 void ent_turret();
+
+#endif
index ad3a0c72fefafc0da3b2c255052aadaafedcbd81..85cbd2006c75e7abedfe63c81fe555788225b1a0 100644 (file)
@@ -1,6 +1,7 @@
-// ==========================
-//  Turret Config Generator
-// ==========================
+#ifndef TURRETS_CONFIG_H
+#define TURRETS_CONFIG_H
+
+#ifdef SVQC
 
 void Dump_Turret_Settings(void);
 float tur_config_file;
@@ -27,3 +28,7 @@ string tur_config_queue[MAX_TUR_CONFIG];
        #define TUR_ADD_CVAR(turret,name) TUR_CONFIG_WRITE_CVARS(turret,name) \
        tursettings \
        #undef TUR_ADD_CVAR
+
+#endif
+
+#endif
index aca2b8ead796d3d99361517f160a7f0cc47f902f..91d427fd80342a82d4f0a8c32e8e78c03e7b14b0 100644 (file)
@@ -1,7 +1,5 @@
-// =========================
-//  SVQC Turret Properties
-// =========================
-
+#ifdef SVQC
+#include "../../server/autocvars.qh"
 
 // Generic aiming
 vector turret_aim_generic()
@@ -166,7 +164,6 @@ float turret_targetscore_generic(entity _turret, entity _target)
 }
 
 // Generic damage handling
-void() turret_respawn;
 void turret_hide()
 {
        self.effects   |= EF_NODRAW;
@@ -211,7 +208,7 @@ void turret_die()
 
 void turret_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
 {
-       // Enougth allready!
+       // Enough already!
        if(self.deadflag == DEAD_DEAD)
                return;
 
@@ -358,7 +355,7 @@ float turret_send(entity to, float sf)
                        WriteByte(MSG_ENTITY, ceil((self.health / self.max_health) * 255));
        }
 
-       return TRUE;
+       return true;
 }
 
 void load_unit_settings(entity ent, string unitname, float is_reload)
@@ -466,7 +463,7 @@ entity turret_projectile(string _snd, float _size, float _health, float _death,
        setsize(proj, '-0.5 -0.5 -0.5' * _size, '0.5 0.5 0.5' * _size);
        proj.owner                = self;
        proj.realowner    = self;
-       proj.bot_dodge    = TRUE;
+       proj.bot_dodge    = true;
        proj.bot_dodgerating = self.shot_dmg;
        proj.think                = turret_projectile_explode;
        proj.touch                = turret_projectile_touch;
@@ -1193,7 +1190,7 @@ void turret_use()
 
 void turret_link()
 {
-       Net_LinkEntity(self, TRUE, 0, turret_send);
+       Net_LinkEntity(self, true, 0, turret_send);
        self.think       = turret_think;
        self.nextthink = time;
        self.tur_head.effects = EF_NODRAW;
@@ -1224,12 +1221,12 @@ void turrets_manager_think()
 float turret_initialize(float tur_id)
 {
        if(!autocvar_g_turrets)
-               return FALSE;
+               return false;
 
        entity e;
        entity tur = get_turretinfo(tur_id);
        if(tur.turretid == 0)
-               return FALSE; // invalid turret
+               return false; // invalid turret
 
        if(!self.tur_head) { TUR_ACTION(tur_id, TR_PRECACHE); } // if tur_head exists, we can assume this turret re-spawned
 
@@ -1340,7 +1337,7 @@ float turret_initialize(float tur_id)
        self.turret_firecheckfunc       = turret_firecheck;
        self.event_damage                       = turret_damage;
        self.use                                        = turret_use;
-       self.bot_attack                         = TRUE;
+       self.bot_attack                         = true;
        self.nextthink                          = time + 1;
        self.nextthink                     += turret_count * sys_frametime;
        
@@ -1390,7 +1387,8 @@ float turret_initialize(float tur_id)
        TUR_ACTION(tur_id, TR_SETUP);
        
        if(MUTATOR_CALLHOOK(TurretSpawn))
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
+#endif
index f89ef1581ba8f46866d15bbd8055a706440df33d..c4ff13e91d3b18edbed79544d1cd14ad0d3b67e2 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef SV_TURRETS_H
+#define SV_TURRETS_H
+
 // turret fields
 .float ticrate; // interal ai think rate
 .vector aim_idle; // where to aim while idle
@@ -68,6 +71,8 @@ const float TFL_TRACKTYPE_FLUIDINERTIA = 3; // simulated inertia ("wobbly" mode)
 .float track_accel_rotate;
 .float track_blendrate;
 
+void() turret_respawn;
+
 /// updates aim org, shot org, shot dir and enemy org for selected turret
 void turret_do_updates(entity e_turret);
 .vector tur_shotdir_updated;
@@ -104,3 +109,5 @@ vector tvt_tadv; // turret angle diff vector, updated by a successful call to tu
 float tvt_thadf; // turret head angle diff float, updated by a successful call to turret_validate_target
 float tvt_tadf; // turret angle diff float, updated by a successful call to turret_validate_target
 float tvt_dist; // turret distance, updated by a successful call to turret_validate_target
+
+#endif
index 5491746e9c32dc0728a77d33b8111e22e34ccd63..b3736aff9cbe4d17bc34820cd3be5f494ea4591b 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef TURRETS_H
+#define TURRETS_H
+
 // turret requests
 #define TR_SETUP          1 // (BOTH) setup turret data
 #define TR_THINK                 2 // (SERVER) logic to run every frame
 #define TR_CONFIG         6 // (ALL)
 
 // functions:
-entity get_turretinfo(float id);
+entity get_turretinfo(int id);
 
 // fields:
 .entity tur_head;
 
 // target selection flags
-.float target_select_flags;
-.float target_validate_flags;
-const float TFL_TARGETSELECT_NO = 2; // don't automatically find targets
-const float TFL_TARGETSELECT_LOS = 4; // require line of sight to find targets
-const float TFL_TARGETSELECT_PLAYERS = 8; // target players
-const float TFL_TARGETSELECT_MISSILES = 16; // target projectiles
-const float TFL_TARGETSELECT_TRIGGERTARGET = 32; // respond to turret_trigger_target events
-const float TFL_TARGETSELECT_ANGLELIMITS = 64; // apply extra angular limits to target selection
-const float TFL_TARGETSELECT_RANGELIMITS = 128; // limit target selection range
-const float TFL_TARGETSELECT_TEAMCHECK = 256; // don't attack teammates
-const float TFL_TARGETSELECT_NOBUILTIN = 512; // only attack targets when triggered
-const float TFL_TARGETSELECT_OWNTEAM = 1024; // only attack teammates
-const float TFL_TARGETSELECT_NOTURRETS = 2048; // don't attack other turrets
-const float TFL_TARGETSELECT_FOV = 4096; // extra limits to attack range
-const float TFL_TARGETSELECT_MISSILESONLY = 8192; // only attack missiles
+.int target_select_flags;
+.int target_validate_flags;
+const int TFL_TARGETSELECT_NO = 2; // don't automatically find targets
+const int TFL_TARGETSELECT_LOS = 4; // require line of sight to find targets
+const int TFL_TARGETSELECT_PLAYERS = 8; // target players
+const int TFL_TARGETSELECT_MISSILES = 16; // target projectiles
+const int TFL_TARGETSELECT_TRIGGERTARGET = 32; // respond to turret_trigger_target events
+const int TFL_TARGETSELECT_ANGLELIMITS = 64; // apply extra angular limits to target selection
+const int TFL_TARGETSELECT_RANGELIMITS = 128; // limit target selection range
+const int TFL_TARGETSELECT_TEAMCHECK = 256; // don't attack teammates
+const int TFL_TARGETSELECT_NOBUILTIN = 512; // only attack targets when triggered
+const int TFL_TARGETSELECT_OWNTEAM = 1024; // only attack teammates
+const int TFL_TARGETSELECT_NOTURRETS = 2048; // don't attack other turrets
+const int TFL_TARGETSELECT_FOV = 4096; // extra limits to attack range
+const int TFL_TARGETSELECT_MISSILESONLY = 8192; // only attack missiles
 
 // aim flags
-.float aim_flags;
-const float TFL_AIM_NO = 1; // no aiming
-const float TFL_AIM_SPLASH = 2; // aim for ground around the target's feet
-const float TFL_AIM_LEAD = 4; // try to predict target movement
-const float TFL_AIM_SHOTTIMECOMPENSATE = 8; // compensate for shot traveltime when leading
-const float TFL_AIM_ZPREDICT = 16; // predict target's z position at impact
-const float TFL_AIM_SIMPLE = 32; // aim at player's current location
+.int aim_flags;
+const int TFL_AIM_NO = 1; // no aiming
+const int TFL_AIM_SPLASH = 2; // aim for ground around the target's feet
+const int TFL_AIM_LEAD = 4; // try to predict target movement
+const int TFL_AIM_SHOTTIMECOMPENSATE = 8; // compensate for shot traveltime when leading
+const int TFL_AIM_ZPREDICT = 16; // predict target's z position at impact
+const int TFL_AIM_SIMPLE = 32; // aim at player's current location
 
 // tracking flags
-.float track_flags;
-const float TFL_TRACK_NO = 2; // don't move head
-const float TFL_TRACK_PITCH = 4; // pitch head
-const float TFL_TRACK_ROTATE = 8; // rotate head
+.int track_flags;
+const int TFL_TRACK_NO = 2; // don't move head
+const int TFL_TRACK_PITCH = 4; // pitch head
+const int TFL_TRACK_ROTATE = 8; // rotate head
 
 // prefire checks
-.float firecheck_flags;
-const float TFL_FIRECHECK_DEAD = 4; // don't attack dead targets (zombies?)
-const float TFL_FIRECHECK_DISTANCES = 8; // another range check
-const float TFL_FIRECHECK_LOS = 16; // line of sight
-const float TFL_FIRECHECK_AIMDIST = 32; // consider distance impactpoint<->aimspot
-const float TFL_FIRECHECK_REALDIST = 64; // consider enemy origin<->impactpoint
-const float TFL_FIRECHECK_ANGLEDIST = 128; // consider angular diff head<->aimspot
-const float TFL_FIRECHECK_TEAMCHECK = 256; // don't attack teammates
-const float TFL_FIRECHECK_AFF = 512; // try to avoid any friendly fire
-const float TFL_FIRECHECK_AMMO_OWN = 1024; // own ammo needs to be larger than damage dealt
-const float TFL_FIRECHECK_AMMO_OTHER = 2048; // target's ammo needs to be less than max
-const float TFL_FIRECHECK_REFIRE = 4096; // check single attack finished delays
-const float TFL_FIRECHECK_NO = 16384; // no prefire checks
+.int firecheck_flags;
+const int TFL_FIRECHECK_DEAD = 4; // don't attack dead targets (zombies?)
+const int TFL_FIRECHECK_DISTANCES = 8; // another range check
+const int TFL_FIRECHECK_LOS = 16; // line of sight
+const int TFL_FIRECHECK_AIMDIST = 32; // consider distance impactpoint<->aimspot
+const int TFL_FIRECHECK_REALDIST = 64; // consider enemy origin<->impactpoint
+const int TFL_FIRECHECK_ANGLEDIST = 128; // consider angular diff head<->aimspot
+const int TFL_FIRECHECK_TEAMCHECK = 256; // don't attack teammates
+const int TFL_FIRECHECK_AFF = 512; // try to avoid any friendly fire
+const int TFL_FIRECHECK_AMMO_OWN = 1024; // own ammo needs to be larger than damage dealt
+const int TFL_FIRECHECK_AMMO_OTHER = 2048; // target's ammo needs to be less than max
+const int TFL_FIRECHECK_REFIRE = 4096; // check single attack finished delays
+const int TFL_FIRECHECK_NO = 16384; // no prefire checks
 
 // attack flags
-.float shoot_flags;
-const float TFL_SHOOT_NO = 64; // no attacking
-const float TFL_SHOOT_VOLLY = 2; // fire in vollies
-const float TFL_SHOOT_VOLLYALWAYS = 4; // always do a full volly, even if target is lost
-const float TFL_SHOOT_HITALLVALID = 8; // loop through all valid targets
-const float TFL_SHOOT_CLEARTARGET = 16; // lose target after attack (after volly is done if in volly mode)
-const float TFL_SHOOT_CUSTOM = 32; // custom attacking
+.int shoot_flags;
+const int TFL_SHOOT_NO = 64; // no attacking
+const int TFL_SHOOT_VOLLY = 2; // fire in vollies
+const int TFL_SHOOT_VOLLYALWAYS = 4; // always do a full volly, even if target is lost
+const int TFL_SHOOT_HITALLVALID = 8; // loop through all valid targets
+const int TFL_SHOOT_CLEARTARGET = 16; // lose target after attack (after volly is done if in volly mode)
+const int TFL_SHOOT_CUSTOM = 32; // custom attacking
 
 // turret capabilities
-.float turret_flags;
-const float TUR_FLAG_NONE = 0; // no abilities
-const float TUR_FLAG_SNIPER = 2; // sniping turret
-const float TUR_FLAG_SPLASH = 4; // can deal splash damage
-const float TUR_FLAG_HITSCAN = 8; // hit scan
-const float TUR_FLAG_MULTIGUN = 16; // multiple guns
-const float TUR_FLAG_GUIDED = 32; // laser guided projectiles
-const float TUR_FLAG_SLOWPROJ = 64; // turret fires slow projectiles
-const float TUR_FLAG_MEDPROJ = 128; // turret fires medium projectiles
-const float TUR_FLAG_FASTPROJ = 256; // turret fires fast projectiles
-const float TUR_FLAG_PLAYER = 512; // can damage players
-const float TUR_FLAG_MISSILE = 1024; // can damage missiles
-const float TUR_FLAG_SUPPORT = 2048; // supports other units
-const float TUR_FLAG_AMMOSOURCE = 4096; // can provide ammunition
-const float TUR_FLAG_RECIEVETARGETS = 8192; // can recieve targets from external sources
-const float TUR_FLAG_MOVE = 16384; // can move
-const float TUR_FLAG_ROAM = 32768; // roams around if not attacking
-const float TUR_FLAG_ISTURRET = 65536; // identifies this unit as a turret
+.int turret_flags;
+const int TUR_FLAG_NONE = 0; // no abilities
+const int TUR_FLAG_SNIPER = 2; // sniping turret
+const int TUR_FLAG_SPLASH = 4; // can deal splash damage
+const int TUR_FLAG_HITSCAN = 8; // hit scan
+const int TUR_FLAG_MULTIGUN = 16; // multiple guns
+const int TUR_FLAG_GUIDED = 32; // laser guided projectiles
+const int TUR_FLAG_SLOWPROJ = 64; // turret fires slow projectiles
+const int TUR_FLAG_MEDPROJ = 128; // turret fires medium projectiles
+const int TUR_FLAG_FASTPROJ = 256; // turret fires fast projectiles
+const int TUR_FLAG_PLAYER = 512; // can damage players
+const int TUR_FLAG_MISSILE = 1024; // can damage missiles
+const int TUR_FLAG_SUPPORT = 2048; // supports other units
+const int TUR_FLAG_AMMOSOURCE = 4096; // can provide ammunition
+const int TUR_FLAG_RECIEVETARGETS = 8192; // can recieve targets from external sources
+const int TUR_FLAG_MOVE = 16384; // can move
+const int TUR_FLAG_ROAM = 32768; // roams around if not attacking
+const int TUR_FLAG_ISTURRET = 65536; // identifies this unit as a turret
 
 // ammo types
 #define ammo_flags currentammo
-const float TFL_AMMO_NONE = 64; // doesn't use ammo
-const float TFL_AMMO_ENERGY = 2; // uses power
-const float TFL_AMMO_BULLETS = 4; // uses bullets
-const float TFL_AMMO_ROCKETS = 8; // uses explosives
-const float TFL_AMMO_RECHARGE = 16; // regenerates ammo
-const float TFL_AMMO_RECIEVE = 32; // can recieve ammo from support units
+const int TFL_AMMO_NONE = 64; // doesn't use ammo
+const int TFL_AMMO_ENERGY = 2; // uses power
+const int TFL_AMMO_BULLETS = 4; // uses bullets
+const int TFL_AMMO_ROCKETS = 8; // uses explosives
+const int TFL_AMMO_RECHARGE = 16; // regenerates ammo
+const int TFL_AMMO_RECIEVE = 32; // can recieve ammo from support units
 
 // damage flags
-.float damage_flags;
-const float TFL_DMG_NO = 256; // doesn't take damage
-const float TFL_DMG_YES = 2; // can be damaged
-const float TFL_DMG_TEAM = 4; // can be damaged by teammates
-const float TFL_DMG_RETALIATE = 8; // target attackers
-const float TFL_DMG_RETALIATE_TEAM = 16; // target attackers, even if on same team
-const float TFL_DMG_TARGETLOSS = 32; // loses target when damaged
-const float TFL_DMG_AIMSHAKE = 64; // damage throws off aim
-const float TFL_DMG_HEADSHAKE = 128; // damage shakes head
-const float TFL_DMG_DEATH_NORESPAWN = 256; // no re-spawning
+.int damage_flags;
+const int TFL_DMG_NO = 256; // doesn't take damage
+const int TFL_DMG_YES = 2; // can be damaged
+const int TFL_DMG_TEAM = 4; // can be damaged by teammates
+const int TFL_DMG_RETALIATE = 8; // target attackers
+const int TFL_DMG_RETALIATE_TEAM = 16; // target attackers, even if on same team
+const int TFL_DMG_TARGETLOSS = 32; // loses target when damaged
+const int TFL_DMG_AIMSHAKE = 64; // damage throws off aim
+const int TFL_DMG_HEADSHAKE = 128; // damage shakes head
+const int TFL_DMG_DEATH_NORESPAWN = 256; // no re-spawning
 
 // spawn flags
-const float TSF_SUSPENDED = 1;
-const float TSF_TERRAINBASE = 2; // currently unused
-const float TSF_NO_AMMO_REGEN = 4; // disable builtin ammo regeneration
-const float TSF_NO_PATHBREAK = 8; // don't break path to chase enemies, will still fire at them if possible
-const float TSL_NO_RESPAWN = 16; // don't re-spawn
-const float TSL_ROAM = 32; // roam while idle
+const int TSF_SUSPENDED = 1;
+const int TSF_TERRAINBASE = 2; // currently unused
+const int TSF_NO_AMMO_REGEN = 4; // disable builtin ammo regeneration
+const int TSF_NO_PATHBREAK = 8; // don't break path to chase enemies, will still fire at them if possible
+const int TSL_NO_RESPAWN = 16; // don't re-spawn
+const int TSL_ROAM = 32; // roam while idle
 
 // send flags
-const float TNSF_UPDATE       = 2;
-const float TNSF_STATUS       = 4;
-const float TNSF_SETUP        = 8;
-const float TNSF_ANG          = 16;
-const float TNSF_AVEL         = 32;
-const float TNSF_MOVE         = 64;
+const int TNSF_UPDATE       = 2;
+const int TNSF_STATUS       = 4;
+const int TNSF_SETUP        = 8;
+const int TNSF_ANG          = 16;
+const int TNSF_AVEL         = 32;
+const int TNSF_MOVE         = 64;
 .float anim_start_time;
-const float TNSF_ANIM         = 128;
+const int TNSF_ANIM         = 128;
 
-const float TNSF_FULL_UPDATE  = 16777215;
+const int TNSF_FULL_UPDATE  = 16777215;
 
 
 // entity properties of turretinfo:
-.float turretid; // TUR_...
+.int turretid; // TUR_...
 .string netname; // short name
 .string turret_name; // human readable name
 .float(float) turret_func; // m_...
@@ -195,3 +198,5 @@ float TUR_LAST;
 #undef TUR_ADD_CVAR
 #undef REGISTER_TURRET
 ACCUMULATE_FUNCTION(RegisterTurrets, register_turrets_done);
+
+#endif
index 1c2dc556459431ef247f67951618fe198ee68fe9..414ec4e822b6d3b0d17d6b909f2a7a6302c039ee 100644 (file)
@@ -105,7 +105,7 @@ void ewheel_move_enemy()
                movelib_beak_simple((autocvar_g_turrets_unit_ewheel_speed_stop));
        }
 
-       turrets_setframe(newframe, FALSE);
+       turrets_setframe(newframe, false);
 }
 
 void ewheel_move_idle()
@@ -147,7 +147,7 @@ float t_ewheel(float req)
                                        self.tur_head.frame = 0;
                        }
                        
-                       return TRUE;
+                       return true;
                }
                case TR_THINK:
                {
@@ -182,7 +182,7 @@ float t_ewheel(float req)
                        if(vlen(self.velocity))
                                self.SendFlags |= TNSF_MOVE;
                
-                       return TRUE;
+                       return true;
                }
                case TR_DEATH:
                {
@@ -194,7 +194,7 @@ float t_ewheel(float req)
 #endif
                        self.pathcurrent = world;
        
-                       return TRUE;
+                       return true;
                }
                case TR_SETUP:
                {
@@ -231,9 +231,9 @@ float t_ewheel(float req)
                                }
                        }
                        
-                       self.iscreature                         = TRUE;
+                       self.iscreature                         = true;
                        self.teleportable                       = TELEPORT_NORMAL;
-                       self.damagedbycontents          = TRUE;
+                       self.damagedbycontents          = true;
                        self.movetype                           = MOVETYPE_WALK;
                        self.solid                                      = SOLID_SLIDEBOX;
                        self.takedamage                         = DAMAGE_AIM;
@@ -248,17 +248,17 @@ float t_ewheel(float req)
                        self.tur_head.aim_speed = (autocvar_g_turrets_unit_ewheel_turnrate);
                        self.tur_head.aim_speed = self.tur_head.aim_speed / (1 / self.ticrate);
                
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
                        precache_model ("models/turrets/ewheel-base2.md3");
                        precache_model ("models/turrets/ewheel-gun1.md3");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -296,15 +296,15 @@ float t_ewheel(float req)
                        self.move_time          = time;
                        self.draw                       = ewheel_draw;
                        
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index 8c131e76e0401fe7db1aad6509e7c754e0cb293e..8068ab1d7e8d97c49ecb22ad90932cec40d33844 100644 (file)
@@ -50,15 +50,15 @@ float t_flac(float req)
                        if (self.tur_head.frame >= 4)
                                self.tur_head.frame = 0;
                        
-                       return TRUE;
+                       return true;
                }
                case TR_THINK:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_DEATH:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_SETUP:
                {
@@ -67,17 +67,17 @@ float t_flac(float req)
                        self.damage_flags |= TFL_DMG_HEADSHAKE;
                        self.target_select_flags |= TFL_TARGETSELECT_NOTURRETS | TFL_TARGETSELECT_MISSILESONLY;
                
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
                        precache_model ("models/turrets/base.md3");
                        precache_model ("models/turrets/flac.md3");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -88,15 +88,15 @@ float t_flac(float req)
        {
                case TR_SETUP:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index d2a3c408e5be68b39c1f2062cc9187e3fafc7cf8..db49745667e515d58a49697f446c122c94c22199 100644 (file)
@@ -54,17 +54,17 @@ float t_fusionreactor(float req)
                        fl_org = 0.5 * (self.enemy.absmin + self.enemy.absmax);
                        te_smallflash(fl_org);
                        
-                       return TRUE;
+                       return true;
                }
                case TR_THINK:
                {
                        self.tur_head.avelocity = '0 250 0' * (self.ammo / self.ammo_max);
                
-                       return TRUE;
+                       return true;
                }
                case TR_DEATH:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_SETUP:
                {
@@ -80,17 +80,17 @@ float t_fusionreactor(float req)
                        
                        self.turret_firecheckfunc = turret_fusionreactor_firecheck;
                
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
                        precache_model ("models/turrets/base.md3");
                        precache_model ("models/turrets/reactor.md3");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -101,15 +101,15 @@ float t_fusionreactor(float req)
        {
                case TR_SETUP:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index 57dca3b79101d70894d31c871de87da3deb63fe7..d090ef7ce52135f62458bb3232246cd24298e1f5 100644 (file)
@@ -101,7 +101,7 @@ float t_hellion(float req)
                        missile.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_HEAT;
                        self.tur_head.frame += 1;
                        
-                       return TRUE;
+                       return true;
                }
                case TR_THINK:
                {
@@ -111,11 +111,11 @@ float t_hellion(float req)
                        if (self.tur_head.frame >= 7)
                                self.tur_head.frame = 0;
                
-                       return TRUE;
+                       return true;
                }
                case TR_DEATH:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_SETUP:
                {
@@ -124,17 +124,17 @@ float t_hellion(float req)
                        self.firecheck_flags = TFL_FIRECHECK_DEAD | TFL_FIRECHECK_DISTANCES | TFL_FIRECHECK_TEAMCHECK | TFL_FIRECHECK_REFIRE | TFL_FIRECHECK_AFF | TFL_FIRECHECK_AMMO_OWN;
                        self.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
                
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
                        precache_model ("models/turrets/base.md3");
                        precache_model ("models/turrets/hellion.md3");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -145,15 +145,15 @@ float t_hellion(float req)
        {
                case TR_SETUP:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index c0f55fa0f06da0614ba1d8230e37c731a00782b4..414c71e4b8286c87879842d68f67abff9f38cc66 100644 (file)
@@ -117,7 +117,7 @@ void turret_hk_missile_think()
                                  self.enemy.velocity *
                                  min((vlen(self.enemy.origin - self.origin) / vlen(self.velocity)),0.5);
 
-               traceline(self.origin, pre_pos,TRUE,self.enemy);
+               traceline(self.origin, pre_pos,true,self.enemy);
                ve = normalize(pre_pos - self.origin);
                fe = trace_fraction;
 
@@ -137,7 +137,7 @@ void turret_hk_missile_think()
                lt_seek = myspeed * 2.95;
 
                // Trace forward
-               traceline(self.origin, self.origin + v_forward * lt_for,FALSE,self);
+               traceline(self.origin, self.origin + v_forward * lt_for,false,self);
                vf = trace_endpos;
                ff = trace_fraction;
 
@@ -158,22 +158,22 @@ void turret_hk_missile_think()
                if (ff < 0.5) pt_seek = 1;
 
                // Trace left
-               traceline(self.origin, self.origin + (-1 * (v_right * pt_seek) + (v_forward * ff)) * lt_seek,FALSE,self);
+               traceline(self.origin, self.origin + (-1 * (v_right * pt_seek) + (v_forward * ff)) * lt_seek,false,self);
                vl = trace_endpos;
                fl = trace_fraction;
 
                // Trace right
-               traceline(self.origin,  self.origin + ((v_right * pt_seek) + (v_forward * ff)) * lt_seek ,FALSE,self);
+               traceline(self.origin,  self.origin + ((v_right * pt_seek) + (v_forward * ff)) * lt_seek ,false,self);
                vr = trace_endpos;
                fr = trace_fraction;
 
                // Trace up
-               traceline(self.origin,  self.origin + ((v_up * pt_seek) + (v_forward * ff)) * lt_seek ,FALSE,self);
+               traceline(self.origin,  self.origin + ((v_up * pt_seek) + (v_forward * ff)) * lt_seek ,false,self);
                vu = trace_endpos;
                fu = trace_fraction;
 
                // Trace down
-               traceline(self.origin,  self.origin + (-1 * (v_up * pt_seek) + (v_forward * ff)) * lt_seek ,FALSE,self);
+               traceline(self.origin,  self.origin + (-1 * (v_up * pt_seek) + (v_forward * ff)) * lt_seek ,false,self);
                vd = trace_endpos;
                fd = trace_fraction;
 
@@ -298,7 +298,7 @@ float t_hk(float req)
                        if (self.tur_head.frame == 0)
                                self.tur_head.frame = self.tur_head.frame + 1;
 
-                       return TRUE;
+                       return true;
                }
                case TR_THINK:
                {
@@ -308,11 +308,11 @@ float t_hk(float req)
                        if (self.tur_head.frame > 5)
                                self.tur_head.frame = 0;
 
-                       return TRUE;
+                       return true;
                }
                case TR_DEATH:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_SETUP:
                {
@@ -325,17 +325,17 @@ float t_hk(float req)
 
                        self.turret_addtarget = turret_hk_addtarget;
 
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
                        precache_model ("models/turrets/base.md3");
                        precache_model ("models/turrets/hk.md3");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -346,15 +346,15 @@ float t_hk(float req)
        {
                case TR_SETUP:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index 26cbc4882835075114623361fb7342f10fe371cb..f4a46212fc0645d9688223635177a5d159754df8 100644 (file)
@@ -24,15 +24,15 @@ float t_machinegun(float req)
                        W_MachineGun_MuzzleFlash();
                        setattachment(self.muzzle_flash, self.tur_head, "tag_fire");
 
-                       return TRUE;
+                       return true;
                }
                case TR_THINK:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_DEATH:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_SETUP:
                {
@@ -42,18 +42,18 @@ float t_machinegun(float req)
                        self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
                        self.turret_flags |= TUR_FLAG_HITSCAN;
 
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
                        precache_model ("models/turrets/base.md3");
                        precache_model ("models/turrets/machinegun.md3");
                        precache_sound ("weapons/uzi_fire.wav");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -64,15 +64,15 @@ float t_machinegun(float req)
        {
                case TR_SETUP:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index fa3c30efcd879f7b13f262b1d124366853eef0a8..254a589484b0302606d130ddc4374c3765be8085 100644 (file)
@@ -27,7 +27,7 @@ float t_mlrs(float req)
                        missile.missile_flags = MIF_SPLASH;
                        te_explosion (missile.origin);
 
-                       return TRUE;
+                       return true;
                }
                case TR_THINK:
                {
@@ -39,11 +39,11 @@ float t_mlrs(float req)
                                dprint("shot_dmg:",ftos(self.shot_dmg),"\n");
                        }
                
-                       return TRUE;
+                       return true;
                }
                case TR_DEATH:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_SETUP:
                {
@@ -54,17 +54,17 @@ float t_mlrs(float req)
                        self.shoot_flags  |= TFL_SHOOT_VOLLYALWAYS;
                        self.volly_counter = self.shot_volly;
 
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
                        precache_model ("models/turrets/base.md3");
                        precache_model ("models/turrets/mlrs.md3");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -75,15 +75,15 @@ float t_mlrs(float req)
        {
                case TR_SETUP:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index 441e041c7356fc4cec2f6f20713b36c9611f8efd..32c392b6648b853ca57d9603af0a9830836f773e 100644 (file)
@@ -83,7 +83,7 @@ float t_phaser(float req)
                        beam.scale = self.target_range / 256;
                        beam.movetype = MOVETYPE_NONE;
                        beam.enemy = self.enemy;
-                       beam.bot_dodge = TRUE;
+                       beam.bot_dodge = true;
                        beam.bot_dodgerating = beam.shot_dmg;
                        sound (beam, CH_SHOTS_SINGLE, "turrets/phaser.wav", VOL_BASE, ATTEN_NORM);
                        self.fireflag = 1;
@@ -98,7 +98,7 @@ float t_phaser(float req)
                        if (self.tur_head.frame == 0)
                                self.tur_head.frame = 1;
 
-                       return TRUE;
+                       return true;
                }
                case TR_THINK:
                {
@@ -122,11 +122,11 @@ float t_phaser(float req)
                                }
                        }
 
-                       return TRUE;
+                       return true;
                }
                case TR_DEATH:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_SETUP:
                {
@@ -135,7 +135,7 @@ float t_phaser(float req)
 
                        self.turret_firecheckfunc = turret_phaser_firecheck;
 
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
@@ -143,11 +143,11 @@ float t_phaser(float req)
                        precache_model ("models/turrets/phaser.md3");
                        precache_model ("models/turrets/phaser_beam.md3");
                        precache_sound ("turrets/phaser.wav");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -158,15 +158,15 @@ float t_phaser(float req)
        {
                case TR_SETUP:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index ac623371f59d531d320e9425f655ddedce9a9d41..095aa9d02d749485d7b30d5e97c94bf059123432 100644 (file)
@@ -50,7 +50,7 @@ float t_plasma(float req)
                                        self.tur_head.frame = 1;
                        }
 
-                       return TRUE;
+                       return true;
                }
                case TR_THINK:
                {
@@ -60,11 +60,11 @@ float t_plasma(float req)
                        if (self.tur_head.frame > 5)
                                self.tur_head.frame = 0;
 
-                       return TRUE;
+                       return true;
                }
                case TR_DEATH:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_SETUP:
                {
@@ -75,17 +75,17 @@ float t_plasma(float req)
                        
                        turret_do_updates(self);
 
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
                        precache_model ("models/turrets/base.md3");
                        precache_model ("models/turrets/plasma.md3");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -96,15 +96,15 @@ float t_plasma(float req)
        {
                case TR_SETUP:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index 279b41ec401c7599daa0cc6f5f0a8505f8540720..110ae1dea7d26075ef64665e8ae69af027b7d13a 100644 (file)
@@ -48,7 +48,7 @@ float t_plasma_dual(float req)
                                self.tur_head.frame += 1;
                        }
 
-                       return TRUE;
+                       return true;
                }
                case TR_THINK:
                {
@@ -58,11 +58,11 @@ float t_plasma_dual(float req)
                        if (self.tur_head.frame > 6)
                                self.tur_head.frame = 0;
 
-                       return TRUE;
+                       return true;
                }
                case TR_DEATH:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_SETUP:
                {
@@ -73,17 +73,17 @@ float t_plasma_dual(float req)
                        
                        turret_do_updates(self);
 
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
                        precache_model ("models/turrets/base.md3");
                        precache_model ("models/turrets/plasmad.md3");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -94,15 +94,15 @@ float t_plasma_dual(float req)
        {
                case TR_SETUP:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index 2878c318789f7ea6e77f70f11eae97cf0f2dbaf9..61a9f5e30437fa7b20f5bc6d18065c4864445e70 100644 (file)
@@ -110,7 +110,7 @@ float t_tesla(float req)
                        t = toast(e,r,d);
                        remove(e);
 
-                       if (t == world) return TRUE;
+                       if (t == world) return true;
 
                        self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES | TFL_TARGETSELECT_TEAMCHECK;
 
@@ -131,14 +131,14 @@ float t_tesla(float req)
                                e = e.chain;
                        }
 
-                       return TRUE;
+                       return true;
                }
                case TR_THINK:
                {
                        if(!self.active)
                        {
                                self.tur_head.avelocity = '0 0 0';
-                               return TRUE;
+                               return true;
                        }
 
                        if(self.ammo < self.shot_dmg)
@@ -150,7 +150,7 @@ float t_tesla(float req)
                                self.tur_head.avelocity = '0 180 0' * (self.ammo / self.shot_dmg);
 
                                if(self.attack_finished_single > time)
-                                       return TRUE;
+                                       return true;
 
                                float f;
                                f = (self.ammo / self.ammo_max);
@@ -160,11 +160,11 @@ float t_tesla(float req)
                                                te_csqc_lightningarc(self.tur_shotorg,self.tur_shotorg + (randomvec() * 350));
                        }
 
-                       return TRUE;
+                       return true;
                }
                case TR_DEATH:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_SETUP:
                {
@@ -181,17 +181,17 @@ float t_tesla(float req)
                        self.aim_flags                  = TFL_AIM_NO;
                        self.track_flags                = TFL_TRACK_NO;
 
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
                        precache_model ("models/turrets/tesla_base.md3");
                        precache_model ("models/turrets/tesla_head.md3");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
@@ -202,15 +202,15 @@ float t_tesla(float req)
        {
                case TR_SETUP:
                {
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index fa89d5a3e4ceaf39389ebabca070db339fc2678e..0d5d3170572c8caaa60b7881d67f14219668cd25 100644 (file)
@@ -81,7 +81,7 @@ void walker_melee_do_dmg()
 
 void walker_setnoanim()
 {
-       turrets_setframe(ANIM_NO, FALSE);
+       turrets_setframe(ANIM_NO, false);
        self.animflag = self.frame;
 }
 void walker_rocket_explode()
@@ -226,7 +226,7 @@ void walker_fire_rocket(vector org)
 
        rocket.classname                  = "walker_rocket";
        rocket.owner                      = self;
-       rocket.bot_dodge                  = TRUE;
+       rocket.bot_dodge                  = true;
        rocket.bot_dodgerating  = 50;
        rocket.takedamage                = DAMAGE_YES;
        rocket.damageforcescale   = 2;
@@ -252,7 +252,7 @@ void walker_fire_rocket(vector org)
        rocket.max_health                = time + 9;
        rocket.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_HEAT;
 
-       CSQCProjectile(rocket, FALSE, PROJECTILE_ROCKET, FALSE); // no culling, has fly sound
+       CSQCProjectile(rocket, false, PROJECTILE_ROCKET, false); // no culling, has fly sound
 }
 
 .vector enemy_last_loc;
@@ -346,7 +346,7 @@ float t_walker(float req)
                        fireBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_WALK_GUN, 0);
                        pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
 
-                       return TRUE;
+                       return true;
                }
                case TR_THINK:
                {
@@ -556,9 +556,9 @@ float t_walker(float req)
                                self.SendFlags |= TNSF_MOVE;
 
                        self.oldorigin = self.origin;
-                       turrets_setframe(self.animflag, FALSE);
+                       turrets_setframe(self.animflag, false);
 
-                       return TRUE;
+                       return true;
                }
                case TR_DEATH:
                {
@@ -568,7 +568,7 @@ float t_walker(float req)
 #endif
                        self.pathcurrent = world;
                
-                       return TRUE;
+                       return true;
                }
                case TR_SETUP:
                {
@@ -591,9 +591,9 @@ float t_walker(float req)
                                
                        self.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
                        self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-                       self.iscreature = TRUE;
+                       self.iscreature = true;
                        self.teleportable = TELEPORT_NORMAL;
-                       self.damagedbycontents = TRUE;
+                       self.damagedbycontents = true;
                        self.solid = SOLID_SLIDEBOX;
                        self.takedamage = DAMAGE_AIM;
                        if(self.movetype != MOVETYPE_WALK)
@@ -630,7 +630,7 @@ float t_walker(float req)
                                }
                        }
 
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
@@ -638,16 +638,18 @@ float t_walker(float req)
                        precache_model ("models/turrets/walker_head_minigun.md3");
                        precache_model ("models/turrets/rocket.md3");
                        precache_sound ("weapons/rocket_impact.wav");
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // SVQC
 #ifdef CSQC
 
+#include "../../../server/movelib.qh"
+
 void walker_draw()
 {
        float dt;
@@ -681,15 +683,15 @@ float t_walker(float req)
                        self.move_time          = time;
                        self.draw                       = walker_draw;
                        
-                       return TRUE;
+                       return true;
                }
                case TR_PRECACHE:
                {
-                       return TRUE;
+                       return true;
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 #endif // CSQC
index 6de59027e38bdc668a9071f398a9bb1955cc73d9..3d6d95a76a42504e5dda204de447114867890ea1 100644 (file)
@@ -113,20 +113,19 @@ vector angleofs3(vector from, vector from_a, entity to)
 * Update self.tur_shotorg by getting up2date bone info
 * NOTICE this func overwrites the global v_forward, v_right and v_up vectors.
 */
-#define turret_tag_fire_update() self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire"));v_forward = normalize(v_forward)
-float turret_tag_fire_update_s()
+float turret_tag_fire_update()
 {
        if(!self.tur_head)
        {
                error("Call to turret_tag_fire_update with self.tur_head missing!\n");
                self.tur_shotorg = '0 0 0';
-               return FALSE;
+               return false;
        }
 
        self.tur_shotorg = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_fire"));
        v_forward = normalize(v_forward);
 
-       return TRUE;
+       return true;
 }
 
 /*
@@ -149,7 +148,7 @@ void FireImoBeam (vector start, vector end, vector smin, vector smax,
        // note down which entities were hit so we can damage them later
        while (1)
        {
-               tracebox(start, smin, smax, end, FALSE, self);
+               tracebox(start, smin, smax, end, false, self);
 
                // if it is world we can't hurt it so stop now
                if (trace_ent == world || trace_fraction == 1)
@@ -159,7 +158,7 @@ void FireImoBeam (vector start, vector end, vector smin, vector smax,
                        break;
 
                // make the entity non-solid so we can hit the next one
-               trace_ent.railgunhit = TRUE;
+               trace_ent.railgunhit = true;
                trace_ent.railgunhitloc = end;
                trace_ent.railgunhitsolidbackup = trace_ent.solid;
 
@@ -172,23 +171,23 @@ void FireImoBeam (vector start, vector end, vector smin, vector smax,
        endpoint = trace_endpos;
 
        // find all the entities the railgun hit and restore their solid state
-       ent = findfloat(world, railgunhit, TRUE);
+       ent = findfloat(world, railgunhit, true);
        while (ent)
        {
                // restore their solid type
                ent.solid = ent.railgunhitsolidbackup;
-               ent = findfloat(ent, railgunhit, TRUE);
+               ent = findfloat(ent, railgunhit, true);
        }
 
        // find all the entities the railgun hit and hurt them
-       ent = findfloat(world, railgunhit, TRUE);
+       ent = findfloat(world, railgunhit, true);
        while (ent)
        {
                // get the details we need to call the damage function
                hitloc = ent.railgunhitloc;
                ent.railgunhitloc = '0 0 0';
                ent.railgunhitsolidbackup = SOLID_NOT;
-               ent.railgunhit = FALSE;
+               ent.railgunhit = false;
 
                // apply the damage
                if (ent.takedamage)
@@ -199,7 +198,7 @@ void FireImoBeam (vector start, vector end, vector smin, vector smax,
                }
 
                // advance to the next entity
-               ent = findfloat(ent, railgunhit, TRUE);
+               ent = findfloat(ent, railgunhit, true);
        }
        trace_endpos = endpoint;
 }
diff --git a/qcsrc/common/turrets/util.qh b/qcsrc/common/turrets/util.qh
new file mode 100644 (file)
index 0000000..71ba066
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef TURRETS_UTIL_H
+#define TURRETS_UTIL_H
+
+vector real_origin(entity ent);
+float shortangle_f(float ang1, float ang2);
+float anglemods(float v);
+float turret_tag_fire_update();
+vector shortangle_vxy(vector ang1, vector ang2);
+vector angleofs(entity from, entity to);
+vector angleofs3(vector from, vector from_a, entity to);
+void FireImoBeam (vector start, vector end, vector smin, vector smax, float bforce, float f_dmg, float f_velfactor, float deathtype);
+
+#endif
index b747a27c468b2da7db99b678a15c66da1a9a0bf9..8529ebd6dd52f38bab8fef47ecd3b6fc48b72070 100644 (file)
@@ -1,7 +1,21 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "constants.qh"
+       #include "util.qh"
+       #include "urllib.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "constants.qh"
+    #include "util.qh"
+    #include "urllib.qh"
+#endif
+
 // files
 .float url_fh;
-#define URL_FH_CURL   -1
-#define URL_FH_STDOUT -2
+const float URL_FH_CURL = -1;
+const float URL_FH_STDOUT = -2;
 
 // URLs
 .string url_url;
 .entity url_ready_pass;
 
 // for multi handles
-.float url_attempt;
-.float url_mode;
+.int url_attempt;
+.int url_mode;
 
 entity url_fromid[NUM_URL_ID];
-float autocvar__urllib_nextslot;
+int autocvar__urllib_nextslot;
 
-float url_URI_Get_Callback(float id, float status, string data)
+float url_URI_Get_Callback(int id, float status, string data)
 {
        if(id < MIN_URL_ID)
                return 0;
@@ -82,10 +96,10 @@ float url_URI_Get_Callback(float id, float status, string data)
        }
 }
 
-void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass)
+void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
 {
        entity e;
-       float i;
+       int i;
        if(strstrofs(url, "://", 0) >= 0)
        {
                switch(mode)
@@ -209,7 +223,7 @@ void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass)
 // close a file
 void url_fclose(entity e)
 {
-       float i;
+       int i;
 
        if(e.url_fh == URL_FH_CURL)
        {
@@ -363,7 +377,7 @@ void url_multi_ready(entity fh, entity me, float status)
        }
        me.url_ready(fh, me.url_ready_pass, status);
 }
-void url_multi_fopen(string url, float mode, url_ready_func rdy, entity pass)
+void url_multi_fopen(string url, int mode, url_ready_func rdy, entity pass)
 {
        float n;
        n = tokenize_console(url);
index 6353c33fef643404c63b2dd16824c9bf9ae0a5ad..d58a0b1aaf7eb4955bf3e87bd6fcf3db036782c5 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef URLLIB_H
+#define URLLIB_H
+
 const float URL_READY_ERROR    = -1;
 const float URL_READY_CLOSED   =  0;
 const float URL_READY_CANWRITE =  1;
@@ -11,8 +14,9 @@ string url_fgets(entity e);
 void url_fputs(entity e, string s);
 
 // returns true if handled
-float url_URI_Get_Callback(float id, float status, string data);
+float url_URI_Get_Callback(int id, float status, string data);
 #define MIN_URL_ID URI_GET_URLLIB
 #define NUM_URL_ID (URI_GET_URLLIB_END - URI_GET_URLLIB + 1)
 
 void url_multi_fopen(string url, float mode, url_ready_func rdy, entity pass);
+#endif
index 634b0fdf1d6b06c82ec8080c26d535da25986670..ed4ebcf0615d26dfa52ea907ea96a190b5f6a6f5 100644 (file)
@@ -1,3 +1,39 @@
+#ifndef UTIL_PRE_H
+#define UTIL_PRE_H
+
 #ifndef NOCOMPAT
-# define COMPAT_NO_MOD_IS_XONOTIC
+    #define COMPAT_NO_MOD_IS_XONOTIC
+#endif
+
+#ifndef QCC_SUPPORT_ACCUMULATE
+    #ifdef GMQCC
+        #define QCC_SUPPORT_ACCUMULATE
+    #endif
+#endif
+
+#ifndef QCC_SUPPORT_NIL
+    #ifdef GMQCC
+        #define QCC_SUPPORT_NIL
+    #endif
+#endif
+
+#ifndef QCC_SUPPORT_INT
+    #define int float
+
+    #define stoi(s) stof(s)
+    #define itos(s) ftos(s)
+#endif
+
+#ifndef QCC_SUPPORT_BOOL
+    #define bool float
+
+    // Boolean Constants
+    const int true     = 1;
+    const int false = 0;
+#endif
+
+// Transitional aliases
+[[deprecated("use true")]] [[alias("true")]] const bool TRUE;
+[[deprecated("use false")]] [[alias("false")]] const bool FALSE;
+
 #endif
index db6f04c62e2eaacc803b2998572c3c2161359f90..49d707f077be45adc59a7867322022ed9be41d96 100644 (file)
@@ -1,3 +1,26 @@
+#include "util.qh"
+
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+    #include "../client/defs.qh"
+    #include "constants.qh"
+    #include "../warpzonelib/mathlib.qh"
+    #include "mapinfo.qh"
+    #include "notifications.qh"
+    #include "deathtypes.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../warpzonelib/mathlib.qh"
+    #include "constants.qh"
+    #include "../server/autocvars.qh"
+    #include "../server/defs.qh"
+    #include "notifications.qh"
+    #include "deathtypes.qh"
+    #include "mapinfo.qh"
+#endif
+
 string wordwrap_buffer;
 
 void wordwrap_buffer_put(string s)
@@ -248,18 +271,17 @@ string fstrunzone(string s)
        return sc;
 }
 
-float fexists(string f)
+bool fexists(string f)
 {
-    float fh;
-    fh = fopen(f, FILE_READ);
+    int fh = fopen(f, FILE_READ);
     if (fh < 0)
-        return FALSE;
+        return false;
     fclose(fh);
-    return TRUE;
+    return true;
 }
 
 // Databases (hash tables)
-#define DB_BUCKETS 8192
+const float DB_BUCKETS = 8192;
 void db_save(float db, string pFilename)
 {
        float fh, i, n;
@@ -276,12 +298,12 @@ void db_save(float db, string pFilename)
        fclose(fh);
 }
 
-float db_create()
+int db_create()
 {
        return buf_create();
 }
 
-float db_load(string pFilename)
+int db_load(string pFilename)
 {
        float db, fh, i, j, n;
        string l;
@@ -346,14 +368,14 @@ void db_close(float db)
 string db_get(float db, string pKey)
 {
        float h;
-       h = crc16(FALSE, pKey) % DB_BUCKETS;
+       h = crc16(false, pKey) % DB_BUCKETS;
        return uri_unescape(infoget(bufstr_get(db, h), pKey));
 }
 
 void db_put(float db, string pKey, string pValue)
 {
        float h;
-       h = crc16(FALSE, pKey) % DB_BUCKETS;
+       h = crc16(false, pKey) % DB_BUCKETS;
        bufstr_set(db, h, infoadd(bufstr_get(db, h), pKey, uri_escape(pValue)));
 }
 
@@ -373,7 +395,7 @@ void db_test()
 }
 
 // Multiline text file buffers
-float buf_load(string pFilename)
+int buf_load(string pFilename)
 {
        float buf, fh, i;
        string l;
@@ -446,7 +468,7 @@ string mmssss(float hundredths)
        return strcat(ftos(minutes), ":", substring(s, 1, 2), ".", substring(s, 3, 2));
 }
 
-string ScoreString(float pFlags, float pValue)
+string ScoreString(int pFlags, float pValue)
 {
        string valstr;
        float l;
@@ -478,19 +500,6 @@ string ScoreString(float pFlags, float pValue)
        return valstr;
 }
 
-float dotproduct(vector a, vector b)
-{
-       return a_x * b_x + a_y * b_y + a_z * b_z;
-}
-
-vector cross(vector a, vector b)
-{
-       return
-               '1 0 0' * (a_y * b_z - a_z * b_y)
-       +       '0 1 0' * (a_z * b_x - a_x * b_z)
-       +       '0 0 1' * (a_x * b_y - a_y * b_x);
-}
-
 // compressed vector format:
 // like MD3, just even shorter
 //   4 bit pitch (16 angles), 0 is -90, 8 is 0, 16 would be 90
@@ -505,7 +514,7 @@ float lengthLogTable[128];
 
 float invertLengthLog(float x)
 {
-       float l, r, m, lerr, rerr;
+       int l, r, m;
 
        if(x >= lengthLogTable[127])
                return 127;
@@ -525,41 +534,40 @@ float invertLengthLog(float x)
        }
 
        // now: r is >=, l is <
-       lerr = (x - lengthLogTable[l]);
-       rerr = (lengthLogTable[r] - x);
+       float lerr = (x - lengthLogTable[l]);
+       float rerr = (lengthLogTable[r] - x);
        if(lerr < rerr)
                return l;
        return r;
 }
 
-vector decompressShortVector(float data)
+vector decompressShortVector(int data)
 {
        vector out;
-       float p, y, len;
        if(data == 0)
                return '0 0 0';
-       p   = (data & 0xF000) / 0x1000;
-       y   = (data & 0x0F80) / 0x80;
-       len = (data & 0x007F);
+       float p = (data & 0xF000) / 0x1000;
+       float y = (data & 0x0F80) / 0x80;
+       int len = (data & 0x007F);
 
        //print("\ndecompress: p ", ftos(p)); print("y ", ftos(y)); print("len ", ftos(len), "\n");
 
        if(p == 0)
        {
-               out_x = 0;
-               out_y = 0;
+               out.x = 0;
+               out.y = 0;
                if(y == 31)
-                       out_z = -1;
+                       out.z = -1;
                else
-                       out_z = +1;
+                       out.z = +1;
        }
        else
        {
                y   = .19634954084936207740 * y;
                p = .19634954084936207740 * p - 1.57079632679489661922;
-               out_x = cos(y) *  cos(p);
-               out_y = sin(y) *  cos(p);
-               out_z =          -sin(p);
+               out.x = cos(y) *  cos(p);
+               out.y = sin(y) *  cos(p);
+               out.z =          -sin(p);
        }
 
        //print("decompressed: ", vtos(out), "\n");
@@ -575,23 +583,23 @@ float compressShortVector(vector vec)
                return 0;
        //print("compress: ", vtos(vec), "\n");
        ang = vectoangles(vec);
-       ang_x = -ang_x;
-       if(ang_x < -90)
-               ang_x += 360;
-       if(ang_x < -90 && ang_x > +90)
+       ang.x = -ang.x;
+       if(ang.x < -90)
+               ang.x += 360;
+       if(ang.x < -90 && ang.x > +90)
                error("BOGUS vectoangles");
        //print("angles: ", vtos(ang), "\n");
 
-       p = floor(0.5 + (ang_x + 90) * 16 / 180) & 15; // -90..90 to 0..14
+       p = floor(0.5 + (ang.x + 90) * 16 / 180) & 15; // -90..90 to 0..14
        if(p == 0)
        {
-               if(vec_z < 0)
+               if(vec.z < 0)
                        y = 31;
                else
                        y = 30;
        }
        else
-               y = floor(0.5 + ang_y * 32 / 360)          & 31; // 0..360 to 0..32
+               y = floor(0.5 + ang.y * 32 / 360)          & 31; // 0..360 to 0..32
        len = invertLengthLog(vlen(vec));
 
        //print("compressed: p ", ftos(p)); print("y ", ftos(y)); print("len ", ftos(len), "\n");
@@ -601,9 +609,9 @@ float compressShortVector(vector vec)
 
 void compressShortVector_init()
 {
-       float l, f, i;
-       l = 1;
-       f = pow(2, 1/8);
+       float l = 1;
+       float f = pow(2, 1/8);
+       int i;
        for(i = 0; i < 128; ++i)
        {
                lengthLogTable[i] = l;
@@ -629,18 +637,18 @@ void compressShortVector_init()
 #ifndef MENUQC
 float CheckWireframeBox(entity forent, vector v0, vector dvx, vector dvy, vector dvz)
 {
-       traceline(v0, v0 + dvx, TRUE, forent); if(trace_fraction < 1) return 0;
-       traceline(v0, v0 + dvy, TRUE, forent); if(trace_fraction < 1) return 0;
-       traceline(v0, v0 + dvz, TRUE, forent); if(trace_fraction < 1) return 0;
-       traceline(v0 + dvx, v0 + dvx + dvy, TRUE, forent); if(trace_fraction < 1) return 0;
-       traceline(v0 + dvx, v0 + dvx + dvz, TRUE, forent); if(trace_fraction < 1) return 0;
-       traceline(v0 + dvy, v0 + dvy + dvx, TRUE, forent); if(trace_fraction < 1) return 0;
-       traceline(v0 + dvy, v0 + dvy + dvz, TRUE, forent); if(trace_fraction < 1) return 0;
-       traceline(v0 + dvz, v0 + dvz + dvx, TRUE, forent); if(trace_fraction < 1) return 0;
-       traceline(v0 + dvz, v0 + dvz + dvy, TRUE, forent); if(trace_fraction < 1) return 0;
-       traceline(v0 + dvx + dvy, v0 + dvx + dvy + dvz, TRUE, forent); if(trace_fraction < 1) return 0;
-       traceline(v0 + dvx + dvz, v0 + dvx + dvy + dvz, TRUE, forent); if(trace_fraction < 1) return 0;
-       traceline(v0 + dvy + dvz, v0 + dvx + dvy + dvz, TRUE, forent); if(trace_fraction < 1) return 0;
+       traceline(v0, v0 + dvx, true, forent); if(trace_fraction < 1) return 0;
+       traceline(v0, v0 + dvy, true, forent); if(trace_fraction < 1) return 0;
+       traceline(v0, v0 + dvz, true, forent); if(trace_fraction < 1) return 0;
+       traceline(v0 + dvx, v0 + dvx + dvy, true, forent); if(trace_fraction < 1) return 0;
+       traceline(v0 + dvx, v0 + dvx + dvz, true, forent); if(trace_fraction < 1) return 0;
+       traceline(v0 + dvy, v0 + dvy + dvx, true, forent); if(trace_fraction < 1) return 0;
+       traceline(v0 + dvy, v0 + dvy + dvz, true, forent); if(trace_fraction < 1) return 0;
+       traceline(v0 + dvz, v0 + dvz + dvx, true, forent); if(trace_fraction < 1) return 0;
+       traceline(v0 + dvz, v0 + dvz + dvy, true, forent); if(trace_fraction < 1) return 0;
+       traceline(v0 + dvx + dvy, v0 + dvx + dvy + dvz, true, forent); if(trace_fraction < 1) return 0;
+       traceline(v0 + dvx + dvz, v0 + dvx + dvy + dvz, true, forent); if(trace_fraction < 1) return 0;
+       traceline(v0 + dvy + dvz, v0 + dvx + dvy + dvz, true, forent); if(trace_fraction < 1) return 0;
        return 1;
 }
 #endif
@@ -764,7 +772,7 @@ void get_mi_min_max(float mode)
        mi_min = mi;
        mi_max = ma;
        MapInfo_Get_ByName(mi_shortname, 0, 0);
-       if(MapInfo_Map_mins_x < MapInfo_Map_maxs_x)
+       if(MapInfo_Map_mins.x < MapInfo_Map_maxs.x)
        {
                mi_min = MapInfo_Map_mins;
                mi_max = MapInfo_Map_maxs;
@@ -775,59 +783,59 @@ void get_mi_min_max(float mode)
                if(mode)
                {
                        // be clever
-                       tracebox('1 0 0' * mi_x,
-                                        '0 1 0' * mi_y + '0 0 1' * mi_z,
-                                        '0 1 0' * ma_y + '0 0 1' * ma_z,
-                                        '1 0 0' * ma_x,
+                       tracebox('1 0 0' * mi.x,
+                                        '0 1 0' * mi.y + '0 0 1' * mi.z,
+                                        '0 1 0' * ma.y + '0 0 1' * ma.z,
+                                        '1 0 0' * ma.x,
                                         MOVE_WORLDONLY,
                                         world);
                        if(!trace_startsolid)
-                               mi_min_x = trace_endpos_x;
+                               mi_min.x = trace_endpos.x;
 
-                       tracebox('0 1 0' * mi_y,
-                                        '1 0 0' * mi_x + '0 0 1' * mi_z,
-                                        '1 0 0' * ma_x + '0 0 1' * ma_z,
-                                        '0 1 0' * ma_y,
+                       tracebox('0 1 0' * mi.y,
+                                        '1 0 0' * mi.x + '0 0 1' * mi.z,
+                                        '1 0 0' * ma.x + '0 0 1' * ma.z,
+                                        '0 1 0' * ma.y,
                                         MOVE_WORLDONLY,
                                         world);
                        if(!trace_startsolid)
-                               mi_min_y = trace_endpos_y;
+                               mi_min.y = trace_endpos.y;
 
-                       tracebox('0 0 1' * mi_z,
-                                        '1 0 0' * mi_x + '0 1 0' * mi_y,
-                                        '1 0 0' * ma_x + '0 1 0' * ma_y,
-                                        '0 0 1' * ma_z,
+                       tracebox('0 0 1' * mi.z,
+                                        '1 0 0' * mi.x + '0 1 0' * mi.y,
+                                        '1 0 0' * ma.x + '0 1 0' * ma.y,
+                                        '0 0 1' * ma.z,
                                         MOVE_WORLDONLY,
                                         world);
                        if(!trace_startsolid)
-                               mi_min_z = trace_endpos_z;
+                               mi_min.z = trace_endpos.z;
 
-                       tracebox('1 0 0' * ma_x,
-                                        '0 1 0' * mi_y + '0 0 1' * mi_z,
-                                        '0 1 0' * ma_y + '0 0 1' * ma_z,
-                                        '1 0 0' * mi_x,
+                       tracebox('1 0 0' * ma.x,
+                                        '0 1 0' * mi.y + '0 0 1' * mi.z,
+                                        '0 1 0' * ma.y + '0 0 1' * ma.z,
+                                        '1 0 0' * mi.x,
                                         MOVE_WORLDONLY,
                                         world);
                        if(!trace_startsolid)
-                               mi_max_x = trace_endpos_x;
+                               mi_max.x = trace_endpos.x;
 
-                       tracebox('0 1 0' * ma_y,
-                                        '1 0 0' * mi_x + '0 0 1' * mi_z,
-                                        '1 0 0' * ma_x + '0 0 1' * ma_z,
-                                        '0 1 0' * mi_y,
+                       tracebox('0 1 0' * ma.y,
+                                        '1 0 0' * mi.x + '0 0 1' * mi.z,
+                                        '1 0 0' * ma.x + '0 0 1' * ma.z,
+                                        '0 1 0' * mi.y,
                                         MOVE_WORLDONLY,
                                         world);
                        if(!trace_startsolid)
-                               mi_max_y = trace_endpos_y;
+                               mi_max.y = trace_endpos.y;
 
-                       tracebox('0 0 1' * ma_z,
-                                        '1 0 0' * mi_x + '0 1 0' * mi_y,
-                                        '1 0 0' * ma_x + '0 1 0' * ma_y,
-                                        '0 0 1' * mi_z,
+                       tracebox('0 0 1' * ma.z,
+                                        '1 0 0' * mi.x + '0 1 0' * mi.y,
+                                        '1 0 0' * ma.x + '0 1 0' * ma.y,
+                                        '0 0 1' * mi.z,
                                         MOVE_WORLDONLY,
                                         world);
                        if(!trace_startsolid)
-                               mi_max_z = trace_endpos_z;
+                               mi_max.z = trace_endpos.z;
                }
        }
 }
@@ -844,15 +852,15 @@ void get_mi_min_max_texcoords(float mode)
        // extend mi_picmax to get a square aspect ratio
        // center the map in that area
        extend = mi_picmax - mi_picmin;
-       if(extend_y > extend_x)
+       if(extend.y > extend.x)
        {
-               mi_picmin_x -= (extend_y - extend_x) * 0.5;
-               mi_picmax_x += (extend_y - extend_x) * 0.5;
+               mi_picmin.x -= (extend.y - extend.x) * 0.5;
+               mi_picmax.x += (extend.y - extend.x) * 0.5;
        }
        else
        {
-               mi_picmin_y -= (extend_x - extend_y) * 0.5;
-               mi_picmax_y += (extend_x - extend_y) * 0.5;
+               mi_picmin.y -= (extend.x - extend.y) * 0.5;
+               mi_picmax.y += (extend.x - extend.y) * 0.5;
        }
 
        // add another some percent
@@ -863,10 +871,10 @@ void get_mi_min_max_texcoords(float mode)
        // calculate the texcoords
        mi_pictexcoord0 = mi_pictexcoord1 = mi_pictexcoord2 = mi_pictexcoord3 = '0 0 0';
        // first the two corners of the origin
-       mi_pictexcoord0_x = (mi_min_x - mi_picmin_x) / (mi_picmax_x - mi_picmin_x);
-       mi_pictexcoord0_y = (mi_min_y - mi_picmin_y) / (mi_picmax_y - mi_picmin_y);
-       mi_pictexcoord2_x = (mi_max_x - mi_picmin_x) / (mi_picmax_x - mi_picmin_x);
-       mi_pictexcoord2_y = (mi_max_y - mi_picmin_y) / (mi_picmax_y - mi_picmin_y);
+       mi_pictexcoord0_x = (mi_min.x - mi_picmin.x) / (mi_picmax.x - mi_picmin.x);
+       mi_pictexcoord0_y = (mi_min.y - mi_picmin.y) / (mi_picmax.y - mi_picmin.y);
+       mi_pictexcoord2_x = (mi_max.x - mi_picmin.x) / (mi_picmax.x - mi_picmin.x);
+       mi_pictexcoord2_y = (mi_max.y - mi_picmin.y) / (mi_picmax.y - mi_picmin.y);
        // then the other corners
        mi_pictexcoord1_x = mi_pictexcoord0_x;
        mi_pictexcoord1_y = mi_pictexcoord2_y;
@@ -938,8 +946,8 @@ float almost_equals(float a, float b)
        float eps;
        eps = (max(a, -a) + max(b, -b)) * 0.001;
        if(a - b < eps && b - a < eps)
-               return TRUE;
-       return FALSE;
+               return true;
+       return false;
 }
 
 float almost_in_bounds(float a, float b, float c)
@@ -1034,17 +1042,17 @@ float rgb_mi_ma_to_hue(vector rgb, float mi, float ma)
 {
        if(mi == ma)
                return 0;
-       else if(ma == rgb_x)
+       else if(ma == rgb.x)
        {
-               if(rgb_y >= rgb_z)
-                       return (rgb_y - rgb_z) / (ma - mi);
+               if(rgb.y >= rgb.z)
+                       return (rgb.y - rgb.z) / (ma - mi);
                else
-                       return (rgb_y - rgb_z) / (ma - mi) + 6;
+                       return (rgb.y - rgb.z) / (ma - mi) + 6;
        }
-       else if(ma == rgb_y)
-               return (rgb_z - rgb_x) / (ma - mi) + 2;
+       else if(ma == rgb.y)
+               return (rgb.z - rgb.x) / (ma - mi) + 2;
        else // if(ma == rgb_z)
-               return (rgb_x - rgb_y) / (ma - mi) + 4;
+               return (rgb.x - rgb.y) / (ma - mi) + 4;
 }
 
 vector hue_mi_ma_to_rgb(float hue, float mi, float ma)
@@ -1057,45 +1065,45 @@ vector hue_mi_ma_to_rgb(float hue, float mi, float ma)
        //      hue = 60 * (rgb_y - rgb_z) / (ma - mi);
        if(hue <= 1)
        {
-               rgb_x = ma;
-               rgb_y = hue * (ma - mi) + mi;
-               rgb_z = mi;
+               rgb.x = ma;
+               rgb.y = hue * (ma - mi) + mi;
+               rgb.z = mi;
        }
        //else if(ma == rgb_y)
        //      hue = 60 * (rgb_z - rgb_x) / (ma - mi) + 120;
        else if(hue <= 2)
        {
-               rgb_x = (2 - hue) * (ma - mi) + mi;
-               rgb_y = ma;
-               rgb_z = mi;
+               rgb.x = (2 - hue) * (ma - mi) + mi;
+               rgb.y = ma;
+               rgb.z = mi;
        }
        else if(hue <= 3)
        {
-               rgb_x = mi;
-               rgb_y = ma;
-               rgb_z = (hue - 2) * (ma - mi) + mi;
+               rgb.x = mi;
+               rgb.y = ma;
+               rgb.z = (hue - 2) * (ma - mi) + mi;
        }
        //else // if(ma == rgb_z)
        //      hue = 60 * (rgb_x - rgb_y) / (ma - mi) + 240;
        else if(hue <= 4)
        {
-               rgb_x = mi;
-               rgb_y = (4 - hue) * (ma - mi) + mi;
-               rgb_z = ma;
+               rgb.x = mi;
+               rgb.y = (4 - hue) * (ma - mi) + mi;
+               rgb.z = ma;
        }
        else if(hue <= 5)
        {
-               rgb_x = (hue - 4) * (ma - mi) + mi;
-               rgb_y = mi;
-               rgb_z = ma;
+               rgb.x = (hue - 4) * (ma - mi) + mi;
+               rgb.y = mi;
+               rgb.z = ma;
        }
        //else if(ma == rgb_x)
        //      hue = 60 * (rgb_y - rgb_z) / (ma - mi);
        else // if(hue <= 6)
        {
-               rgb_x = ma;
-               rgb_y = mi;
-               rgb_z = (6 - hue) * (ma - mi) + mi;
+               rgb.x = ma;
+               rgb.y = mi;
+               rgb.z = (6 - hue) * (ma - mi) + mi;
        }
 
        return rgb;
@@ -1106,23 +1114,23 @@ vector rgb_to_hsv(vector rgb)
        float mi, ma;
        vector hsv;
 
-       mi = min(rgb_x, rgb_y, rgb_z);
-       ma = max(rgb_x, rgb_y, rgb_z);
+       mi = min(rgb.x, rgb.y, rgb.z);
+       ma = max(rgb.x, rgb.y, rgb.z);
 
-       hsv_x = rgb_mi_ma_to_hue(rgb, mi, ma);
-       hsv_z = ma;
+       hsv.x = rgb_mi_ma_to_hue(rgb, mi, ma);
+       hsv.z = ma;
 
        if(ma == 0)
-               hsv_y = 0;
+               hsv.y = 0;
        else
-               hsv_y = 1 - mi/ma;
+               hsv.y = 1 - mi/ma;
 
        return hsv;
 }
 
 vector hsv_to_rgb(vector hsv)
 {
-       return hue_mi_ma_to_rgb(hsv_x, hsv_z * (1 - hsv_y), hsv_z);
+       return hue_mi_ma_to_rgb(hsv.x, hsv.z * (1 - hsv.y), hsv.z);
 }
 
 vector rgb_to_hsl(vector rgb)
@@ -1130,18 +1138,18 @@ vector rgb_to_hsl(vector rgb)
        float mi, ma;
        vector hsl;
 
-       mi = min(rgb_x, rgb_y, rgb_z);
-       ma = max(rgb_x, rgb_y, rgb_z);
+       mi = min(rgb.x, rgb.y, rgb.z);
+       ma = max(rgb.x, rgb.y, rgb.z);
 
-       hsl_x = rgb_mi_ma_to_hue(rgb, mi, ma);
+       hsl.x = rgb_mi_ma_to_hue(rgb, mi, ma);
 
-       hsl_z = 0.5 * (mi + ma);
+       hsl.z = 0.5 * (mi + ma);
        if(mi == ma)
-               hsl_y = 0;
-       else if(hsl_z <= 0.5)
-               hsl_y = (ma - mi) / (2*hsl_z);
+               hsl.y = 0;
+       else if(hsl.z <= 0.5)
+               hsl.y = (ma - mi) / (2*hsl.z);
        else // if(hsl_z > 0.5)
-               hsl_y = (ma - mi) / (2 - 2*hsl_z);
+               hsl.y = (ma - mi) / (2 - 2*hsl.z);
 
        return hsl;
 }
@@ -1150,17 +1158,17 @@ vector hsl_to_rgb(vector hsl)
 {
        float mi, ma, maminusmi;
 
-       if(hsl_z <= 0.5)
-               maminusmi = hsl_y * 2 * hsl_z;
+       if(hsl.z <= 0.5)
+               maminusmi = hsl.y * 2 * hsl.z;
        else
-               maminusmi = hsl_y * (2 - 2 * hsl_z);
+               maminusmi = hsl.y * (2 - 2 * hsl.z);
 
        // hsl_z     = 0.5 * mi + 0.5 * ma
        // maminusmi =     - mi +       ma
-       mi = hsl_z - 0.5 * maminusmi;
-       ma = hsl_z + 0.5 * maminusmi;
+       mi = hsl.z - 0.5 * maminusmi;
+       ma = hsl.z + 0.5 * maminusmi;
 
-       return hue_mi_ma_to_rgb(hsl_x, mi, ma);
+       return hue_mi_ma_to_rgb(hsl.x, mi, ma);
 }
 
 string rgb_to_hexcolor(vector rgb)
@@ -1168,9 +1176,9 @@ string rgb_to_hexcolor(vector rgb)
        return
                strcat(
                        "^x",
-                       DEC_TO_HEXDIGIT(floor(rgb_x * 15 + 0.5)),
-                       DEC_TO_HEXDIGIT(floor(rgb_y * 15 + 0.5)),
-                       DEC_TO_HEXDIGIT(floor(rgb_z * 15 + 0.5))
+                       DEC_TO_HEXDIGIT(floor(rgb.x * 15 + 0.5)),
+                       DEC_TO_HEXDIGIT(floor(rgb.y * 15 + 0.5)),
+                       DEC_TO_HEXDIGIT(floor(rgb.z * 15 + 0.5))
                );
 }
 
@@ -1178,7 +1186,7 @@ string rgb_to_hexcolor(vector rgb)
 float boxesoverlap(vector m1, vector m2, vector m3, vector m4) {return m2_x >= m3_x && m1_x <= m4_x && m2_y >= m3_y && m1_y <= m4_y && m2_z >= m3_z && m1_z <= m4_z;}
 
 // requires the same, but is a stronger condition
-float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs) {return smins_x >= bmins_x && smaxs_x <= bmaxs_x && smins_y >= bmins_y && smaxs_y <= bmaxs_y && smins_z >= bmins_z && smaxs_z <= bmaxs_z;}
+float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs) {return smins.x >= bmins.x && smaxs.x <= bmaxs.x && smins.y >= bmins.y && smaxs.y <= bmaxs.y && smins.z >= bmins.z && smaxs.z <= bmaxs.z;}
 
 #ifndef MENUQC
 #endif
@@ -1313,17 +1321,17 @@ float textLengthUpToLength(string theText, float maxWidth, textLengthUpToLength_
 
 string find_last_color_code(string s)
 {
-       float start, len, i, carets;
-       start = strstrofs(s, "^", 0);
+       int start = strstrofs(s, "^", 0);
        if (start == -1) // no caret found
                return "";
-       len = strlen(s)-1;
+       int len = strlen(s)-1;
+       int i;
        for(i = len; i >= start; --i)
        {
                if(substring(s, i, 1) != "^")
                        continue;
 
-               carets = 1;
+               int carets = 1;
                while (i-carets >= start && substring(s, i-carets, 1) == "^")
                        ++carets;
 
@@ -1571,15 +1579,15 @@ vector solve_quadratic(float a, float b, float c) // ax^2 + bx + c = 0
        {
                if(b != 0)
                {
-                       v_x = v_y = -c / b;
-                       v_z = 1;
+                       v.x = v.y = -c / b;
+                       v.z = 1;
                }
                else
                {
                        if(c == 0)
                        {
                                // actually, every number solves the equation!
-                               v_z = 1;
+                               v.z = 1;
                        }
                }
        }
@@ -1591,26 +1599,26 @@ vector solve_quadratic(float a, float b, float c) // ax^2 + bx + c = 0
                        D = sqrt(D);
                        if(a > 0) // put the smaller solution first
                        {
-                               v_x = ((-b)-D) / (2*a);
-                               v_y = ((-b)+D) / (2*a);
+                               v.x = ((-b)-D) / (2*a);
+                               v.y = ((-b)+D) / (2*a);
                        }
                        else
                        {
-                               v_x = (-b+D) / (2*a);
-                               v_y = (-b-D) / (2*a);
+                               v.x = (-b+D) / (2*a);
+                               v.y = (-b-D) / (2*a);
                        }
-                       v_z = 1;
+                       v.z = 1;
                }
                else
                {
                        // complex solutions!
                        D = sqrt(-D);
-                       v_x = -b / (2*a);
+                       v.x = -b / (2*a);
                        if(a > 0)
-                               v_y =  D / (2*a);
+                               v.y =  D / (2*a);
                        else
-                               v_y = -D / (2*a);
-                       v_z = 0;
+                               v.y = -D / (2*a);
+                       v.z = 0;
                }
        }
        return v;
@@ -1634,7 +1642,7 @@ vector solve_shotdirection(vector myorg, vector myvel, vector eorg, vector evel,
        vector solution = solve_quadratic(evel * evel - spd * spd, 2 * (eorg * evel), eorg * eorg);
        // p = 2 * (eorg * evel) / (evel * evel - spd * spd)
        // q = (eorg * eorg) / (evel * evel - spd * spd)
-       if(!solution_z) // no real solution
+       if(!solution.z) // no real solution
        {
                // happens if D < 0
                // (eorg * evel)^2 < (evel^2 - spd^2) * eorg^2
@@ -1645,17 +1653,17 @@ vector solve_shotdirection(vector myorg, vector myvel, vector eorg, vector evel,
                // spd < |evel| * sin angle(evel, eorg)
                return '0 0 0';
        }
-       else if(solution_x > 0)
+       else if(solution.x > 0)
        {
                // both solutions > 0: take the smaller one
                // happens if p < 0 and q > 0
-               ret = normalize(eorg + solution_x * evel);
+               ret = normalize(eorg + solution.x * evel);
        }
-       else if(solution_y > 0)
+       else if(solution.y > 0)
        {
                // one solution > 0: take the larger one
                // happens if q < 0 or q == 0 and p < 0
-               ret = normalize(eorg + solution_y * evel);
+               ret = normalize(eorg + solution.y * evel);
        }
        else
        {
@@ -1702,12 +1710,12 @@ vector get_shotvelocity(vector myvel, vector mydir, float spd, float newton_styl
                vector solution = solve_quadratic(1, -2 * (mydir * myvel), myvel * myvel - spd * spd);
 
                float outspeed;
-               if(solution_z)
-                       outspeed = solution_y; // the larger one
+               if(solution.z)
+                       outspeed = solution.y; // the larger one
                else
                {
                        //outspeed = 0; // slowest possible shot
-                       outspeed = solution_x; // the real part (that is, the average!)
+                       outspeed = solution.x; // the real part (that is, the average!)
                        //dprint("impossible shot, adjusting\n");
                }
 
@@ -1722,9 +1730,9 @@ vector get_shotvelocity(vector myvel, vector mydir, float spd, float newton_styl
 float compressShotOrigin(vector v)
 {
        float x, y, z;
-       x = rint(v_x * 2);
-       y = rint(v_y * 4) + 128;
-       z = rint(v_z * 4) + 128;
+       x = rint(v.x * 2);
+       y = rint(v.y * 4) + 128;
+       z = rint(v.z * 4) + 128;
        if(x > 255 || x < 0)
        {
                print("shot origin ", vtos(v), " x out of bounds\n");
@@ -1742,12 +1750,12 @@ float compressShotOrigin(vector v)
        }
        return x * 0x10000 + y * 0x100 + z;
 }
-vector decompressShotOrigin(float f)
+vector decompressShotOrigin(int f)
 {
        vector v;
-       v_x = ((f & 0xFF0000) / 0x10000) / 2;
-       v_y = ((f & 0xFF00) / 0x100 - 128) / 4;
-       v_z = ((f & 0xFF) - 128) / 4;
+       v.x = ((f & 0xFF0000) / 0x10000) / 2;
+       v.y = ((f & 0xFF00) / 0x100 - 128) / 4;
+       v.z = ((f & 0xFF) - 128) / 4;
        return v;
 }
 
@@ -1845,16 +1853,16 @@ vector healtharmor_maxdamage(float h, float a, float armorblock, float deathtype
        healthdamage = (h - 1) / (1 - armorblock); // damage we can take if we could use more health
        armordamage = a + (h - 1); // damage we can take if we could use more armor
        armorideal = healthdamage * armorblock;
-       v_y = armorideal;
+       v.y = armorideal;
        if(armordamage < healthdamage)
        {
-               v_x = armordamage;
-               v_z = 1;
+               v.x = armordamage;
+               v.z = 1;
        }
        else
        {
-               v_x = healthdamage;
-               v_z = 0;
+               v.x = healthdamage;
+               v.z = 0;
        }
        return v;
 }
@@ -1864,9 +1872,9 @@ vector healtharmor_applydamage(float a, float armorblock, float deathtype, float
        vector v;
        if (deathtype == DEATH_DROWN)  // Why should armor help here...
                armorblock = 0;
-       v_y = bound(0, damage * armorblock, a); // save
-       v_x = bound(0, damage - v_y, damage); // take
-       v_z = 0;
+       v.y = bound(0, damage * armorblock, a); // save
+       v.x = bound(0, damage - v.y, damage); // take
+       v.z = 0;
        return v;
 }
 #endif
@@ -1885,27 +1893,26 @@ string getcurrentmod()
 
 #ifndef MENUQC
 #ifdef CSQC
-float ReadInt24_t()
+int ReadInt24_t()
 {
-       float v;
-       v = ReadShort() * 256; // note: this is signed
+       int v = ReadShort() * 256; // note: this is signed
        v += ReadByte(); // note: this is unsigned
        return v;
 }
 vector ReadInt48_t()
 {
        vector v;
-       v_x = ReadInt24_t();
-       v_y = ReadInt24_t();
-       v_z = 0;
+       v.x = ReadInt24_t();
+       v.y = ReadInt24_t();
+       v.z = 0;
        return v;
 }
 vector ReadInt72_t()
 {
        vector v;
-       v_x = ReadInt24_t();
-       v_y = ReadInt24_t();
-       v_z = ReadInt24_t();
+       v.x = ReadInt24_t();
+       v.y = ReadInt24_t();
+       v.z = ReadInt24_t();
        return v;
 }
 #else
@@ -1917,14 +1924,14 @@ void WriteInt24_t(float dst, float val)
 }
 void WriteInt48_t(float dst, vector val)
 {
-       WriteInt24_t(dst, val_x);
-       WriteInt24_t(dst, val_y);
+       WriteInt24_t(dst, val.x);
+       WriteInt24_t(dst, val.y);
 }
 void WriteInt72_t(float dst, vector val)
 {
-       WriteInt24_t(dst, val_x);
-       WriteInt24_t(dst, val_y);
-       WriteInt24_t(dst, val_z);
+       WriteInt24_t(dst, val.x);
+       WriteInt24_t(dst, val.y);
+       WriteInt24_t(dst, val.z);
 }
 #endif
 #endif
@@ -2035,9 +2042,6 @@ string get_model_datafilename(string m, float sk, string fil)
 
 float get_model_parameters(string m, float sk)
 {
-       string fn, s, c;
-       float fh, i;
-
        get_model_parameters_modelname = string_null;
        get_model_parameters_modelskin = -1;
        get_model_parameters_name = string_null;
@@ -2048,7 +2052,7 @@ float get_model_parameters(string m, float sk)
        get_model_parameters_desc = string_null;
        get_model_parameters_bone_upperbody = string_null;
        get_model_parameters_bone_weapon = string_null;
-       for(i = 0; i < MAX_AIM_BONES; ++i)
+       for(int i = 0; i < MAX_AIM_BONES; ++i)
        {
                get_model_parameters_bone_aim[i] = string_null;
                get_model_parameters_bone_aimweight[i] = 0;
@@ -2071,8 +2075,8 @@ float get_model_parameters(string m, float sk)
                m = substring(m, 0, -7);
        }
 
-       fn = get_model_datafilename(m, sk, "txt");
-       fh = fopen(fn, FILE_READ);
+       string fn = get_model_datafilename(m, sk, "txt");
+       int fh = fopen(fn, FILE_READ);
        if(fh < 0)
        {
                sk = 0;
@@ -2084,6 +2088,7 @@ float get_model_parameters(string m, float sk)
 
        get_model_parameters_modelname = m;
        get_model_parameters_modelskin = sk;
+       string s, c;
        while((s = fgets(fh)))
        {
                if(s == "")
@@ -2115,7 +2120,7 @@ float get_model_parameters(string m, float sk)
                        get_model_parameters_bone_upperbody = s;
                if(c == "bone_weapon")
                        get_model_parameters_bone_weapon = s;
-               for(i = 0; i < MAX_AIM_BONES; ++i)
+               for(int i = 0; i < MAX_AIM_BONES; ++i)
                        if(c == strcat("bone_aim", ftos(i)))
                        {
                                get_model_parameters_bone_aimweight[i] = stof(car(s));
@@ -2140,7 +2145,7 @@ float get_model_parameters(string m, float sk)
 
 vector vec2(vector v)
 {
-       v_z = 0;
+       v.z = 0;
        return v;
 }
 
@@ -2152,9 +2157,9 @@ vector NearestPointOnBox(entity box, vector org)
        m1 = box.mins + box.origin;
        m2 = box.maxs + box.origin;
 
-       nearest_x = bound(m1_x, org_x, m2_x);
-       nearest_y = bound(m1_y, org_y, m2_y);
-       nearest_z = bound(m1_z, org_z, m2_z);
+       nearest.x = bound(m1_x, org.x, m2_x);
+       nearest.y = bound(m1_y, org.y, m2_y);
+       nearest.z = bound(m1_z, org.z, m2_z);
 
        return nearest;
 }
@@ -2258,7 +2263,7 @@ string CTX(string s)
 // x-encoding (encoding as zero length invisible string)
 const string XENCODE_2  = "xX";
 const string XENCODE_22 = "0123456789abcdefABCDEF";
-string xencode(float f)
+string xencode(int f)
 {
        float a, b, c, d;
        d = f % 22; f = floor(f / 22);
@@ -2289,7 +2294,7 @@ float xdecode(string s)
        return ((a * 22 + b) * 22 + c) * 22 + d;
 }
 
-float lowestbit(float f)
+float lowestbit(int f)
 {
        f &= ~(f * 2);
        f &= ~(f * 4);
@@ -2327,12 +2332,12 @@ float InterpretBoolean(string input)
                case "yes":
                case "true":
                case "on":
-                       return TRUE;
+                       return true;
 
                case "no":
                case "false":
                case "off":
-                       return FALSE;
+                       return false;
 
                default: return stof(input);
        }
@@ -2342,8 +2347,7 @@ float InterpretBoolean(string input)
 #ifdef CSQC
 entity ReadCSQCEntity()
 {
-       float f;
-       f = ReadShort();
+       int f = ReadShort();
        if(f == 0)
                return world;
        return findfloat(world, entnum, f);
@@ -2373,7 +2377,7 @@ void m_shutdown()
        cvar_settemp_restore(); // this must be done LAST, but in any case
 }
 
-#define APPROXPASTTIME_ACCURACY_REQUIREMENT 0.05
+const float APPROXPASTTIME_ACCURACY_REQUIREMENT = 0.05;
 #define APPROXPASTTIME_MAX (16384 * APPROXPASTTIME_ACCURACY_REQUIREMENT)
 #define APPROXPASTTIME_RANGE (64 * APPROXPASTTIME_ACCURACY_REQUIREMENT)
 // this will use the value:
@@ -2459,25 +2463,25 @@ float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float x)
 float cubic_speedfunc_is_sane(float startspeedfactor, float endspeedfactor)
 {
        if(startspeedfactor < 0 || endspeedfactor < 0)
-               return FALSE;
+               return false;
 
        /*
        // if this is the case, the possible zeros of the first derivative are outside
        // 0..1
        We can calculate this condition as condition
        if(se <= 3)
-               return TRUE;
+               return true;
        */
 
        // better, see below:
        if(startspeedfactor <= 3 && endspeedfactor <= 3)
-               return TRUE;
+               return true;
 
        // if this is the case, the first derivative has no zeros at all
        float se = startspeedfactor + endspeedfactor;
        float s_e = startspeedfactor - endspeedfactor;
        if(3 * (se - 4) * (se - 4) + s_e * s_e <= 12) // an ellipse
-               return TRUE;
+               return true;
 
        // Now let s <= 3, s <= 3, s+e >= 3 (triangle) then we get se <= 6 (top right corner).
        // we also get s_e <= 6 - se
@@ -2485,7 +2489,7 @@ float cubic_speedfunc_is_sane(float startspeedfactor, float endspeedfactor)
        // is quadratic, has value 12 at 3 and 6, and value < 12 in between.
        // Therefore, above "better" check works!
 
-       return FALSE;
+       return false;
 
        // known good cases:
        // (0, [0..3])
@@ -2539,7 +2543,7 @@ void FindConnectedComponent(entity e, .entity fld, findNextEntityNearFunction_t
        queue_end.FindConnectedComponent_processing = 1;
 
        // for each queued item:
-       for(; queue_start; queue_start = queue_start.fld)
+       for (; queue_start; queue_start = queue_start.fld)
        {
                // find all neighbors of queue_start
                entity t;
@@ -2566,7 +2570,7 @@ void FindConnectedComponent(entity e, .entity fld, findNextEntityNearFunction_t
 #ifdef SVQC
 vector combine_to_vector(float x, float y, float z)
 {
-       vector result; result_x = x; result_y = y; result_z = z;
+       vector result; result.x = x; result.y = y; result.z = z;
        return result;
 }
 
@@ -2574,14 +2578,14 @@ vector get_corner_position(entity box, float corner)
 {
        switch(corner)
        {
-               case 1: return combine_to_vector(box.absmin_x, box.absmin_y, box.absmin_z);
-               case 2: return combine_to_vector(box.absmax_x, box.absmin_y, box.absmin_z);
-               case 3: return combine_to_vector(box.absmin_x, box.absmax_y, box.absmin_z);
-               case 4: return combine_to_vector(box.absmin_x, box.absmin_y, box.absmax_z);
-               case 5: return combine_to_vector(box.absmax_x, box.absmax_y, box.absmin_z);
-               case 6: return combine_to_vector(box.absmin_x, box.absmax_y, box.absmax_z);
-               case 7: return combine_to_vector(box.absmax_x, box.absmin_y, box.absmax_z);
-               case 8: return combine_to_vector(box.absmax_x, box.absmax_y, box.absmax_z);
+               case 1: return combine_to_vector(box.absmin.x, box.absmin.y, box.absmin.z);
+               case 2: return combine_to_vector(box.absmax.x, box.absmin.y, box.absmin.z);
+               case 3: return combine_to_vector(box.absmin.x, box.absmax.y, box.absmin.z);
+               case 4: return combine_to_vector(box.absmin.x, box.absmin.y, box.absmax.z);
+               case 5: return combine_to_vector(box.absmax.x, box.absmax.y, box.absmin.z);
+               case 6: return combine_to_vector(box.absmin.x, box.absmax.y, box.absmax.z);
+               case 7: return combine_to_vector(box.absmax.x, box.absmin.y, box.absmax.z);
+               case 8: return combine_to_vector(box.absmax.x, box.absmax.y, box.absmax.z);
                default: return '0 0 0';
        }
 }
@@ -2635,9 +2639,9 @@ string CCR(string input)
 vector vec3(float x, float y, float z)
 {
        vector v;
-       v_x = x;
-       v_y = y;
-       v_z = z;
+       v.x = x;
+       v.y = y;
+       v.z = z;
        return v;
 }
 
@@ -2645,17 +2649,17 @@ vector vec3(float x, float y, float z)
 vector animfixfps(entity e, vector a, vector b)
 {
        // multi-frame anim: keep as-is
-       if(a_y == 1)
+       if(a.y == 1)
        {
                float dur;
-               dur = frameduration(e.modelindex, a_x);
-               if(dur <= 0 && b_y)
+               dur = frameduration(e.modelindex, a.x);
+               if(dur <= 0 && b.y)
                {
                        a = b;
-                       dur = frameduration(e.modelindex, a_x);
+                       dur = frameduration(e.modelindex, a.x);
                }
                if(dur > 0)
-                       a_z = 1.0 / dur;
+                       a.z = 1.0 / dur;
        }
        return a;
 }
@@ -2781,7 +2785,7 @@ float Announcer_PickNumber(float type, float num)
 #endif
 
 #ifndef MENUQC
-float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents)
+int Mod_Q1BSP_SuperContentsFromNativeContents(int nativecontents)
 {
        switch(nativecontents)
        {
@@ -2801,7 +2805,7 @@ float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents)
        return 0;
 }
 
-float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents)
+int Mod_Q1BSP_NativeContentsFromSuperContents(int supercontents)
 {
        if(supercontents & (DPCONTENTS_SOLID | DPCONTENTS_BODY))
                return CONTENT_SOLID;
index 65b4e67a427b5eca7ba99208d874cec288d466be..b2cdf8dcaf2232be15fb675e2140d4018d686b64 100644 (file)
@@ -1,11 +1,7 @@
-// commonly used, but better make them macros
-#define TRUE 1
-#define FALSE 0
+#ifndef COMMON_UTIL_H
+#define COMMON_UTIL_H
 
-// a dummy macro that prevents the "hanging ;" warning
-#define ENDS_WITH_CURLY_BRACE
-
-#ifdef GMQCC
+#ifdef QCC_SUPPORT_ACCUMULATE
 # define ACCUMULATE_FUNCTION(func,otherfunc) \
        [[accumulate]] void func() { otherfunc(); }
 # define CALL_ACCUMULATED_FUNCTION(func) \
@@ -78,7 +74,7 @@ float median(float a, float b, float c);
 // works for up to 10 decimals!
 string ftos_decimals(float number, float decimals);
 
-float fexists(string f);
+bool fexists(string f);
 
 vector colormapPaletteColor(float c, float isPants);
 
@@ -86,25 +82,25 @@ vector colormapPaletteColor(float c, float isPants);
 string fstrunzone(string s);
 
 // database (NOTE: keys are case sensitive)
-void db_save(float db, string filename);
-void db_dump(float db, string pFilename);
-float db_create();
-float db_load(string filename);
-void db_close(float db);
-string db_get(float db, string key);
-void db_put(float db, string key, string value);
+void db_save(int db, string filename);
+void db_dump(int db, string pFilename);
+int db_create();
+int db_load(string filename);
+void db_close(int db);
+string db_get(int db, string key);
+void db_put(int db, string key, string value);
 
 // stringbuffer loading/saving
-float buf_load(string filename);
-void buf_save(float buf, string filename);
+int buf_load(string filename);
+void buf_save(int buf, string filename);
 
 #define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.4)
 string format_time(float seconds);
 string mmsss(float t);
 string mmssss(float t);
 
-#define TIME_DECIMALS 2
-#define TIME_FACTOR 100
+const float TIME_DECIMALS = 2;
+const float TIME_FACTOR = 100;
 #define TIME_ENCODED_TOSTRING(n) mmssss(n)
 #define RACE_RECORD "/race100record/"
 #define CTS_RECORD "/cts100record/"
@@ -113,9 +109,6 @@ string mmssss(float t);
 
 string ScoreString(float vflags, float value);
 
-float dotproduct(vector a, vector b);
-vector cross(vector a, vector b);
-
 void compressShortVector_init();
 vector decompressShortVector(float data);
 float compressShortVector(vector vec);
@@ -229,7 +222,7 @@ string getcurrentmod();
 
 #ifndef MENUQC
 #ifdef CSQC
-float ReadInt24_t();
+int ReadInt24_t();
 vector ReadInt48_t();
 vector ReadInt72_t();
 #else
@@ -240,12 +233,12 @@ void WriteInt72_t(float dest, vector val);
 #endif
 
 // the NULL function
-#ifdef GMQCC
+#ifdef QCC_SUPPORT_NIL
 #define func_null nil
 #define string_null nil
 #else
 var void func_null(void);
-var string string_null;
+string string_null;
 #endif
 float float2range11(float f);
 float float2range01(float f);
@@ -269,7 +262,7 @@ float get_model_parameters_age;
 string get_model_parameters_description;
 string get_model_parameters_bone_upperbody;
 string get_model_parameters_bone_weapon;
-#define MAX_AIM_BONES 4
+const int MAX_AIM_BONES = 4;
 string get_model_parameters_bone_aim[MAX_AIM_BONES];
 float get_model_parameters_bone_aimweight[MAX_AIM_BONES];
 float get_model_parameters_fixbone;
@@ -378,16 +371,16 @@ void backtrace(string msg);
 
 // color code replace, place inside of sprintf and parse the string... defaults described as constants
 // foreground/normal colors
-var string autocvar_hud_colorset_foreground_1 = "2"; // F1 - Green  // primary priority (important names, etc)
-var string autocvar_hud_colorset_foreground_2 = "3"; // F2 - Yellow // secondary priority (items, locations, numbers, etc)
-var string autocvar_hud_colorset_foreground_3 = "4"; // F3 - Blue   // tertiary priority or relatively inconsequential text
-var string autocvar_hud_colorset_foreground_4 = "1"; // F4 - Red    // notice/attention grabbing texting
+string autocvar_hud_colorset_foreground_1 = "2"; // F1 - Green  // primary priority (important names, etc)
+string autocvar_hud_colorset_foreground_2 = "3"; // F2 - Yellow // secondary priority (items, locations, numbers, etc)
+string autocvar_hud_colorset_foreground_3 = "4"; // F3 - Blue   // tertiary priority or relatively inconsequential text
+string autocvar_hud_colorset_foreground_4 = "1"; // F4 - Red    // notice/attention grabbing texting
 // "kill" colors
-var string autocvar_hud_colorset_kill_1 = "1"; // K1 - Red    // "bad" or "dangerous" text (death messages against you, kill notifications, etc)
-var string autocvar_hud_colorset_kill_2 = "3"; // K2 - Yellow // similar to above, but less important... OR, a highlight out of above message type
-var string autocvar_hud_colorset_kill_3 = "4"; // K3 - Blue   // "good" or "beneficial" text (you fragging someone, etc)
+string autocvar_hud_colorset_kill_1 = "1"; // K1 - Red    // "bad" or "dangerous" text (death messages against you, kill notifications, etc)
+string autocvar_hud_colorset_kill_2 = "3"; // K2 - Yellow // similar to above, but less important... OR, a highlight out of above message type
+string autocvar_hud_colorset_kill_3 = "4"; // K3 - Blue   // "good" or "beneficial" text (you fragging someone, etc)
 // background color
-var string autocvar_hud_colorset_background = "7"; // BG - White // neutral/unimportant text
+string autocvar_hud_colorset_background = "7"; // BG - White // neutral/unimportant text
 
 string CCR(string input);
 
@@ -427,18 +420,18 @@ void dedicated_print(string input);
 #endif
 
 #ifndef MENUQC
-#define CNT_NORMAL 1
-#define CNT_GAMESTART 2
-#define CNT_IDLE 3
-#define CNT_KILL 4
-#define CNT_RESPAWN 5
-#define CNT_ROUNDSTART 6
+const float CNT_NORMAL = 1;
+const float CNT_GAMESTART = 2;
+const float CNT_IDLE = 3;
+const float CNT_KILL = 4;
+const float CNT_RESPAWN = 5;
+const float CNT_ROUNDSTART = 6;
 float Announcer_PickNumber(float type, float num);
 #endif
 
 #ifndef MENUQC
-float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents);
-float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents);
+int Mod_Q1BSP_SuperContentsFromNativeContents(int nativecontents);
+int Mod_Q1BSP_NativeContentsFromSuperContents(int supercontents);
 #endif
 
 // Quadratic splines (bezier)
@@ -448,4 +441,5 @@ vector bezier_quadratic_getderivative(vector a, vector p, vector b, float t);
 #define APPEND_TO_STRING(list,sep,add) ((list) = (((list) != "") ? strcat(list, sep, add) : (add)))
 
 // Returns the correct difference between two always increasing numbers
-#define COMPARE_INCREASING(to,from) (to < from ? from + to + 2 : to - from)
\ No newline at end of file
+#define COMPARE_INCREASING(to,from) (to < from ? from + to + 2 : to - from)
+#endif
index 4f4cd2b3d8f35a7bf82d3f2fdda523034f1f9475..b4ee1e25d9608d7d428cb22d9063413853b0da67 100644 (file)
@@ -1,3 +1,14 @@
+// TODO: include once
+//#ifndef WEAPONS_ALL_H
+//#define WEAPONS_ALL_H
+
+#include "../util.qh"
+
+#ifdef SVQC
+#   include "config.qh"
+#   include "../../server/bot/aim.qh"
+#endif
+
 // ONLY EVER ADD NEW WEAPONS AT THE END. IF YOU REMOVE ONE, PUT THE LAST ONE ON
 // ITS PLACE. THIS IS TO AVOID UNNECESSARY RENUMBERING OF WEAPON IMPULSES.
 // IF YOU DISREGARD THIS NOTICE, I'LL KILL YOU WITH THE @!#%'N TUBA
@@ -27,3 +38,5 @@
 #include "w_arc.qc"
 #include "w_hmg.qc"
 #include "w_rpc.qc"
+
+//#endif
index 7bc64e0b5371c0ddf3fb007257f5f6af34c25480..46bb8a6d45d465879915690e1ef4d51383800903 100644 (file)
@@ -129,16 +129,16 @@ vector solve_cubic_abcd(float a, float b, float c, float d)
        v = solve_cubic_pq(p, q);
        v = (v -  b * '1 1 1') * (1.0 / (3.0 * a));
        if(a < 0)
-               v += '1 0 -1' * (v_z - v_x); // swap x, z
+               v += '1 0 -1' * (v.z - v.x); // swap x, z
        return v;
 }
 
 vector findperpendicular(vector v)
 {
        vector p;
-       p_x = v_z;
-       p_y = -v_x;
-       p_z = v_y;
+       p.x = v.z;
+       p.y = -v.x;
+       p.z = v.y;
        return normalize(cliptoplane(p, v));
 }
 
@@ -152,7 +152,7 @@ vector W_CalculateSpread(vector forward, float spread, float spreadfactor, float
        if(spread <= 0)
                return forward;
        sstyle = spreadstyle; //autocvar_g_projectiles_spread_style;
-       
+
        if(sstyle == 0)
        {
                // this is the baseline for the spread value!
index 9a6dd1c547a78c2972d950d95fccf1c03c9aeeb4..d91d22c67c2c0491c9da5bad2b5d2d09ad034aae 100644 (file)
@@ -1,2 +1,5 @@
+#ifndef CALCULATIONS_H
+#define CALCULATIONS_H
 vector damage_explosion_calcpush(vector explosion_f, vector target_v, float speedfactor);
 vector W_CalculateSpread(vector forward, float spread, float spreadfactor, float spreadstyle);
+#endif
index 2537022f6ac55bba9cff6d12570e68ea0f12b3f9..a314f036b3bb853cbc1b53251df380b6879f27e4 100644 (file)
@@ -1,22 +1,32 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../util.qh"
+    #include "config.qh"
+    #include "weapons.qh"
+#endif
+
 // ==========================
 //  Balance Config Generator
 // ==========================
 
-void W_Config_Queue_Swap(float root, float child, entity pass)
+void W_Config_Queue_Swap(int root, int child, entity pass)
 {
        string oldroot = wep_config_queue[root];
        wep_config_queue[root] = wep_config_queue[child];
        wep_config_queue[child] = oldroot;
 }
 
-float W_Config_Queue_Compare(float root, float child, entity pass)
+float W_Config_Queue_Compare(int root, int child, entity pass)
 {
        return strcmp(wep_config_queue[root], wep_config_queue[child]);
 }
 
 void Dump_Weapon_Settings(void)
 {
-       float i, x, totalsettings = 0;
+       int i, x, totalsettings = 0;
        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
        {
                // step 1: clear the queue
@@ -29,16 +39,16 @@ void Dump_Weapon_Settings(void)
 
                // step 3: sort queue
                heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, world);
-               
+
                // step 4: write queue
                WEP_CONFIG_WRITETOFILE(sprintf(
                        "// {{{ #%d: %s%s\n",
                        i,
                        WEP_NAME(i),
                        (((get_weaponinfo(i)).spawnflags & WEP_FLAG_MUTATORBLOCKED) ? " (MUTATOR WEAPON)" : "")
-               ))
-               for(x = 0; x <= WEP_CONFIG_COUNT; ++x) { WEP_CONFIG_WRITETOFILE(wep_config_queue[x]) }
-               WEP_CONFIG_WRITETOFILE("// }}}\n")
+               ));
+               for(x = 0; x <= WEP_CONFIG_COUNT; ++x) { WEP_CONFIG_WRITETOFILE(wep_config_queue[x]); }
+               WEP_CONFIG_WRITETOFILE("// }}}\n");
 
                // step 5: debug info
                print(sprintf("#%d: %s: %d settings...\n", i, WEP_NAME(i), WEP_CONFIG_COUNT));
index 6a0489314849cd47bfee81208355e02dd79a5852..4e968ec4e518629d0a1dd9c9f8319b901e75fef0 100644 (file)
@@ -1,22 +1,26 @@
+#ifndef WEAPONS_CONFIG_H
+#define WEAPONS_CONFIG_H
+
 // ==========================
 //  Balance Config Generator
 // ==========================
 
 void Dump_Weapon_Settings(void);
-float wep_config_file;
-float wep_config_alsoprint;
+int wep_config_file;
+bool wep_config_alsoprint;
 
-#define MAX_WEP_CONFIG 256
-float WEP_CONFIG_COUNT;
+const int MAX_WEP_CONFIG = 256;
+int WEP_CONFIG_COUNT;
 string wep_config_queue[MAX_WEP_CONFIG];
 
 #define WEP_CONFIG_QUEUE(a) { \
        wep_config_queue[WEP_CONFIG_COUNT] = a; \
        ++WEP_CONFIG_COUNT; }
 
-#define WEP_CONFIG_WRITETOFILE(a) { \
+#define WEP_CONFIG_WRITETOFILE(a) do { \
        fputs(wep_config_file, a); \
-       if(wep_config_alsoprint) { print(a); } }
+       if(wep_config_alsoprint) { print(a); } \
+} while(0)
 
 #define WEP_CONFIG_WRITE_CVARS_NONE(wepname,name) \
        { WEP_CONFIG_QUEUE( \
@@ -28,7 +32,7 @@ string wep_config_queue[MAX_WEP_CONFIG];
 #define WEP_CONFIG_WRITE_CVARS_BOTH(wepname,name) \
        WEP_CONFIG_WRITE_CVARS_PRI(wepname, name) \
        WEP_CONFIG_WRITE_CVARS_SEC(wepname, name)
-       
+
 #define WEP_CONFIG_WRITE_CVARS(wepid,wepname,mode,name) WEP_CONFIG_WRITE_CVARS_##mode(wepname, name)
 
 #define WEP_CONFIG_WRITE_PROPS_string(wepname,name) \
@@ -42,3 +46,4 @@ string wep_config_queue[MAX_WEP_CONFIG];
                cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }
 
 #define WEP_CONFIG_WRITE_PROPS(wepid,wepname,type,prop,name) WEP_CONFIG_WRITE_PROPS_##type(wepname,name)
+#endif
index 80fcf5524b15afed5294ed374eac22bfa73bef48..d8faa7be97daead90da13c9ab84dbcd7e23a89c0 100644 (file)
@@ -55,29 +55,29 @@ REGISTER_WEAPON(
        w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
 
 #ifndef MENUQC
-#define ARC_MAX_SEGMENTS 20
+const float ARC_MAX_SEGMENTS = 20;
 vector arc_shotorigin[4];
 .vector beam_start;
 .vector beam_dir;
 .vector beam_wantdir;
-.float beam_type;
-
-#define ARC_BT_MISS        0x00
-#define ARC_BT_WALL        0x01
-#define ARC_BT_HEAL        0x02
-#define ARC_BT_HIT         0x03
-#define ARC_BT_BURST_MISS  0x10
-#define ARC_BT_BURST_WALL  0x11
-#define ARC_BT_BURST_HEAL  0x12
-#define ARC_BT_BURST_HIT   0x13
-#define ARC_BT_BURSTMASK   0x10
-
-#define ARC_SF_SETTINGS    1
-#define ARC_SF_START       2
-#define ARC_SF_WANTDIR     4
-#define ARC_SF_BEAMDIR     8
-#define ARC_SF_BEAMTYPE    16
-#define ARC_SF_LOCALMASK   14
+.int beam_type;
+
+const int ARC_BT_MISS =        0x00;
+const int ARC_BT_WALL =        0x01;
+const int ARC_BT_HEAL =        0x02;
+const int ARC_BT_HIT =         0x03;
+const int ARC_BT_BURST_MISS =  0x10;
+const int ARC_BT_BURST_WALL =  0x11;
+const int ARC_BT_BURST_HEAL =  0x12;
+const int ARC_BT_BURST_HIT =   0x13;
+const int ARC_BT_BURSTMASK =   0x10;
+
+const int ARC_SF_SETTINGS =    1;
+const int ARC_SF_START =       2;
+const int ARC_SF_WANTDIR =     4;
+const int ARC_SF_BEAMDIR =     8;
+const int ARC_SF_BEAMTYPE =    16;
+const int ARC_SF_LOCALMASK =   14;
 #endif
 #ifdef SVQC
 ARC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
@@ -153,28 +153,28 @@ float W_Arc_Beam_Send(entity to, float sf)
        }
        if(sf & ARC_SF_START) // starting location
        {
-               WriteCoord(MSG_ENTITY, self.beam_start_x);
-               WriteCoord(MSG_ENTITY, self.beam_start_y);
-               WriteCoord(MSG_ENTITY, self.beam_start_z);
+               WriteCoord(MSG_ENTITY, self.beam_start.x);
+               WriteCoord(MSG_ENTITY, self.beam_start.y);
+               WriteCoord(MSG_ENTITY, self.beam_start.z);
        }
        if(sf & ARC_SF_WANTDIR) // want/aim direction
        {
-               WriteCoord(MSG_ENTITY, self.beam_wantdir_x);
-               WriteCoord(MSG_ENTITY, self.beam_wantdir_y);
-               WriteCoord(MSG_ENTITY, self.beam_wantdir_z);
+               WriteCoord(MSG_ENTITY, self.beam_wantdir.x);
+               WriteCoord(MSG_ENTITY, self.beam_wantdir.y);
+               WriteCoord(MSG_ENTITY, self.beam_wantdir.z);
        }
        if(sf & ARC_SF_BEAMDIR) // beam direction
        {
-               WriteCoord(MSG_ENTITY, self.beam_dir_x);
-               WriteCoord(MSG_ENTITY, self.beam_dir_y);
-               WriteCoord(MSG_ENTITY, self.beam_dir_z);
+               WriteCoord(MSG_ENTITY, self.beam_dir.x);
+               WriteCoord(MSG_ENTITY, self.beam_dir.y);
+               WriteCoord(MSG_ENTITY, self.beam_dir.z);
        }
        if(sf & ARC_SF_BEAMTYPE) // beam type
        {
                WriteByte(MSG_ENTITY, self.beam_type);
        }
 
-       return TRUE;
+       return true;
 }
 
 void Reset_ArcBeam(entity player, vector forward)
@@ -187,22 +187,22 @@ void Reset_ArcBeam(entity player, vector forward)
 }
 
 float Arc_GetHeat_Percent(entity player)
-{      
+{
        if ( WEP_CVAR(arc, overheat_max) <= 0 ||  WEP_CVAR(arc, overheat_max) <= 0 )
        {
                player.arc_overheat = 0;
                return 0;
        }
-       
+
        if ( player.arc_beam )
                return player.arc_beam.beam_heat/WEP_CVAR(arc, overheat_max);
-       
+
        if ( player.arc_overheat > time )
        {
-               return (player.arc_overheat-time) / WEP_CVAR(arc, overheat_max) 
+               return (player.arc_overheat-time) / WEP_CVAR(arc, overheat_max)
                        * player.arc_cooldown;
        }
-       
+
        return 0;
 }
 void Arc_Player_SetHeat(entity player)
@@ -218,13 +218,13 @@ void W_Arc_Beam_Think(void)
                remove(self);
                return;
        }
-       
-       
+
+
        float burst = 0;
        if( self.owner.BUTTON_ATCK2 || self.beam_bursting)
        {
                if(!self.beam_bursting)
-                       self.beam_bursting = TRUE;
+                       self.beam_bursting = true;
                burst = ARC_BT_BURSTMASK;
        }
 
@@ -253,21 +253,21 @@ void W_Arc_Beam_Think(void)
                        {
                                cooldown_speed = self.beam_heat / WEP_CVAR(arc, beam_refire);
                        }
-                       
+
                        if ( cooldown_speed )
                        {
                                self.owner.arc_overheat = time + self.beam_heat / cooldown_speed;
                                self.owner.arc_cooldown = cooldown_speed;
                        }
-                       
+
                        if ( WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max) )
                        {
-                               pointparticles( particleeffectnum("arc_overheat"), 
+                               pointparticles( particleeffectnum("arc_overheat"),
                                        self.beam_start, self.beam_wantdir, 1 );
                                sound(self, CH_WEAPON_A, "weapons/arc_stop.wav", VOL_BASE, ATTN_NORM);
                        }
                }
-               
+
                if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
                entity oldself = self;
                self = self.owner;
@@ -280,7 +280,7 @@ void W_Arc_Beam_Think(void)
                remove(self);
                return;
        }
-       
+
        // decrease ammo
        float coefficient = frametime;
        if(!(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
@@ -304,7 +304,7 @@ void W_Arc_Beam_Think(void)
 
        W_SetupShot_Range(
                self.owner,
-               TRUE,
+               true,
                0,
                "",
                0,
@@ -332,7 +332,7 @@ void W_Arc_Beam_Think(void)
        if(!self.beam_initialized)
        {
                self.beam_dir = w_shotdir;
-               self.beam_initialized = TRUE;
+               self.beam_initialized = true;
        }
 
        // WEAPONTODO: Detect player velocity so that the beam curves when moving too
@@ -341,7 +341,7 @@ void W_Arc_Beam_Think(void)
 
        // note that if we do this, it'll always be corrected to a maximum angle by beam_maxangle handling
 
-       float segments; 
+       float segments;
        if(self.beam_dir != w_shotdir)
        {
                // calculate how much we're going to move the end of the beam to the want position
@@ -390,7 +390,7 @@ void W_Arc_Beam_Think(void)
                if(WEP_CVAR(arc, beam_degreespersegment))
                {
                        segments = bound(
-                               1, 
+                               1,
                                (
                                        min(
                                                angle,
@@ -545,7 +545,7 @@ void W_Arc_Beam_Think(void)
 
                                new_beam_type = ARC_BT_HIT;
                        }
-                       break; 
+                       break;
                }
                else if(trace_fraction != 1)
                {
@@ -586,10 +586,10 @@ void W_Arc_Beam(float burst)
        beam.think = W_Arc_Beam_Think;
        beam.owner = self;
        beam.movetype = MOVETYPE_NONE;
-       beam.bot_dodge = TRUE;
+       beam.bot_dodge = true;
        beam.bot_dodgerating = WEP_CVAR(arc, beam_damage);
        beam.beam_bursting = burst;
-       Net_LinkEntity(beam, FALSE, 0, W_Arc_Beam_Send);
+       Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
 
        entity oldself = self;
        self = beam;
@@ -600,7 +600,7 @@ void W_Arc_Beam(float burst)
 void Arc_Smoke()
 {
        makevectors(self.v_angle);
-       W_SetupShot_Range(self,TRUE,0,"",0,0,0);
+       W_SetupShot_Range(self,true,0,"",0,0,0);
 
        vector smoke_origin = w_shotorg + self.velocity*frametime;
        if ( self.arc_overheat > time )
@@ -620,12 +620,12 @@ void Arc_Smoke()
        else if ( self.arc_beam && WEP_CVAR(arc, overheat_max) > 0 &&
                        self.arc_beam.beam_heat > WEP_CVAR(arc, overheat_min) )
        {
-               if ( random() < (self.arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) / 
+               if ( random() < (self.arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) /
                                ( WEP_CVAR(arc, overheat_max)-WEP_CVAR(arc, overheat_min) ) )
                        pointparticles( particleeffectnum("arc_smoke"), smoke_origin, '0 0 0', 1 );
        }
-       
-       if (  self.arc_smoke_sound && ( self.arc_overheat <= time || 
+
+       if (  self.arc_smoke_sound && ( self.arc_overheat <= time ||
                !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || self.switchweapon != WEP_ARC )
        {
                self.arc_smoke_sound = 0;
@@ -645,7 +645,7 @@ float W_Arc(float req)
                                        WEP_CVAR(arc, beam_botaimspeed),
                                        0,
                                        WEP_CVAR(arc, beam_botaimlifetime),
-                                       FALSE
+                                       false
                                );
                        }
                        else
@@ -654,10 +654,10 @@ float W_Arc(float req)
                                        1000000,
                                        0,
                                        0.001,
-                                       FALSE
+                                       false
                                );
                        }
-                       return TRUE;
+                       return true;
                }
                case WR_THINK:
                {
@@ -667,11 +667,11 @@ float W_Arc(float req)
                        if ( self.arc_overheat <= time )
                        if(self.BUTTON_ATCK || self.BUTTON_ATCK2 || self.arc_beam.beam_bursting )
                        {
-                       
+
                                if(self.arc_BUTTON_ATCK_prev)
                                {
                                        #if 0
-                                       if(self.animstate_startframe == self.anim_shoot_x && self.animstate_numframes == self.anim_shoot_y)
+                                       if(self.animstate_startframe == self.anim_shoot.x && self.animstate_numframes == self.anim_shoot.y)
                                                weapon_thinkf(WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
                                        else
                                        #endif
@@ -683,7 +683,7 @@ float W_Arc(float req)
                                        if(weapon_prepareattack(!!self.BUTTON_ATCK2, 0))
                                        {
                                                W_Arc_Beam(!!self.BUTTON_ATCK2);
-                                               
+
                                                if(!self.arc_BUTTON_ATCK_prev)
                                                {
                                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
@@ -691,10 +691,10 @@ float W_Arc(float req)
                                                }
                                        }
                                }
-                               
-                               return TRUE;
+
+                               return true;
                        }
-                       
+
                        if(self.arc_BUTTON_ATCK_prev != 0)
                        {
                                sound(self, CH_WEAPON_A, "weapons/arc_stop.wav", VOL_BASE, ATTN_NORM);
@@ -714,7 +714,7 @@ float W_Arc(float req)
                        }
                        #endif
 
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
@@ -727,13 +727,13 @@ float W_Arc(float req)
                        precache_sound("weapons/arc_loop_overheat.wav");
                        if(!arc_shotorigin[0])
                        {
-                               arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), FALSE, FALSE, 1);
-                               arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), FALSE, FALSE, 2);
-                               arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), FALSE, FALSE, 3);
-                               arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), FALSE, FALSE, 4);
+                               arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 1);
+                               arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 2);
+                               arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 3);
+                               arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 4);
                        }
-                       ARC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       ARC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -746,8 +746,8 @@ float W_Arc(float req)
                }
                case WR_CONFIG:
                {
-                       ARC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       ARC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_KILLMESSAGE:
                {
@@ -759,20 +759,20 @@ float W_Arc(float req)
                        weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
                        self.arc_overheat = 0;
                        self.arc_cooldown = 0;
-                       return TRUE;
+                       return true;
                }
                case WR_PICKUP:
                {
-                       if ( !client_hasweapon(self, WEP_ARC, FALSE, FALSE) &&
+                       if ( !client_hasweapon(self, WEP_ARC, false, false) &&
                                weapon_dropevent_item.arc_overheat > time )
                        {
                                self.arc_overheat = weapon_dropevent_item.arc_overheat;
                                self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
                        }
-                       return TRUE;
+                       return true;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -810,7 +810,7 @@ void Draw_ArcBeam_callback(vector start, vector hit, vector end)
        // draw primary beam render
        vector top    = hitorigin + (thickdir * thickness);
        vector bottom = hitorigin - (thickdir * thickness);
-       
+
        vector last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
        vector last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
 
@@ -850,7 +850,7 @@ void Draw_ArcBeam_callback(vector start, vector hit, vector end)
                trailparticles(beam, beam.beam_traileffect, start, hitorigin);
        }
 
-       // set up for the next 
+       // set up for the next
        Draw_ArcBeam_callback_last_thickness = thickness;
        Draw_ArcBeam_callback_last_top = WarpZone_UnTransformOrigin(WarpZone_trace_transform, top);
        Draw_ArcBeam_callback_last_bottom = WarpZone_UnTransformOrigin(WarpZone_trace_transform, bottom);
@@ -860,10 +860,10 @@ void Reset_ArcBeam(void)
 {
        entity e;
        for (e = world; (e = findfloat(e, beam_usevieworigin, 1)); ) {
-               e.beam_initialized = FALSE;
+               e.beam_initialized = false;
        }
        for (e = world; (e = findfloat(e, beam_usevieworigin, 2)); ) {
-               e.beam_initialized = FALSE;
+               e.beam_initialized = false;
        }
 }
 
@@ -893,7 +893,7 @@ void Draw_ArcBeam(void)
                // Currently we have to replicate nearly the same method of figuring
                // out the shotdir that the server does... Ideally in the future we
                // should be able to acquire this from a generalized function built
-               // into a weapon system for client code. 
+               // into a weapon system for client code.
 
                // find where we are aiming
                makevectors(warpzone_save_view_angles);
@@ -924,13 +924,13 @@ void Draw_ArcBeam(void)
 
                // move shot origin to the actual gun muzzle origin
                vector origin_offset =
-                         right * -self.beam_shotorigin_y 
-                       + up * self.beam_shotorigin_z;
+                         right * -self.beam_shotorigin.y
+                       + up * self.beam_shotorigin.z;
 
                start_pos = start_pos + origin_offset;
 
                // Move it also forward, but only as far as possible without hitting anything. Don't poke into walls!
-               traceline(start_pos, start_pos + forward * self.beam_shotorigin_x, MOVE_NORMAL, self);
+               traceline(start_pos, start_pos + forward * self.beam_shotorigin.x, MOVE_NORMAL, self);
                start_pos = trace_endpos;
 
                // calculate the aim direction now
@@ -939,7 +939,7 @@ void Draw_ArcBeam(void)
                if(!self.beam_initialized)
                {
                        self.beam_dir = wantdir;
-                       self.beam_initialized = TRUE;
+                       self.beam_initialized = true;
                }
 
                if(self.beam_dir != wantdir)
@@ -987,7 +987,7 @@ void Draw_ArcBeam(void)
                        if(self.beam_degreespersegment)
                        {
                                segments = bound(
-                                       1, 
+                                       1,
                                        (
                                                min(
                                                        angle,
@@ -1035,7 +1035,7 @@ void Draw_ArcBeam(void)
                        if(self.beam_degreespersegment)
                        {
                                segments = bound(
-                                       1, 
+                                       1,
                                        (
                                                min(
                                                        angle,
@@ -1168,13 +1168,13 @@ void Remove_ArcBeam(void)
 
 void Ent_ReadArcBeam(float isnew)
 {
-       float sf = ReadByte();
+       int sf = ReadByte();
        entity flash;
 
        if(isnew)
        {
                // calculate shot origin offset from gun alignment
-               float gunalign = autocvar_cl_gunalign;
+               int gunalign = autocvar_cl_gunalign;
                if(gunalign != 1 && gunalign != 2 && gunalign != 4)
                        gunalign = 3; // default value
                --gunalign;
@@ -1488,8 +1488,8 @@ void Ent_ReadArcBeam(float isnew)
                                self.beam_color = randomvec();
                                self.beam_alpha = 1;
                                self.beam_thickness = 8;
-                               self.beam_traileffect = FALSE;
-                               self.beam_hiteffect = FALSE;
+                               self.beam_traileffect = false;
+                               self.beam_hiteffect = false;
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
@@ -1525,20 +1525,20 @@ float W_Arc(float req)
                case WR_IMPACTEFFECT:
                {
                        // todo
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/arc_loop.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index aa8d0a89b665bbbcd18a58bf3db6887fc98c00f8..8eaff86e35241899d5a760600f858b451e1c11f6 100644 (file)
@@ -9,7 +9,7 @@ REGISTER_WEAPON(
 /* color     */ '1 0.5 0.5',
 /* modelname */ "laser",
 /* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshairlaser 0.4",
+/* crosshair */ "gfx/crosshairlaser 0.5",
 /* wepimg    */ "weaponlaser",
 /* refname   */ "blaster",
 /* wepname   */ _("Blaster")
@@ -68,7 +68,7 @@ void W_Blaster_Touch(void)
                self.projectiledeathtype,
                other
        );
-       
+
        remove(self);
 }
 
@@ -77,7 +77,7 @@ void W_Blaster_Think(void)
        self.movetype = MOVETYPE_FLY;
        self.think = SUB_Remove;
        self.nextthink = time + self.blaster_lifetime;
-       CSQCProjectile(self, TRUE, PROJECTILE_BLASTER, TRUE);
+       CSQCProjectile(self, true, PROJECTILE_BLASTER, true);
 }
 
 void W_Blaster_Attack(
@@ -94,13 +94,13 @@ void W_Blaster_Attack(
 {
        vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
 
-       W_SetupShot_Dir(self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, atk_damage);
+       W_SetupShot_Dir(self, s_forward, false, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, atk_damage);
        pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
        entity missile = spawn();
        missile.owner = missile.realowner = self;
        missile.classname = "blasterbolt";
-       missile.bot_dodge = TRUE;
+       missile.bot_dodge = true;
        missile.bot_dodgerating = atk_damage;
        PROJECTILE_MAKETRIGGER(missile);
 
@@ -112,7 +112,7 @@ void W_Blaster_Attack(
 
        setorigin(missile, w_shotorg);
        setsize(missile, '0 0 0', '0 0 0');
-       
+
        W_SetupProjVelocity_Explicit(
                missile,
                w_shotdir,
@@ -121,7 +121,7 @@ void W_Blaster_Attack(
                0,
                0,
                atk_spread,
-               FALSE
+               false
        );
 
        missile.angles = vectoangles(missile.velocity);
@@ -132,7 +132,7 @@ void W_Blaster_Attack(
        missile.touch = W_Blaster_Touch;
        missile.flags = FL_PROJECTILE;
        missile.missile_flags = MIF_SPLASH;
-       missile.projectiledeathtype = atk_deathtype; 
+       missile.projectiledeathtype = atk_deathtype;
        missile.think = W_Blaster_Think;
        missile.nextthink = time + atk_delay;
 
@@ -156,16 +156,16 @@ float W_Blaster(float request)
                        if(WEP_CVAR(blaster, secondary))
                        {
                                if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
-                                       { self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), FALSE); }
+                                       { self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
                                else
-                                       { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), FALSE); }
+                                       { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
                        }
                        else
-                               { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), FALSE); }
+                               { self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
 
-                       return TRUE;
+                       return true;
                }
-               
+
                case WR_THINK:
                {
                        if(self.BUTTON_ATCK)
@@ -221,48 +221,48 @@ float W_Blaster(float request)
                                        }
                                }
                        }
-                       return TRUE;
+                       return true;
                }
-               
-               case WR_INIT: 
+
+               case WR_INIT:
                {
                        precache_model("models/weapons/g_laser.md3");
                        precache_model("models/weapons/v_laser.md3");
                        precache_model("models/weapons/h_laser.iqm");
                        precache_sound("weapons/lasergun_fire.wav");
-                       BLASTER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       BLASTER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
-               
+
                case WR_SETUP:
                {
                        self.ammo_field = ammo_none;
-                       return TRUE;
+                       return true;
                }
-               
+
                case WR_CHECKAMMO1:
                case WR_CHECKAMMO2:
                {
-                       return TRUE; // laser has infinite ammo
+                       return true; // laser has infinite ammo
                }
-               
+
                case WR_CONFIG:
                {
-                       BLASTER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       BLASTER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
-               
+
                case WR_SUICIDEMESSAGE:
                {
                        return WEAPON_BLASTER_SUICIDE;
                }
-               
+
                case WR_KILLMESSAGE:
                {
                        return WEAPON_BLASTER_MURDER;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -276,21 +276,21 @@ float W_Blaster(float request)
                        org2 = w_org + w_backoff * 6;
                        pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
                        if(!w_issilent) { sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM); }
-                       return TRUE;
+                       return true;
                }
-               
+
                case WR_INIT:
                {
                        precache_sound("weapons/laserimpact.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index d17826a9247908f7c1bceb42dcfc2d91645d585c..21a86e7da0c33f7d901584c194b4575a450ca47e 100644 (file)
@@ -9,7 +9,7 @@ REGISTER_WEAPON(
 /* color     */ '1 0.5 1',
 /* modelname */ "crylink",
 /* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshaircrylink 0.4",
+/* crosshair */ "gfx/crosshaircrylink 0.5",
 /* wepimg    */ "weaponcrylink",
 /* refname   */ "crylink",
 /* wepname   */ _("Crylink")
@@ -123,9 +123,9 @@ void W_Crylink_LinkExplode(entity e, entity e2)
 
        if(e == e.realowner.crylink_lastgroup)
                e.realowner.crylink_lastgroup = world;
-               
+
        float isprimary = !(e.projectiledeathtype & HITTYPE_SECONDARY);
-               
+
        RadiusDamage(e, e.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * a, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * a, WEP_CVAR_BOTH(crylink, isprimary, radius), world, world, WEP_CVAR_BOTH(crylink, isprimary, force) * a, e.projectiledeathtype, other);
 
        W_Crylink_LinkExplode(e.queuenext, e2);
@@ -241,7 +241,7 @@ void W_Crylink_LinkJoinEffect_Think(void)
                if(n >= 2)
                {
                        float isprimary = !(e.projectiledeathtype & HITTYPE_SECONDARY);
-                       
+
                        if(WEP_CVAR_BOTH(crylink, isprimary, joinexplode))
                        {
                                n /= WEP_CVAR_BOTH(crylink, isprimary, shots);
@@ -266,7 +266,7 @@ void W_Crylink_LinkJoinEffect_Think(void)
 
 float W_Crylink_Touch_WouldHitFriendly(entity projectile, float rad)
 {
-       entity head = WarpZone_FindRadius((projectile.origin + (projectile.mins + projectile.maxs) * 0.5), rad + MAX_DAMAGEEXTRARADIUS, FALSE);
+       entity head = WarpZone_FindRadius((projectile.origin + (projectile.mins + projectile.maxs) * 0.5), rad + MAX_DAMAGEEXTRARADIUS, false);
        float hit_friendly = 0;
        float hit_enemy = 0;
 
@@ -279,11 +279,11 @@ float W_Crylink_Touch_WouldHitFriendly(entity projectile, float rad)
                        else
                                ++hit_enemy;
                }
-                       
+
                head = head.chain;
        }
 
-       return (hit_enemy ? FALSE : hit_friendly);
+       return (hit_enemy ? false : hit_friendly);
 }
 
 // NO bounce protection, as bounces are limited!
@@ -306,7 +306,7 @@ void W_Crylink_Touch(void)
                f *= a;
 
        float totaldamage = RadiusDamage(self, self.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), world, world, WEP_CVAR_BOTH(crylink, isprimary, force) * f, self.projectiledeathtype, other);
-               
+
        if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(self, WEP_CVAR_BOTH(crylink, isprimary, radius)))))
        {
                if(self == self.realowner.crylink_lastgroup)
@@ -329,7 +329,7 @@ void W_Crylink_Touch(void)
        self.projectiledeathtype |= HITTYPE_BOUNCE;
        // commented out as it causes a little hitch...
        //if(proj.cnt == 0)
-       //      CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
+       //      CSQCProjectile(proj, true, PROJECTILE_CRYLINK, true);
 }
 
 void W_Crylink_Fadethink(void)
@@ -353,7 +353,7 @@ void W_Crylink_Attack(void)
        if(WEP_CVAR_PRI(crylink, joinexplode))
                maxdmg += WEP_CVAR_PRI(crylink, joinexplode_damage);
 
-       W_SetupShot(self, FALSE, 2, "weapons/crylink_fire.wav", CH_WEAPON_A, maxdmg);
+       W_SetupShot(self, false, 2, "weapons/crylink_fire.wav", CH_WEAPON_A, maxdmg);
        forward = v_forward;
        right = v_right;
        up = v_up;
@@ -367,7 +367,7 @@ void W_Crylink_Attack(void)
                proj.reset = W_Crylink_Reset;
                proj.realowner = proj.owner = self;
                proj.classname = "spike";
-               proj.bot_dodge = TRUE;
+               proj.bot_dodge = true;
                proj.bot_dodgerating = WEP_CVAR_PRI(crylink, damage);
                if(shots == 1) {
                        proj.queuenext = proj;
@@ -404,11 +404,11 @@ void W_Crylink_Attack(void)
                else
                {
                        makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
-                       s_y = v_forward_x;
-                       s_z = v_forward_y;
+                       s.y = v_forward.x;
+                       s.z = v_forward.y;
                }
                s = s * WEP_CVAR_PRI(crylink, spread) * g_weaponspreadfactor;
-               W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s_y + up * s_z, v_up, WEP_CVAR_PRI(crylink, speed), 0, 0, 0, FALSE);
+               W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_PRI(crylink, speed), 0, 0, 0, false);
                proj.touch = W_Crylink_Touch;
 
                proj.think = W_Crylink_Fadethink;
@@ -434,8 +434,8 @@ void W_Crylink_Attack(void)
 
                proj.flags = FL_PROJECTILE;
                proj.missile_flags = MIF_SPLASH;
-    
-               CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
+
+               CSQCProjectile(proj, true, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), true);
 
                other = proj; MUTATOR_CALLHOOK(EditProjectile);
        }
@@ -462,7 +462,7 @@ void W_Crylink_Attack2(void)
        if(WEP_CVAR_SEC(crylink, joinexplode))
                maxdmg += WEP_CVAR_SEC(crylink, joinexplode_damage);
 
-       W_SetupShot(self, FALSE, 2, "weapons/crylink_fire2.wav", CH_WEAPON_A, maxdmg);
+       W_SetupShot(self, false, 2, "weapons/crylink_fire2.wav", CH_WEAPON_A, maxdmg);
        forward = v_forward;
        right = v_right;
        up = v_up;
@@ -476,7 +476,7 @@ void W_Crylink_Attack2(void)
                proj.reset = W_Crylink_Reset;
                proj.realowner = proj.owner = self;
                proj.classname = "spike";
-               proj.bot_dodge = TRUE;
+               proj.bot_dodge = true;
                proj.bot_dodgerating = WEP_CVAR_SEC(crylink, damage);
                if(shots == 1) {
                        proj.queuenext = proj;
@@ -514,18 +514,18 @@ void W_Crylink_Attack2(void)
                        else
                        {
                                makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
-                               s_y = v_forward_x;
-                               s_z = v_forward_y;
+                               s.y = v_forward.x;
+                               s.z = v_forward.y;
                        }
                        s = s * WEP_CVAR_SEC(crylink, spread) * g_weaponspreadfactor;
-                       s = w_shotdir + right * s_y + up * s_z;
+                       s = w_shotdir + right * s.y + up * s.z;
                }
                else
                {
                        s = (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * WEP_CVAR_SEC(crylink, spread) * g_weaponspreadfactor);
                }
 
-               W_SetupProjVelocity_Explicit(proj, s, v_up, WEP_CVAR_SEC(crylink, speed), 0, 0, 0, FALSE);
+               W_SetupProjVelocity_Explicit(proj, s, v_up, WEP_CVAR_SEC(crylink, speed), 0, 0, 0, false);
                proj.touch = W_Crylink_Touch;
                proj.think = W_Crylink_Fadethink;
                if(counter == (shots - 1) / 2)
@@ -550,8 +550,8 @@ void W_Crylink_Attack2(void)
 
                proj.flags = FL_PROJECTILE;
         proj.missile_flags = MIF_SPLASH;
-        
-               CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
+
+               CSQCProjectile(proj, true, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), true);
 
                other = proj; MUTATOR_CALLHOOK(EditProjectile);
        }
@@ -571,11 +571,11 @@ float W_Crylink(float req)
                case WR_AIM:
                {
                        if(random() < 0.10)
-                               self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), FALSE);
+                               self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
                        else
-                               self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), FALSE);
-                               
-                       return TRUE;
+                               self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
+
+                       return true;
                }
                case WR_THINK:
                {
@@ -612,7 +612,7 @@ float W_Crylink(float req)
                                                vector pos;
                                                entity linkjoineffect;
                                                float isprimary = (self.crylink_waitrelease == 1);
-                                               
+
                                                pos = W_Crylink_LinkJoin(self.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
 
                                                linkjoineffect = spawn();
@@ -632,8 +632,8 @@ float W_Crylink(float req)
                                        }
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -643,14 +643,14 @@ float W_Crylink(float req)
                        precache_sound("weapons/crylink_fire.wav");
                        precache_sound("weapons/crylink_fire2.wav");
                        precache_sound("weapons/crylink_linkjoin.wav");
-                       CRYLINK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       CRYLINK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
                        // don't "run out of ammo" and switch weapons while waiting for release
                        if(self.crylink_lastgroup && self.crylink_waitrelease)
-                               return TRUE;
+                               return true;
 
                        ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_PRI(crylink, ammo);
                        ammo_amount += self.(weapon_load[WEP_CRYLINK]) >= WEP_CVAR_PRI(crylink, ammo);
@@ -660,7 +660,7 @@ float W_Crylink(float req)
                {
                        // don't "run out of ammo" and switch weapons while waiting for release
                        if(self.crylink_lastgroup && self.crylink_waitrelease)
-                               return TRUE;
+                               return true;
 
                        ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_SEC(crylink, ammo);
                        ammo_amount += self.(weapon_load[WEP_CRYLINK]) >= WEP_CVAR_SEC(crylink, ammo);
@@ -668,13 +668,13 @@ float W_Crylink(float req)
                }
                case WR_CONFIG:
                {
-                       CRYLINK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       CRYLINK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -685,7 +685,7 @@ float W_Crylink(float req)
                        return WEAPON_CRYLINK_MURDER;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -709,22 +709,22 @@ float W_Crylink(float req)
                                if(!w_issilent)
                                        sound(self, CH_SHOTS, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/crylink_impact2.wav");
                        precache_sound("weapons/crylink_impact.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index cff16702dfd25fefbf9576594bdcebd8ee096df8..9e5f98a492033c49f1121aa6f72ce30e0793a8b5 100644 (file)
@@ -9,7 +9,7 @@ REGISTER_WEAPON(
 /* color     */ '1 1 0',
 /* modelname */ "rl",
 /* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshairrocketlauncher 0.5875",
+/* crosshair */ "gfx/crosshairrocketlauncher 0.7",
 /* wepimg    */ "weaponrocketlauncher",
 /* refname   */ "devastator",
 /* wepname   */ _("Devastator")
@@ -119,14 +119,14 @@ void W_Devastator_DoRemoteExplode(void)
        self.event_damage = func_null;
        self.takedamage = DAMAGE_NO;
 
-       float handled_as_rocketjump = FALSE;
+       float handled_as_rocketjump = false;
 
        entity head = WarpZone_FindRadius(
                self.origin,
                WEP_CVAR(devastator, remote_jump_radius),
-               FALSE
+               false
        );
-       
+
        while(head)
        {
                if(head.takedamage && (head == self.realowner))
@@ -135,14 +135,14 @@ void W_Devastator_DoRemoteExplode(void)
                        if(distance_to_head <= WEP_CVAR(devastator, remote_jump_radius))
                        {
                                // we handled this as a rocketjump :)
-                               handled_as_rocketjump = TRUE;
+                               handled_as_rocketjump = true;
 
-                               // modify velocity 
+                               // modify velocity
                                head.velocity_x *= 0.9;
                                head.velocity_y *= 0.9;
                                head.velocity_z = bound(
                                        WEP_CVAR(devastator, remote_jump_velocity_z_min),
-                                       head.velocity_z + WEP_CVAR(devastator, remote_jump_velocity_z_add),
+                                       head.velocity.z + WEP_CVAR(devastator, remote_jump_velocity_z_add),
                                        WEP_CVAR(devastator, remote_jump_velocity_z_max)
                                );
 
@@ -226,7 +226,7 @@ vector W_Devastator_SteerTo(vector thisdir, vector goaldir, float maxturn_cos)
        //   0 = (m^2 - f^2) * x^2 + (2 * f * (m^2 - 1)) * x + (m^2 - 1)
        m2 = maxturn_cos * maxturn_cos;
        v = solve_quadratic(m2 - f * f, 2 * f * (m2 - 1), m2 - 1);
-       return normalize(thisdir + goaldir * v_y); // the larger solution!
+       return normalize(thisdir + goaldir * v.y); // the larger solution!
 }
 // assume thisdir == -goaldir:
 //   f == -1
@@ -252,7 +252,7 @@ void W_Devastator_Think(void)
        }
 
        // accelerate
-       makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0');
+       makevectors(self.angles.x * '-1 0 0' + self.angles.y * '0 1 0');
        velspeed = WEP_CVAR(devastator, speed) * g_weaponspeedfactor - (self.velocity * v_forward);
        if(velspeed > 0)
                self.velocity = self.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * g_weaponspeedfactor * frametime, velspeed);
@@ -321,13 +321,13 @@ void W_Devastator_Damage(entity inflictor, entity attacker, float damage, float
 {
        if(self.health <= 0)
                return;
-       
+
        if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
-               
+
        self.health = self.health - damage;
        self.angles = vectoangles(self.velocity);
-       
+
        if(self.health <= 0)
                W_PrepareExplosionByDamage(attacker, W_Devastator_Explode);
 }
@@ -339,7 +339,7 @@ void W_Devastator_Attack(void)
 
        W_DecreaseAmmo(WEP_CVAR(devastator, ammo));
 
-       W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', FALSE, 5, "weapons/rocket_fire.wav", CH_WEAPON_A, WEP_CVAR(devastator, damage));
+       W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 5, "weapons/rocket_fire.wav", CH_WEAPON_A, WEP_CVAR(devastator, damage));
        pointparticles(particleeffectnum("rocketlauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
        missile = WarpZone_RefSys_SpawnSameRefSys(self);
@@ -351,14 +351,14 @@ void W_Devastator_Attack(void)
                missile.spawnshieldtime = -1;
        missile.pushltime = time + WEP_CVAR(devastator, guidedelay);
        missile.classname = "rocket";
-       missile.bot_dodge = TRUE;
+       missile.bot_dodge = true;
        missile.bot_dodgerating = WEP_CVAR(devastator, damage) * 2; // * 2 because it can be detonated inflight which makes it even more dangerous
 
        missile.takedamage = DAMAGE_YES;
        missile.damageforcescale = WEP_CVAR(devastator, damageforcescale);
        missile.health = WEP_CVAR(devastator, health);
        missile.event_damage = W_Devastator_Damage;
-       missile.damagedbycontents = TRUE;
+       missile.damagedbycontents = true;
 
        missile.movetype = MOVETYPE_FLY;
        PROJECTILE_MAKETRIGGER(missile);
@@ -374,9 +374,9 @@ void W_Devastator_Attack(void)
        missile.nextthink = time;
        missile.cnt = time + WEP_CVAR(devastator, lifetime);
        missile.flags = FL_PROJECTILE;
-       missile.missile_flags = MIF_SPLASH; 
+       missile.missile_flags = MIF_SPLASH;
 
-       CSQCProjectile(missile, WEP_CVAR(devastator, guiderate) == 0 && WEP_CVAR(devastator, speedaccel) == 0, PROJECTILE_ROCKET, FALSE); // because of fly sound
+       CSQCProjectile(missile, WEP_CVAR(devastator, guiderate) == 0 && WEP_CVAR(devastator, speedaccel) == 0, PROJECTILE_ROCKET, false); // because of fly sound
 
        // muzzle flash for 1st person view
        flash = spawn();
@@ -400,12 +400,12 @@ float W_Devastator(float req)
                case WR_AIM:
                {
                        // aim and decide to fire if appropriate
-                       self.BUTTON_ATCK = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), FALSE);
+                       self.BUTTON_ATCK = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
                        if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
                        {
                                // decide whether to detonate rockets
                                entity missile, targetlist, targ;
-                               targetlist = findchainfloat(bot_attack, TRUE);
+                               targetlist = findchainfloat(bot_attack, true);
                                for(missile = world; (missile = find(missile, classname, "rocket")); ) if(missile.realowner == self)
                                {
                                        targ = targetlist;
@@ -413,23 +413,23 @@ float W_Devastator(float req)
                                        {
                                                if(targ != missile.realowner && vlen(targ.origin - missile.origin) < WEP_CVAR(devastator, radius))
                                                {
-                                                       self.BUTTON_ATCK2 = TRUE;
+                                                       self.BUTTON_ATCK2 = true;
                                                        break;
                                                }
                                                targ = targ.chain;
                                        }
                                }
-                               
-                               if(self.BUTTON_ATCK2) self.BUTTON_ATCK = FALSE;
+
+                               if(self.BUTTON_ATCK2) self.BUTTON_ATCK = false;
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                #else
                case WR_AIM:
                {
                        // aim and decide to fire if appropriate
-                       self.BUTTON_ATCK = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), FALSE);
+                       self.BUTTON_ATCK = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
                        if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
                        {
                                // decide whether to detonate rockets
@@ -443,7 +443,7 @@ float W_Devastator(float req)
                                selfdamage = 0;
                                teamdamage = 0;
                                enemydamage = 0;
-                               targetlist = findchainfloat(bot_attack, TRUE);
+                               targetlist = findchainfloat(bot_attack, true);
                                missile = find(world, classname, "rocket");
                                while(missile)
                                {
@@ -493,7 +493,7 @@ float W_Devastator(float req)
                                                        if(
                                                                (v_forward * normalize(missile.origin - targ.origin)< 0.1)
                                                                && desirabledamage > 0.1*coredamage
-                                                       )self.BUTTON_ATCK2 = TRUE;
+                                                       )self.BUTTON_ATCK2 = true;
                                                        targ = targ.chain;
                                                }
                                        }else{
@@ -504,7 +504,7 @@ float W_Devastator(float req)
                                                        if(IS_PLAYER(self.enemy))
                                                                if(desirabledamage >= 0.1*coredamage)
                                                                        if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
-                                                                               self.BUTTON_ATCK2 = TRUE;
+                                                                               self.BUTTON_ATCK2 = true;
                                        //      dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
                                        }
 
@@ -513,15 +513,15 @@ float W_Devastator(float req)
                                // if we would be doing at X percent of the core damage, detonate it
                                // but don't fire a new shot at the same time!
                                if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
-                                       self.BUTTON_ATCK2 = TRUE;
+                                       self.BUTTON_ATCK2 = true;
                                if((skill > 6.5) && (selfdamage > self.health))
-                                       self.BUTTON_ATCK2 = FALSE;
-                               //if(self.BUTTON_ATCK2 == TRUE)
+                                       self.BUTTON_ATCK2 = false;
+                               //if(self.BUTTON_ATCK2 == true)
                                //      dprint(ftos(desirabledamage),"\n");
-                               if(self.BUTTON_ATCK2 == TRUE) self.BUTTON_ATCK = FALSE;
+                               if(self.BUTTON_ATCK2 == true) self.BUTTON_ATCK = false;
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                #endif
                case WR_THINK:
@@ -551,7 +551,7 @@ float W_Devastator(float req)
                                        {
                                                if(!rock.rl_detonate_later)
                                                {
-                                                       rock.rl_detonate_later = TRUE;
+                                                       rock.rl_detonate_later = true;
                                                        rockfound = 1;
                                                }
                                        }
@@ -559,8 +559,8 @@ float W_Devastator(float req)
                                                sound(self, CH_WEAPON_B, "weapons/rocket_det.wav", VOL_BASE, ATTN_NORM);
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -574,13 +574,13 @@ float W_Devastator(float req)
                                precache_sound("weapons/rocket_fire.wav");
                                precache_sound("weapons/rocket_mode.wav");
                        //}
-                       DEVASTATOR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       DEVASTATOR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_SETUP:
                {
                        self.rl_release = 1;
-                       return TRUE;
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -588,14 +588,14 @@ float W_Devastator(float req)
                        // don't switch while guiding a missile
                        if(ATTACK_FINISHED(self) <= time || self.weapon != WEP_DEVASTATOR)
                        {
-                               ammo_amount = FALSE;
+                               ammo_amount = false;
                                if(WEP_CVAR(devastator, reload_ammo))
                                {
                                        if(self.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR]) < WEP_CVAR(devastator, ammo))
-                                               ammo_amount = TRUE;
+                                               ammo_amount = true;
                                }
                                else if(self.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo))
-                                       ammo_amount = TRUE;
+                                       ammo_amount = true;
                                return !ammo_amount;
                        }
                        #endif
@@ -603,7 +603,7 @@ float W_Devastator(float req)
                        if(self.rl_release == 0)
                        {
                                printf("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.WEP_AMMO(DEVASTATOR), WEP_CVAR(devastator, ammo));
-                               return TRUE;
+                               return true;
                        }
                        else
                        {
@@ -620,22 +620,22 @@ float W_Devastator(float req)
                }
                case WR_CHECKAMMO2:
                {
-                       return FALSE;
+                       return false;
                }
                case WR_CONFIG:
                {
-                       DEVASTATOR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       DEVASTATOR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RESETPLAYER:
                {
                        self.rl_release = 0;
-                       return TRUE;
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(WEP_CVAR(devastator, ammo), "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -649,7 +649,7 @@ float W_Devastator(float req)
                                return WEAPON_DEVASTATOR_MURDER_DIRECT;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -664,21 +664,21 @@ float W_Devastator(float req)
                        pointparticles(particleeffectnum("rocket_explode"), org2, '0 0 0', 1);
                        if(!w_issilent)
                                sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
-                               
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/rocket_impact.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 3ec86c782de9d781c9d8945d9c3eef04dcbd1902..3f5e75159b5b8339490f0eb2c8aff57664e2fa65 100644 (file)
@@ -9,7 +9,7 @@ REGISTER_WEAPON(
 /* color     */ '0 0.5 1',
 /* modelname */ "electro",
 /* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshairelectro 0.5",
+/* crosshair */ "gfx/crosshairelectro 0.6",
 /* wepimg    */ "weaponelectro",
 /* refname   */ "electro",
 /* wepname   */ _("Electro")
@@ -90,15 +90,15 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own)
                                        }
                                }
                        }
-                       
+
                        // change owner to whoever caused the combo explosion
                        e.realowner = own;
                        e.takedamage = DAMAGE_NO;
                        e.classname = "electro_orb_chain";
-                       
+
                        // now set the next one to trigger as well
                        e.think = W_Electro_ExplodeCombo;
-                       
+
                        // delay combo chains, looks cooler
                        e.nextthink =
                                (
@@ -120,7 +120,7 @@ void W_Electro_ExplodeCombo(void)
        W_Electro_TriggerCombo(self.origin, WEP_CVAR(electro, combo_comboradius), self.realowner);
 
        self.event_damage = func_null;
-       
+
        RadiusDamage(
                self,
                self.realowner,
@@ -148,7 +148,7 @@ void W_Electro_Explode(void)
 
        self.event_damage = func_null;
        self.takedamage = DAMAGE_NO;
-       
+
        if(self.movetype == MOVETYPE_BOUNCE)
        {
                RadiusDamage(
@@ -201,7 +201,7 @@ void W_Electro_Bolt_Think(void)
        if(WEP_CVAR_PRI(electro, midaircombo_radius))
        {
                float found = 0;
-               entity e = WarpZone_FindRadius(self.origin, WEP_CVAR_PRI(electro, midaircombo_radius), TRUE);
+               entity e = WarpZone_FindRadius(self.origin, WEP_CVAR_PRI(electro, midaircombo_radius), true);
 
                // loop through nearby orbs and trigger them
                while(e)
@@ -215,7 +215,7 @@ void W_Electro_Bolt_Think(void)
 
                                // now set the next one to trigger as well
                                e.think = W_Electro_ExplodeCombo;
-                               
+
                                // delay combo chains, looks cooler
                                e.nextthink =
                                        (
@@ -252,7 +252,7 @@ void W_Electro_Attack_Bolt(void)
                self,
                '0 0 -3',
                '0 0 -3',
-               FALSE,
+               false,
                2,
                "weapons/electro_fire.wav",
                CH_WEAPON_A,
@@ -264,7 +264,7 @@ void W_Electro_Attack_Bolt(void)
        proj = spawn();
        proj.classname = "electro_bolt";
        proj.owner = proj.realowner = self;
-       proj.bot_dodge = TRUE;
+       proj.bot_dodge = true;
        proj.bot_dodgerating = WEP_CVAR_PRI(electro, damage);
        proj.use = W_Electro_Explode;
        proj.think = W_Electro_Bolt_Think;
@@ -282,7 +282,7 @@ void W_Electro_Attack_Bolt(void)
        proj.flags = FL_PROJECTILE;
        proj.missile_flags = MIF_SPLASH;
 
-       CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO_BEAM, TRUE);
+       CSQCProjectile(proj, true, PROJECTILE_ELECTRO_BEAM, true);
 
        other = proj; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -350,7 +350,7 @@ void W_Electro_Attack_Orb(void)
                self,
                '0 0 -4',
                '0 0 -4',
-               FALSE,
+               false,
                2,
                "weapons/electro_fire2.wav",
                CH_WEAPON_A,
@@ -366,7 +366,7 @@ void W_Electro_Attack_Orb(void)
        proj.owner = proj.realowner = self;
        proj.use = W_Electro_Explode;
        proj.think = adaptor_think2use_hittype_splash;
-       proj.bot_dodge = TRUE;
+       proj.bot_dodge = true;
        proj.bot_dodgerating = WEP_CVAR_SEC(electro, damage);
        proj.nextthink = time + WEP_CVAR_SEC(electro, lifetime);
        PROJECTILE_MAKETRIGGER(proj);
@@ -398,7 +398,7 @@ void W_Electro_Attack_Orb(void)
        setsize(p2, proj.mins, proj.maxs);
 #endif
 
-       CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, FALSE); // no culling, it has sound
+       CSQCProjectile(proj, true, PROJECTILE_ELECTRO, false); // no culling, it has sound
 
        other = proj; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -414,7 +414,7 @@ void W_Electro_CheckAttack(void)
                weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
                return;
        }
-       // WEAPONTODO: when the player releases the button, cut down the length of refire2? 
+       // WEAPONTODO: when the player releases the button, cut down the length of refire2?
        w_ready();
 }
 
@@ -426,33 +426,33 @@ float W_Electro(float req)
        {
                case WR_AIM:
                {
-                       self.BUTTON_ATCK = self.BUTTON_ATCK2 = FALSE;
+                       self.BUTTON_ATCK = self.BUTTON_ATCK2 = false;
                        if(vlen(self.origin-self.enemy.origin) > 1000) { self.bot_secondary_electromooth = 0; }
                        if(self.bot_secondary_electromooth == 0)
                        {
                                float shoot;
 
                                if(WEP_CVAR_PRI(electro, speed))
-                                       shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), FALSE);
+                                       shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
                                else
-                                       shoot = bot_aim(1000000, 0, 0.001, FALSE);
+                                       shoot = bot_aim(1000000, 0, 0.001, false);
 
                                if(shoot)
                                {
-                                       self.BUTTON_ATCK = TRUE;
+                                       self.BUTTON_ATCK = true;
                                        if(random() < 0.01) self.bot_secondary_electromooth = 1;
                                }
                        }
                        else
                        {
-                               if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), TRUE))
+                               if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
                                {
-                                       self.BUTTON_ATCK2 = TRUE;
+                                       self.BUTTON_ATCK2 = true;
                                        if(random() < 0.03) self.bot_secondary_electromooth = 0;
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_THINK:
                {
@@ -467,12 +467,12 @@ float W_Electro(float req)
                                if(!ammo_amount)
                                {
                                        WEP_ACTION(self.weapon, WR_RELOAD);
-                                       return FALSE;
+                                       return false;
                                }
-                               
-                               return TRUE;
+
+                               return true;
                        }
-                       
+
                        if(self.BUTTON_ATCK)
                        {
                                if(weapon_prepareattack(0, WEP_CVAR_PRI(electro, refire)))
@@ -493,7 +493,7 @@ float W_Electro(float req)
                                }
                        }
 
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
@@ -505,8 +505,8 @@ float W_Electro(float req)
                        precache_sound("weapons/electro_fire2.wav");
                        precache_sound("weapons/electro_impact.wav");
                        precache_sound("weapons/electro_impact_combo.wav");
-                       ELECTRO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       ELECTRO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -530,18 +530,18 @@ float W_Electro(float req)
                }
                case WR_CONFIG:
                {
-                       ELECTRO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       ELECTRO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RESETPLAYER:
                {
                        self.electro_secondarytime = time;
-                       return TRUE;
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -565,7 +565,7 @@ float W_Electro(float req)
                        }
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -599,22 +599,22 @@ float W_Electro(float req)
                                                sound(self, CH_SHOTS, "weapons/electro_impact.wav", VOL_BASE, ATTEN_NORM);
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/electro_impact.wav");
                        precache_sound("weapons/electro_impact_combo.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 80c453a4d735a79a0efdea85065f3d40f6342d95..d0980091353b01615c9475f8ec9fd1caa1ee0736 100644 (file)
@@ -122,13 +122,13 @@ void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage,
                return;
 
        RandomSelection_Init();
-       for(e = WarpZone_FindRadius(self.origin, dist, TRUE); e; e = e.chain)
+       for(e = WarpZone_FindRadius(self.origin, dist, true); e; e = e.chain)
        if(e != self.realowner) if(e.takedamage == DAMAGE_AIM) if(!IS_PLAYER(e) || !self.realowner || DIFF_TEAM(e, self))
        {
                p = e.origin;
-               p_x += e.mins_x + random() * (e.maxs_x - e.mins_x);
-               p_y += e.mins_y + random() * (e.maxs_y - e.mins_y);
-               p_z += e.mins_z + random() * (e.maxs_z - e.mins_z);
+               p.x += e.mins.x + random() * (e.maxs.x - e.mins.x);
+               p.y += e.mins.y + random() * (e.maxs.y - e.mins.y);
+               p.z += e.mins.z + random() * (e.maxs.z - e.mins.z);
                d = vlen(WarpZone_UnTransformOrigin(e, self.origin) - p);
                if(d < dist)
                {
@@ -181,14 +181,14 @@ void W_Fireball_Attack1(void)
 {
        entity proj;
 
-       W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', FALSE, 2, "weapons/fireball_fire2.wav", CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage));
+       W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, "weapons/fireball_fire2.wav", CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage));
 
        pointparticles(particleeffectnum("fireball_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
        proj = spawn();
        proj.classname = "plasma_prim";
        proj.owner = proj.realowner = self;
-       proj.bot_dodge = TRUE;
+       proj.bot_dodge = true;
        proj.bot_dodgerating = WEP_CVAR_PRI(fireball, damage);
        proj.pushltime = time + WEP_CVAR_PRI(fireball, lifetime);
        proj.use = W_Fireball_Explode;
@@ -211,15 +211,15 @@ void W_Fireball_Attack1(void)
        proj.flags = FL_PROJECTILE;
     proj.missile_flags = MIF_SPLASH | MIF_PROXY;
 
-       CSQCProjectile(proj, TRUE, PROJECTILE_FIREBALL, TRUE);
+       CSQCProjectile(proj, true, PROJECTILE_FIREBALL, true);
 
        other = proj; MUTATOR_CALLHOOK(EditProjectile);
 }
 
 void W_Fireball_AttackEffect(float i, vector f_diff)
 {
-       W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', FALSE, 0, "", 0, 0);
-       w_shotorg += f_diff_x * v_up + f_diff_y * v_right;
+       W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 0, "", 0, 0);
+       w_shotorg += f_diff.x * v_up + f_diff.y * v_right;
        pointparticles(particleeffectnum("fireball_preattack_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 }
 
@@ -315,8 +315,8 @@ void W_Fireball_Attack2(void)
                        f_diff = '+1.25 +3.75 0';
                        break;
        }
-       W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', FALSE, 2, "weapons/fireball_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage));
-       traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, self);
+       W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 2, "weapons/fireball_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage));
+       traceline(w_shotorg, w_shotorg + f_diff.x * v_up + f_diff.y * v_right, MOVE_NORMAL, self);
        w_shotorg = trace_endpos;
 
        pointparticles(particleeffectnum("fireball_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
@@ -324,7 +324,7 @@ void W_Fireball_Attack2(void)
        proj = spawn();
        proj.owner = proj.realowner = self;
        proj.classname = "grenade";
-       proj.bot_dodge = TRUE;
+       proj.bot_dodge = true;
        proj.bot_dodgerating = WEP_CVAR_SEC(fireball, damage);
        proj.movetype = MOVETYPE_BOUNCE;
        proj.projectiledeathtype = WEP_FIREBALL | HITTYPE_SECONDARY;
@@ -342,7 +342,7 @@ void W_Fireball_Attack2(void)
        proj.flags = FL_PROJECTILE;
     proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
 
-       CSQCProjectile(proj, TRUE, PROJECTILE_FIREMINE, TRUE);
+       CSQCProjectile(proj, true, PROJECTILE_FIREMINE, true);
 
        other = proj; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -353,26 +353,26 @@ float W_Fireball(float req)
        {
                case WR_AIM:
                {
-                       self.BUTTON_ATCK = FALSE;
-                       self.BUTTON_ATCK2 = FALSE;
+                       self.BUTTON_ATCK = false;
+                       self.BUTTON_ATCK2 = false;
                        if(self.bot_primary_fireballmooth == 0)
                        {
-                               if(bot_aim(WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), FALSE))
+                               if(bot_aim(WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false))
                                {
-                                       self.BUTTON_ATCK = TRUE;
+                                       self.BUTTON_ATCK = true;
                                        if(random() < 0.02) self.bot_primary_fireballmooth = 0;
                                }
                        }
                        else
                        {
-                               if(bot_aim(WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), TRUE))
+                               if(bot_aim(WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true))
                                {
-                                       self.BUTTON_ATCK2 = TRUE;
+                                       self.BUTTON_ATCK2 = true;
                                        if(random() < 0.01) self.bot_primary_fireballmooth = 1;
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_THINK:
                {
@@ -393,8 +393,8 @@ float W_Fireball(float req)
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready);
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -405,28 +405,28 @@ float W_Fireball(float req)
                        precache_sound("weapons/fireball_fire.wav");
                        precache_sound("weapons/fireball_fire2.wav");
                        precache_sound("weapons/fireball_prefire2.wav");
-                       FIREBALL_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       FIREBALL_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_SETUP:
                {
                        self.ammo_field = ammo_none;
-                       return TRUE;
+                       return true;
                }
                case WR_CHECKAMMO1:
                case WR_CHECKAMMO2:
                {
-                       return TRUE; // fireball has infinite ammo
+                       return true; // fireball has infinite ammo
                }
                case WR_CONFIG:
                {
-                       FIREBALL_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       FIREBALL_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RESETPLAYER:
                {
                        self.fireball_primarytime = time;
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -443,7 +443,7 @@ float W_Fireball(float req)
                                return WEAPON_FIREBALL_MURDER_BLAST;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -465,21 +465,21 @@ float W_Fireball(float req)
                                if(!w_issilent)
                                        sound(self, CH_SHOTS, "weapons/fireball_impact2.wav", VOL_BASE, ATTEN_NORM * 0.25); // long range boom
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/fireball_impact2.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index fe3abf0a9a6d9f550c7cadcc2a37dced29f90274..1085c315afae03ef3992de648a29ad3c48344097 100644 (file)
@@ -79,11 +79,11 @@ void W_Hagar_Damage(entity inflictor, entity attacker, float damage, float death
 {
        if(self.health <= 0)
                return;
-               
-       float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == self.owner) : TRUE)
-               && (inflictor.projectiledeathtype & HITTYPE_SECONDARY) 
+
+       float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == self.owner) : true)
+               && (inflictor.projectiledeathtype & HITTYPE_SECONDARY)
                && (self.projectiledeathtype & HITTYPE_SECONDARY));
-       
+
        if(is_linkexplode)
                is_linkexplode = (is_linkexplode && WEP_CVAR_SEC(hagar, load_linkexplode));
        else
@@ -94,7 +94,7 @@ void W_Hagar_Damage(entity inflictor, entity attacker, float damage, float death
 
        self.health = self.health - damage;
        self.angles = vectoangles(self.velocity);
-       
+
        if(self.health <= 0)
                W_PrepareExplosionByDamage(attacker, self.think);
 }
@@ -126,22 +126,22 @@ void W_Hagar_Attack(void)
 
        W_DecreaseAmmo(WEP_CVAR_PRI(hagar, ammo));
 
-       W_SetupShot(self, FALSE, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage));
+       W_SetupShot(self, false, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage));
 
        pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
        missile = spawn();
        missile.owner = missile.realowner = self;
        missile.classname = "missile";
-       missile.bot_dodge = TRUE;
+       missile.bot_dodge = true;
        missile.bot_dodgerating = WEP_CVAR_PRI(hagar, damage);
-       
+
        missile.takedamage = DAMAGE_YES;
        missile.health = WEP_CVAR_PRI(hagar, health);
        missile.damageforcescale = WEP_CVAR_PRI(hagar, damageforcescale);
        missile.event_damage = W_Hagar_Damage;
-       missile.damagedbycontents = TRUE;
-       
+       missile.damagedbycontents = true;
+
        missile.touch = W_Hagar_Touch;
        missile.use = W_Hagar_Explode;
        missile.think = adaptor_think2use_hittype_splash;
@@ -156,9 +156,9 @@ void W_Hagar_Attack(void)
 
        missile.angles = vectoangles(missile.velocity);
        missile.flags = FL_PROJECTILE;
-       missile.missile_flags = MIF_SPLASH; 
+       missile.missile_flags = MIF_SPLASH;
 
-       CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR, TRUE);
+       CSQCProjectile(missile, true, PROJECTILE_HAGAR, true);
 
        other = missile; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -169,21 +169,21 @@ void W_Hagar_Attack2(void)
 
        W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo));
 
-       W_SetupShot(self, FALSE, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
+       W_SetupShot(self, false, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
 
        pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
        missile = spawn();
        missile.owner = missile.realowner = self;
        missile.classname = "missile";
-       missile.bot_dodge = TRUE;
+       missile.bot_dodge = true;
        missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage);
-       
+
        missile.takedamage = DAMAGE_YES;
        missile.health = WEP_CVAR_SEC(hagar, health);
        missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
        missile.event_damage = W_Hagar_Damage;
-       missile.damagedbycontents = TRUE;
+       missile.damagedbycontents = true;
 
        missile.touch = W_Hagar_Touch2;
        missile.cnt = 0;
@@ -200,9 +200,9 @@ void W_Hagar_Attack2(void)
 
        missile.angles = vectoangles(missile.velocity);
        missile.flags = FL_PROJECTILE;
-       missile.missile_flags = MIF_SPLASH; 
+       missile.missile_flags = MIF_SPLASH;
 
-       CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR_BOUNCING, TRUE);
+       CSQCProjectile(missile, true, PROJECTILE_HAGAR_BOUNCING, true);
 
        other = missile; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -222,7 +222,7 @@ void W_Hagar_Attack2_Load_Release(void)
 
        weapon_prepareattack_do(1, WEP_CVAR_SEC(hagar, refire));
 
-       W_SetupShot(self, FALSE, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
+       W_SetupShot(self, false, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
        pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
        forward = v_forward;
@@ -236,14 +236,14 @@ void W_Hagar_Attack2_Load_Release(void)
                missile = spawn();
                missile.owner = missile.realowner = self;
                missile.classname = "missile";
-               missile.bot_dodge = TRUE;
+               missile.bot_dodge = true;
                missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage);
-               
+
                missile.takedamage = DAMAGE_YES;
                missile.health = WEP_CVAR_SEC(hagar, health);
                missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
                missile.event_damage = W_Hagar_Damage;
-               missile.damagedbycontents = TRUE;
+               missile.damagedbycontents = true;
 
                missile.touch = W_Hagar_Touch; // not bouncy
                missile.use = W_Hagar_Explode2;
@@ -254,13 +254,13 @@ void W_Hagar_Attack2_Load_Release(void)
                setorigin(missile, w_shotorg);
                setsize(missile, '0 0 0', '0 0 0');
                missile.movetype = MOVETYPE_FLY;
-               missile.missile_flags = MIF_SPLASH; 
-               
+               missile.missile_flags = MIF_SPLASH;
+
                // per-shot spread calculation: the more shots there are, the less spread is applied (based on the bias cvar)
-               spread_pershot = ((shots - 1) / (WEP_CVAR_SEC(hagar, load_max) - 1)); 
+               spread_pershot = ((shots - 1) / (WEP_CVAR_SEC(hagar, load_max) - 1));
                spread_pershot = (1 - (spread_pershot * WEP_CVAR_SEC(hagar, load_spread_bias)));
                spread_pershot = (WEP_CVAR_SEC(hagar, spread) * spread_pershot * g_weaponspreadfactor);
-               
+
                // pattern spread calculation
                s = '0 0 0';
                if(counter == 0)
@@ -268,17 +268,17 @@ void W_Hagar_Attack2_Load_Release(void)
                else
                {
                        makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
-                       s_y = v_forward_x;
-                       s_z = v_forward_y;
+                       s.y = v_forward.x;
+                       s.z = v_forward.y;
                }
                s = s * WEP_CVAR_SEC(hagar, load_spread) * g_weaponspreadfactor;
-               
-               W_SetupProjVelocity_Explicit(missile, w_shotdir + right * s_y + up * s_z, v_up, WEP_CVAR_SEC(hagar, speed), 0, 0, spread_pershot, FALSE);
+
+               W_SetupProjVelocity_Explicit(missile, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_SEC(hagar, speed), 0, 0, spread_pershot, false);
 
                missile.angles = vectoangles(missile.velocity);
                missile.flags = FL_PROJECTILE;
 
-               CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR, TRUE);
+               CSQCProjectile(missile, true, PROJECTILE_HAGAR, true);
 
                other = missile; MUTATOR_CALLHOOK(EditProjectile);
        }
@@ -291,7 +291,7 @@ void W_Hagar_Attack2_Load_Release(void)
 void W_Hagar_Attack2_Load(void)
 {
        // loadable hagar secondary attack, must always run each frame
-       
+
        if(time < game_starttime)
                return;
 
@@ -320,7 +320,7 @@ void W_Hagar_Attack2_Load(void)
                                self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor();
 
                                // require letting go of the alt fire button before we can load again
-                               self.hagar_loadblock = TRUE;
+                               self.hagar_loadblock = true;
                        }
                }
                else
@@ -345,14 +345,14 @@ void W_Hagar_Attack2_Load(void)
                        {
                                // if this is the last rocket we can load, play a beep sound to notify the player
                                sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM);
-                               self.hagar_loadbeep = TRUE;
+                               self.hagar_loadbeep = true;
                        }
                }
        }
        else if(self.hagar_loadblock)
        {
                // the alt fire button has been released, so re-enable loading if blocked
-               self.hagar_loadblock = FALSE;
+               self.hagar_loadblock = false;
        }
 
        if(self.hagar_load)
@@ -364,10 +364,10 @@ void W_Hagar_Attack2_Load(void)
                        {
                                // we're about to automatically release after holding time, play a beep sound to notify the player
                                sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM);
-                               self.hagar_warning = TRUE;
+                               self.hagar_warning = true;
                        }
                }
-               
+
                // release if player let go of button or if they've held it in too long
                if(!self.BUTTON_ATCK2 || ((loaded || !enough_ammo) && self.hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0))
                {
@@ -377,8 +377,8 @@ void W_Hagar_Attack2_Load(void)
        }
        else
        {
-               self.hagar_loadbeep = FALSE;
-               self.hagar_warning = FALSE;
+               self.hagar_loadbeep = false;
+               self.hagar_warning = false;
        }
 
        // we aren't checking ammo during an attack, so we must do it here
@@ -398,11 +398,11 @@ float W_Hagar(float req)
                case WR_AIM:
                {
                        if(random()>0.15)
-                               self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), FALSE);
+                               self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
                        else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
-                               self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), FALSE);
-                               
-                       return TRUE;
+                               self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
+
+                       return true;
                }
                case WR_THINK:
                {
@@ -429,8 +429,8 @@ float W_Hagar(float req)
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_GONETHINK:
                {
@@ -440,8 +440,8 @@ float W_Hagar(float req)
                                self.weaponentity.state = WS_READY;
                                W_Hagar_Attack2_Load_Release();
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -451,20 +451,20 @@ float W_Hagar(float req)
                        precache_sound("weapons/hagar_fire.wav");
                        precache_sound("weapons/hagar_load.wav");
                        precache_sound("weapons/hagar_beep.wav");
-                       HAGAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       HAGAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_SETUP:
                {
-                       self.hagar_loadblock = FALSE;
+                       self.hagar_loadblock = false;
 
                        if(self.hagar_load)
                        {
                                W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
                                self.hagar_load = 0;
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -480,28 +480,28 @@ float W_Hagar(float req)
                }
                case WR_CONFIG:
                {
-                       HAGAR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       HAGAR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RESETPLAYER:
                {
                        self.hagar_load = 0;
-                       return TRUE;
+                       return true;
                }
                case WR_PLAYERDEATH:
                {
                        // if we have any rockets loaded when we die, release them
                        if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
                                W_Hagar_Attack2_Load_Release();
-                               
-                       return TRUE;
+
+                       return true;
                }
                case WR_RELOAD:
                {
                        if(!self.hagar_load) // require releasing loaded rockets first
                                W_Reload(min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), "weapons/reload.wav");
-                               
-                       return TRUE;
+
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -515,7 +515,7 @@ float W_Hagar(float req)
                                return WEAPON_HAGAR_MURDER_SPRAY;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -537,23 +537,23 @@ float W_Hagar(float req)
                                else
                                        sound(self, CH_SHOTS, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/hagexp1.wav");
                        precache_sound("weapons/hagexp2.wav");
                        precache_sound("weapons/hagexp3.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index d3dbed2f9c9fd9a88d974d227c378460016570b4..38f04841a727eb5b574f5333f303eb0feb1cc253 100644 (file)
@@ -56,9 +56,9 @@ void W_HLAC_Touch(void)
        PROJECTILE_TOUCH;
 
        self.event_damage = func_null;
-       
+
        isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY);
-       
+
        RadiusDamage(self, self.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius), world, world, WEP_CVAR_BOTH(hlac, isprimary, force), self.projectiledeathtype, other);
 
        remove(self);
@@ -76,7 +76,7 @@ void W_HLAC_Attack(void)
     if(self.crouch)
         spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
 
-       W_SetupShot(self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage));
+       W_SetupShot(self, false, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage));
        pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
        if(!autocvar_g_norecoil)
        {
@@ -87,7 +87,7 @@ void W_HLAC_Attack(void)
        missile = spawn();
        missile.owner = missile.realowner = self;
        missile.classname = "hlacbolt";
-       missile.bot_dodge = TRUE;
+       missile.bot_dodge = true;
 
     missile.bot_dodgerating = WEP_CVAR_PRI(hlac, damage);
 
@@ -108,7 +108,7 @@ void W_HLAC_Attack(void)
        missile.flags = FL_PROJECTILE;
        missile.projectiledeathtype = WEP_HLAC;
 
-       CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
+       CSQCProjectile(missile, true, PROJECTILE_HLAC, true);
 
        other = missile; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -124,13 +124,13 @@ void W_HLAC_Attack2(void)
     if(self.crouch)
         spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod);
 
-       W_SetupShot(self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage));
+       W_SetupShot(self, false, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage));
        pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
        missile = spawn();
        missile.owner = missile.realowner = self;
        missile.classname = "hlacbolt";
-       missile.bot_dodge = TRUE;
+       missile.bot_dodge = true;
 
     missile.bot_dodgerating = WEP_CVAR_SEC(hlac, damage);
 
@@ -149,10 +149,10 @@ void W_HLAC_Attack2(void)
     missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
 
        missile.flags = FL_PROJECTILE;
-       missile.missile_flags = MIF_SPLASH; 
+       missile.missile_flags = MIF_SPLASH;
        missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
 
-       CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
+       CSQCProjectile(missile, true, PROJECTILE_HLAC, true);
 
        other = missile; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -210,8 +210,8 @@ float W_HLAC(float req)
        {
                case WR_AIM:
                {
-                       self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), FALSE);
-                       return TRUE;
+                       self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
+                       return true;
                }
                case WR_THINK:
                {
@@ -235,8 +235,8 @@ float W_HLAC(float req)
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -244,8 +244,8 @@ float W_HLAC(float req)
                        precache_model("models/weapons/v_hlac.md3");
                        precache_model("models/weapons/h_hlac.iqm");
                        precache_sound("weapons/lasergun_fire.wav");
-                       HLAC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       HLAC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -261,13 +261,13 @@ float W_HLAC(float req)
                }
                case WR_CONFIG:
                {
-                       HLAC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       HLAC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -278,7 +278,7 @@ float W_HLAC(float req)
                        return WEAPON_HLAC_MURDER;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -293,21 +293,21 @@ float W_HLAC(float req)
                        pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
                        if(!w_issilent)
                                sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
-                               
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/laserimpact.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 69777c4c2ccafcef98d0860e244ccfba854a447e..8190411cd648ebd829a1758db8762bb8fd7c1c7e 100644 (file)
@@ -60,7 +60,7 @@ void W_HeavyMachineGun_Attack_Auto()
 
        W_DecreaseAmmo(WEP_CVAR(hmg, ammo));
 
-       W_SetupShot (self, TRUE, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(hmg, damage));
+       W_SetupShot (self, true, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(hmg, damage));
 
        if(!autocvar_g_norecoil)
        {
@@ -93,11 +93,11 @@ float W_HeavyMachineGun(float req)
                case WR_AIM:
                {
                        if(vlen(self.origin-self.enemy.origin) < 3000 - bound(0, skill, 10) * 200)
-                               self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
+                               self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false);
                        else
-                               self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
-                       
-                       return TRUE;
+                               self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
+
+                       return true;
                }
                case WR_THINK:
                {
@@ -113,7 +113,7 @@ float W_HeavyMachineGun(float req)
                                }
                        }
 
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
@@ -122,8 +122,8 @@ float W_HeavyMachineGun(float req)
                        precache_model ("models/weapons/v_ok_hmg.md3");
                        precache_model ("models/weapons/h_ok_hmg.iqm");
                        precache_sound ("weapons/uzi_fire.wav");
-                       HMG_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       HMG_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -145,13 +145,13 @@ float W_HeavyMachineGun(float req)
                }
                case WR_CONFIG:
                {
-                       HMG_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       HMG_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(WEP_CVAR(hmg, ammo), "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -165,7 +165,7 @@ float W_HeavyMachineGun(float req)
                                return WEAPON_HMG_MURDER_SPRAY;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -186,22 +186,22 @@ float W_HeavyMachineGun(float req)
                                else if(w_random < 0.2)
                                        sound(self, CH_SHOTS, "weapons/ric3.wav", VOL_BASE, ATTEN_NORM);
 
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/ric1.wav");
                        precache_sound("weapons/ric2.wav");
                        precache_sound("weapons/ric3.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 3713ca9c75c417fe91dddbd2f3b44d0fc24e696e..5d52dabaebba0ccc6e15f078de7a71cbb9ce0493 100644 (file)
@@ -62,7 +62,7 @@ void spawnfunc_weapon_hook(void)
 {
        if(g_grappling_hook) // offhand hook
        {
-               startitem_failed = TRUE;
+               startitem_failed = true;
                remove(self);
                return;
        }
@@ -112,12 +112,12 @@ void W_Hook_Damage(entity inflictor, entity attacker, float damage, float deatht
 {
        if(self.health <= 0)
                return;
-               
+
        if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
-               return; // g_projectiles_damage says to halt    
-       
+               return; // g_projectiles_damage says to halt
+
        self.health = self.health - damage;
-       
+
        if(self.health <= 0)
                W_PrepareExplosionByDamage(self.realowner, W_Hook_Explode2);
 }
@@ -133,12 +133,12 @@ void W_Hook_Attack2(void)
        entity gren;
 
        //W_DecreaseAmmo(WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb)
-       W_SetupShot(self, FALSE, 4, "weapons/hookbomb_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hook, damage));
+       W_SetupShot(self, false, 4, "weapons/hookbomb_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hook, damage));
 
        gren = spawn();
        gren.owner = gren.realowner = self;
        gren.classname = "hookbomb";
-       gren.bot_dodge = TRUE;
+       gren.bot_dodge = true;
        gren.bot_dodgerating = WEP_CVAR_SEC(hook, damage);
        gren.movetype = MOVETYPE_TOSS;
        PROJECTILE_MAKETRIGGER(gren);
@@ -150,12 +150,12 @@ void W_Hook_Attack2(void)
        gren.think = adaptor_think2use_hittype_splash;
        gren.use = W_Hook_Explode2;
        gren.touch = W_Hook_Touch2;
-       
+
        gren.takedamage = DAMAGE_YES;
        gren.health = WEP_CVAR_SEC(hook, health);
        gren.damageforcescale = WEP_CVAR_SEC(hook, damageforcescale);
        gren.event_damage = W_Hook_Damage;
-       gren.damagedbycontents = TRUE;
+       gren.damagedbycontents = true;
        gren.missile_flags = MIF_SPLASH | MIF_ARC;
 
        gren.velocity = '0 0 1' * WEP_CVAR_SEC(hook, speed);
@@ -168,7 +168,7 @@ void W_Hook_Attack2(void)
        gren.angles = '0 0 0';
        gren.flags = FL_PROJECTILE;
 
-       CSQCProjectile(gren, TRUE, PROJECTILE_HOOKBOMB, TRUE);
+       CSQCProjectile(gren, true, PROJECTILE_HOOKBOMB, true);
 
        other = gren; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -176,13 +176,13 @@ void W_Hook_Attack2(void)
 float W_Hook(float req)
 {
        float hooked_time_max, hooked_fuel;
-               
+
        switch(req)
        {
                case WR_AIM:
                {
                        // no bot AI for hook (yet?)
-                       return TRUE;
+                       return true;
                }
                case WR_THINK:
                {
@@ -196,7 +196,7 @@ float W_Hook(float req)
                                {
                                        W_DecreaseAmmo(WEP_CVAR_PRI(hook, ammo));
                                        self.hook_state |= HOOK_FIRING;
-                                       weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);                             
+                                       weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
                                }
                        }
 
@@ -221,13 +221,13 @@ float W_Hook(float req)
 
                        if(self.hook && self.hook.state == 1)
                        {
-                               hooked_time_max = WEP_CVAR_PRI(hook, hooked_time_max);                  
+                               hooked_time_max = WEP_CVAR_PRI(hook, hooked_time_max);
                                if(hooked_time_max > 0)
                                {
                                        if( time > self.hook_time_hooked + hooked_time_max )
                                                self.hook_state |= HOOK_REMOVING;
                                }
-                               
+
                                hooked_fuel = WEP_CVAR_PRI(hook, hooked_ammo);
                                if(hooked_fuel > 0)
                                {
@@ -253,7 +253,7 @@ float W_Hook(float req)
                        }
                        else
                        {
-                               self.hook_time_hooked = time;                           
+                               self.hook_time_hooked = time;
                                self.hook_time_fueldecrease = time + WEP_CVAR_PRI(hook, hooked_time_free);
                        }
 
@@ -282,8 +282,8 @@ float W_Hook(float req)
                                        self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -293,13 +293,13 @@ float W_Hook(float req)
                        precache_sound("weapons/hook_impact.wav"); // done by g_hook.qc
                        precache_sound("weapons/hook_fire.wav");
                        precache_sound("weapons/hookbomb_fire.wav");
-                       HOOK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       HOOK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_SETUP:
                {
                        self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
-                       return TRUE;
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -311,28 +311,28 @@ float W_Hook(float req)
                case WR_CHECKAMMO2:
                {
                        // infinite ammo for now
-                       return TRUE; // self.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
+                       return true; // self.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
                }
                case WR_CONFIG:
                {
-                       HOOK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       HOOK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RESETPLAYER:
                {
                        self.hook_refire = time;
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
-                       return FALSE;
+                       return false;
                }
                case WR_KILLMESSAGE:
                {
                        return WEAPON_HOOK_MURDER;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -347,21 +347,21 @@ float W_Hook(float req)
                        pointparticles(particleeffectnum("hookbomb_explode"), org2, '0 0 0', 1);
                        if(!w_issilent)
                                sound(self, CH_SHOTS, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_NORM);
-                               
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/hookbomb_impact.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 9c69c8d824b3d03c7db8ed18b32d7db39d7782b2..14a59e39892583450992262c11cdff7dd9c92cc0 100644 (file)
@@ -103,7 +103,7 @@ void W_MachineGun_MuzzleFlash(void)
 
 void W_MachineGun_Attack(float deathtype)
 {
-       W_SetupShot(self, TRUE, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
+       W_SetupShot(self, true, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
        if(!autocvar_g_norecoil)
        {
                self.punchangle_x = random() - 0.5;
@@ -179,7 +179,7 @@ void W_MachineGun_Attack_Auto(void)
 
        W_DecreaseAmmo(WEP_CVAR(machinegun, sustained_ammo));
 
-       W_SetupShot(self, TRUE, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
+       W_SetupShot(self, true, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
        if(!autocvar_g_norecoil)
        {
                self.punchangle_x = random() - 0.5;
@@ -205,7 +205,7 @@ void W_MachineGun_Attack_Auto(void)
 
 void W_MachineGun_Attack_Burst(void)
 {
-       W_SetupShot(self, TRUE, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
+       W_SetupShot(self, true, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
        if(!autocvar_g_norecoil)
        {
                self.punchangle_x = random() - 0.5;
@@ -243,11 +243,11 @@ float W_MachineGun(float req)
                case WR_AIM:
                {
                        if(vlen(self.origin-self.enemy.origin) < 3000 - bound(0, skill, 10) * 200)
-                               self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
+                               self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false);
                        else
-                               self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
-                       
-                       return TRUE;
+                               self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
+
+                       return true;
                }
                case WR_THINK:
                {
@@ -270,7 +270,7 @@ float W_MachineGun(float req)
                                        {
                                                W_SwitchWeapon_Force(self, w_getbestweapon(self));
                                                w_ready();
-                                               return FALSE;
+                                               return false;
                                        }
 
                                        W_DecreaseAmmo(WEP_CVAR(machinegun, burst_ammo));
@@ -298,8 +298,8 @@ float W_MachineGun(float req)
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -308,8 +308,8 @@ float W_MachineGun(float req)
                        precache_model("models/weapons/v_uzi.md3");
                        precache_model("models/weapons/h_uzi.iqm");
                        precache_sound("weapons/uzi_fire.wav");
-                       MACHINEGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       MACHINEGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -345,13 +345,13 @@ float W_MachineGun(float req)
                }
                case WR_CONFIG:
                {
-                       MACHINEGUN_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       MACHINEGUN_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -365,7 +365,7 @@ float W_MachineGun(float req)
                                return WEAPON_MACHINEGUN_MURDER_SPRAY;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -385,23 +385,23 @@ float W_MachineGun(float req)
                                        sound(self, CH_SHOTS, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
                                else if(w_random < 0.2)
                                        sound(self, CH_SHOTS, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
-                                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/ric1.wav");
                        precache_sound("weapons/ric2.wav");
                        precache_sound("weapons/ric3.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 2dac41e1badd5a236b30bba74ebddbb4c2b84930..2fe0172a9435d1d195e71c8d5e7b0cb4e38d7386 100644 (file)
@@ -85,7 +85,7 @@ void W_MineLayer_Stick(entity to)
        newmine.health = self.health;
        newmine.event_damage = self.event_damage;
        newmine.spawnshieldtime = self.spawnshieldtime;
-       newmine.damagedbycontents = TRUE;
+       newmine.damagedbycontents = true;
 
        newmine.movetype = MOVETYPE_NONE; // lock the mine in place
        newmine.projectiledeathtype = self.projectiledeathtype;
@@ -218,7 +218,7 @@ void W_MineLayer_Think(void)
                        self.movetype = MOVETYPE_NONE;
                }
        }
-       
+
        // our lifetime has expired, it's time to die - mine_time just allows us to play a sound for this
        // TODO: replace this mine_trigger.wav sound with a real countdown
        if((time > self.cnt) && (!self.mine_time) && (self.cnt > 0))
@@ -294,15 +294,15 @@ void W_MineLayer_Damage(entity inflictor, entity attacker, float damage, float d
 {
        if(self.health <= 0)
                return;
-               
+
        float is_from_enemy = (inflictor.realowner != self.realowner);
-               
+
        if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, (is_from_enemy ? 1 : -1)))
                return; // g_projectiles_damage says to halt
-               
+
        self.health = self.health - damage;
        self.angles = vectoangles(self.velocity);
-       
+
        if(self.health <= 0)
                W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode);
 }
@@ -326,7 +326,7 @@ void W_MineLayer_Attack(void)
 
        W_DecreaseAmmo(WEP_CVAR(minelayer, ammo));
 
-       W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', FALSE, 5, "weapons/mine_fire.wav", CH_WEAPON_A, WEP_CVAR(minelayer, damage));
+       W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 5, "weapons/mine_fire.wav", CH_WEAPON_A, WEP_CVAR(minelayer, damage));
        pointparticles(particleeffectnum("rocketlauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
        mine = WarpZone_RefSys_SpawnSameRefSys(self);
@@ -336,14 +336,14 @@ void W_MineLayer_Attack(void)
        else
                mine.spawnshieldtime = -1;
        mine.classname = "mine";
-       mine.bot_dodge = TRUE;
+       mine.bot_dodge = true;
        mine.bot_dodgerating = WEP_CVAR(minelayer, damage) * 2; // * 2 because it can detonate inflight which makes it even more dangerous
 
        mine.takedamage = DAMAGE_YES;
        mine.damageforcescale = WEP_CVAR(minelayer, damageforcescale);
        mine.health = WEP_CVAR(minelayer, health);
        mine.event_damage = W_MineLayer_Damage;
-       mine.damagedbycontents = TRUE;
+       mine.damagedbycontents = true;
 
        mine.movetype = MOVETYPE_TOSS;
        PROJECTILE_MAKETRIGGER(mine);
@@ -363,7 +363,7 @@ void W_MineLayer_Attack(void)
 
        if(mine.cnt > 0) { mine.cnt += time; }
 
-       CSQCProjectile(mine, TRUE, PROJECTILE_MINE, TRUE);
+       CSQCProjectile(mine, true, PROJECTILE_MINE, true);
 
        // muzzle flash for 1st person view
        flash = spawn();
@@ -375,7 +375,7 @@ void W_MineLayer_Attack(void)
        // common properties
 
        other = mine; MUTATOR_CALLHOOK(EditProjectile);
-       
+
        self.minelayer_mines = W_MineLayer_Count(self);
 }
 
@@ -390,7 +390,7 @@ float W_MineLayer_PlacedMines(float detonate)
                {
                        if(!mine.minelayer_detonate)
                        {
-                               mine.minelayer_detonate = TRUE;
+                               mine.minelayer_detonate = true;
                                minfound = 1;
                        }
                }
@@ -410,9 +410,9 @@ float W_MineLayer(float req)
                {
                        // aim and decide to fire if appropriate
                        if(self.minelayer_mines >= WEP_CVAR(minelayer, limit))
-                               self.BUTTON_ATCK = FALSE;
+                               self.BUTTON_ATCK = false;
                        else
-                               self.BUTTON_ATCK = bot_aim(WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), FALSE);
+                               self.BUTTON_ATCK = bot_aim(WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false);
                        if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
                        {
                                // decide whether to detonate mines
@@ -426,7 +426,7 @@ float W_MineLayer(float req)
                                selfdamage = 0;
                                teamdamage = 0;
                                enemydamage = 0;
-                               targetlist = findchainfloat(bot_attack, TRUE);
+                               targetlist = findchainfloat(bot_attack, true);
                                mine = find(world, classname, "mine");
                                while(mine)
                                {
@@ -476,7 +476,7 @@ float W_MineLayer(float req)
                                                        if(
                                                                (v_forward * normalize(mine.origin - targ.origin)< 0.1)
                                                                && desirabledamage > 0.1*coredamage
-                                                       )self.BUTTON_ATCK2 = TRUE;
+                                                       )self.BUTTON_ATCK2 = true;
                                                        targ = targ.chain;
                                                }
                                        }else{
@@ -487,7 +487,7 @@ float W_MineLayer(float req)
                                                        if(IS_PLAYER(self.enemy))
                                                                if(desirabledamage >= 0.1*coredamage)
                                                                        if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
-                                                                               self.BUTTON_ATCK2 = TRUE;
+                                                                               self.BUTTON_ATCK2 = true;
                                        //      dprint(ftos(random()/distance*300),">");dprint(ftos(frametime*bound(0,(10-skill)*0.2,1)),"\n");
                                        }
 
@@ -496,22 +496,22 @@ float W_MineLayer(float req)
                                // if we would be doing at X percent of the core damage, detonate it
                                // but don't fire a new shot at the same time!
                                if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
-                                       self.BUTTON_ATCK2 = TRUE;
+                                       self.BUTTON_ATCK2 = true;
                                if((skill > 6.5) && (selfdamage > self.health))
-                                       self.BUTTON_ATCK2 = FALSE;
-                               //if(self.BUTTON_ATCK2 == TRUE)
+                                       self.BUTTON_ATCK2 = false;
+                               //if(self.BUTTON_ATCK2 == true)
                                //      dprint(ftos(desirabledamage),"\n");
-                               if(self.BUTTON_ATCK2 == TRUE) self.BUTTON_ATCK = FALSE;
+                               if(self.BUTTON_ATCK2 == true) self.BUTTON_ATCK = false;
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_THINK:
                {
                        if(autocvar_g_balance_minelayer_reload_ammo && self.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
                        {
                                // not if we're holding the minelayer without enough ammo, but can detonate existing mines
-                               if(!(W_MineLayer_PlacedMines(FALSE) && self.WEP_AMMO(MINE_LAYER) < WEP_CVAR(minelayer, ammo)))
+                               if(!(W_MineLayer_PlacedMines(false) && self.WEP_AMMO(MINE_LAYER) < WEP_CVAR(minelayer, ammo)))
                                        WEP_ACTION(self.weapon, WR_RELOAD);
                        }
                        else if(self.BUTTON_ATCK)
@@ -525,11 +525,11 @@ float W_MineLayer(float req)
 
                        if(self.BUTTON_ATCK2)
                        {
-                               if(W_MineLayer_PlacedMines(TRUE))
+                               if(W_MineLayer_PlacedMines(true))
                                        sound(self, CH_WEAPON_B, "weapons/mine_det.wav", VOL_BASE, ATTN_NORM);
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -542,8 +542,8 @@ float W_MineLayer(float req)
                        precache_sound("weapons/mine_fire.wav");
                        precache_sound("weapons/mine_stick.wav");
                        precache_sound("weapons/mine_trigger.wav");
-                       MINELAYER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       MINELAYER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -554,29 +554,29 @@ float W_MineLayer(float req)
                                ammo_amount += self.(weapon_load[WEP_MINE_LAYER]) >= WEP_CVAR(minelayer, ammo);
                                return ammo_amount;
                        }
-                       return TRUE;
+                       return true;
                }
                case WR_CHECKAMMO2:
                {
-                       if(W_MineLayer_PlacedMines(FALSE))
-                               return TRUE;
+                       if(W_MineLayer_PlacedMines(false))
+                               return true;
                        else
-                               return FALSE;
+                               return false;
                }
                case WR_CONFIG:
                {
-                       MINELAYER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       MINELAYER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RESETPLAYER:
                {
                        self.minelayer_mines = 0;
-                       return TRUE;
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(WEP_CVAR(minelayer, ammo), "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -587,7 +587,7 @@ float W_MineLayer(float req)
                        return WEAPON_MINELAYER_MURDER;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -602,21 +602,21 @@ float W_MineLayer(float req)
                        pointparticles(particleeffectnum("rocket_explode"), org2, '0 0 0', 1);
                        if(!w_issilent)
                                sound(self, CH_SHOTS, "weapons/mine_exp.wav", VOL_BASE, ATTN_NORM);
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/mine_exp.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index de40fcb3933ec04462de65c03cd9287fdfbda626..34b5e57473cbf8d6a0e8eb774d3ea78bc258b62e 100644 (file)
@@ -103,12 +103,12 @@ void W_Mortar_Grenade_Damage(entity inflictor, entity attacker, float damage, fl
 {
        if(self.health <= 0)
                return;
-               
+
        if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
-               
+
        self.health = self.health - damage;
-       
+
        if(self.health <= 0)
                W_PrepareExplosionByDamage(attacker, self.use);
 }
@@ -198,10 +198,10 @@ void W_Mortar_Grenade_Touch2(void)
                pointparticles(particleeffectnum("hagar_bounce"), self.origin, self.velocity, 1);
                self.projectiledeathtype |= HITTYPE_BOUNCE;
                self.gl_bouncecnt += 1;
-               
+
                if(WEP_CVAR_SEC(mortar, lifetime_bounce) && self.gl_bouncecnt == 1)
                        self.nextthink = time + WEP_CVAR_SEC(mortar, lifetime_bounce);
-                       
+
        }
        else if(WEP_CVAR_SEC(mortar, type) == 2 && (!other || (other.takedamage != DAMAGE_AIM && other.movetype == MOVETYPE_NONE))) // stick
        {
@@ -227,7 +227,7 @@ void W_Mortar_Attack(void)
 
        W_DecreaseAmmo(WEP_CVAR_PRI(mortar, ammo));
 
-       W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', FALSE, 4, "weapons/grenade_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage));
+       W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, "weapons/grenade_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage));
        w_shotdir = v_forward; // no TrueAim for grenades please
 
        pointparticles(particleeffectnum("grenadelauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
@@ -235,7 +235,7 @@ void W_Mortar_Attack(void)
        gren = spawn();
        gren.owner = gren.realowner = self;
        gren.classname = "grenade";
-       gren.bot_dodge = TRUE;
+       gren.bot_dodge = true;
        gren.bot_dodgerating = WEP_CVAR_PRI(mortar, damage);
        gren.movetype = MOVETYPE_BOUNCE;
        gren.bouncefactor = WEP_CVAR(mortar, bouncefactor);
@@ -255,7 +255,7 @@ void W_Mortar_Attack(void)
        gren.health = WEP_CVAR_PRI(mortar, health);
        gren.damageforcescale = WEP_CVAR_PRI(mortar, damageforcescale);
        gren.event_damage = W_Mortar_Grenade_Damage;
-       gren.damagedbycontents = TRUE;
+       gren.damagedbycontents = true;
        gren.missile_flags = MIF_SPLASH | MIF_ARC;
        W_SetupProjVelocity_UP_PRI(gren, mortar);
 
@@ -263,9 +263,9 @@ void W_Mortar_Attack(void)
        gren.flags = FL_PROJECTILE;
 
        if(WEP_CVAR_PRI(mortar, type) == 0 || WEP_CVAR_PRI(mortar, type) == 2)
-               CSQCProjectile(gren, TRUE, PROJECTILE_GRENADE, TRUE);
+               CSQCProjectile(gren, true, PROJECTILE_GRENADE, true);
        else
-               CSQCProjectile(gren, TRUE, PROJECTILE_GRENADE_BOUNCING, TRUE);
+               CSQCProjectile(gren, true, PROJECTILE_GRENADE_BOUNCING, true);
 
        other = gren; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -276,7 +276,7 @@ void W_Mortar_Attack2(void)
 
        W_DecreaseAmmo(WEP_CVAR_SEC(mortar, ammo));
 
-       W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', FALSE, 4, "weapons/grenade_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage));
+       W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, "weapons/grenade_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage));
        w_shotdir = v_forward; // no TrueAim for grenades please
 
        pointparticles(particleeffectnum("grenadelauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
@@ -284,7 +284,7 @@ void W_Mortar_Attack2(void)
        gren = spawn();
        gren.owner = gren.realowner = self;
        gren.classname = "grenade";
-       gren.bot_dodge = TRUE;
+       gren.bot_dodge = true;
        gren.bot_dodgerating = WEP_CVAR_SEC(mortar, damage);
        gren.movetype = MOVETYPE_BOUNCE;
        gren.bouncefactor = WEP_CVAR(mortar, bouncefactor);
@@ -303,7 +303,7 @@ void W_Mortar_Attack2(void)
        gren.health = WEP_CVAR_SEC(mortar, health);
        gren.damageforcescale = WEP_CVAR_SEC(mortar, damageforcescale);
        gren.event_damage = W_Mortar_Grenade_Damage;
-       gren.damagedbycontents = TRUE;
+       gren.damagedbycontents = true;
        gren.missile_flags = MIF_SPLASH | MIF_ARC;
        W_SetupProjVelocity_UP_SEC(gren, mortar);
 
@@ -311,9 +311,9 @@ void W_Mortar_Attack2(void)
        gren.flags = FL_PROJECTILE;
 
        if(WEP_CVAR_SEC(mortar, type) == 0 || WEP_CVAR_SEC(mortar, type) == 2)
-               CSQCProjectile(gren, TRUE, PROJECTILE_GRENADE, TRUE);
+               CSQCProjectile(gren, true, PROJECTILE_GRENADE, true);
        else
-               CSQCProjectile(gren, TRUE, PROJECTILE_GRENADE_BOUNCING, TRUE);
+               CSQCProjectile(gren, true, PROJECTILE_GRENADE_BOUNCING, true);
 
        other = gren; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -328,26 +328,26 @@ float W_Mortar(float req)
        {
                case WR_AIM:
                {
-                       self.BUTTON_ATCK = FALSE;
-                       self.BUTTON_ATCK2 = FALSE;
+                       self.BUTTON_ATCK = false;
+                       self.BUTTON_ATCK2 = false;
                        if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
                        {
-                               if(bot_aim(WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), TRUE))
+                               if(bot_aim(WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true))
                                {
-                                       self.BUTTON_ATCK = TRUE;
+                                       self.BUTTON_ATCK = true;
                                        if(random() < 0.01) self.bot_secondary_grenademooth = 1;
                                }
                        }
                        else
                        {
-                               if(bot_aim(WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), TRUE))
+                               if(bot_aim(WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true))
                                {
-                                       self.BUTTON_ATCK2 = TRUE;
+                                       self.BUTTON_ATCK2 = true;
                                        if(random() < 0.02) self.bot_secondary_grenademooth = 0;
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                /*case WR_CALCINFO:
                {
@@ -357,11 +357,11 @@ float W_Mortar(float req)
 
                        // for the range calculation, closer to 1 is better
                        wepinfo_pri_range_max = 2000 * wepinfo_pri_speed;
-                       wepinfo_pri_range = wepinfo_pri_speed * WEP_CVAR_PRI(mortar, 
-                       
+                       wepinfo_pri_range = wepinfo_pri_speed * WEP_CVAR_PRI(mortar,
+
                        wepinfo_sec_refire = max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime));
                        wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / wepinfo_sec_refire));
-                       
+
                        wepinfo_sec_dps = (WEP_CVAR_SEC(mortar, damage) * (1 / max3(sys_frametime, WEP_CVAR_SEC(mortar, refire), WEP_CVAR_SEC(mortar, animtime))));
                        wepinfo_ter_dps = 0;
                        */
@@ -386,7 +386,7 @@ float W_Mortar(float req)
                                        {
                                                if(!nade.gl_detonate_later)
                                                {
-                                                       nade.gl_detonate_later = TRUE;
+                                                       nade.gl_detonate_later = true;
                                                        nadefound = 1;
                                                }
                                        }
@@ -399,8 +399,8 @@ float W_Mortar(float req)
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -415,8 +415,8 @@ float W_Mortar(float req)
                        precache_sound("weapons/grenade_bounce6.wav");
                        precache_sound("weapons/grenade_stick.wav");
                        precache_sound("weapons/grenade_fire.wav");
-                       MORTAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       MORTAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -432,13 +432,13 @@ float W_Mortar(float req)
                }
                case WR_CONFIG:
                {
-                       MORTAR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       MORTAR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), "weapons/reload.wav"); // WEAPONTODO
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -455,7 +455,7 @@ float W_Mortar(float req)
                                return WEAPON_MORTAR_MURDER_EXPLODE;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -470,21 +470,21 @@ float W_Mortar(float req)
                        pointparticles(particleeffectnum("grenade_explode"), org2, '0 0 0', 1);
                        if(!w_issilent)
                                sound(self, CH_SHOTS, "weapons/grenade_impact.wav", VOL_BASE, ATTN_NORM);
-                               
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/grenade_impact.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index e1fb82f8f2bd427a0eb7767e43d5434f5fc7fb7d..0010449a025923feff26357579fc0a98fd2fe9d0 100644 (file)
@@ -194,7 +194,7 @@ void W_Porto_Touch(void)
                        Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN);
                        self.right_vector = self.right_vector - 2 * trace_plane_normal * (self.right_vector * norm);
                        self.angles = vectoangles(self.velocity - 2 * trace_plane_normal * (self.velocity * norm));
-                       CSQCProjectile(self, TRUE, PROJECTILE_PORTO_BLUE, TRUE); // change type
+                       CSQCProjectile(self, true, PROJECTILE_PORTO_BLUE, true); // change type
                }
                else
                {
@@ -235,7 +235,7 @@ void W_Porto_Attack(float type)
 {
        entity gren;
 
-       W_SetupShot(self, FALSE, 4, "porto/fire.wav", CH_WEAPON_A, 0);
+       W_SetupShot(self, false, 4, "porto/fire.wav", CH_WEAPON_A, 0);
        // always shoot from the eye
        w_shotdir = v_forward;
        w_shotorg = self.origin + self.view_ofs + ((w_shotorg - self.origin - self.view_ofs) * v_forward) * v_forward;
@@ -247,7 +247,7 @@ void W_Porto_Attack(float type)
        gren.owner = gren.realowner = self;
        gren.playerid = self.playerid;
        gren.classname = "porto";
-       gren.bot_dodge = TRUE;
+       gren.bot_dodge = true;
        gren.bot_dodgerating = 200;
        gren.movetype = MOVETYPE_BOUNCEMISSILE;
        PROJECTILE_MAKETRIGGER(gren);
@@ -255,11 +255,11 @@ void W_Porto_Attack(float type)
        gren.scale = 4;
        setorigin(gren, w_shotorg);
        setsize(gren, '0 0 0', '0 0 0');
-       
+
        gren.nextthink = time + WEP_CVAR_BOTH(porto, (type <= 0), lifetime);
        gren.think = W_Porto_Think;
        gren.touch = W_Porto_Touch;
-       
+
        if(self.items & IT_STRENGTH)
                W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(porto, (type <= 0), speed) * autocvar_g_balance_powerup_strength_force, 0);
        else
@@ -277,9 +277,9 @@ void W_Porto_Attack(float type)
        gren.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;
 
        if(type > 0)
-               CSQCProjectile(gren, TRUE, PROJECTILE_PORTO_BLUE, TRUE);
+               CSQCProjectile(gren, true, PROJECTILE_PORTO_BLUE, true);
        else
-               CSQCProjectile(gren, TRUE, PROJECTILE_PORTO_RED, TRUE);
+               CSQCProjectile(gren, true, PROJECTILE_PORTO_RED, true);
 
        other = gren; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -290,23 +290,23 @@ float W_Porto(float req)
        //vector v_angle_save;
 
        if(g_nexball) { return w_nexball_weapon(req); }
-       
+
        switch(req)
        {
                case WR_AIM:
                {
-                       self.BUTTON_ATCK = FALSE;
-                       self.BUTTON_ATCK2 = FALSE;
+                       self.BUTTON_ATCK = false;
+                       self.BUTTON_ATCK2 = false;
                        if(!WEP_CVAR(porto, secondary))
-                               if(bot_aim(WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), FALSE))
-                                       self.BUTTON_ATCK = TRUE;
-                                       
-                       return TRUE;
+                               if(bot_aim(WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false))
+                                       self.BUTTON_ATCK = true;
+
+                       return true;
                }
                case WR_CONFIG:
                {
-                       PORTO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       PORTO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_THINK:
                {
@@ -363,8 +363,8 @@ float W_Porto(float req)
                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -378,21 +378,21 @@ float W_Porto(float req)
                        precache_sound("porto/explode.wav");
                        precache_sound("porto/fire.wav");
                        precache_sound("porto/unsupported.wav");
-                       PORTO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       PORTO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_SETUP:
                {
                        self.ammo_field = ammo_none;
-                       return TRUE;
+                       return true;
                }
                case WR_RESETPLAYER:
                {
                        self.porto_current = world;
-                       return TRUE;
+                       return true;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -403,20 +403,20 @@ float W_Porto(float req)
                case WR_IMPACTEFFECT:
                {
                        print("Since when does Porto send DamageInfo?\n");
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
                        // nothing to do
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 03c396cebabcc91f9b7e2086af6404d984283cdc..f20872f7045067fb300a1c24ffd6240a0af5e773 100644 (file)
@@ -9,7 +9,7 @@ REGISTER_WEAPON(
 /* color     */ '0.5 1 0',
 /* modelname */ "campingrifle",
 /* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshairrifle 0.5",
+/* crosshair */ "gfx/crosshairrifle 0.6",
 /* wepimg    */ "weaponrifle",
 /* refname   */ "rifle",
 /* wepname   */ _("Rifle")
@@ -56,7 +56,7 @@ void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSolid
 
        W_DecreaseAmmo(pAmmo);
 
-       W_SetupShot(self, TRUE, 2, pSound, CH_WEAPON_A, pDamage * pShots);
+       W_SetupShot(self, true, 2, pSound, CH_WEAPON_A, pDamage * pShots);
 
        pointparticles(particleeffectnum("rifle_muzzleflash"), w_shotorg, w_shotdir * 2000, 1);
 
@@ -136,33 +136,33 @@ void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animt
 float W_Rifle(float req)
 {
        float ammo_amount;
-       
+
        switch(req)
        {
                case WR_AIM:
                {
-                       self.BUTTON_ATCK=FALSE;
-                       self.BUTTON_ATCK2=FALSE;
+                       self.BUTTON_ATCK=false;
+                       self.BUTTON_ATCK2=false;
                        if(vlen(self.origin-self.enemy.origin) > 1000)
                                self.bot_secondary_riflemooth = 0;
                        if(self.bot_secondary_riflemooth == 0)
                        {
-                               if(bot_aim(1000000, 0, 0.001, FALSE))
+                               if(bot_aim(1000000, 0, 0.001, false))
                                {
-                                       self.BUTTON_ATCK = TRUE;
+                                       self.BUTTON_ATCK = true;
                                        if(random() < 0.01) self.bot_secondary_riflemooth = 1;
                                }
                        }
                        else
                        {
-                               if(bot_aim(1000000, 0, 0.001, FALSE))
+                               if(bot_aim(1000000, 0, 0.001, false))
                                {
-                                       self.BUTTON_ATCK2 = TRUE;
+                                       self.BUTTON_ATCK2 = true;
                                        if(random() < 0.03) self.bot_secondary_riflemooth = 0;
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_THINK:
                {
@@ -198,8 +198,8 @@ float W_Rifle(float req)
                                        }
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -208,8 +208,8 @@ float W_Rifle(float req)
                        precache_model("models/weapons/h_campingrifle.iqm");
                        precache_sound("weapons/campingrifle_fire.wav");
                        precache_sound("weapons/campingrifle_fire2.wav");
-                       RIFLE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       RIFLE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -225,18 +225,18 @@ float W_Rifle(float req)
                }
                case WR_CONFIG:
                {
-                       RIFLE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       RIFLE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RESETPLAYER:
                {
                        self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
-                       return TRUE;
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -260,7 +260,7 @@ float W_Rifle(float req)
                        }
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -282,8 +282,8 @@ float W_Rifle(float req)
                                else if(w_random < 0.5)
                                        sound(self, CH_SHOTS, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -294,23 +294,23 @@ float W_Rifle(float req)
                        {
                                precache_pic("gfx/reticle_nex");
                        }
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        if(button_zoom || zoomscript_caught)
                        {
                                reticle_image = "gfx/reticle_nex";
-                               return TRUE;
+                               return true;
                        }
                        else
                        {
                                // no weapon specific image for this weapon
-                               return FALSE;
+                               return false;
                        }
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 81e1144434287fde8164cc48e27679ef7a20f117..387dc32d82eb5c891bc40b3a8fbbdd6e6a70a50e 100644 (file)
@@ -9,7 +9,7 @@ REGISTER_WEAPON(
 /* color     */ '0.5 0.5 0',
 /* modelname */ "ok_rl",
 /* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshairrocketlauncher 0.5875",
+/* crosshair */ "gfx/crosshairrocketlauncher 0.7",
 /* wepimg    */ "weaponrpc",
 /* refname   */ "rpc",
 /* wepname      */ _("Rocket Propelled Chainsaw")
@@ -107,19 +107,19 @@ void W_RocketPropelledChainsaw_Attack (void)
        entity flash = spawn ();
 
        W_DecreaseAmmo(WEP_CVAR(rpc, ammo));
-       W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', FALSE, 5, "weapons/rocket_fire.wav", CH_WEAPON_A, WEP_CVAR(rpc, damage));
+       W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', false, 5, "weapons/rocket_fire.wav", CH_WEAPON_A, WEP_CVAR(rpc, damage));
        pointparticles(particleeffectnum("rocketlauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
        PROJECTILE_MAKETRIGGER(missile);
 
        missile.owner = missile.realowner = self;
-       missile.bot_dodge = TRUE;
+       missile.bot_dodge = true;
        missile.bot_dodgerating = WEP_CVAR(rpc, damage) * 2;
 
        missile.takedamage = DAMAGE_YES;
        missile.damageforcescale = WEP_CVAR(rpc, damageforcescale);
        missile.health = WEP_CVAR(rpc, health);
        missile.event_damage = W_RocketPropelledChainsaw_Damage;
-       missile.damagedbycontents = TRUE;
+       missile.damagedbycontents = true;
        missile.movetype = MOVETYPE_FLY;
 
        missile.projectiledeathtype = WEP_RPC;
@@ -135,7 +135,7 @@ void W_RocketPropelledChainsaw_Attack (void)
        missile.nextthink = time;
        missile.flags = FL_PROJECTILE;
 
-       CSQCProjectile(missile, TRUE, PROJECTILE_RPC, FALSE);
+       CSQCProjectile(missile, true, PROJECTILE_RPC, false);
 
        setmodel(flash, "models/flash.md3"); // precision set below
        SUB_SetFade (flash, time, 0.1);
@@ -148,13 +148,13 @@ void W_RocketPropelledChainsaw_Attack (void)
 
 float W_RocketPropelledChainsaw(float req)
 {
-       float ammo_amount = FALSE;
+       float ammo_amount = false;
        switch(req)
        {
                case WR_AIM:
                {
-                       self.BUTTON_ATCK = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), FALSE);
-                       return TRUE;
+                       self.BUTTON_ATCK = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
+                       return true;
                }
                case WR_THINK:
                {
@@ -177,7 +177,7 @@ float W_RocketPropelledChainsaw(float req)
                                }
                        }
 
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
@@ -186,8 +186,8 @@ float W_RocketPropelledChainsaw(float req)
                        precache_model("models/weapons/v_ok_rl.md3");
                        precache_model("models/weapons/g_ok_rl.md3");
                        precache_sound ("weapons/rocket_fire.wav");
-                       RPC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       RPC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -197,17 +197,17 @@ float W_RocketPropelledChainsaw(float req)
                }
                case WR_CHECKAMMO2:
                {
-                       return FALSE;
+                       return false;
                }
                case WR_CONFIG:
                {
-                       RPC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       RPC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(WEP_CVAR(rpc, ammo), "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -227,7 +227,7 @@ float W_RocketPropelledChainsaw(float req)
                }
        }
 
-       return FALSE;
+       return false;
 }
 #endif
 
@@ -244,21 +244,21 @@ float W_RocketPropelledChainsaw(float req)
                        if(!w_issilent)
                                sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
 
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/rocket_impact.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
 
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index d4c4d33941efc18591d9a168c918beda8f6d5422..45a121ab40bef47b03a42f32090dcf3b6fed3c84 100644 (file)
@@ -142,9 +142,9 @@ void W_Seeker_Missile_Think(void)
                {
                        // Is it a better idea (shorter distance) to trace to the target itself?
                        if( vlen(self.origin + olddir * self.wait) < dist)
-                               traceline(self.origin, self.origin + olddir * self.wait, FALSE, self);
+                               traceline(self.origin, self.origin + olddir * self.wait, false, self);
                        else
-                               traceline(self.origin, eorg, FALSE, self);
+                               traceline(self.origin, eorg, false, self);
 
                        // Setup adaptive tracelength
                        self.wait = bound(WEP_CVAR(seeker, missile_smart_trace_min), vlen(self.origin - trace_endpos), self.wait = WEP_CVAR(seeker, missile_smart_trace_max));
@@ -249,16 +249,16 @@ void W_Seeker_Fire_Missile(vector f_diff, entity m_target)
        W_DecreaseAmmo(WEP_CVAR(seeker, missile_ammo));
 
        makevectors(self.v_angle);
-       W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/seeker_fire.wav", CH_WEAPON_A, 0);
+       W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, "weapons/seeker_fire.wav", CH_WEAPON_A, 0);
        w_shotorg += f_diff;
        pointparticles(particleeffectnum("seeker_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
-       //self.detornator         = FALSE;
+       //self.detornator         = false;
 
        missile                 = spawn();
        missile.owner           = missile.realowner = self;
        missile.classname       = "seeker_missile";
-       missile.bot_dodge       = TRUE;
+       missile.bot_dodge       = true;
        missile.bot_dodgerating = WEP_CVAR(seeker, missile_damage);
 
        missile.think           = W_Seeker_Missile_Think;
@@ -272,7 +272,7 @@ void W_Seeker_Fire_Missile(vector f_diff, entity m_target)
        missile.takedamage      = DAMAGE_YES;
        missile.health          = WEP_CVAR(seeker, missile_health);
        missile.damageforcescale = WEP_CVAR(seeker, missile_damageforcescale);
-       missile.damagedbycontents = TRUE;
+       missile.damagedbycontents = true;
        //missile.think           = W_Seeker_Missile_Animate; // csqc projectiles.
 
        if(missile.enemy != world)
@@ -291,7 +291,7 @@ void W_Seeker_Fire_Missile(vector f_diff, entity m_target)
 
        missile.angles = vectoangles(missile.velocity);
 
-       CSQCProjectile(missile, FALSE, PROJECTILE_SEEKER, TRUE);
+       CSQCProjectile(missile, false, PROJECTILE_SEEKER, true);
 
        other = missile; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -340,7 +340,7 @@ void W_Seeker_Fire_Flac(void)
                        f_diff = '+1.25 +3.75 0';
                        break;
        }
-       W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/flac_fire.wav", CH_WEAPON_A, WEP_CVAR(seeker, flac_damage));
+       W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, "weapons/flac_fire.wav", CH_WEAPON_A, WEP_CVAR(seeker, flac_damage));
        w_shotorg += f_diff;
 
        pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
@@ -348,7 +348,7 @@ void W_Seeker_Fire_Flac(void)
        missile                                 = spawn();
        missile.owner                   = missile.realowner = self;
        missile.classname               = "missile";
-       missile.bot_dodge               = TRUE;
+       missile.bot_dodge               = true;
        missile.bot_dodgerating = WEP_CVAR(seeker, flac_damage);
        missile.touch                   = W_Seeker_Flac_Explode;
        missile.use                     = W_Seeker_Flac_Explode;
@@ -369,7 +369,7 @@ void W_Seeker_Fire_Flac(void)
        setsize(missile, '-2 -2 -2', '2 2 2');
 
        W_SetupProjVelocity_UP_PRE(missile, seeker, flac_);
-       CSQCProjectile(missile, TRUE, PROJECTILE_FLAC, TRUE);
+       CSQCProjectile(missile, true, PROJECTILE_FLAC, true);
 
        other = missile; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -545,7 +545,7 @@ void W_Seeker_Tag_Touch(void)
 
                if(WEP_CVAR(seeker, type) == 1)
                {
-                       WaypointSprite_Spawn("tagged-target", WEP_CVAR(seeker, tag_tracker_lifetime), 0, other, '0 0 64', self.realowner, 0, other, wps_tag_tracker, TRUE, RADARICON_TAGGED, '0.5 1 0');
+                       WaypointSprite_Spawn("tagged-target", WEP_CVAR(seeker, tag_tracker_lifetime), 0, other, '0 0 64', self.realowner, 0, other, wps_tag_tracker, true, RADARICON_TAGGED, '0.5 1 0');
                        WaypointSprite_UpdateRule(other.wps_tag_tracker, 0, SPRITERULE_DEFAULT);
                }
        }
@@ -559,12 +559,12 @@ void W_Seeker_Fire_Tag(void)
        entity missile;
        W_DecreaseAmmo(WEP_CVAR(seeker, tag_ammo));
 
-       W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/tag_fire.wav", CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count));
+       W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, "weapons/tag_fire.wav", CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count));
 
        missile                 = spawn();
        missile.owner           = missile.realowner = self;
        missile.classname       = "seeker_tag";
-       missile.bot_dodge       = TRUE;
+       missile.bot_dodge       = true;
        missile.bot_dodgerating = 50;
        missile.touch           = W_Seeker_Tag_Touch;
        missile.think           = SUB_Remove;
@@ -587,7 +587,7 @@ void W_Seeker_Fire_Tag(void)
        W_SetupProjVelocity_PRE(missile, seeker, tag_);
        missile.angles = vectoangles(missile.velocity);
 
-       CSQCProjectile(missile, TRUE, PROJECTILE_TAG, FALSE); // has sound
+       CSQCProjectile(missile, true, PROJECTILE_TAG, false); // has sound
 
        other = missile; MUTATOR_CALLHOOK(EditProjectile);
 }
@@ -606,12 +606,12 @@ float W_Seeker(float req)
                {
                        if(WEP_CVAR(seeker, type) == 1)
                                if(W_Seeker_Tagged_Info(self, self.enemy) != world)
-                                       self.BUTTON_ATCK = bot_aim(WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), FALSE);
+                                       self.BUTTON_ATCK = bot_aim(WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
                                else
-                                       self.BUTTON_ATCK2 = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), FALSE);
+                                       self.BUTTON_ATCK2 = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
                        else
-                               self.BUTTON_ATCK = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), FALSE);
-                       return TRUE;
+                               self.BUTTON_ATCK = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+                       return true;
                }
                case WR_THINK:
                {
@@ -658,7 +658,7 @@ float W_Seeker(float req)
                                }
                        }
 
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
@@ -668,8 +668,8 @@ float W_Seeker(float req)
                        precache_sound("weapons/tag_fire.wav");
                        precache_sound("weapons/flac_fire.wav");
                        precache_sound("weapons/seeker_fire.wav");
-                       SEEKER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       SEEKER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -701,13 +701,13 @@ float W_Seeker(float req)
                }
                case WR_CONFIG:
                {
-                       SEEKER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       SEEKER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -721,7 +721,7 @@ float W_Seeker(float req)
                                return WEAPON_SEEKER_MURDER_SPRAY;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -767,7 +767,7 @@ float W_Seeker(float req)
                                                sound(self, CH_SHOTS, "weapons/seekerexp3.wav", 1, ATTEN_NORM);
                                }
                        }
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
@@ -778,15 +778,15 @@ float W_Seeker(float req)
                        precache_sound("weapons/tagexp2.wav");
                        precache_sound("weapons/tagexp3.wav");
                        precache_sound("weapons/tag_impact.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 759dc35eaecbb4496924c3b1e25c492f4b26ab0c..3f40c5397fcfb8d34b96f4db4e0132c8b07bc5d1 100644 (file)
@@ -93,7 +93,7 @@ void spawnfunc_weapon_shockwave(void)
        weapon_defaultspawnfunc(WEP_SHOCKWAVE);
 }
 
-#define MAX_SHOCKWAVE_HITS 10
+const float MAX_SHOCKWAVE_HITS = 10;
 //#define DEBUG_SHOCKWAVE
 
 .float swing_prev;
@@ -121,24 +121,24 @@ void W_Shockwave_Melee_Think(void)
        // set start time of melee
        if(!self.cnt)
        {
-               self.cnt = time; 
+               self.cnt = time;
                W_PlayStrengthSound(self.realowner);
        }
 
        // update values for v_* vectors
        makevectors(self.realowner.v_angle);
-       
+
        // calculate swing percentage based on time
        meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor();
        swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10);
        f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces));
-       
-       // perform the traces needed for this frame 
+
+       // perform the traces needed for this frame
        for(i=self.swing_prev; i < f; ++i)
        {
                swing_factor = ((1 - (i / WEP_CVAR(shockwave, melee_traces))) * 2 - 1);
-               
-               targpos = (self.realowner.origin + self.realowner.view_ofs 
+
+               targpos = (self.realowner.origin + self.realowner.view_ofs
                        + (v_forward * WEP_CVAR(shockwave, melee_range))
                        + (v_up * swing_factor * WEP_CVAR(shockwave, melee_swing_up))
                        + (v_right * swing_factor * WEP_CVAR(shockwave, melee_swing_side)));
@@ -147,26 +147,26 @@ void W_Shockwave_Melee_Think(void)
                        self.realowner,
                        (self.realowner.origin + self.realowner.view_ofs),
                        targpos,
-                       FALSE,
+                       false,
                        self.realowner,
                        ANTILAG_LATENCY(self.realowner)
                );
-               
+
                // draw lightning beams for debugging
 #ifdef DEBUG_SHOCKWAVE
-               te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5); 
+               te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5);
                te_customflash(targpos, 40,  2, '1 1 1');
 #endif
-               
+
                is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || (trace_ent.flags & FL_MONSTER));
 
                if((trace_fraction < 1) // if trace is good, apply the damage and remove self if necessary
-                       && (trace_ent.takedamage == DAMAGE_AIM)  
+                       && (trace_ent.takedamage == DAMAGE_AIM)
                        && (trace_ent != self.swing_alreadyhit)
                        && (is_player || WEP_CVAR(shockwave, melee_nonplayerdamage)))
                {
                        target_victim = trace_ent; // so it persists through other calls
-                       
+
                        if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught
                                swing_damage = (WEP_CVAR(shockwave, melee_damage) * min(1, swing_factor + 1));
                        else
@@ -176,10 +176,10 @@ void W_Shockwave_Melee_Think(void)
                        Damage(
                                target_victim,
                                self.realowner,
-                               self.realowner, 
+                               self.realowner,
                                swing_damage,
-                               (WEP_SHOCKWAVE | HITTYPE_SECONDARY), 
-                               (self.realowner.origin + self.realowner.view_ofs), 
+                               (WEP_SHOCKWAVE | HITTYPE_SECONDARY),
+                               (self.realowner.origin + self.realowner.view_ofs),
                                (v_forward * WEP_CVAR(shockwave, melee_force))
                        );
 
@@ -211,7 +211,7 @@ void W_Shockwave_Melee_Think(void)
                        }
                }
        }
-       
+
        if(time >= self.cnt + meleetime)
        {
                // melee is finished
@@ -220,7 +220,7 @@ void W_Shockwave_Melee_Think(void)
        }
        else
        {
-               // set up next frame 
+               // set up next frame
                self.swing_prev = i;
                self.nextthink = time;
        }
@@ -236,7 +236,7 @@ void W_Shockwave_Melee(void)
        meleetemp.owner = meleetemp.realowner = self;
        meleetemp.think = W_Shockwave_Melee_Think;
        meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
-       W_SetupShot_Range(self, TRUE, 0, "", 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
+       W_SetupShot_Range(self, true, 0, "", 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
 }
 
 // SHOCKWAVE ATTACK MODE
@@ -249,7 +249,7 @@ float W_Shockwave_Attack_CheckSpread(
        float spreadlimit;
        float distance_of_attack = vlen(sw_shotorg - attack_endpos);
        float distance_from_line = vlen(targetorg - nearest_on_line);
-       
+
        spreadlimit = (distance_of_attack ? min(1, (vlen(sw_shotorg - nearest_on_line) / distance_of_attack)) : 1);
        spreadlimit =
                (
@@ -265,7 +265,7 @@ float W_Shockwave_Attack_CheckSpread(
        )
                { return bound(0, (distance_from_line / spreadlimit), 1); }
        else
-               { return FALSE; }
+               { return false; }
 }
 
 float W_Shockwave_Attack_IsVisible(
@@ -283,14 +283,14 @@ float W_Shockwave_Attack_IsVisible(
        if(W_Shockwave_Attack_CheckSpread(nearest_to_attacker, nearest_on_line, sw_shotorg, attack_endpos))
        {
                WarpZone_TraceLine(sw_shotorg, nearest_to_attacker, MOVE_NOMONSTERS, self);
-               if(trace_fraction == 1) { return TRUE; } // yes, the nearest point is clear and we can allow the damage
+               if(trace_fraction == 1) { return true; } // yes, the nearest point is clear and we can allow the damage
        }
 
        // STEP TWO: Check if shotorg to center point is clear
        if(W_Shockwave_Attack_CheckSpread(center, nearest_on_line, sw_shotorg, attack_endpos))
        {
                WarpZone_TraceLine(sw_shotorg, center, MOVE_NOMONSTERS, self);
-               if(trace_fraction == 1) { return TRUE; } // yes, the center point is clear and we can allow the damage
+               if(trace_fraction == 1) { return true; } // yes, the center point is clear and we can allow the damage
        }
 
        // STEP THREE: Check each corner to see if they are clear
@@ -300,11 +300,11 @@ float W_Shockwave_Attack_IsVisible(
                if(W_Shockwave_Attack_CheckSpread(corner, nearest_on_line, sw_shotorg, attack_endpos))
                {
                        WarpZone_TraceLine(sw_shotorg, corner, MOVE_NOMONSTERS, self);
-                       if(trace_fraction == 1) { return TRUE; } // yes, this corner is clear and we can allow the damage
+                       if(trace_fraction == 1) { return true; } // yes, this corner is clear and we can allow the damage
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 float W_Shockwave_Attack_CheckHit(
@@ -313,35 +313,35 @@ float W_Shockwave_Attack_CheckHit(
        vector final_force,
        float final_damage)
 {
-       if(!head) { return FALSE; }
+       if(!head) { return false; }
        float i;
-       
+
        for(i = 0; i <= queue; ++i)
        {
                if(shockwave_hit[i] == head)
                {
                        if(vlen(final_force) > vlen(shockwave_hit_force[i])) { shockwave_hit_force[i] = final_force; }
                        if(final_damage > shockwave_hit_damage[i]) { shockwave_hit_damage[i] = final_damage; }
-                       return FALSE;
+                       return false;
                }
        }
 
        shockwave_hit[queue] = head;
        shockwave_hit_force[queue] = final_force;
        shockwave_hit_damage[queue] = final_damage;
-       return TRUE;
+       return true;
 }
 
 void W_Shockwave_Send(void)
 {
        WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
        WriteByte(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE);
-       WriteCoord(MSG_BROADCAST, w_shotorg_x);
-       WriteCoord(MSG_BROADCAST, w_shotorg_y);
-       WriteCoord(MSG_BROADCAST, w_shotorg_z);
-       WriteCoord(MSG_BROADCAST, w_shotdir_x);
-       WriteCoord(MSG_BROADCAST, w_shotdir_y);
-       WriteCoord(MSG_BROADCAST, w_shotdir_z);
+       WriteCoord(MSG_BROADCAST, w_shotorg.x);
+       WriteCoord(MSG_BROADCAST, w_shotorg.y);
+       WriteCoord(MSG_BROADCAST, w_shotorg.z);
+       WriteCoord(MSG_BROADCAST, w_shotdir.x);
+       WriteCoord(MSG_BROADCAST, w_shotdir.y);
+       WriteCoord(MSG_BROADCAST, w_shotdir.z);
        WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance));
        WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255));
        WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255));
@@ -357,9 +357,9 @@ void W_Shockwave_Attack(void)
        entity head;
 
        float i, queue = 0;
-       
+
        // set up the shot direction
-       W_SetupShot(self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
+       W_SetupShot(self, false, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
        vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
        WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, self);
        vector attack_hitpos = trace_endpos;
@@ -387,21 +387,21 @@ void W_Shockwave_Attack(void)
                        WEP_CVAR(shockwave, blast_splash_radius),
                        WEP_CVAR(shockwave, blast_jump_radius)
                ),
-               FALSE
+               false
        );
-       
+
        while(head)
        {
                if(head.takedamage)
                {
                        float distance_to_head = vlen(attack_hitpos - head.WarpZone_findradius_nearest);
-                       
+
                        if((head == self) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius)))
                        {
                                // ========================
                                //  BLAST JUMP CALCULATION
                                // ========================
-                               
+
                                // calculate importance of distance and accuracy for this attack
                                multiplier_from_accuracy = (1 -
                                        (distance_to_head ?
@@ -436,7 +436,7 @@ void W_Shockwave_Attack(void)
                                        );
 
                                // figure out the direction of force
-                               vel = normalize(combine_to_vector(head.velocity_x, head.velocity_y, 0));
+                               vel = normalize(combine_to_vector(head.velocity.x, head.velocity.y, 0));
                                vel *=
                                        (
                                                bound(0, (vlen(vel) / autocvar_sv_maxspeed), 1)
@@ -447,7 +447,7 @@ void W_Shockwave_Attack(void)
 
                                // now multiply the direction by force units
                                final_force *= (WEP_CVAR(shockwave, blast_jump_force) * multiplier);
-                               final_force_z *= WEP_CVAR(shockwave, blast_jump_force_zscale);
+                               final_force.z *= WEP_CVAR(shockwave, blast_jump_force_zscale);
 
                                // trigger damage with this calculated info
                                Damage(
@@ -477,7 +477,7 @@ void W_Shockwave_Attack(void)
                                // ==========================
                                //  BLAST SPLASH CALCULATION
                                // ==========================
-                               
+
                                // calculate importance of distance and accuracy for this attack
                                multiplier_from_accuracy = (1 -
                                        (distance_to_head ?
@@ -518,7 +518,7 @@ void W_Shockwave_Attack(void)
 
                                // now multiply the direction by force units
                                final_force *= (WEP_CVAR(shockwave, blast_splash_force) * multiplier);
-                               final_force_z *= WEP_CVAR(shockwave, blast_force_zscale);
+                               final_force.z *= WEP_CVAR(shockwave, blast_force_zscale);
 
                                // queue damage with this calculated info
                                if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
@@ -540,7 +540,7 @@ void W_Shockwave_Attack(void)
        }
 
        // cone damage trace
-       head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(shockwave, blast_distance), FALSE);
+       head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(shockwave, blast_distance), false);
        while(head)
        {
                if((head != self) && head.takedamage)
@@ -549,23 +549,21 @@ void W_Shockwave_Attack(void)
                        //  BLAST CONE CALCULATION
                        // ========================
 
-                       // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc) 
+                       // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
                        center = CENTER_OR_VIEWOFS(head);
 
                        // find the closest point on the enemy to the center of the attack
-                       float ang; // angle between shotdir and h
                        float h; // hypotenuse, which is the distance between attacker to head
                        float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
-                       
+
                        h = vlen(center - self.origin);
-                       ang = acos(dotproduct(normalize(center - self.origin), w_shotdir));
-                       a = h * cos(ang);
+                       a = h * (normalize(center - self.origin) * w_shotdir);
                        // WEAPONTODO: replace with simpler method
 
                        vector nearest_on_line = (w_shotorg + a * w_shotdir);
                        vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
 
-                       if((vlen(head.WarpZone_findradius_dist) <= WEP_CVAR(shockwave, blast_distance)) 
+                       if((vlen(head.WarpZone_findradius_dist) <= WEP_CVAR(shockwave, blast_distance))
                                && (W_Shockwave_Attack_IsVisible(head, nearest_on_line, w_shotorg, attack_endpos)))
                        {
                                // calculate importance of distance and accuracy for this attack
@@ -609,7 +607,7 @@ void W_Shockwave_Attack(void)
 
                                // now multiply the direction by force units
                                final_force *= (WEP_CVAR(shockwave, blast_force) * multiplier);
-                               final_force_z *= WEP_CVAR(shockwave, blast_force_zscale);
+                               final_force.z *= WEP_CVAR(shockwave, blast_force_zscale);
 
                                // queue damage with this calculated info
                                if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
@@ -635,7 +633,7 @@ void W_Shockwave_Attack(void)
                head = shockwave_hit[i-1];
                final_force = shockwave_hit_force[i-1];
                final_damage = shockwave_hit_damage[i-1];
-               
+
                Damage(
                        head,
                        self,
@@ -660,7 +658,7 @@ void W_Shockwave_Attack(void)
                        vlen(final_force)
                ));
                #endif
-               
+
                shockwave_hit[i-1] = world;
                shockwave_hit_force[i-1] = '0 0 0';
                shockwave_hit_damage[i-1] = 0;
@@ -674,11 +672,11 @@ float W_Shockwave(float req)
                case WR_AIM:
                {
                        if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
-                               { self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE); }
+                               { self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false); }
                        else
-                               { self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE); }
-                       
-                       return TRUE;
+                               { self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false); }
+
+                       return true;
                }
                case WR_THINK:
                {
@@ -704,8 +702,8 @@ float W_Shockwave(float req)
                                        weapon_thinkf(WFRAME_FIRE1, 0, W_Shockwave_Melee);
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -716,19 +714,19 @@ float W_Shockwave(float req)
                        precache_sound("misc/itempickup.wav");
                        precache_sound("weapons/lasergun_fire.wav");
                        precache_sound("weapons/shotgun_melee.wav");
-                       SHOCKWAVE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       SHOCKWAVE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                case WR_CHECKAMMO2:
                {
                        // shockwave has infinite ammo
-                       return TRUE;
+                       return true;
                }
                case WR_CONFIG:
                {
-                       SHOCKWAVE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       SHOCKWAVE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -742,14 +740,14 @@ float W_Shockwave(float req)
                                return WEAPON_SHOCKWAVE_MURDER;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
 // WEAPONTODO: add client side settings for these
-#define SW_MAXALPHA 0.5
-#define SW_FADETIME 0.4
-#define SW_DISTTOMIN 200
+const float SW_MAXALPHA = 0.5;
+const float SW_FADETIME = 0.4;
+const float SW_DISTTOMIN = 200;
 void Draw_Shockwave()
 {
        // fading/removal control
@@ -782,23 +780,23 @@ void Draw_Shockwave()
        {
                // perfect circle effect lines
                makevectors('0 360 0' * (0.75 + (counter - 0.5) / divisions));
-               angle_y = v_forward_x;
-               angle_z = v_forward_y;
+               angle.y = v_forward.x;
+               angle.z = v_forward.y;
 
                // first do the spread_to_min effect
                deviation = angle * spread_to_min;
-               deviation = ((self.sw_shotdir + (right * deviation_y) + (up * deviation_z)));
+               deviation = ((self.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
                new_min_dist = SW_DISTTOMIN;
                new_min_end = (self.sw_shotorg + (deviation * new_min_dist));
                //te_lightning2(world, new_min_end, self.sw_shotorg);
 
                // then calculate spread_to_max effect
                deviation = angle * spread_to_max;
-               deviation = ((self.sw_shotdir + (right * deviation_y) + (up * deviation_z)));
+               deviation = ((self.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
                new_max_dist = vlen(new_min_end - endpos);
                new_max_end = (new_min_end + (deviation * new_max_dist));
                //te_lightning2(world, new_end, prev_min_end);
-               
+
 
                if(counter == 0)
                {
@@ -853,9 +851,9 @@ void Net_ReadShockwaveParticle(void)
        entity shockwave;
        shockwave = spawn();
        shockwave.draw = Draw_Shockwave;
-       
+
        shockwave.sw_shotorg_x = ReadCoord(); shockwave.sw_shotorg_y = ReadCoord(); shockwave.sw_shotorg_z = ReadCoord();
-       shockwave.sw_shotdir_x  = ReadCoord(); shockwave.sw_shotdir_y  = ReadCoord(); shockwave.sw_shotdir_z  = ReadCoord();
+       shockwave.sw_shotdir_x = ReadCoord(); shockwave.sw_shotdir_y = ReadCoord(); shockwave.sw_shotdir_z = ReadCoord();
 
        shockwave.sw_distance = ReadShort();
        shockwave.sw_spread_max = ReadByte();
@@ -876,22 +874,22 @@ float W_Shockwave(float req)
                        //vector org2;
                        //org2 = w_org + w_backoff * 2;
                        //pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
-                       return FALSE;
+                       return false;
                }
                case WR_INIT:
                {
                        //precache_sound("weapons/ric1.wav");
                        //precache_sound("weapons/ric2.wav");
                        //precache_sound("weapons/ric3.wav");
-                       return FALSE;
+                       return false;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 9227cdab4ee15b1e2c9257e7e167aa319645709e..5415b4a6f0726d57b20ea393e1683efb704eedb0 100644 (file)
@@ -60,7 +60,7 @@ void W_Shotgun_Attack(float isprimary)
 
        W_DecreaseAmmo(WEP_CVAR_PRI(shotgun, ammo));
 
-       W_SetupShot(self, TRUE, 5, "weapons/shotgun_fire.wav", ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets));
+       W_SetupShot(self, true, 5, "weapons/shotgun_fire.wav", ((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, 0);
 
@@ -119,7 +119,7 @@ void W_Shotgun_Melee_Think(void)
                        + (v_up * swing_factor * WEP_CVAR_SEC(shotgun, melee_swing_up))
                        + (v_right * swing_factor * WEP_CVAR_SEC(shotgun, melee_swing_side)));
 
-               WarpZone_traceline_antilag(self, self.realowner.origin + self.realowner.view_ofs, targpos, FALSE, self, ANTILAG_LATENCY(self.realowner));
+               WarpZone_traceline_antilag(self, self.realowner.origin + self.realowner.view_ofs, targpos, false, self, ANTILAG_LATENCY(self.realowner));
 
                // draw lightning beams for debugging
                //te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5);
@@ -188,7 +188,7 @@ void W_Shotgun_Attack2(void)
        meleetemp.realowner = self;
        meleetemp.think = W_Shotgun_Melee_Think;
        meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor();
-       W_SetupShot_Range(self, TRUE, 0, "", 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range));
+       W_SetupShot_Range(self, true, 0, "", 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range));
 }
 
 // alternate secondary weapon frames
@@ -203,7 +203,7 @@ void W_Shotgun_Attack3_Frame2()
        }
 
        sound(self, CH_WEAPON_SINGLE, "misc/null.wav", VOL_BASE, ATTN_NORM); // kill previous sound
-       W_Shotgun_Attack(TRUE); // actually is secondary, but we trick the last shot into playing full reload sound
+       W_Shotgun_Attack(true); // actually is secondary, but we trick the last shot into playing full reload sound
        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready);
 }
 void W_Shotgun_Attack3_Frame1()
@@ -216,7 +216,7 @@ void W_Shotgun_Attack3_Frame1()
                return;
        }
 
-       W_Shotgun_Attack(FALSE);
+       W_Shotgun_Attack(false);
        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2);
 }
 
@@ -230,11 +230,11 @@ float W_Shotgun(float req)
                case WR_AIM:
                {
                        if(vlen(self.origin-self.enemy.origin) <= WEP_CVAR_SEC(shotgun, melee_range))
-                               self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
+                               self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
                        else
-                               self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
+                               self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false);
 
-                       return TRUE;
+                       return true;
                }
                case WR_THINK:
                {
@@ -252,7 +252,7 @@ float W_Shotgun(float req)
                                        {
                                                if(weapon_prepareattack(0, WEP_CVAR_PRI(shotgun, animtime)))
                                                {
-                                                       W_Shotgun_Attack(TRUE);
+                                                       W_Shotgun_Attack(true);
                                                        self.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
                                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
                                                }
@@ -264,7 +264,7 @@ float W_Shotgun(float req)
                                        {
                                                if(weapon_prepareattack(0, WEP_CVAR_SEC(shotgun, alt_animtime)))
                                                {
-                                                       W_Shotgun_Attack(FALSE);
+                                                       W_Shotgun_Attack(false);
                                                        self.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
                                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
                                                }
@@ -280,8 +280,8 @@ float W_Shotgun(float req)
                                // attempt forcing playback of the anim by switching to another anim (that we never play) here...
                                weapon_thinkf(WFRAME_FIRE1, 0, W_Shotgun_Attack2);
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -292,13 +292,13 @@ float W_Shotgun(float req)
                        precache_sound("misc/itempickup.wav");
                        precache_sound("weapons/shotgun_fire.wav");
                        precache_sound("weapons/shotgun_melee.wav");
-                       SHOTGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       SHOTGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_SETUP:
                {
                        self.ammo_field = ammo_none;
-                       return TRUE;
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -310,28 +310,28 @@ float W_Shotgun(float req)
                {
                        if(IS_BOT_CLIENT(self))
                        if(vlen(self.origin-self.enemy.origin) > WEP_CVAR_SEC(shotgun, melee_range))
-                               return FALSE; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
+                               return false; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
                        switch(WEP_CVAR(shotgun, secondary))
                        {
-                               case 1: return TRUE; // melee does not use ammo
+                               case 1: return true; // melee does not use ammo
                                case 2: // secondary triple shot
                                {
                                        ammo_amount = self.WEP_AMMO(SHOTGUN) >= WEP_CVAR_PRI(shotgun, ammo);
                                        ammo_amount += self.(weapon_load[WEP_SHOTGUN]) >= WEP_CVAR_PRI(shotgun, ammo);
                                        return ammo_amount;
                                }
-                               default: return FALSE; // secondary unavailable
+                               default: return false; // secondary unavailable
                        }
                }
                case WR_CONFIG:
                {
-                       SHOTGUN_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       SHOTGUN_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(WEP_CVAR_PRI(shotgun, ammo), "weapons/reload.wav"); // WEAPONTODO
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -345,7 +345,7 @@ float W_Shotgun(float req)
                                return WEAPON_SHOTGUN_MURDER;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -370,22 +370,22 @@ float W_Shotgun(float req)
                                self.prevric = time;
                        }
 
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
                        precache_sound("weapons/ric1.wav");
                        precache_sound("weapons/ric2.wav");
                        precache_sound("weapons/ric3.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index e08cf676fb76eb92508241aec738317d3d824b0d..0b70b85729fe463d832bfc0b6e8edc0e5b211efe 100644 (file)
@@ -60,34 +60,34 @@ float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorep
        float i, j, mmin, mmax, nolength;
        float n = tokenize_console(melody);
        if(n > pl.tuba_lastnotes_cnt)
-               return FALSE;
+               return false;
        float pitchshift = 0;
 
        if(instrument >= 0)
                if(pl.tuba_instrument != instrument)
-                       return FALSE;
+                       return false;
 
        // verify notes...
-       nolength = FALSE;
+       nolength = false;
        for(i = 0; i < n; ++i)
        {
                vector v = pl.(tuba_lastnotes[(pl.tuba_lastnotes_last - i + MAX_TUBANOTES) % MAX_TUBANOTES]);
                float ai = stof(argv(n - i - 1));
                float np = floor(ai);
                if(ai == np)
-                       nolength = TRUE;
+                       nolength = true;
                // n counts the last played notes BACKWARDS
                // _x is start
                // _y is end
                // _z is note pitch
                if(ignorepitch && i == 0)
                {
-                       pitchshift = np - v_z;
+                       pitchshift = np - v.z;
                }
                else
                {
-                       if(v_z + pitchshift != np)
-                               return FALSE;
+                       if(v.z + pitchshift != np)
+                               return false;
                }
        }
 
@@ -132,18 +132,18 @@ float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorep
                                //printf("second note: %f to %f, should be %f\n", vj_x, vj_y, tj);
                                //printf("m1 = %f\n", (vi_x - vj_y) / (ti - tj));
                                //printf("m2 = %f\n", (vi_y - vj_x) / (ti - tj));
-                               mmin = max(mmin, (vi_x - vj_y) / (ti - tj)); // lower bound
-                               mmax = min(mmax, (vi_y - vj_x) / (ti - tj)); // upper bound
+                               mmin = max(mmin, (vi.x - vj.y) / (ti - tj)); // lower bound
+                               mmax = min(mmax, (vi.y - vj.x) / (ti - tj)); // upper bound
                        }
                }
 
                if(mmin > mmax) // rhythm fail
-                       return FALSE;
+                       return false;
        }
 
        pl.tuba_lastnotes_cnt = 0;
 
-       return TRUE;
+       return true;
 }
 
 void W_Tuba_NoteOff(void)
@@ -184,16 +184,13 @@ void W_Tuba_NoteOff(void)
 
 float W_Tuba_GetNote(entity pl, float hittype)
 {
-       float note;
-       float movestate;
-       movestate = 5;
-       if(pl.movement_x < 0) movestate -= 3;
-       if(pl.movement_x > 0) movestate += 3;
-       if(pl.movement_y < 0) movestate -= 1;
-       if(pl.movement_y > 0) movestate += 1;
-#ifdef GMQCC
-       note = 0;
-#endif
+       float movestate = 5;
+       if (pl.movement.x < 0)          movestate -= 3;
+       else if (pl.movement.x > 0)     movestate += 3;
+       if (pl.movement.y < 0)          movestate -= 1;
+       else if (pl.movement.y > 0)     movestate += 1;
+
+       float note = 0;
        switch(movestate)
        {
        // layout: originally I wanted
@@ -259,7 +256,7 @@ float W_Tuba_NoteSendEntity(entity to, float sf)
 
        msg_entity = to;
        if(!sound_allowed(MSG_ONE, self.realowner))
-               return FALSE;
+               return false;
 
        WriteByte(MSG_ENTITY, ENT_CLIENT_TUBANOTE);
        WriteByte(MSG_ENTITY, sf);
@@ -274,11 +271,11 @@ float W_Tuba_NoteSendEntity(entity to, float sf)
        }
        if(sf & 2)
        {
-               WriteCoord(MSG_ENTITY, self.origin_x);
-               WriteCoord(MSG_ENTITY, self.origin_y);
-               WriteCoord(MSG_ENTITY, self.origin_z);
+               WriteCoord(MSG_ENTITY, self.origin.x);
+               WriteCoord(MSG_ENTITY, self.origin.y);
+               WriteCoord(MSG_ENTITY, self.origin.z);
        }
-       return TRUE;
+       return true;
 }
 
 void W_Tuba_NoteThink(void)
@@ -324,7 +321,7 @@ void W_Tuba_NoteOn(float hittype)
        vector o;
        float n;
 
-       W_SetupShot(self, FALSE, 2, "", 0, WEP_CVAR(tuba, damage));
+       W_SetupShot(self, false, 2, "", 0, WEP_CVAR(tuba, damage));
 
        n = W_Tuba_GetNote(self, hittype);
 
@@ -354,7 +351,7 @@ void W_Tuba_NoteOn(float hittype)
                self.tuba_note.think = W_Tuba_NoteThink;
                self.tuba_note.nextthink = time;
                self.tuba_note.spawnshieldtime = time;
-               Net_LinkEntity(self.tuba_note, FALSE, 0, W_Tuba_NoteSendEntity);
+               Net_LinkEntity(self.tuba_note, false, 0, W_Tuba_NoteSendEntity);
        }
 
        self.tuba_note.teleport_time = time + WEP_CVAR(tuba, refire) * 2 * W_WeaponRateFactor(); // so it can get prolonged safely
@@ -385,8 +382,8 @@ float W_Tuba(float req)
                                else
                                        self.BUTTON_ATCK2 = 1;
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_THINK:
                {
@@ -414,8 +411,8 @@ float W_Tuba(float req)
                                        self = oldself;
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -426,14 +423,14 @@ float W_Tuba(float req)
                        precache_model("models/weapons/h_akordeon.iqm");
                        precache_model("models/weapons/v_kleinbottle.md3");
                        precache_model("models/weapons/h_kleinbottle.iqm");
-                       TUBA_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       TUBA_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_SETUP:
                {
                        self.ammo_field = ammo_none;
                        self.tuba_instrument = 0;
-                       return TRUE;
+                       return true;
                }
                case WR_RELOAD:
                {
@@ -455,23 +452,23 @@ float W_Tuba(float req)
                                                self.weaponname = "tuba";
                                                break;
                                }
-                               W_SetupShot(self, FALSE, 0, "", 0, 0);
+                               W_SetupShot(self, false, 0, "", 0, 0);
                                pointparticles(particleeffectnum("teleport"), w_shotorg, '0 0 0', 1);
                                self.weaponentity.state = WS_INUSE;
                                weapon_thinkf(WFRAME_RELOAD, 0.5, w_ready);
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_CHECKAMMO1:
                case WR_CHECKAMMO2:
                {
-                       return TRUE; // tuba has infinite ammo
+                       return true; // tuba has infinite ammo
                }
                case WR_CONFIG:
                {
-                       TUBA_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       TUBA_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -492,7 +489,7 @@ float W_Tuba(float req)
                                return WEAPON_TUBA_MURDER;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -506,11 +503,11 @@ float W_Tuba(float req)
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
 
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 90ea15d5c473dc88c4bda842d46f5114e0c816a5..b67056f7e2257926c58cfdcc29bf7e1510da82b1 100644 (file)
@@ -9,7 +9,7 @@ REGISTER_WEAPON(
 /* color     */ '0.5 1 1',
 /* modelname */ "minstanex",
 /* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshairminstanex 0.4",
+/* crosshair */ "gfx/crosshairminstanex 0.6",
 /* wepimg    */ "weaponminstanex",
 /* refname   */ "vaporizer",
 /* wepname   */ _("Vaporizer")
@@ -56,7 +56,7 @@ void W_Vaporizer_Attack(void)
        float flying;
        flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
 
-       W_SetupShot(self, TRUE, 0, "", CH_WEAPON_A, 10000);
+       W_SetupShot(self, true, 0, "", CH_WEAPON_A, 10000);
        // handle sound separately so we can change the volume
        // added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway)
        sound (self, CH_WEAPON_A, "weapons/minstanexfire.wav", VOL_BASE * 0.8, ATTEN_NORM);
@@ -113,7 +113,7 @@ void W_Vaporizer_Attack(void)
                                WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
                        break;
        }
-       
+
        W_DecreaseAmmo(((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
 }
 
@@ -130,11 +130,11 @@ float W_Vaporizer(float req)
                case WR_AIM:
                {
                        if(self.WEP_AMMO(VAPORIZER) > 0)
-                               self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
+                               self.BUTTON_ATCK = bot_aim(1000000, 0, 1, false);
                        else
-                               self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), FALSE); // WEAPONTODO: replace with proper vaporizer cvars
-                               
-                       return TRUE;
+                               self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
+
+                       return true;
                }
                case WR_THINK:
                {
@@ -158,14 +158,16 @@ float W_Vaporizer(float req)
                                {
                                        // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
                                        self.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
-                                       
+
                                        // decrease ammo for the laser?
                                        if(WEP_CVAR_SEC(vaporizer, ammo))
                                                W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
 
                                        // ugly instagib hack to reuse the fire mode of the laser
+                                       int oldwep = self.weapon; // we can't avoid this hack
+                                       self.weapon = WEP_BLASTER;
                                        W_Blaster_Attack(
-                                               WEP_VAPORIZER | HITTYPE_SECONDARY,
+                                               WEP_BLASTER | HITTYPE_SECONDARY,
                                                WEP_CVAR_SEC(vaporizer, shotangle),
                                                WEP_CVAR_SEC(vaporizer, damage),
                                                WEP_CVAR_SEC(vaporizer, edgedamage),
@@ -176,13 +178,14 @@ float W_Vaporizer(float req)
                                                WEP_CVAR_SEC(vaporizer, delay),
                                                WEP_CVAR_SEC(vaporizer, lifetime)
                                        );
-                                       
+                                       self.weapon = oldwep;
+
                                        // now do normal refire
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -195,14 +198,14 @@ float W_Vaporizer(float req)
                        precache_sound("weapons/nexwhoosh2.wav");
                        precache_sound("weapons/nexwhoosh3.wav");
                        //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
-                       VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_SETUP:
                {
                        self.ammo_field = WEP_AMMO(VAPORIZER);
                        self.vaporizer_lasthit = 0;
-                       return TRUE;
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -213,20 +216,20 @@ float W_Vaporizer(float req)
                case WR_CHECKAMMO2:
                {
                        if(!WEP_CVAR_SEC(vaporizer, ammo))
-                               return TRUE;
+                               return true;
                        ammo_amount = self.WEP_AMMO(VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
                        ammo_amount += self.(weapon_load[WEP_VAPORIZER]) >= WEP_CVAR_SEC(vaporizer, ammo);
                        return ammo_amount;
                }
                case WR_CONFIG:
                {
-                       VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RESETPLAYER:
                {
                        self.vaporizer_lasthit = 0;
-                       return TRUE;
+                       return true;
                }
                case WR_RELOAD:
                {
@@ -237,7 +240,7 @@ float W_Vaporizer(float req)
                                used_ammo = vaporizer_ammo;
 
                        W_Reload(used_ammo, "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -248,7 +251,7 @@ float W_Vaporizer(float req)
                        return WEAPON_VAPORIZER_MURDER;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
@@ -270,7 +273,7 @@ float W_Vaporizer(float req)
                                pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
                                if(!w_issilent) { sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM); }
                        }
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
@@ -280,23 +283,23 @@ float W_Vaporizer(float req)
                        {
                                precache_pic("gfx/reticle_nex");
                        }
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        if(button_zoom || zoomscript_caught)
                        {
                                reticle_image = "gfx/reticle_nex";
-                               return TRUE;
+                               return true;
                        }
                        else
                        {
                                // no weapon specific image for this weapon
-                               return FALSE;
+                               return false;
                        }
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 6512d0430809ffdff549f8834460c49b0d254ad5..374256403d88def7a6fde94d0526e3a51f3b98e8 100644 (file)
@@ -64,19 +64,19 @@ void SendCSQCVortexBeamParticle(float charge) {
        v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
        WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
        WriteByte(MSG_BROADCAST, TE_CSQC_VORTEXBEAMPARTICLE);
-       WriteCoord(MSG_BROADCAST, w_shotorg_x);
-       WriteCoord(MSG_BROADCAST, w_shotorg_y);
-       WriteCoord(MSG_BROADCAST, w_shotorg_z);
-       WriteCoord(MSG_BROADCAST, v_x);
-       WriteCoord(MSG_BROADCAST, v_y);
-       WriteCoord(MSG_BROADCAST, v_z);
+       WriteCoord(MSG_BROADCAST, w_shotorg.x);
+       WriteCoord(MSG_BROADCAST, w_shotorg.y);
+       WriteCoord(MSG_BROADCAST, w_shotorg.z);
+       WriteCoord(MSG_BROADCAST, v.x);
+       WriteCoord(MSG_BROADCAST, v.y);
+       WriteCoord(MSG_BROADCAST, v.z);
        WriteByte(MSG_BROADCAST, bound(0, 255 * charge, 255));
 }
 
 void W_Vortex_Attack(float issecondary)
 {
        float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge;
-       
+
        mydmg = WEP_CVAR_BOTH(vortex, !issecondary, damage);
        myforce = WEP_CVAR_BOTH(vortex, !issecondary, force);
        mymindist = WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_mindist);
@@ -100,7 +100,7 @@ void W_Vortex_Attack(float issecondary)
        mydmg *= charge;
        myforce *= charge;
 
-       W_SetupShot(self, TRUE, 5, "weapons/nexfire.wav", CH_WEAPON_A, mydmg);
+       W_SetupShot(self, true, 5, "weapons/nexfire.wav", CH_WEAPON_A, mydmg);
        if(charge > WEP_CVAR(vortex, charge_animlimit) && WEP_CVAR(vortex, charge_animlimit)) // if the Vortex is overcharged, we play an extra sound
        {
                sound(self, CH_WEAPON_B, "weapons/nexcharge.wav", VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM);
@@ -110,7 +110,7 @@ void W_Vortex_Attack(float issecondary)
        FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX);
 
        if(yoda && flying)
-               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA); 
+               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
 
        //beam and muzzle flash done on client
        SendCSQCVortexBeamParticle(charge);
@@ -129,20 +129,20 @@ float W_Vortex(float req)
        {
                case WR_AIM:
                {
-                       if(bot_aim(1000000, 0, 1, FALSE))
-                               self.BUTTON_ATCK = TRUE;
+                       if(bot_aim(1000000, 0, 1, false))
+                               self.BUTTON_ATCK = true;
                        else
                        {
                                if(WEP_CVAR(vortex, charge))
-                                       self.BUTTON_ATCK2 = TRUE;
+                                       self.BUTTON_ATCK2 = true;
                        }
-                       return TRUE;
+                       return true;
                }
                case WR_THINK:
                {
                        if(WEP_CVAR(vortex, charge) && self.vortex_charge < WEP_CVAR(vortex, charge_limit))
                                self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_rate) * frametime / W_TICSPERFRAME);
-                               
+
                        if(WEP_CVAR_SEC(vortex, chargepool))
                                if(self.vortex_chargepool_ammo < 1)
                                {
@@ -237,8 +237,8 @@ float W_Vortex(float req)
                                        }
                                }
                        }
-                       
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -251,8 +251,8 @@ float W_Vortex(float req)
                        precache_sound("weapons/nexwhoosh1.wav");
                        precache_sound("weapons/nexwhoosh2.wav");
                        precache_sound("weapons/nexwhoosh3.wav");
-                       VORTEX_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       VORTEX_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -271,18 +271,18 @@ float W_Vortex(float req)
                        }
                        else
                        {
-                               return FALSE; // zoom is not a fire mode
+                               return false; // zoom is not a fire mode
                        }
                }
                case WR_CONFIG:
                {
-                       VORTEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       VORTEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_RELOAD:
                {
                        W_Reload(min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), "weapons/reload.wav");
-                       return TRUE;
+                       return true;
                }
                case WR_SUICIDEMESSAGE:
                {
@@ -293,11 +293,11 @@ float W_Vortex(float req)
                        return WEAPON_VORTEX_MURDER;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
-var float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO
+float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO
 float W_Vortex(float req)
 {
        switch(req)
@@ -309,8 +309,8 @@ float W_Vortex(float req)
                        pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
                        if(!w_issilent)
                                sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
-                               
-                       return TRUE;
+
+                       return true;
                }
                case WR_INIT:
                {
@@ -319,23 +319,23 @@ float W_Vortex(float req)
                        {
                                precache_pic("gfx/reticle_nex");
                        }
-                       return TRUE;
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        if(button_zoom || zoomscript_caught || (!WEP_CVAR(vortex, secondary) && button_attack2))
                        {
                                reticle_image = "gfx/reticle_nex";
-                               return TRUE;
+                               return true;
                        }
                        else
                        {
                                // no weapon specific image for this weapon
-                               return FALSE;
+                               return false;
                        }
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif
index 4f11fc3ef272ed53c5763b8f420c36553e6e7b68..55fcc0e14ffa597cbfaace6da0d52f09a4329f4d 100644 (file)
@@ -1,3 +1,56 @@
+#ifndef WEAPONS_C
+#define WEAPONS_C
+
+#include "weapons.qh"
+
+#if defined(CSQC)
+       #include "../../dpdefs/csprogsdefs.qh"
+       #include "../../client/defs.qh"
+       #include "../constants.qh"
+       #include "../stats.qh"
+       #include "../../warpzonelib/anglestransform.qh"
+       #include "../../warpzonelib/mathlib.qh"
+       #include "../../warpzonelib/common.qh"
+       #include "../../warpzonelib/client.qh"
+       #include "../util.qh"
+       #include "../buffs.qh"
+       #include "../../client/autocvars.qh"
+       #include "../deathtypes.qh"
+       #include "../../csqcmodellib/interpolate.qh"
+       #include "../../client/movetypes.qh"
+       #include "../../client/main.qh"
+       #include "../../csqcmodellib/cl_model.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../warpzonelib/anglestransform.qh"
+    #include "../../warpzonelib/mathlib.qh"
+    #include "../../warpzonelib/common.qh"
+    #include "../../warpzonelib/util_server.qh"
+    #include "../../warpzonelib/server.qh"
+    #include "../constants.qh"
+    #include "../stats.qh"
+    #include "../teams.qh"
+    #include "../util.qh"
+    #include "../buffs.qh"
+    #include "../monsters/monsters.qh"
+    #include "config.qh"
+    #include "../../server/weapons/csqcprojectile.qh"
+    #include "../../server/weapons/tracing.qh"
+    #include "../../server/t_items.qh"
+    #include "../../server/autocvars.qh"
+    #include "../../server/constants.qh"
+    #include "../../server/defs.qh"
+    #include "../notifications.qh"
+    #include "../deathtypes.qh"
+    #include "../../server/mutators/mutators_include.qh"
+    #include "../mapinfo.qh"
+    #include "../../server/command/common.qh"
+    #include "../../csqcmodellib/sv_model.qh"
+    #include "../../server/portals.qh"
+    #include "../../server/g_hook.qh"
+#endif
 #ifndef MENUQC
 #include "calculations.qc"
 #endif
@@ -45,7 +98,7 @@ void WriteWepSet(float dst, WepSet w)
 #elif WEP_MAXCOUNT > 24
        WriteInt48_t(dst, w);
 #else
-       WriteInt24_t(dst, w_x);
+       WriteInt24_t(dst, w.x);
 #endif
 }
 #endif
@@ -53,11 +106,11 @@ void WriteWepSet(float dst, WepSet w)
 WepSet WepSet_GetFromStat()
 {
        WepSet w = '0 0 0';
-       w_x = getstati(STAT_WEAPONS);
+       w.x = getstati(STAT_WEAPONS);
 #if WEP_MAXCOUNT > 24
-       w_y = getstati(STAT_WEAPONS2);
+       w.y = getstati(STAT_WEAPONS2);
 #if WEP_MAXCOUNT > 48
-       w_z = getstati(STAT_WEAPONS3);
+       w.z = getstati(STAT_WEAPONS3);
 #endif
 #endif
        return w;
@@ -75,7 +128,7 @@ WepSet ReadWepSet()
 #endif
 
 void register_weapon(
-       float id,
+       int id,
        WepSet bit,
        float(float) func,
        .float ammotype,
@@ -112,7 +165,7 @@ void register_weapon(
        e.netname = refname;
        e.message = wepname;
 
-       #ifndef MENUQC
+       #ifdef CSQC
        func(WR_INIT);
        #endif
 }
@@ -141,14 +194,14 @@ void register_weapons_done()
        dummy_weapon_info.w_crosshair_size = 1;
        dummy_weapon_info.model2 = "";
 
-       float i;
+       int i;
        weaponorder_byid = "";
        for(i = WEP_MAXCOUNT; i >= 1; --i)
                if(weapon_info[i-1])
                        weaponorder_byid = strcat(weaponorder_byid, " ", ftos(i));
        weaponorder_byid = strzone(substring(weaponorder_byid, 1, strlen(weaponorder_byid) - 1));
 }
-entity get_weaponinfo(float id)
+entity get_weaponinfo(int id)
 {
        entity w;
        if(id < WEP_FIRST || id > WEP_LAST)
@@ -179,7 +232,7 @@ string W_UndeprecateName(string s)
        switch ( s )
        {
                case "nex"            : return "vortex";
-               case "rocketlauncher" : return "devastator"; 
+               case "rocketlauncher" : return "devastator";
                case "laser"          : return "blaster";
                case "minstanex"      : return "vaporizer";
                case "grenadelauncher": return "mortar";
@@ -209,14 +262,14 @@ string W_NumberWeaponOrder(string order)
 
 float W_FixWeaponOrder_BuildImpulseList_buf[WEP_MAXCOUNT];
 string W_FixWeaponOrder_BuildImpulseList_order;
-void W_FixWeaponOrder_BuildImpulseList_swap(float i, float j, entity pass)
+void W_FixWeaponOrder_BuildImpulseList_swap(int i, int j, entity pass)
 {
        float h;
        h = W_FixWeaponOrder_BuildImpulseList_buf[i];
        W_FixWeaponOrder_BuildImpulseList_buf[i] = W_FixWeaponOrder_BuildImpulseList_buf[j];
        W_FixWeaponOrder_BuildImpulseList_buf[j] = h;
 }
-float W_FixWeaponOrder_BuildImpulseList_cmp(float i, float j, entity pass)
+float W_FixWeaponOrder_BuildImpulseList_cmp(int i, int j, entity pass)
 {
        entity e1, e2;
        float d;
@@ -233,7 +286,7 @@ float W_FixWeaponOrder_BuildImpulseList_cmp(float i, float j, entity pass)
 }
 string W_FixWeaponOrder_BuildImpulseList(string o)
 {
-       float i;
+       int i;
        W_FixWeaponOrder_BuildImpulseList_order = o;
        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                W_FixWeaponOrder_BuildImpulseList_buf[i - WEP_FIRST] = i;
@@ -291,7 +344,7 @@ string GetAmmoPicture(.float ammotype)
 }
 
 #ifdef CSQC
-.float GetAmmoFieldFromNum(float i)
+.float GetAmmoFieldFromNum(int i)
 {
        switch(i)
        {
@@ -305,7 +358,7 @@ string GetAmmoPicture(.float ammotype)
        }
 }
 
-float GetAmmoStat(.float ammotype)
+int GetAmmoStat(.float ammotype)
 {
        switch(ammotype)
        {
@@ -319,3 +372,4 @@ float GetAmmoStat(.float ammotype)
        }
 }
 #endif
+#endif
index dca226f42018ec13421d15cc6b2329137ca96b8c..7ac8a9e8dfa09ddacc034db56f0debb6a7014c07 100644 (file)
@@ -1,44 +1,47 @@
+#ifndef WEAPONS_H
+#define WEAPONS_H
+
 #ifndef MENUQC
 #include "calculations.qh"
 #endif
 
-const float MAX_SHOT_DISTANCE = 32768;
+const int MAX_SHOT_DISTANCE = 32768;
 
 // weapon pickup ratings for bot logic
-const float BOT_PICKUP_RATING_LOW  =  2500;
-const float BOT_PICKUP_RATING_MID  =  5000;
-const float BOT_PICKUP_RATING_HIGH = 10000;
+const int BOT_PICKUP_RATING_LOW  =  2500;
+const int BOT_PICKUP_RATING_MID  =  5000;
+const int BOT_PICKUP_RATING_HIGH = 10000;
 
 // weapon flags
-const float WEP_TYPE_OTHER          =  0x00; // not for damaging people
-const float WEP_TYPE_SPLASH         =  0x01; // splash damage
-const float WEP_TYPE_HITSCAN        =  0x02; // hitscan
-const float WEP_TYPEMASK            =  0x0F;
-const float WEP_FLAG_CANCLIMB       =  0x10; // can be used for movement
-const float WEP_FLAG_NORMAL         =  0x20; // in "most weapons" set
-const float WEP_FLAG_HIDDEN         =  0x40; // hides from menu
-const float WEP_FLAG_RELOADABLE     =  0x80; // can has reload
-const float WEP_FLAG_SUPERWEAPON    = 0x100; // powerup timer
-const float WEP_FLAG_MUTATORBLOCKED = 0x200; // hides from impulse 99 etc. (mutators are allowed to clear this flag)
+const int WEP_TYPE_OTHER          =  0x00; // not for damaging people
+const int WEP_TYPE_SPLASH         =  0x01; // splash damage
+const int WEP_TYPE_HITSCAN        =  0x02; // hitscan
+const int WEP_TYPEMASK            =  0x0F;
+const int WEP_FLAG_CANCLIMB       =  0x10; // can be used for movement
+const int WEP_FLAG_NORMAL         =  0x20; // in "most weapons" set
+const int WEP_FLAG_HIDDEN         =  0x40; // hides from menu
+const int WEP_FLAG_RELOADABLE     =  0x80; // can has reload
+const int WEP_FLAG_SUPERWEAPON    = 0x100; // powerup timer
+const int WEP_FLAG_MUTATORBLOCKED = 0x200; // hides from impulse 99 etc. (mutators are allowed to clear this flag)
 
 // weapon requests
-const float WR_SETUP          =  1; // (SERVER) setup weapon data
-const float WR_THINK          =  2; // (SERVER) logic to run every frame
-const float WR_CHECKAMMO1     =  3; // (SERVER) checks ammo for weapon primary
-const float WR_CHECKAMMO2     =  4; // (SERVER) checks ammo for weapon second
-const float WR_AIM            =  5; // (SERVER) runs bot aiming code for this weapon
-const float WR_INIT           =  6; // (BOTH)   precaches models/sounds used by this weapon, also sets up weapon properties
-const float WR_SUICIDEMESSAGE =  7; // (SERVER) notification number for suicide message (may inspect w_deathtype for details)
-const float WR_KILLMESSAGE    =  8; // (SERVER) notification number for kill message (may inspect w_deathtype for details)
-const float WR_RELOAD         =  9; // (SERVER) handles reloading for weapon
-const float WR_RESETPLAYER    = 10; // (SERVER) clears fields that the weapon may use
-const float WR_IMPACTEFFECT   = 11; // (CLIENT) impact effect for weapon explosion
-const float WR_PLAYERDEATH    = 12; // (SERVER) called whenever a player dies
-const float WR_GONETHINK      = 13; // (SERVER) logic to run when weapon is lost
-const float WR_CONFIG         = 14; // (ALL)    dump weapon cvars to config in data directory (see: sv_cmd dumpweapons)
-const float WR_ZOOMRETICLE    = 15; // (CLIENT) weapon specific zoom reticle
-const float WR_DROP           = 16; // (SERVER) the weapon is dropped
-const float WR_PICKUP         = 17; // (SERVER) a weapon is picked up
+const int WR_SETUP          =  1; // (SERVER) setup weapon data
+const int WR_THINK          =  2; // (SERVER) logic to run every frame
+const int WR_CHECKAMMO1     =  3; // (SERVER) checks ammo for weapon primary
+const int WR_CHECKAMMO2     =  4; // (SERVER) checks ammo for weapon second
+const int WR_AIM            =  5; // (SERVER) runs bot aiming code for this weapon
+const int WR_INIT           =  6; // (BOTH)   precaches models/sounds used by this weapon, also sets up weapon properties
+const int WR_SUICIDEMESSAGE =  7; // (SERVER) notification number for suicide message (may inspect w_deathtype for details)
+const int WR_KILLMESSAGE    =  8; // (SERVER) notification number for kill message (may inspect w_deathtype for details)
+const int WR_RELOAD         =  9; // (SERVER) handles reloading for weapon
+const int WR_RESETPLAYER    = 10; // (SERVER) clears fields that the weapon may use
+const int WR_IMPACTEFFECT   = 11; // (CLIENT) impact effect for weapon explosion
+const int WR_PLAYERDEATH    = 12; // (SERVER) called whenever a player dies
+const int WR_GONETHINK      = 13; // (SERVER) logic to run when weapon is lost
+const int WR_CONFIG         = 14; // (ALL)    dump weapon cvars to config in data directory (see: sv_cmd dumpweapons)
+const int WR_ZOOMRETICLE    = 15; // (CLIENT) weapon specific zoom reticle
+const int WR_DROP           = 16; // (SERVER) the weapon is dropped
+const int WR_PICKUP         = 17; // (SERVER) a weapon is picked up
 
 // variables:
 string weaponorder_byid;
@@ -58,14 +61,15 @@ WepSet ReadWepSet();
 // weapon name macros
 #define WEP_FIRST 1
 #define WEP_MAXCOUNT 24 // Increase as needed. Can be up to three times as much.
-float WEP_COUNT;
-float WEP_LAST;
+int WEP_COUNT;
+int WEP_LAST;
 WepSet WEPSET_ALL;
 WepSet WEPSET_SUPERWEAPONS;
 
 // functions:
 entity get_weaponinfo(float id);
 string W_FixWeaponOrder(string order, float complete);
+string W_UndeprecateName(string s);
 string W_NameWeaponOrder(string order);
 string W_NumberWeaponOrder(string order);
 string W_FixWeaponOrder_BuildImpulseList(string o);
@@ -76,8 +80,8 @@ void W_RandomWeapons(entity e, float n);
 string GetAmmoPicture(.float ammotype);
 
 #ifdef CSQC
-.float GetAmmoFieldFromNum(float i);
-float GetAmmoStat(.float ammotype);
+.float GetAmmoFieldFromNum(int i);
+int GetAmmoStat(.float ammotype);
 #endif
 
 // ammo types
@@ -152,12 +156,12 @@ void register_weapons_done();
 
 // entity properties of weaponinfo:
 // fields which are explicitly/manually set are marked with "M", fields set automatically are marked with "A"
-.float weapon;              // M: WEP_id    // WEP_...
+.int weapon;                // M: WEP_id    // WEP_...
 .WepSet weapons;            // A: WEPSET_id // WEPSET_...
 .float(float) weapon_func;  // M: function  // w_...
 ..float ammo_field;         // M: ammotype  // main ammo field
-.float impulse;             // M: impulse   // weapon impulse
-.float spawnflags;          // M: flags     // WEPSPAWNFLAG_... combined
+.int impulse;               // M: impulse   // weapon impulse
+.int spawnflags;            // M: flags     // WEPSPAWNFLAG_... combined
 .float bot_pickupbasevalue; // M: rating    // bot weapon priority
 .vector wpcolor;            // M: color     // waypointsprite color
 .string wpmodel;            // A: wpn-id    // wpn- sprite name
@@ -173,7 +177,7 @@ void register_weapons_done();
 
 // note: the fabs call is just there to hide "if result is constant" warning
 #define REGISTER_WEAPON_2(id,bit,function,ammotype,impulse,flags,rating,color,modelname,simplemdl,crosshair,wepimg,refname,wepname) \
-       float id; \
+       int id; \
        WepSet bit; \
        float function(float); \
        void RegisterWeapons_##id() \
@@ -206,3 +210,4 @@ void register_weapons_done();
 #undef REGISTER_WEAPON
 
 ACCUMULATE_FUNCTION(RegisterWeapons, register_weapons_done);
+#endif
index 7c723c44c2117995385e579e9bc47cb6bcbb53d4..6d3542bd0028ad55f84a4c817e4c78b5f6bf1d16 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 Rudolf Polzer
+ * Copyright (c) 2011 Rudolf PolzerCSQCModel_InterpolateAnimation_2To4_PreNote
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
-
-var float autocvar_cl_lerpanim_maxdelta_framegroups = 0.1;
-var float autocvar_cl_nolerp = 0;
+ #if defined(CSQC)
+        #include "../dpdefs/csprogsdefs.qh"
+        #include "../client/defs.qh"
+        #include "../common/util.qh"
+        #include "../common/animdecide.qh"
+        #include "interpolate.qh"
+        #include "../common/csqcmodel_settings.qh"
+        #include "common.qh"
+        #include "cl_model.qh"
+        #include "cl_player.qh"
+ #elif defined(MENUQC)
+ #elif defined(SVQC)
+ #endif
+
+float autocvar_cl_lerpanim_maxdelta_framegroups = 0.1;
+float autocvar_cl_nolerp = 0;
 
 .float csqcmodel_lerpfrac;
 .float csqcmodel_lerpfrac2;
 .float csqcmodel_lerpfractime;
 .float csqcmodel_lerpfrac2time;
 
-void CSQCModel_InterpolateAnimation_2To4_PreNote(float sf)
+void CSQCModel_InterpolateAnimation_2To4_PreNote(int sf)
 {
        if(sf & CSQCMODEL_PROPERTY_FRAME)
        {
@@ -47,7 +60,7 @@ void CSQCModel_InterpolateAnimation_2To4_PreNote(float sf)
                self.lerpfrac = self.csqcmodel_lerpfrac;
        }
 }
-void CSQCModel_InterpolateAnimation_1To2_PreNote(float sf)
+void CSQCModel_InterpolateAnimation_1To2_PreNote(int sf)
 {
        if(sf & CSQCMODEL_PROPERTY_FRAME)
        {
@@ -64,7 +77,7 @@ void CSQCModel_InterpolateAnimation_PreNote(float sf)
 #endif
 }
 
-void CSQCModel_InterpolateAnimation_2To4_Note(float sf, float set_times)
+void CSQCModel_InterpolateAnimation_2To4_Note(int sf, float set_times)
 {
        if(sf & CSQCMODEL_PROPERTY_FRAME)
        {
@@ -83,7 +96,7 @@ void CSQCModel_InterpolateAnimation_2To4_Note(float sf, float set_times)
                        self.csqcmodel_lerpfractime = time;
        }
 }
-void CSQCModel_InterpolateAnimation_1To2_Note(float sf, float set_times)
+void CSQCModel_InterpolateAnimation_1To2_Note(int sf, float set_times)
 {
        if(sf & CSQCMODEL_PROPERTY_FRAME)
        {
@@ -94,9 +107,9 @@ void CSQCModel_InterpolateAnimation_1To2_Note(float sf, float set_times)
 void CSQCModel_InterpolateAnimation_Note(float sf)
 {
 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
-       CSQCModel_InterpolateAnimation_2To4_Note(sf, TRUE);
+       CSQCModel_InterpolateAnimation_2To4_Note(sf, true);
 #else
-       CSQCModel_InterpolateAnimation_1To2_Note(sf, TRUE);
+       CSQCModel_InterpolateAnimation_1To2_Note(sf, true);
 #endif
 }
 
@@ -173,9 +186,9 @@ void CSQCModel_InterpolateAnimation_Do()
 void CSQCModel_Draw()
 {
        // some nice flags for CSQCMODEL_IF and the hooks
-       local noref float isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
-       local noref float islocalplayer = (self.entnum == player_localnum + 1);
-       local noref float isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
+       bool isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
+       noref bool islocalplayer = (self.entnum == player_localnum + 1);
+       noref bool isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
 
        // we don't do this for the local player as that one is already handled
        // by CSQCPlayer_SetCamera()
@@ -200,15 +213,14 @@ void CSQCModel_Draw()
        self.csqcmodel_teleported = 0;
 }
 
-void CSQCModel_Read(float isnew)
+void CSQCModel_Read(bool isnew)
 {
-       float sf;
-       sf = ReadInt24_t();
+       int sf = ReadInt24_t();
 
        // some nice flags for CSQCMODEL_IF and the hooks
-       local noref float isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
-       local noref float islocalplayer = (self.entnum == player_localnum + 1);
-       local noref float isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
+       bool isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
+       bool islocalplayer = (self.entnum == player_localnum + 1);
+       noref bool isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
 
        self.classname = "csqcmodel";
        self.iflags |= IFLAG_ORIGIN; // interpolate origin too
index ded7357419221c50305a1a907df5d355d995fb54..c2aca6f7a2677a9291b294ca17cbbea5f8377063 100644 (file)
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
+#ifndef CL_MODEL_H
+#define CL_MODEL_H
 
-void CSQCModel_Read(float isnew);
+#include "common.qh"
+
+void CSQCModel_Read(bool isnew);
 
 #define CSQCMODEL_IF(cond)
 #define CSQCMODEL_ENDIF
@@ -48,3 +52,4 @@ void CSQCModel_InterpolateAnimation_1To2_Note(float sf, float set_times);
 void CSQCModel_InterpolateAnimation_2To4_Do();
 void CSQCModel_InterpolateAnimation_1To2_Do();
 // will overwrite lerpfrac, lerpfrac3, lerpfrac4, and possibly clear frame*time if they are undisplayed according to lerpfracs
+#endif
index 63db0ac14b6ea777aef4e349f39e0d360682c9f5..1f3017afdefd64766649fc7636b9602034b718a9 100644 (file)
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "../client/defs.qh"
+       #include "../common/constants.qh"
+       #include "../common/stats.qh"
+       #include "../common/util.qh"
+       #include "interpolate.qh"
+       #include "../client/main.qh"
+       #include "common.qh"
+       #include "cl_model.qh"
+       #include "cl_player.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
 
-var float autocvar_cl_movement_errorcompensation = 0;
+float autocvar_cl_movement_errorcompensation = 0;
 
 // engine stuff
-#define REFDEFFLAG_TELEPORTED 1
-#define REFDEFFLAG_JUMPING 2
 float pmove_onground; // weird engine flag we shouldn't really use but have to for now
 
 vector csqcplayer_origin, csqcplayer_velocity;
-float csqcplayer_sequence, player_pmflags;
+float csqcplayer_sequence;
+int player_pmflags;
 float csqcplayer_moveframe;
 vector csqcplayer_predictionerroro;
 vector csqcplayer_predictionerrorv;
@@ -169,8 +182,6 @@ float CSQCPlayer_IsLocalPlayer()
        return (self == csqcplayer);
 }
 
-void(entity e, float fl) V_CalcRefdef = #640; // DP_CSQC_V_CALCREFDEF
-
 void CSQCPlayer_SetCamera()
 {
        vector v0;
@@ -220,7 +231,7 @@ void CSQCPlayer_SetCamera()
                                o = self.origin;
                                v = v0;
                                csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
-                               CSQCPlayer_PredictTo(servercommandframe + 1, FALSE);
+                               CSQCPlayer_PredictTo(servercommandframe + 1, false);
                                CSQCPlayer_SetPredictionError(self.origin - o, self.velocity - v, pmove_onground - !!(self.pmove_flags & PMF_ONGROUND));
                                self.origin = o;
                                self.velocity = v;
@@ -239,7 +250,7 @@ void CSQCPlayer_SetCamera()
 
                                CSQCPlayer_SavePrediction();
                        }
-                       CSQCPlayer_PredictTo(clientcommandframe + 1, TRUE);
+                       CSQCPlayer_PredictTo(clientcommandframe + 1, true);
 
 #ifdef CSQCMODEL_SERVERSIDE_CROUCH
                        // get crouch state from the server (LAG)
@@ -251,7 +262,7 @@ void CSQCPlayer_SetCamera()
 
                        CSQCPlayer_SetMinsMaxs();
 
-                       self.angles_y = input_angles_y;
+                       self.angles_y = input_angles.y;
                }
 
                // relink
@@ -274,7 +285,7 @@ void CSQCPlayer_SetCamera()
 
        if(view)
        {
-               var float refdefflags = 0;
+               int refdefflags = 0;
 
                if(view.csqcmodel_teleported)
                        refdefflags |= REFDEFFLAG_TELEPORTED;
index 1cb42f2a5ce8383b6345546a038766ebcee7a6e8..55e63cf56dfd144e886970d17f1b35967a6cccca 100644 (file)
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
+#ifndef CL_PLAYER_H
+#define CL_PLAYER_H
 
 entity csqcplayer;
 float csqcplayer_status;
-#define CSQCPLAYERSTATUS_UNPREDICTED 0
-#define CSQCPLAYERSTATUS_FROMSERVER 1
-#define CSQCPLAYERSTATUS_PREDICTED 2
+const int CSQCPLAYERSTATUS_UNPREDICTED = 0;
+const int CSQCPLAYERSTATUS_FROMSERVER = 1;
+const int CSQCPLAYERSTATUS_PREDICTED = 2;
 
 // only ever READ these!
-.float pmove_flags;
-#define PMF_JUMP_HELD 1
-#define PMF_DUCKED 4
-#define PMF_ONGROUND 8
+.int pmove_flags;
+const int PMF_JUMP_HELD = 1;
+//const int PMF_DUCKED = 4;
+//const int PMF_ONGROUND = 8;
 
 void CSQCPlayer_SetCamera();
 float CSQCPlayer_PreUpdate();
 float CSQCPlayer_PostUpdate();
 float CSQCPlayer_IsLocalPlayer();
+#endif
index 2c13404f5f6f6a4490d26c3a40a9c3011d5cb7e5..de02e7a6dd15dcef8a08928aaa1eb89593154c75 100644 (file)
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
+#ifndef CSQCMODELLIB_COMMON_H
+#define CSQCMODELLIB_COMMON_H
+
+#include "../common/csqcmodel_settings.qh"
 
 noref string csqcmodel_license = "\
 Copyright (c) 2011 Rudolf Polzer\
@@ -44,25 +48,25 @@ IN THE SOFTWARE.\
 
 .vector glowmod;
 .vector view_ofs;
-.float frame;
+.int frame;
 .float frame1time;
-.float frame2;
+.int frame2;
 .float frame2time;
 .float lerpfrac;
 
-#define CSQCMODEL_PROPERTY_FRAME 8388608
-#define CSQCMODEL_PROPERTY_TELEPORTED 4194304 // the "teleport bit" cancelling interpolation
-#define CSQCMODEL_PROPERTY_MODELINDEX 2097152
-#define CSQCMODEL_PROPERTY_ORIGIN 1048576
-#define CSQCMODEL_PROPERTY_YAW 524288
-#define CSQCMODEL_PROPERTY_PITCHROLL 262144
-#define CSQCMODEL_PROPERTY_FRAME2 131072
-#define CSQCMODEL_PROPERTY_LERPFRAC 65536
-#define CSQCMODEL_PROPERTY_SIZE 32768
+const int CSQCMODEL_PROPERTY_FRAME = 8388608;
+const int CSQCMODEL_PROPERTY_TELEPORTED = 4194304; // the "teleport bit" cancelling interpolation
+const int CSQCMODEL_PROPERTY_MODELINDEX = 2097152;
+const int CSQCMODEL_PROPERTY_ORIGIN = 1048576;
+const int CSQCMODEL_PROPERTY_YAW = 524288;
+const int CSQCMODEL_PROPERTY_PITCHROLL = 262144;
+const int CSQCMODEL_PROPERTY_FRAME2 = 131072;
+const int CSQCMODEL_PROPERTY_LERPFRAC = 65536;
+const int CSQCMODEL_PROPERTY_SIZE = 32768;
 
 #define ALLPROPERTIES_COMMON \
-       CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME, float, ReadByte, WriteByte, frame) \
-       CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_MODELINDEX, float, ReadShort, WriteShort, modelindex) \
+       CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME, int, ReadByte, WriteByte, frame) \
+       CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_MODELINDEX, int, ReadShort, WriteShort, modelindex) \
        CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, float, ReadCoord, WriteCoord, origin_x) \
        CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, float, ReadCoord, WriteCoord, origin_y) \
        CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, float, ReadCoord, WriteCoord, origin_z) \
@@ -85,8 +89,9 @@ IN THE SOFTWARE.\
 .float frame4time;
 .float lerpfrac4;
 #define ALLPROPERTIES ALLPROPERTIES_COMMON \
-       CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME2, float, ReadByte, WriteByte, frame2) \
+       CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME2, int, ReadByte, WriteByte, frame2) \
        CSQCMODEL_PROPERTY_SCALED(CSQCMODEL_PROPERTY_LERPFRAC, float, ReadByte, WriteByte, lerpfrac, 255, 0, 255)
 #else
 #define ALLPROPERTIES ALLPROPERTIES_COMMON
 #endif
+#endif
index 994323cfe037334bed894624c7c12089108b069d..5c8e1e31e62ce7d3af314b5116ce4f02eea24cbf 100644 (file)
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "../client/defs.qh"
+       #include "../warpzonelib/anglestransform.qh"
+       #include "../client/autocvars.qh"
+       #include "interpolate.qh"
+       #include "cl_model.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
 
 .vector iorigin1, iorigin2;
 .vector ivelocity1, ivelocity2;
@@ -35,7 +45,7 @@ void InterpolateOrigin_Reset()
 void InterpolateOrigin_Note()
 {
        float dt;
-       float f0;
+       int f0;
 
        dt = time - self.itime2;
 
@@ -95,7 +105,7 @@ void InterpolateOrigin_Note()
        else if(self.iflags & IFLAG_V_ANGLE_X)
        {
                self.ivforward1_x = self.ivforward2_x;
-               self.ivforward2_x = self.v_angle_x;
+               self.ivforward2_x = self.v_angle.x;
        }
 
        if(self.iflags & IFLAG_VELOCITY)
index 66bf491e57dd745378e9d939bf65b80e88d4d80e..5ee57850c0ff3a74168d766fb8749aee46c29e74 100644 (file)
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
+#ifndef INTERPOLATE_H
+#define INTERPOLATE_H
 
-.float iflags;
-#define IFLAG_VELOCITY 1
-#define IFLAG_ANGLES 2
-#define IFLAG_AUTOANGLES 4
-#define IFLAG_VALID 8
-#define IFLAG_PREVALID 16
-#define IFLAG_TELEPORTED 32
-#define IFLAG_AUTOVELOCITY 64
-#define IFLAG_V_ANGLE 128
-#define IFLAG_V_ANGLE_X 256
-#define IFLAG_ORIGIN 512
+.int iflags;
+const int IFLAG_VELOCITY = 1;
+const int IFLAG_ANGLES = 2;
+const int IFLAG_AUTOANGLES = 4;
+const int IFLAG_VALID = 8;
+const int IFLAG_PREVALID = 16;
+const int IFLAG_TELEPORTED = 32;
+const int IFLAG_AUTOVELOCITY = 64;
+const int IFLAG_V_ANGLE = 128;
+const int IFLAG_V_ANGLE_X = 256;
+const int IFLAG_ORIGIN = 512;
 #define IFLAG_INTERNALMASK (IFLAG_VALID | IFLAG_PREVALID)
 
 // call this BEFORE reading an entity update
@@ -47,3 +49,4 @@ void InterpolateOrigin_Do();
 
 // in case we interpolate that:
 .vector v_angle;
+#endif
index aab2a5637ccea77c2210dbd092bbe11b75d87741..b30d7e94b0daca67ea8f251fb0d7e2c341369846 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef CSQCMODELLIB_SETTINGS_H
+#define CSQCMODELLIB_SETTINGS_H
 // define this if svqc code wants to use .frame2 and .lerpfrac
 //#define CSQCMODEL_HAVE_TWO_FRAMES
 
@@ -25,3 +27,4 @@
 //vector PL_CROUCH_MIN  = ...;
 //vector PL_CROUCH_MAX  = ...;
 //vector PL_CROUCH_VIEW_OFS  = ...;
+#endif
index ef47a54da35370694038574a498a851092142d86..425c985ad6926cb6a060f30e924ec33964e79ddf 100644 (file)
  * IN THE SOFTWARE.
  */
 
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+       #include "../dpdefs/dpextensions.qh"
+       #include "../common/constants.qh"
+       #include "../common/util.qh"
+       #include "../common/animdecide.qh"
+       #include "../server/constants.qh"
+       #include "../server/defs.qh"
+       #include "common.qh"
+       #include "sv_model.qh"
+#endif
+
 // generic CSQC model code
 
-float CSQCModel_Send(entity to, float sf)
+float CSQCModel_Send(entity to, int sf)
 {
        // some nice flags for CSQCMODEL_IF
        float isplayer = (IS_CLIENT(self));
@@ -50,7 +64,7 @@ float CSQCModel_Send(entity to, float sf)
 #undef CSQCMODEL_ENDIF
 #undef CSQCMODEL_IF
 
-       return TRUE;
+       return true;
 }
 
 #ifdef CSQCPLAYER_FORCE_UPDATES
index 3c4ce2b78615971c09c545a9874efd116f21ff4d..73e03e86207e4bdeaf2321a6ef1d31273b64170a 100644 (file)
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
+ #ifndef SV_MODEL_H
+ #define SV_MODEL_H
+
+ #include "common.qh"
 
 // generic CSQC model code
 
@@ -37,3 +41,4 @@ void CSQCModel_UnlinkEntity();
 #undef CSQCMODEL_PROPERTY
 #undef CSQCMODEL_ENDIF
 #undef CSQCMODEL_IF
+#endif
diff --git a/qcsrc/dpdefs/csprogsdefs.qc b/qcsrc/dpdefs/csprogsdefs.qc
deleted file mode 100644 (file)
index 8f4ec8b..0000000
+++ /dev/null
@@ -1,1458 +0,0 @@
-/*
-==============================================================================
-
-                       SOURCE FOR GLOBALVARS_T C STRUCTURE
-                       MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
-
-==============================================================================
-*/
-
-//
-// system globals
-//
-entity         self;
-entity         other;
-entity         world;
-float          time;
-float          frametime;
-
-float          player_localentnum;     //the entnum
-float          player_localnum;        //the playernum
-float          maxclients;     //a constant filled in by the engine. gah, portability eh?
-
-float          clientcommandframe;     //player movement
-float          servercommandframe;     //clientframe echoed off the server
-
-string         mapname;
-
-//
-// global variables set by built in functions
-//
-vector         v_forward, v_up, v_right;       // set by makevectors()
-
-// set by traceline / tracebox
-float          trace_allsolid;
-float          trace_startsolid;
-float          trace_fraction;
-vector         trace_endpos;
-vector         trace_plane_normal;
-float          trace_plane_dist;
-entity         trace_ent;
-float          trace_inopen;
-float          trace_inwater;
-
-//
-// required prog functions
-//
-void()         CSQC_Init;
-void()         CSQC_Shutdown;
-float(float f, float t, float n)       CSQC_InputEvent;
-void(float w, float h)         CSQC_UpdateView;
-float(string s)        CSQC_ConsoleCommand;
-
-//these fields are read and set by the default player physics
-vector         pmove_org;
-vector         pmove_vel;
-vector         pmove_mins;
-vector         pmove_maxs;
-//retrieved from the current movement commands (read by player physics)
-float          input_timelength;
-vector         input_angles;
-vector         input_movevalues;       //forwards, right, up.
-float          input_buttons;          //attack, use, jump (default physics only uses jump)
-
-float          movevar_gravity;
-float          movevar_stopspeed;
-float          movevar_maxspeed;
-float          movevar_spectatormaxspeed;      //used by NOCLIP movetypes.
-float          movevar_accelerate;
-float          movevar_airaccelerate;
-float          movevar_wateraccelerate;
-float          movevar_friction;
-float          movevar_waterfriction;
-float          movevar_entgravity;     //the local player's gravity field. Is a multiple (1 is the normal value)
-
-//================================================
-void           end_sys_globals;                // flag for structure dumping
-//================================================
-
-/*
-==============================================================================
-
-                       SOURCE FOR ENTVARS_T C STRUCTURE
-                       MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
-
-==============================================================================
-*/
-
-//
-// system fields (*** = do not set in prog code, maintained by C code)
-//
-.float         modelindex;             // *** model index in the precached list
-.vector                absmin, absmax; // *** origin + mins / maxs
-
-.float         entnum; // *** the ent number as on the server
-.float         drawmask;
-.void()                predraw;
-
-.float         movetype;
-.float         solid;
-
-.vector                origin;                 // ***
-.vector                oldorigin;              // ***
-.vector                velocity;
-.vector                angles;
-.vector                avelocity;
-
-.string                classname;              // spawn function
-.string                model;
-.float         frame;
-.float         skin;
-.float         effects;
-
-.vector                mins, maxs;             // bounding box extents reletive to origin
-.vector                size;                   // maxs - mins
-
-.void()                touch;
-.void()                use;
-.void()                think;
-.void()                blocked;                // for doors or plats, called when can't push other
-
-.float         nextthink;
-
-.entity                chain;
-
-.string                netname;
-
-.entity        enemy;
-
-.float         flags;
-
-.float         colormap;
-
-.entity                owner;          // who launched a missile
-
-//================================================
-void           end_sys_fields;                 // flag for structure dumping
-//================================================
-
-/*
-==============================================================================
-
-                       OPTIONAL FIELDS AND GLOBALS
-
-==============================================================================
-*/
-
-// Additional OPTIONAL Fields and Globals
-float          intermission; // indicates intermission state (0 = normal, 1 = scores, 2 = finale text)
-
-vector         view_angles; // same as input_angles
-vector         view_punchangle; // from server
-vector         view_punchvector; // from server
-
-/*
-==============================================================================
-
-                       CONSTANT DEFINITIONS
-
-==============================================================================
-*/
-
-const float MASK_ENGINE                        = 1;
-const float MASK_ENGINEVIEWMODELS      = 2;
-const float MASK_NORMAL                        = 4;
-
-const float RF_VIEWMODEL       = 1;
-const float RF_EXTERNALMODEL   = 2;
-const float RF_DEPTHHACK       = 4;
-const float RF_ADDITIVE                = 8;
-const float RF_USEAXIS         = 16;
-
-const float VF_MIN             = 1;    //(vector)
-const float VF_MIN_X           = 2;    //(float)
-const float VF_MIN_Y           = 3;    //(float)
-const float VF_SIZE            = 4;    //(vector) (viewport size)
-const float VF_SIZE_Y          = 5;    //(float)
-const float VF_SIZE_X          = 6;    //(float)
-const float VF_VIEWPORT                = 7;    //(vector, vector)
-const float VF_FOV             = 8;    //(vector)
-const float VF_FOVX            = 9;    //(float)
-const float VF_FOVY            = 10;   //(float)
-const float VF_ORIGIN          = 11;   //(vector)
-const float VF_ORIGIN_X                = 12;   //(float)
-const float VF_ORIGIN_Y                = 13;   //(float)
-const float VF_ORIGIN_Z                = 14;   //(float)
-const float VF_ANGLES          = 15;   //(vector)
-const float VF_ANGLES_X                = 16;   //(float)
-const float VF_ANGLES_Y                = 17;   //(float)
-const float VF_ANGLES_Z                = 18;   //(float)
-const float VF_DRAWWORLD       = 19;   //(float)
-const float VF_DRAWENGINESBAR  = 20;   //(float)
-const float VF_DRAWCROSSHAIR   = 21;   //(float)
-
-const float VF_CL_VIEWANGLES   = 33;   //(vector)
-const float VF_CL_VIEWANGLES_X = 34;   //(float)
-const float VF_CL_VIEWANGLES_Y = 35;   //(float)
-const float VF_CL_VIEWANGLES_Z = 36;   //(float)
-
-const float VF_PERSPECTIVE      = 200;
-
-const float STAT_HEALTH                = 0;
-const float STAT_WEAPONMODEL   = 2;
-const float STAT_AMMO          = 3;
-const float STAT_ARMOR         = 4;
-const float STAT_WEAPONFRAME   = 5;
-const float STAT_SHELLS                = 6;
-const float STAT_NAILS         = 7;
-const float STAT_ROCKETS       = 8;
-const float STAT_CELLS         = 9;
-const float STAT_ACTIVEWEAPON  = 10;
-const float STAT_TOTALSECRETS  = 11;
-const float STAT_TOTALMONSTERS = 12;
-const float STAT_SECRETS               = 13;
-const float STAT_MONSTERS              = 14;
-const float STAT_ITEMS         = 15;
-const float STAT_VIEWHEIGHT    = 16;
-
-// Quake Sound Constants
-const float CHAN_AUTO                  = 0;
-const float CHAN_WEAPON                        = 1;
-const float CHAN_VOICE                 = 2;
-const float CHAN_ITEM                  = 3;
-const float CHAN_BODY                  = 4;
-
-const float ATTN_NONE                  = 0;
-const float ATTN_NORM                  = 1;
-const float ATTN_IDLE                  = 2;
-const float ATTN_STATIC                        = 3;
-
-// Frik File Constants
-const float FILE_READ                  = 0;
-const float FILE_APPEND                        = 1;
-const float FILE_WRITE                 = 2;
-
-// Quake Point Contents
-const float CONTENT_EMPTY                                      = -1;
-const float CONTENT_SOLID                                      = -2;
-const float CONTENT_WATER                                      = -3;
-const float CONTENT_SLIME                                      = -4;
-const float CONTENT_LAVA                                       = -5;
-const float CONTENT_SKY                                                = -6;
-
-// Quake Solid Constants
-const float SOLID_NOT                                          = 0;
-const float SOLID_TRIGGER                                      = 1;
-const float SOLID_BBOX                                         = 2;
-const float SOLID_SLIDEBOX                                     = 3;
-const float SOLID_BSP                                          = 4;
-const float SOLID_CORPSE                                       = 5;
-
-// Quake Move Constants
-const float MOVE_NORMAL                                                = 0;
-const float MOVE_NOMONSTERS                                    = 1;
-const float MOVE_MISSILE                                       = 2;
-
-// Boolean Constants
-const float true       = 1;
-const float false      = 0;
-const float TRUE       = 1;
-const float FALSE      = 0;
-
-const float EXTRA_LOW = -99999999;
-const float EXTRA_HIGH = 99999999;
-
-const vector VEC_1     = '1 1 1';
-const vector VEC_0     = '0 0 0';
-const vector VEC_M1    = '-1 -1 -1';
-
-const float M_PI = 3.14159265358979323846;
-
-vector VEC_HULL_MIN = '-16 -16 -24';
-vector VEC_HULL_MAX = '16 16 32';
-
-// Quake Temporary Entity Constants
-const float TE_SPIKE                                           = 0;
-const float TE_SUPERSPIKE                                      = 1;
-const float TE_GUNSHOT                                         = 2;
-const float TE_EXPLOSION                                       = 3;
-const float TE_TAREXPLOSION                                    = 4;
-const float TE_LIGHTNING1                                      = 5;
-const float TE_LIGHTNING2                                      = 6;
-const float TE_WIZSPIKE                                                = 7;
-const float TE_KNIGHTSPIKE                                     = 8;
-const float TE_LIGHTNING3                                      = 9;
-const float TE_LAVASPLASH                                      = 10;
-const float TE_TELEPORT                                                = 11;
-const float TE_EXPLOSION2                                      = 12;
-       // Darkplaces Additions
-       const float TE_EXPLOSIONRGB                                     = 53;
-       const float TE_GUNSHOTQUAD                                      = 57;
-       const float TE_EXPLOSIONQUAD                            = 70;
-       const float TE_SPIKEQUAD                                        = 58;
-       const float TE_SUPERSPIKEQUAD                           = 59;
-
-// PFlags for Dynamic Lights
-const float PFLAGS_NOSHADOW                                    = 1;
-const float PFLAGS_CORONA                                      = 2;
-const float PFLAGS_FULLDYNAMIC                         = 128;
-
-const float EF_ADDITIVE                = 32;
-const float EF_BLUE            = 64;
-const float EF_FLAME           = 1024;
-const float EF_FULLBRIGHT      = 512;
-const float EF_NODEPTHTEST     = 8192;
-const float EF_NODRAW          = 16;
-const float EF_NOSHADOW                = 4096;
-const float EF_RED             = 128;
-const float EF_STARDUST                = 2048;
-const float EF_SELECTABLE      = 16384;
-
-const float PFL_ONGROUND       = 1;
-const float PFL_CROUCH         = 2;
-const float PFL_DEAD           = 4;
-const float PFL_GIBBED         = 8;
-
-// draw flags
-const float DRAWFLAG_NORMAL = 0;
-const float DRAWFLAG_ADDITIVE = 1;
-const float DRAWFLAG_MODULATE = 2;
-const float DRAWFLAG_2XMODULATE = 3;
-const float DRAWFLAG_SCREEN = 4;
-const float DRAWFLAG_MIPMAP = 0x100; // only for R_BeginPolygon
-
-/*
-==============================================================================
-
-                       BUILTIN DEFINITIONS
-                       EXTENSIONS ARE NOT ADDED HERE, BUT BELOW!
-
-==============================================================================
-*/
-
-void(vector ang) makevectors = #1;
-void(entity e, vector o) setorigin = #2;
-void(entity e, string m) setmodel = #3;
-void(entity e, vector min, vector max) setsize = #4;
-
-void() break_to_debugger = #6;
-float() random = #7;
-void(entity e, float chan, string samp) sound = #8;
-vector(vector v) normalize = #9;
-void(string e) error = #10;
-void(string e) objerror = #11;
-float(vector v) vlen = #12;
-float(vector v) vectoyaw = #13;
-entity() spawn = #14;
-void(entity e) remove = #15;
-float(vector v1, vector v2, float tryents, entity ignoreentity) traceline = #16;
-
-entity(entity start, .string fld, string match) find = #18;
-void(string s) precache_sound = #19;
-void(string s) precache_model = #20;
-
-entity(vector org, float rad) findradius = #22;
-
-void(string s, ...) dprint = #25;
-string(float f) ftos = #26;
-string(vector v) vtos = #27;
-void() coredump = #28;
-void() traceon = #29;
-void() traceoff = #30;
-void(entity e) eprint = #31;
-// settrace optional
-float(float yaw, float dist, float settrace) walkmove = #32;
-
-float() droptofloor = #34;
-void(float style, string value) lightstyle = #35;
-float(float v) rint = #36;
-float(float v) floor = #37;
-float(float v) ceil = #38;
-
-float(entity e) checkbottom = #40;
-float(vector v) pointcontents = #41;
-
-float(float f) fabs = #43;
-
-float(string s) cvar = #45;
-void(string s, ...) localcmd = #46;
-entity(entity e) nextent = #47;
-void(vector o, vector d, float color, float count) particle = #48;
-void() ChangeYaw = #49;
-
-vector(vector v) vectoangles = #51;
-vector(vector v, vector w) vectoangles2 = #51;
-
-float(float f) sin = #60;
-float(float f) cos = #61;
-float(float f) sqrt = #62;
-void(entity ent) changepitch = #63;
-void(entity e, entity ignore) tracetoss = #64;
-string(entity ent) etos = #65;
-
-string(string s) precache_file = #68;
-void(entity e) makestatic = #69;
-
-void(string var, string val) cvar_set = #72;
-
-void(vector pos, string samp, float vol, float atten) ambientsound = #74;
-string(string s) precache_model2 = #75;
-string(string s) precache_sound2 = #76;
-string(string s) precache_file2 = #77;
-
-float(string s) stof = #81;
-
-
-void(vector v1, vector min, vector max, vector v2, float nomonsters, entity forent) tracebox = #90;
-vector() randomvec = #91;
-vector(vector org) getlight = #92;
-vector(vector org, float lpflags) getlight2 = #92;
-vector getlight_dir;
-vector getlight_ambient;
-vector getlight_diffuse;
-const float LP_LIGHTMAP        = 1;
-const float LP_RTWORLD = 2;
-const float LP_DYNLIGHT = 4;
-const float LP_COMPLETE = 7;
-
-float(string name, string value) registercvar = #93;
-float( float a, ... ) min = #94;
-float( float b, ... ) max = #95;
-float(float minimum, float val, float maximum) bound = #96;
-float(float f, float f) pow = #97;
-entity(entity start, .float fld, float match) findfloat = #98;
-float(string s) checkextension = #99;
-// FrikaC and Telejano range #100-#199
-
-float(string filename, float mode) fopen = #110;
-void(float fhandle) fclose = #111;
-string(float fhandle) fgets = #112;
-void(float fhandle, string s) fputs = #113;
-float(string s) strlen = #114;
-string(...) strcat = #115;
-string(string s, float start, float length) substring = #116;
-vector(string) stov = #117;
-string(string s) strzone = #118;
-void(string s) strunzone = #119;
-
-// FTEQW range #200-#299
-
-float(float number, float quantity) bitshift = #218;
-
-//float(string str, string sub[, float startpos]) strstrofs = #221;
-float(string str, string sub, float startpos) strstrofs = #221;
-float(string str, float ofs) str2chr = #222;
-string(float c, ...) chr2str = #223;
-string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
-string(float chars, string s, ...) strpad = #225;
-string(string info, string key, string value, ...) infoadd = #226;
-string(string info, string key) infoget = #227;
-float(string s1, string s2) strcmp = #228;
-float(string s1, string s2, float len) strncmp = #228;
-float(string s1, string s2) strcasecmp = #229;
-float(string s1, string s2, float len) strncasecmp = #230;
-
-// CSQC range #300-#399
-void() clearscene = #300;
-void(float mask) addentities = #301;
-void(entity ent) addentity = #302;
-float(float property, ...) setproperty = #303;
-float(float property) getproperty = #309;
-vector(float property) getpropertyvec = #309;
-void() renderscene = #304;
-void(vector org, float radius, vector lightcolours) adddynamiclight = #305;
-void(vector org, float radius, vector lightcolours, float style, string cubemapname, float pflags) adddynamiclight2 = #305;
-//void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon = #306;
-void(string texturename, float flag, ...) R_BeginPolygon = #306;
-void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex = #307;
-void() R_EndPolygon = #308;
-vector (vector v) cs_unproject = #310;
-vector (vector v) cs_project = #311;
-
-void(float width, vector pos1, vector pos2, float flag) drawline = #315;
-float(string name) iscachedpic = #316;
-string(string name, ...) precache_pic = #317;
-string(string name) precache_cubemap = #317;
-vector(string picname) draw_getimagesize = #318;
-void(string name) freepic = #319;
-float(vector position, float character, vector scale, vector rgb, float alpha, float flag) drawcharacter = #320;
-float(vector position, string text, vector scale, vector rgb, float alpha, float flag) drawstring = #321;
-float(vector position, string pic, vector size, vector rgb, float alpha, float flag) drawpic = #322;
-float(vector position, vector size, vector rgb, float alpha, float flag) drawfill = #323;
-void(float x, float y, float width, float height) drawsetcliparea = #324;
-void(void) drawresetcliparea = #325;
-float(vector position, string text, vector scale, float alpha, float flag) drawcolorcodedstring = #326;
-vector(vector position, string text, vector scale, vector rgb, float alpha, float flag) drawcolorcodedstring2 = #326;
-
-float(float stnum) getstatf = #330;
-float(float stnum, ...) getstati = #331; // can optionally take first bit and count
-string(float firststnum) getstats = #332;
-void(entity e, float mdlindex) setmodelindex = #333;
-string(float mdlindex) modelnameforindex = #334;
-float(string effectname) particleeffectnum = #335;
-void(entity ent, float effectnum, vector start, vector end) trailparticles = #336;
-//void(float effectnum, vector origin [, vector dir, float count]) pointparticles = #337;
-void(float effectnum, vector origin , vector dir, float count) pointparticles = #337;
-void(string s, ...) centerprint = #338;
-void(string s, ...) print = #339;
-string(float keynum) keynumtostring = #340;
-float(string keyname) stringtokeynum = #341;
-string(float keynum) getkeybind = #342;
-void(float usecursor) setcursormode = #343;
-vector() getmousepos = #344;
-float(float framenum) getinputstate = #345;
-void(float sens) setsensitivityscale = #346;
-void(...) runstandardplayerphysics = #347; // this may or may not take a player ent
-string(float playernum, string keyname) getplayerkeyvalue = #348;
-float() isdemo = #349;
-float() isserver = #350;
-void(vector origin, vector forward, vector right, vector up) SetListener = #351;
-void(string cmdname) registercommand = #352;
-float(entity ent) wasfreed = #353;
-string(string key) serverkey = #354;
-
-// Use proper case; refer to the id1 Write* functions!
-float() ReadByte = #360;
-float() ReadChar = #361;
-float() ReadShort = #362;
-float() ReadLong = #363;
-float() ReadCoord = #364;
-float() ReadAngle = #365;
-string() ReadString = #366;
-float() ReadFloat = #367;
-
-// LordHavoc's range #400-#499
-void(entity from, entity to) copyentity = #400;
-
-entity(.string fld, string match) findchain = #402;
-entity(.float fld, float match) findchainfloat = #403;
-void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404;
-void(vector org, vector velocity, float howmany) te_blood = #405;
-void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406;
-void(vector org, vector color) te_explosionrgb = #407;
-void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408;
-void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409;
-void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410;
-void(vector org, vector vel, float howmany) te_spark = #411;
-void(vector org) te_gunshotquad = #412;
-void(vector org) te_spikequad = #413;
-void(vector org) te_superspikequad = #414;
-void(vector org) te_explosionquad = #415;
-void(vector org) te_smallflash = #416;
-void(vector org, float radius, float lifetime, vector color) te_customflash = #417;
-void(vector org) te_gunshot = #418;
-void(vector org) te_spike = #419;
-void(vector org) te_superspike = #420;
-void(vector org) te_explosion = #421;
-void(vector org) te_tarexplosion = #422;
-void(vector org) te_wizspike = #423;
-void(vector org) te_knightspike = #424;
-void(vector org) te_lavasplash = #425;
-void(vector org) te_teleport = #426;
-void(vector org, float colorstart, float colorlength) te_explosion2 = #427;
-void(entity own, vector start, vector end) te_lightning1 = #428;
-void(entity own, vector start, vector end) te_lightning2 = #429;
-void(entity own, vector start, vector end) te_lightning3 = #430;
-void(entity own, vector start, vector end) te_beam = #431;
-void(vector dir) vectorvectors = #432;
-void(vector org) te_plasmaburn = #433;
-float(entity e, float s) getsurfacenumpoints = #434;
-vector(entity e, float s, float n) getsurfacepoint = #435;
-vector(entity e, float s) getsurfacenormal = #436;
-string(entity e, float s) getsurfacetexture = #437;
-float(entity e, vector p) getsurfacenearpoint = #438;
-vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
-
-float(string s) tokenize = #441;
-string(float n) argv = #442;
-void(entity e, entity tagentity, string tagname) setattachment = #443;
-float(string pattern, float caseinsensitive, float quiet) search_begin = #444;
-void(float handle) search_end = #445;
-float(float handle) search_getsize = #446;
-string(float handle, float num) search_getfilename = #447;
-string(string s) cvar_string = #448;
-entity(entity start, .float fld, float match) findflags = #449;
-entity(.float fld, float match) findchainflags = #450;
-float(entity ent, string tagname) gettagindex = #451;
-vector(entity ent, float tagindex) gettaginfo = #452;
-
-void(vector org, vector vel, float howmany) te_flamejet = #457;
-
-entity(float num) entitybyindex = #459;
-float() buf_create = #460;
-void(float bufhandle) buf_del = #461;
-float(float bufhandle) buf_getsize = #462;
-void(float bufhandle_from, float bufhandle_to) buf_copy = #463;
-void(float bufhandle, float sortpower, float backward) buf_sort = #464;
-string(float bufhandle, string glue) buf_implode = #465;
-string(float bufhandle, float string_index) bufstr_get = #466;
-void(float bufhandle, float string_index, string str) bufstr_set = #467;
-float(float bufhandle, string str, float order) bufstr_add = #468;
-void(float bufhandle, float string_index) bufstr_free = #469;
-
-float(float s) asin = #471;
-float(float c) acos = #472;
-float(float t) atan = #473;
-float(float c, float s) atan2 = #474;
-float(float a) tan = #475;
-float(string s) strippedstringlen = #476;
-float(string s) strlennocol = #476; // This is the correct name for the function, but not removing the decolorizedstring mapping.
-string(string s) decolorizedstring = #477;
-string(string s) strdecolorize = #477; // This is the correct name for the function, but not removing the decolorizedstring mapping.
-string(float uselocaltime, string format, ...) strftime = #478;
-string(string s) strtolower = #480;
-string(string s) strtoupper = #481;
-string(string s) cvar_defstring = #482;
-void(vector origin, string sample, float volume, float attenuation) pointsound = #483;
-string(string search, string replace, string subject) strreplace = #484;
-string(string search, string replace, string subject) strireplace = #485;
-vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
-#ifdef SUPPORT_GECKO
-float gecko_create( string name ) = #487;
-void gecko_destroy( string name ) = #488;
-void gecko_navigate( string name, string URI ) = #489;
-float gecko_keyevent( string name, float key, float eventtype ) = #490;
-void gecko_mousemove( string name, float x, float y ) = #491;
-void gecko_resize( string name, float w, float h ) = #492;
-vector gecko_get_texture_extent( string name ) = #493;
-#else
-
-#endif
-
-/*
-==============================================================================
-
-                       EXTENSION DEFINITIONS
-
-==============================================================================
-*/
-
-// DP_CSQC_SPAWNPARTICLE
-// idea: VorteX
-// darkplaces implementation: VorteX
-// constant definitions:
-// particle base behavior:
-float PT_ALPHASTATIC = 1;
-float PT_STATIC = 2;
-float PT_SPARK = 3;
-float PT_BEAM = 4;
-float PT_RAIN = 5;
-float PT_RAINDECAL = 6;
-float PT_SNOW = 7;
-float PT_BUBBLE = 8;
-float PT_BLOOD = 9;
-float PT_SMOKE = 10;
-float PT_DECAL = 11;
-float PT_ENTITYPARTICLE = 12;
-// particle blendtypes:
-float PBLEND_ALPHA = 0;
-float PBLEND_ADD = 1;
-float PBLEND_INVMOD = 2;
-// particle orientation:
-float PARTICLE_BILLBOARD = 0;
-float PARTICLE_SPARK = 1;
-float PARTICLE_ORIENTED_DOUBLESIDED = 2;
-float PARTICLE_BEAM = 3;
-// global definitions:
-float particle_type; // one of PT_
-float particle_blendmode; // one of PBLEND_ values
-float particle_orientation; // one of PARTICLE_ values
-vector particle_color1;
-vector particle_color2;
-float particle_tex; // number of chunk in particlefont
-float particle_size;
-float particle_sizeincrease;
-float particle_alpha;
-float particle_alphafade;
-float particle_time;
-float particle_gravity;
-float particle_bounce;
-float particle_airfriction;
-float particle_liquidfriction;
-float particle_originjitter;
-float particle_velocityjitter;
-float particle_qualityreduction; // enable culling of this particle when FPS is low
-float particle_stretch;
-vector particle_staincolor1;
-vector particle_staincolor2;
-float particle_staintex;
-float particle_stainalpha;
-float particle_stainsize;
-float particle_delayspawn;
-float particle_delaycollision;
-float particle_angle;
-float particle_spin;
-// builtin definitions:
-float(float max_themes) initparticlespawner = #522; // check fields/globals for integration and enable particle spawner, return 1 is succeded, otherwise returns 0
-void() resetparticle = #523; // reset p_ globals to default theme #0
-void(float theme) particletheme = #524; // restore p_ globals from saved theme
-float() particlethemesave = #525; // save p_ globals to new particletheme and return it's index
-void(float theme) particlethemeupdate = #525; // save p_ globals to new particletheme and return it's index
-void(float theme) particlethemefree = #526; // delete a particle theme
-float(vector org, vector vel) spawnparticle = #527; // returns 0 when failed, 1 when spawned
-float(vector org, vector vel, float theme) quickparticle = #527; // not reading globals, just theme, returns 0 when failed, 1 when spawned
-float(vector org, vector vel, float delay, float collisiondelay) delayedparticle = #528;
-float(vector org, vector vel, float delay, float collisiondelay, float theme) quickdelayedparticle = #528;
-// description: this builtin provides an easy and flexible way to spawn particles,
-// it is not created as replace for DP_SV_POINTPARTICLES but as an addition to it.
-// With this extension you can create a specific particles like rain particles, or entity particles
-// notes:
-// 1) 0 is default particle template, it could be changed
-// 2) color vectors could have value 0-255 of each component
-// restrictions: max themes could be between 4 and 2048
-// warning: you should call initparticlespawner() at very beginning BEFORE all other particle spawner functions
-// function to query particle info
-// don't remove this function as it protects all particle_ globals from FTEQCC/FRIKQCC non-referenced removal optimisation
-void() printparticle =
-{
-       // vortex: this also protects from 'non-referenced' optimisation on some compilers
-       print("PARTICLE:\n");
-       print(strcat("  type: ", ftos(particle_type), "\n"));
-       print(strcat("  blendmode: ", ftos(particle_blendmode), "\n"));
-       print(strcat("  orientation: ", ftos(particle_orientation), "\n"));
-       print(strcat("  color1: ", vtos(particle_color1), "\n"));
-       print(strcat("  color2: ", vtos(particle_color2), "\n"));
-       print(strcat("  tex: ", ftos(particle_tex), "\n"));
-       print(strcat("  size: ", ftos(particle_size), "\n"));
-       print(strcat("  sizeincrease: ", ftos(particle_sizeincrease), "\n"));
-       print(strcat("  alpha: ", ftos(particle_alpha), "\n"));
-       print(strcat("  alphafade: ", ftos(particle_alphafade), "\n"));
-       print(strcat("  time: ", ftos(particle_time), "\n"));
-       print(strcat("  gravity: ", ftos(particle_gravity), "\n"));
-       print(strcat("  bounce: ", ftos(particle_bounce), "\n"));
-       print(strcat("  airfriction: ", ftos(particle_airfriction), "\n"));
-       print(strcat("  liquidfriction: ", ftos(particle_liquidfriction), "\n"));
-       print(strcat("  originjitter: ", ftos(particle_originjitter), "\n"));
-       print(strcat("  velocityjitter: ", ftos(particle_velocityjitter), "\n"));
-       print(strcat("  qualityreduction: ", ftos(particle_qualityreduction), "\n"));
-       print(strcat("  stretch: ", ftos(particle_stretch), "\n"));
-       print(strcat("  staincolor1: ", vtos(particle_staincolor1), "\n"));
-       print(strcat("  staincolor2: ", vtos(particle_staincolor2), "\n"));
-       print(strcat("  staintex: ", ftos(particle_staintex), "\n"));
-       print(strcat("  stainalpha: ", ftos(particle_stainalpha), "\n"));
-       print(strcat("  stainsize: ", ftos(particle_stainsize), "\n"));
-       print(strcat("  delayspawn: ", ftos(particle_delayspawn), "\n"));
-       print(strcat("  delaycollision: ", ftos(particle_delaycollision), "\n"));
-       print(strcat("  angle: ", ftos(particle_angle), "\n"));
-       print(strcat("  spin: ", ftos(particle_spin), "\n"));
-}
-
-// DP_CSQC_ENTITYTRANSPARENTSORTING_OFFSET
-// idea: VorteX
-// darkplaces implementation: VorteX
-float RF_USETRANSPARENTOFFSET = 64; // enables transparent origin offsetting
-// global definitions
-float transparent_offset; // should be set before entity is added
-// description: offset a model's meshes origin used for transparent sorting. Could be used to tweak sorting bugs on very large transparent entities or hacking transparent sorting order for certain objects
-// example: transparent_offset = 1000000; // entity always appear on background of other transparents
-// note: offset is done in view forward axis
-
-// DP_CSQC_ENTITYWORLDOBJECT
-// idea: VorteX
-// darkplaces implementation: VorteX
-const float RF_WORLDOBJECT = 128;
-// description: when renderflag is set, engine will not use culling methods for this entity, e.g. it will always be drawn
-// useful for large outdoor objects (like asteroids on sky horizon or sky models)
-
-// DP_CSQC_ENTITYMODELLIGHT
-// idea: VorteX
-// darkplaces implementation: VorteX
-const float RF_MODELLIGHT = 4096;
-.vector modellight_ambient;
-.vector modellight_diffuse;
-.vector modellight_dir;
-// description: allows CSQC to override directional model lightning on entity
-
-// DP_CSQC_SETPAUSE
-// idea: VorteX
-// darkplaces implementation: VorteX
-// builtin definitions:
-void(float ispaused) setpause = #531;
-// description: provides ability to set pause in local games (similar to one set once console is activated)
-// not stopping sound/cd track, useful for inventory screens, ingame menus with input etc.
-
-// DP_CSQC_QUERYRENDERENTITY
-// idea: VorteX
-// darkplaces implementation: VorteX
-// constant definitions:
-// render entity fields:
-float E_ACTIVE             = 0; // float 0/1
-float E_ORIGIN      = 1; // vector
-float E_FORWARD     = 2; // vector
-float E_RIGHT       = 3; // vector
-float E_UP          = 4; // vector
-float E_SCALE       = 5; // float
-float E_ORIGINANDVECTORS = 6; // returns origin, + sets v_* vectors to orientation
-float E_ALPHA       = 7; // float
-float E_COLORMOD    = 8; // vector
-float E_PANTSCOLOR  = 9; // vector
-float E_SHIRTCOLOR  = 10; // vector
-float E_SKIN        = 11; // float
-float E_MINS        = 12; // vector
-float E_MAXS        = 13; // vector
-float E_ABSMIN      = 14; // vector
-float E_ABSMAX      = 15; // vector
-float E_LIGHT       = 16; // vector - modellight
-// builtin definitions:
-float(float entitynum, float fldnum) getentity = #504;
-vector(float entitynum, float fldnum) getentityvec = #504;
-// description: allows to query parms from render entities, especially useful with attaching CSQC ents to
-// server entities networked and interpolated by engine (monsters, players), number of entity is it's SVQC number
-// you can send it via tempentity/CSQC entity message. Note that this builtin doesnt know about entity removing/reallocating
-// so it's meaning to work for short period of time, dont use it on missiles/grenades whatever will be removed next five seconds
-
-//DP_GFX_FONTS
-//idea: Blub\0, divVerent
-//darkplaces implementation: Blub\0
-//console commands:
-//  loadfont fontname fontmaps size1 size2 ...
-//   A font can simply be gfx/tgafile (freetype fonts doent need extension),
-//   or alternatively you can specify multiple fonts and faces
-//   Like this: gfx/vera-sans:2,gfx/fallback:1
-//   to load face 2 of the font gfx/vera-sans and use face 1
-//   of gfx/fallback as fallback font
-//   You can also specify a list of font sizes to load, like this:
-//   loadfont console gfx/conchars,gfx/fallback 8 12 16 24 32
-//   In many cases, 8 12 16 24 32 should be a good choice.
-//   for slots see:
-//constant definitions:
-float drawfont;            // set it before drawstring()/drawchar() calls
-float FONT_DEFAULT = 0;    // 'default'
-float FONT_CONSOLE = 1;    // 'console', REALLY should be fixed width (ls!)
-float FONT_SBAR = 2;       // 'sbar', used on hud, must be fixed width
-float FONT_NOTIFY = 3;     // 'notify', used on sprint/bprint
-float FONT_CHAT = 4;       // 'chat'
-float FONT_CENTERPRINT = 5;// 'centerprint'
-float FONT_INFOBAR = 6;    // 'infobar'
-float FONT_MENU = 7;       // 'menu', should be fixed width
-float FONT_USER0 = 8;      // 'user0', userdefined fonts
-float FONT_USER1 = 9;      // 'user1', userdefined fonts
-float FONT_USER2 = 10;     // 'user2', userdefined fonts
-float FONT_USER3 = 11;     // 'user3', userdefined fonts
-float FONT_USER4 = 12;     // 'user4', userdefined fonts
-float FONT_USER5 = 13;     // 'user5', userdefined fonts
-float FONT_USER6 = 14;     // 'user6', userdefined fonts
-float FONT_USER7 = 15;     // 'user7' slot, userdefined fonts
-//builtin definitions:
-float findfont(string s) = #356; // find font by fontname and return it's index
-float loadfont(string fontname, string fontmaps, string sizes, float slot, float fix_scale, float fix_voffset) = #357;
-// loads font immediately so stringwidth() function can be used just after builtin call
-// returns a font slotnum (which is used to set drawfont to)
-// first 3 parms are identical to "loadfont" console command ones
-// slot could be one of FONT_ constants or result of findfont() or -1 to not use it
-// if slot is given, font will be loaded to this slotnum and fontname become new title for it
-// this way you can rename user* fonts to something more usable
-// fix_* parms let you fix badly made fonts by applying some transformations to them
-// fix_scale : per-character center-oriented scale (doesn't change line height at all)
-// fix_voffset : vertical offset for each character, it's a multiplier to character height
-float stringwidth(string text, float allowColorCodes, vector size) = #327; // get a width of string with given font and char size
-float stringwidth_menu(string text, float allowColorCodes, vector size) = #468; // in menu.dat it has different builtin #
-//description: engine support for custom fonts in console, hud, qc etc.
-// limits:
-//  max 128 chars for font name
-//  max 3 font fallbacks
-//  max 8 sizes per font
-
-//DP_GFX_FONTS_FREETYPE
-//idea: Blub\0, divVerent
-//darkplaces implementation: Blub\0
-//cvar definitions:
-//   r_font_disable_freetype 0/1 : disable freetype fonts loading (uttetly disables freetype library initialization)
-//   r_font_antialias 0/1 : antialiasing when loading font
-//   r_font_hint 0/1/2/3  : hinting when loading font, 0 is no hinting, 1 light autohinting , 2 full autohinting, 3 full hinting
-//   r_font_postprocess_blur X      : font outline blur amount
-//   r_font_postprocess_outline X   : font outline width
-//   r_font_postprocess_shadow_x X  : font outline shadow x shift amount, applied during outlining
-//   r_font_postprocess_shadow_y X  : font outline shadow y shift amount, applied during outlining
-//   r_font_postprocess_shadow_z X  : font outline shadow z shift amount, applied during blurring
-//description: engine support for truetype/freetype fonts
-//so .AFM+.PFB/.OTF/.TTF files could be stuffed as fontmaps in loadfont()
-//(console command version will support them as well)
-
-//DP_CSQC_BINDMAPS
-//idea: daemon, motorsep
-//darkplaces implementation: divVerent
-//builtin definitions:
-string(float key, float bindmap) getkeybind_bindmap = #342;
-float(float key, string bind, float bindmap) setkeybind_bindmap = #630;
-vector(void) getbindmaps = #631;
-float(vector bm) setbindmaps = #632;
-string(string command, float bindmap) findkeysforcommand = #610;
-//<already in EXT_CSQC> float(string key) stringtokeynum = #341;
-//<already in EXT_CSQC> string(float keynum) keynumtostring = #340;
-//description: key bind setting/getting including support for switchable
-//bindmaps.
-
-//DP_CRYPTO
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions: (CSQC)
-float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513;
-//description:
-//use -1 as buffer handle to justs end delim as postdata
-
-//DP_CSQC_MAINVIEW
-//idea: divVerent
-//darkplaces implementation: divVerent
-//constant definitions:
-const float VF_MAINVIEW         = 400;
-//use setproperty(VF_MAINVIEW, 1); before calling R_RenderView for the render
-//that shall become the "main" view, which is e.g. used by PRYDON_CLIENTCURSOR
-//this flag is set for the first scene, and not cleared by R_ClearScene
-//this flag is automatically cleared by R_RenderView
-//so when not using this extension, the first view rendered is the main view
-
-//DP_CSQC_MINFPS_QUALITY
-//idea: divVerent
-//darkplaces implementation: divVerent
-//constant definitions:
-const float VF_MINFPS_QUALITY   = 401;
-//use getproperty(VF_MINFPS_QUALITY); to do CSQC based LOD based on cl_minfps
-//1 should lead to an unmodified view
-
-//DP_CSQC_V_CALCREFDEF_WIP1
-//DP_CSQC_V_CALCREFDEF_WIP2
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions:
-void(entity e, float refdefflags) V_CalcRefdef = #640;
-//constant definitions:
-float PMF_DUCKED = 4;
-float PMF_ONGROUND = 8;
-float REFDEFFLAG_TELEPORTED = 1;
-float REFDEFFLAG_JUMPING = 2;
-float REFDEFFLAG_DEAD = 4;
-float REFDEFFLAG_INTERMISSION = 8;
-//- use this on the player entity after performing prediction
-//- pass REFDEFFLAG_TELEPORTED if the player teleported since last frame
-//- pass REFDEFFLAG_JUMPING if jump button is pressed
-//- pass REFDEFFLAG_DEAD if dead (DP_CSQC_V_CALCREFDEF_WIP2)
-//- pass REFDEFFLAG_INTERMISSION if in intermission (DP_CSQC_V_CALCREFDEF_WIP2)
-//- the player entity needs to have origin, velocity, pmove_flags set according
-//  to prediction (the above two PMF_ flags are used in the player's pmove_flags)
-//- NOTE: to check for this, ALSO OR a check with DP_CSQC_V_CALCREFDEF to also support
-//  the finished extension once done
-
-// assorted builtins
-float  drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #328;
-vector drawgetimagesize(string pic) = #318;
-#define SPA_POSITION 0
-#define SPA_S_AXIS 1
-#define SPA_T_AXIS 2
-#define SPA_R_AXIS 3
-#define SPA_TEXCOORDS0 4
-#define SPA_LIGHTMAP0_TEXCOORDS 5
-#define SPA_LIGHTMAP_COLOR 6
-float (entity e, float s)                                              getsurfacenumpoints = #434;
-vector (entity e, float s, float n)                                    getsurfacepoint = #435;
-vector (entity e, float s)                                             getsurfacenormal = #436;
-string (entity e, float s)                                             getsurfacetexture = #437;
-float (entity e, vector p)                                             getsurfacenearpoint = #438;
-vector (entity e, float s, vector p)                                   getsurfaceclippedpoint = #439;
-vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
-float(entity e, float s) getsurfacenumtriangles = #628;
-vector(entity e, float s, float n) getsurfacetriangle = #629;
-
-//DP_QC_ASINACOSATANATAN2TAN
-//idea: Urre
-//darkplaces implementation: LordHavoc
-//constant definitions:
-float DEG2RAD = 0.0174532925199432957692369076848861271344287188854172545609719144;
-float RAD2DEG = 57.2957795130823208767981548141051703324054724665643215491602438612;
-float PI      = 3.1415926535897932384626433832795028841971693993751058209749445923;
-//builtin definitions:
-float(float s) asin = #471; // returns angle in radians for a given sin() value, the result is in the range -PI*0.5 to PI*0.5
-float(float c) acos = #472; // returns angle in radians for a given cos() value, the result is in the range 0 to PI
-float(float t) atan = #473; // returns angle in radians for a given tan() value, the result is in the range -PI*0.5 to PI*0.5
-float(float c, float s) atan2 = #474; // returns angle in radians for a given cos() and sin() value pair, the result is in the range -PI to PI (this is identical to vectoyaw except it returns radians rather than degrees)
-float(float a) tan = #475; // returns tangent value (which is simply sin(a)/cos(a)) for the given angle in radians, the result is in the range -infinity to +infinity
-//description:
-//useful math functions for analyzing vectors, note that these all use angles in radians (just like the cos/sin functions) not degrees unlike makevectors/vectoyaw/vectoangles, so be sure to do the appropriate conversions (multiply by DEG2RAD or RAD2DEG as needed).
-//note: atan2 can take unnormalized vectors (just like vectoyaw), and the function was included only for completeness (more often you want vectoyaw or vectoangles), atan2(v_x,v_y) * RAD2DEG gives the same result as vectoyaw(v)
-
-//DP_QC_SPRINTF
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions:
-string(string format, ...) sprintf = #627;
-//description:
-//you know sprintf :P
-//supported stuff:
-//  %
-//  optional: <argpos>$ for the argument to format
-//  flags: #0- +
-//  optional: <width>, *, or *<argpos>$ for the field width
-//  optional: .<precision>, .*, or .*<argpos>$ for the precision
-//  length modifiers: h for forcing a float, l for forcing an int/entity (by default, %d etc. cast a float to int)
-//  conversions:
-//    d takes a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an int
-//    i takes an int/entity if no length is specified or i is, and a float if h is specified as length, and cast it to an int
-//    ouxXc take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an unsigned int
-//    eEfFgG take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to a double
-//    s takes a string
-//    vV takes a vector, and processes the three components as if it were a gG for all three components, separated by space
-//    For conversions s and c, the flag # makes precision and width interpreted
-//      as byte count, by default it is interpreted as character count in UTF-8
-//      enabled engines. No other conversions can create wide characters, and #
-//      has another meaning in these.
-
-//DP_QC_GETTIME
-//idea: tZork
-//darkplaces implementation: tZork, divVerent
-//constant definitions:
-float GETTIME_FRAMESTART = 0; // time of start of frame
-float GETTIME_REALTIME = 1; // current time (may be OS specific)
-float GETTIME_HIRES = 2; // like REALTIME, but may reset between QC invocations and thus can be higher precision
-float GETTIME_UPTIME = 3; // time since start of the engine
-//builtin definitions:
-float(float tmr) gettime = #519;
-//description:
-//some timers to query...
-
-//DP_QC_GETTIME_CDTRACK
-//idea: divVerent
-//darkplaces implementation: divVerent
-//constant definitions:
-float GETTIME_CDTRACK = 4;
-//description:
-//returns the playing time of the current cdtrack when passed to gettime()
-//see DP_END_GETSOUNDTIME for similar functionality but for entity sound channels
-
-//DP_QC_TOKENIZEBYSEPARATOR
-//idea: Electro, SavageX, LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-float(string s, string separator1, ...) tokenizebyseparator = #479;
-//description:
-//this function returns tokens separated by any of the supplied separator strings, example:
-//numnumbers = tokenizebyseparator("10.2.3.4", ".");
-//returns 4 and the tokens are "10" "2" "3" "4"
-//possibly useful for parsing IPv4 addresses (such as "1.2.3.4") and IPv6 addresses (such as "[1234:5678:9abc:def0:1234:5678:9abc:def0]:26000")
-
-//DP_QC_TOKENIZE_CONSOLE
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions:
-float(string s) tokenize_console = #514;
-float(float i) argv_start_index = #515;
-float(float i) argv_end_index = #516;
-//description:
-//this function returns tokens separated just like the console does
-//also, functions are provided to get the index of the first and last character of each token in the original string
-//Passing negative values to them, or to argv, will be treated as indexes from the LAST token (like lists work in Perl). So argv(-1) will return the LAST token.
-
-//DP_SND_SOUND7_WIP1
-//DP_SND_SOUND7_WIP2
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions:
-void(entity e, float chan, string samp, float vol, float atten, float speed, float flags) sound7 = #8;
-float SOUNDFLAG_RELIABLE = 1;
-//description:
-//plays a sound, with some more flags
-//extensions to sound():
-//- channel may be in the range from -128 to 127; channels -128 to 0 are "auto",
-//  i.e. support multiple sounds at once, but cannot be stopped/restarted
-//- a value 0 in the speed parameter means no change; otherwise, it is a
-//  percentage of playback speed ("pitch shifting"). 100 is normal pitch, 50 is
-//  half speed, 200 is double speed, etc. (DP_SND_SOUND7_WIP2)
-//- the flag SOUNDFLAG_RELIABLE can be specified, which makes the sound send
-//  to MSG_ALL (reliable) instead of MSG_BROADCAST (unreliable, default);
-//  similarily, SOUNDFLAG_RELIABLE_TO_ONE sends to MSG_ONE
-//- channel 0 is controlled by snd_channel0volume; channel 1 and -1 by
-//  snd_channel1volume, etc. (so, a channel shares the cvar with its respective
-//  auto-channel); however, the mod MUST define snd_channel8volume and upwards
-//  in default.cfg if they are to be used, as the engine does not create them
-//  to not litter the cvar list
-//- this extension applies to CSQC as well; CSQC_Event_Sound will get speed and
-//  flags as extra 7th and 8th argument
-//- WIP2 ideas: SOUNDFLAG_RELIABLE_TO_ONE, SOUNDFLAG_NOPHS, SOUNDFLAG_FORCELOOP
-//- NOTE: to check for this, ALSO OR a check with DP_SND_SOUND7 to also support
-//  the finished extension once done
-
-//DP_PRECACHE_PIC_FLAGS
-//idea: divVerent
-//darkplaces implementation: divVerent
-//constant definitions:
-float PRECACHE_PIC_FROMWAD = 1; // this one actually is part of EXT_CSQC
-float PRECACHE_PIC_NOTPERSISTENT = 2; // picture may get deallocated when unused
-float PRECACHE_PIC_MIPMAP = 8; // mipmap the texture for possibly better downscaling at memory expense
-//notes: these constants are given as optional second argument to precache_pic()
-
-//DP_QC_TRACE_MOVETYPE_WORLDONLY
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//constant definitions:
-float MOVE_WORLDONLY = 3;
-//description:
-//allows traces to hit only world (ignoring all entities, unlike MOVE_NOMONSTERS which hits all bmodels), use as the nomonsters parameter to trace functions
-
-//DP_SND_GETSOUNDTIME
-//idea: VorteX
-//darkplaces implementation: VorteX
-//constant definitions:
-float(entity e, float channel) getsoundtime = #533; // get currently sound playing position on entity channel, -1 if not playing or error
-float(string sample) soundlength = #534; // returns length of sound sample in seconds, -1 on error (sound not precached, sound system not initialized etc.)
-//description: provides opportunity to query length of sound samples and realtime tracking of sound playing on entities (similar to DP_GETTIME_CDTRACK)
-//note: beware dedicated server not running sound engine at all, so in dedicated mode this builtins will not work in server progs
-//note also: menu progs not supporting getsoundtime() (will give a warning) since it has no sound playing on entities
-//examples of use:
-//  - QC-driven looped sounds
-//  - QC events when sound playing is finished
-//  - toggleable ambientsounds
-//  - subtitles
-
-//DP_QC_NUM_FOR_EDICT
-//idea: Blub\0
-//darkplaces implementation: Blub\0
-//Function to get the number of an entity - a clean way.
-float(entity num) num_for_edict = #512;
-
-//DP_TRACE_HITCONTENTSMASK_SURFACEINFO
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//globals:
-.float dphitcontentsmask; // if non-zero on the entity passed to traceline/tracebox/tracetoss this will override the normal collidable contents rules and instead hit these contents values (for example AI can use tracelines that hit DONOTENTER if it wants to, by simply changing this field on the entity passed to traceline), this affects normal movement as well as trace calls
-float trace_dpstartcontents; // DPCONTENTS_ value at start position of trace
-float trace_dphitcontents; // DPCONTENTS_ value of impacted surface (not contents at impact point, just contents of the surface that was hit)
-float trace_dphitq3surfaceflags; // Q3SURFACEFLAG_ value of impacted surface
-string trace_dphittexturename; // texture name of impacted surface
-//constants:
-float DPCONTENTS_SOLID = 1; // hit a bmodel, not a bounding box
-float DPCONTENTS_WATER = 2;
-float DPCONTENTS_SLIME = 4;
-float DPCONTENTS_LAVA = 8;
-float DPCONTENTS_SKY = 16;
-float DPCONTENTS_BODY = 32; // hit a bounding box, not a bmodel
-float DPCONTENTS_CORPSE = 64; // hit a SOLID_CORPSE entity
-float DPCONTENTS_NODROP = 128; // an area where backpacks should not spawn
-float DPCONTENTS_PLAYERCLIP = 256; // blocks player movement
-float DPCONTENTS_MONSTERCLIP = 512; // blocks monster movement
-float DPCONTENTS_DONOTENTER = 1024; // AI hint brush
-float DPCONTENTS_LIQUIDSMASK = 14; // WATER | SLIME | LAVA
-float DPCONTENTS_BOTCLIP = 2048; // AI hint brush
-float DPCONTENTS_OPAQUE = 4096; // only fully opaque brushes get this (may be useful for line of sight checks)
-float Q3SURFACEFLAG_NODAMAGE = 1;
-float Q3SURFACEFLAG_SLICK = 2; // low friction surface
-float Q3SURFACEFLAG_SKY = 4; // sky surface (also has NOIMPACT and NOMARKS set)
-float Q3SURFACEFLAG_LADDER = 8; // climbable surface
-float Q3SURFACEFLAG_NOIMPACT = 16; // projectiles should remove themselves on impact (this is set on sky)
-float Q3SURFACEFLAG_NOMARKS = 32; // projectiles should not leave marks, such as decals (this is set on sky)
-float Q3SURFACEFLAG_FLESH = 64; // projectiles should do a fleshy effect (blood?) on impact
-float Q3SURFACEFLAG_NODRAW = 128; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_HINT = 256; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_SKIP = 512; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_NOLIGHTMAP = 1024; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_POINTLIGHT = 2048; // compiler hint (not important to qc)
-float Q3SURFACEFLAG_METALSTEPS = 4096; // walking on this surface should make metal step sounds
-float Q3SURFACEFLAG_NOSTEPS = 8192; // walking on this surface should not make footstep sounds
-float Q3SURFACEFLAG_NONSOLID = 16384; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_LIGHTFILTER = 32768; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_ALPHASHADOW = 65536; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_NODLIGHT = 131072; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_DUST = 262144; // translucent 'light beam' effect (not important to qc)
-//description:
-//adds additional information after a traceline/tracebox/tracetoss call.
-//also (very important) sets trace_* globals before calling .touch functions,
-//this allows them to inspect the nature of the collision (for example
-//determining if a projectile hit sky), clears trace_* variables for the other
-//object in a touch event (that is to say, a projectile moving will see the
-//trace results in its .touch function, but the player it hit will see very
-//little information in the trace_ variables as it was not moving at the time)
-
-//DP_QC_CVAR_TYPE
-//idea: divVerent
-//DarkPlaces implementation: divVerent
-//builtin definitions:
-float(string name) cvar_type = #495;
-float CVAR_TYPEFLAG_EXISTS = 1;
-float CVAR_TYPEFLAG_SAVED = 2;
-float CVAR_TYPEFLAG_PRIVATE = 4;
-float CVAR_TYPEFLAG_ENGINE = 8;
-float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
-float CVAR_TYPEFLAG_READONLY = 32;
-
-//DP_QC_CRC16
-//idea: divVerent
-//darkplaces implementation: divVerent
-//Some hash function to build hash tables with. This has to be be the CRC-16-CCITT that is also required for the QuakeWorld download protocol.
-//When caseinsensitive is set, the CRC is calculated of the lower cased string.
-float(float caseinsensitive, string s, ...) crc16 = #494;
-
-//DP_QC_URI_ESCAPE
-//idea: divVerent
-//darkplaces implementation: divVerent
-//URI::Escape's functionality
-string(string in) uri_escape = #510;
-string(string in) uri_unescape = #511;
-
-//DP_QC_DIGEST
-//idea: motorsep, Spike
-//DarkPlaces implementation: divVerent
-//builtin definitions:
-string(string digest, string data, ...) digest_hex = #639;
-//description:
-//returns a given hex digest of given data
-//the returned digest is always encoded in hexadecimal
-//only the "MD4" digest is always supported!
-//if the given digest is not supported, string_null is returned
-//the digest string is matched case sensitively, use "MD4", not "md4"!
-
-//DP_QC_DIGEST_SHA256
-//idea: motorsep, Spike
-//DarkPlaces implementation: divVerent
-//description:
-//"SHA256" is also an allowed digest type
-
-//DP_QC_LOG
-//darkplaces implementation: divVerent
-//builtin definitions:
-float log(float f) = #532;
-//description:
-//logarithm
-
-//FTE_CSQC_SKELETONOBJECTS
-//idea: Spike, LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-// all skeleton numbers are 1-based (0 being no skeleton)
-// all bone numbers are 1-based (0 being invalid)
-float(float modlindex) skel_create = #263; // create a skeleton (be sure to assign this value into .skeletonindex for use), returns skeleton index (1 or higher) on success, returns 0 on failure (for example if the modelindex is not skeletal), it is recommended that you create a new skeleton if you change modelindex, as the skeleton uses the hierarchy from the model.
-float(float skel, entity ent, float modlindex, float retainfrac, float firstbone, float lastbone) skel_build = #264; // blend in a percentage of standard animation, 0 replaces entirely, 1 does nothing, 0.5 blends half, etc, and this only alters the bones in the specified range for which out of bounds values like 0,100000 are safe (uses .frame, .frame2, .frame3, .frame4, .lerpfrac, .lerpfrac3, .lerpfrac4, .frame1time, .frame2time, .frame3time, .frame4time), returns skel on success, 0 on failure
-float(float skel) skel_get_numbones = #265; // returns how many bones exist in the created skeleton, 0 if skeleton does not exist
-string(float skel, float bonenum) skel_get_bonename = #266; // returns name of bone (as a tempstring), "" if invalid bonenum (< 1 for example) or skeleton does not exist
-float(float skel, float bonenum) skel_get_boneparent = #267; // returns parent num for supplied bonenum, 0 if bonenum has no parent or bone does not exist (returned value is always less than bonenum, you can loop on this)
-float(float skel, string tagname) skel_find_bone = #268; // get number of bone with specified name, 0 on failure, bonenum (1-based) on success, same as using gettagindex but takes modelindex instead of entity
-vector(float skel, float bonenum) skel_get_bonerel = #269; // get matrix of bone in skeleton relative to its parent - sets v_forward, v_right, v_up, returns origin (relative to parent bone)
-vector(float skel, float bonenum) skel_get_boneabs = #270; // get matrix of bone in skeleton in model space - sets v_forward, v_right, v_up, returns origin (relative to entity)
-void(float skel, float bonenum, vector org) skel_set_bone = #271; // set matrix of bone relative to its parent, reads v_forward, v_right, v_up, takes origin as parameter (relative to parent bone)
-void(float skel, float bonenum, vector org) skel_mul_bone = #272; // transform bone matrix (relative to its parent) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bone)
-void(float skel, float startbone, float endbone, vector org) skel_mul_bones = #273; // transform bone matrices (relative to their parents) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bones)
-void(float skeldst, float skelsrc, float startbone, float endbone) skel_copybones = #274; // copy bone matrices (relative to their parents) from one skeleton to another, useful for copying a skeleton to a corpse
-void(float skel) skel_delete = #275; // deletes skeleton at the beginning of the next frame (you can add the entity, delete the skeleton, renderscene, and it will still work)
-float(float modlindex, string framename) frameforname = #276; // finds number of a specified frame in the animation, returns -1 if no match found
-float(float modlindex, float framenum) frameduration = #277; // returns the intended play time (in seconds) of the specified framegroup, if it does not exist the result is 0, if it is a single frame it may be a small value around 0.1 or 0.
-//fields:
-.float skeletonindex; // active skeleton overriding standard animation on model
-.float frame; // primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
-.float frame2; // secondary framegroup animation (strength = lerpfrac)
-.float frame3; // tertiary framegroup animation (strength = lerpfrac3)
-.float frame4; // quaternary framegroup animation (strength = lerpfrac4)
-.float lerpfrac; // strength of framegroup blend
-.float lerpfrac3; // strength of framegroup blend
-.float lerpfrac4; // strength of framegroup blend
-.float frame1time; // start time of framegroup animation
-.float frame2time; // start time of framegroup animation
-.float frame3time; // start time of framegroup animation
-.float frame4time; // start time of framegroup animation
-//description:
-//this extension provides a way to do complex skeletal animation on an entity.
-//
-//see also DP_SKELETONOBJECTS (this extension implemented on server as well as client)
-//
-//notes:
-//each model contains its own skeleton, reusing a skeleton with incompatible models will yield garbage (or not render).
-//each model contains its own animation data, you can use animations from other model files (for example saving out all character animations as separate model files).
-//if an engine supports loading an animation-only file format such as .md5anim in FTEQW, it can be used to animate any model with a compatible skeleton.
-//proper use of this extension may require understanding matrix transforms (v_forward, v_right, v_up, origin), and you must keep in mind that v_right is negative for this purpose.
-//
-//features include:
-//multiple animations blended together.
-//animating a model with animations from another model with a compatible skeleton.
-//restricting animation blends to certain bones of a model - for example independent animation of legs, torso, head.
-//custom bone controllers - for example making eyes track a target location.
-//
-//
-//
-//example code follows...
-//
-//this helper function lets you identify (by parentage) what group a bone
-//belongs to - for example "torso", "leftarm", would return 1 ("torso") for
-//all children of the bone named "torso", unless they are children of
-//"leftarm" (which is a child of "torso") which would return 2 instead...
-float(float skel, float bonenum, string g1, string g2, string g3, string g4, string g5, string g6) example_skel_findbonegroup =
-{
-       local string bonename;
-       while (bonenum >= 0)
-       {
-               bonename = skel_get_bonename(skel, bonenum);
-               if (bonename == g1) return 1;
-               if (bonename == g2) return 2;
-               if (bonename == g3) return 3;
-               if (bonename == g4) return 4;
-               if (bonename == g5) return 5;
-               if (bonename == g6) return 6;
-               bonenum = skel_get_boneparent(skel, bonenum);
-       }
-       return 0;
-};
-// create a skeletonindex for our player using current modelindex
-void() example_skel_player_setup =
-{
-       self.skeletonindex = skel_create(self.modelindex);
-};
-// setup bones of skeleton based on an animation
-// note: animmodelindex can be a different model than self.modelindex
-void(float animmodelindex, float framegroup, float framegroupstarttime) example_skel_player_update_begin =
-{
-       // start with our standard animation
-       self.frame = framegroup;
-       self.frame2 = 0;
-       self.frame3 = 0;
-       self.frame4 = 0;
-       self.frame1time = framegroupstarttime;
-       self.frame2time = 0;
-       self.frame3time = 0;
-       self.frame4time = 0;
-       self.lerpfrac = 0;
-       self.lerpfrac3 = 0;
-       self.lerpfrac4 = 0;
-       skel_build(self.skeletonindex, self, animmodelindex, 0, 0, 100000);
-};
-// apply a different framegroup animation to bones with a specified parent
-void(float animmodelindex, float framegroup, float framegroupstarttime, float blendalpha, string groupbonename, string excludegroupname1, string excludegroupname2) example_skel_player_update_applyoverride =
-{
-       local float bonenum;
-       local float numbones;
-       self.frame = framegroup;
-       self.frame2 = 0;
-       self.frame3 = 0;
-       self.frame4 = 0;
-       self.frame1time = framegroupstarttime;
-       self.frame2time = 0;
-       self.frame3time = 0;
-       self.frame4time = 0;
-       self.lerpfrac = 0;
-       self.lerpfrac3 = 0;
-       self.lerpfrac4 = 0;
-       bonenum = 0;
-       numbones = skel_get_numbones(self.skeletonindex);
-       while (bonenum < numbones)
-       {
-               if (example_skel_findbonegroup(self.skeletonindex, bonenum, groupbonename, excludegroupname1, excludegroupname2, "", "", "") == 1)
-                       skel_build(self.skeletonindex, self, animmodelindex, 1 - blendalpha, bonenum, bonenum + 1);
-               bonenum = bonenum + 1;
-       }
-};
-// make eyes point at a target location, be sure v_forward, v_right, v_up are set correctly before calling
-void(vector eyetarget, string bonename) example_skel_player_update_eyetarget =
-{
-       local float bonenum;
-       local vector ang;
-       local vector oldforward, oldright, oldup;
-       local vector relforward, relright, relup, relorg;
-       local vector boneforward, boneright, boneup, boneorg;
-       local vector parentforward, parentright, parentup, parentorg;
-       local vector u, v;
-       local vector modeleyetarget;
-       bonenum = skel_find_bone(self.skeletonindex, bonename) - 1;
-       if (bonenum < 0)
-               return;
-       oldforward = v_forward;
-       oldright = v_right;
-       oldup = v_up;
-       v = eyetarget - self.origin;
-       modeleyetarget_x =   v * v_forward;
-       modeleyetarget_y = 0-v * v_right;
-       modeleyetarget_z =   v * v_up;
-       // this is an eyeball, make it point at the target location
-       // first get all the data we can...
-       relorg = skel_get_bonerel(self.skeletonindex, bonenum);
-       relforward = v_forward;
-       relright = v_right;
-       relup = v_up;
-       boneorg = skel_get_boneabs(self.skeletonindex, bonenum);
-       boneforward = v_forward;
-       boneright = v_right;
-       boneup = v_up;
-       parentorg = skel_get_boneabs(self.skeletonindex, skel_get_boneparent(self.skeletonindex, bonenum));
-       parentforward = v_forward;
-       parentright = v_right;
-       parentup = v_up;
-       // get the vector from the eyeball to the target
-       u = modeleyetarget - boneorg;
-       // now transform it inversely by the parent matrix to produce new rel vectors
-       v_x = u * parentforward;
-       v_y = u * parentright;
-       v_z = u * parentup;
-       ang = vectoangles2(v, relup);
-       ang_x = 0 - ang_x;
-       makevectors(ang);
-       // set the relative bone matrix
-       skel_set_bone(self.skeletonindex, bonenum, relorg);
-       // restore caller's v_ vectors
-       v_forward = oldforward;
-       v_right = oldright;
-       v_up = oldup;
-};
-// delete skeleton when we're done with it
-// note: skeleton remains valid until next frame when it is really deleted
-void() example_skel_player_delete =
-{
-       skel_delete(self.skeletonindex);
-       self.skeletonindex = 0;
-};
-//
-// END OF EXAMPLES FOR FTE_CSQC_SKELETONOBJECTS
-//
-
-//DP_QC_ENTITYDATA
-//idea: KrimZon
-//darkplaces implementation: KrimZon
-//builtin definitions:
-float() numentityfields = #496;
-string(float fieldnum) entityfieldname = #497;
-float(float fieldnum) entityfieldtype = #498;
-string(float fieldnum, entity ent) getentityfieldstring = #499;
-float(float fieldnum, entity ent, string s) putentityfieldstring = #500;
-//constants:
-//Returned by entityfieldtype
-float FIELD_STRING   = 1;
-float FIELD_FLOAT    = 2;
-float FIELD_VECTOR   = 3;
-float FIELD_ENTITY   = 4;
-float FIELD_FUNCTION = 6;
-//description:
-//Versatile functions intended for storing data from specific entities between level changes, but can be customized for some kind of partial savegame.
-//WARNING: .entity fields cannot be saved and restored between map loads as they will leave dangling pointers.
-//numentityfields returns the number of entity fields. NOT offsets. Vectors comprise 4 fields: v, v_x, v_y and v_z.
-//entityfieldname returns the name as a string, eg. "origin" or "classname" or whatever.
-//entityfieldtype returns a value that the constants represent, but the field may be of another type in more exotic progs.dat formats or compilers.
-//getentityfieldstring returns data as would be written to a savegame, eg... "0.05" (float), "0 0 1" (vector), or "Hello World!" (string). Function names can also be returned.
-//putentityfieldstring puts the data returned by getentityfieldstring back into the entity.
-
-//DP_QC_ENTITYSTRING
-void(string s) loadfromdata = #529;
-void(string s) loadfromfile = #530;
-void(string s) callfunction = #605;
-void(float fh, entity e) writetofile = #606;
-float(string s) isfunction = #607;
-void(entity e, string s) parseentitydata = #608;
-
-// assorted builtins
-const float            STAT_MOVEVARS_TICRATE           = 240;
-const float            STAT_MOVEVARS_TIMESCALE         = 241;
-const float            STAT_FRAGLIMIT                                  = 235;
-const float            STAT_TIMELIMIT                                  = 236;
-const float     STAT_MOVEVARS_GRAVITY           = 242;
-string(void)                                           ReadPicture = #501;
-float PARTICLES_USEALPHA = 1;
-float particles_alphamin, particles_alphamax;
-float PARTICLES_USECOLOR = 2;
-vector particles_colormin, particles_colormax;
-float PARTICLES_USEFADE = 4;  // fades the COUNT (fade alpha using alphamin/alphamax)
-float particles_fade;
-float PARTICLES_DRAWASTRAIL = 128;
-void(float effectindex, entity own, vector org_from, vector org_to, vector dir_from, vector dir_to, float countmultiplier, float flags) boxparticles = #502;
-float trace_networkentity;
-const float RF_FULLBRIGHT      = 256;
-const float RF_NOSHADOW        = 512;
-float RF_DYNAMICMODELLIGHT = 8192;
-
-float gettaginfo_parent;
-string gettaginfo_name;
-vector gettaginfo_offset;
-vector gettaginfo_forward;
-vector gettaginfo_right;
-vector gettaginfo_up;
-float checkpvs(vector viewpos, entity viewee) = #240;
diff --git a/qcsrc/dpdefs/csprogsdefs.qh b/qcsrc/dpdefs/csprogsdefs.qh
new file mode 100644 (file)
index 0000000..4effe64
--- /dev/null
@@ -0,0 +1,1459 @@
+#ifndef CSPROGSDEFS_H
+#define CSPROGSDEFS_H
+
+#pragma noref 1
+
+/*
+==============================================================================
+
+                       SOURCE FOR GLOBALVARS_T C STRUCTURE
+                       MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
+
+==============================================================================
+*/
+
+//
+// system globals
+//
+entity         self;
+entity         other;
+entity         world;
+float          time;
+float          frametime;
+
+int            player_localentnum;     //the entnum
+int            player_localnum;        //the playernum
+float          maxclients;     //a constant filled in by the engine. gah, portability eh?
+
+float          clientcommandframe;     //player movement
+float          servercommandframe;     //clientframe echoed off the server
+
+string         mapname;
+
+//
+// global variables set by built in functions
+//
+vector         v_forward, v_up, v_right;       // set by makevectors()
+
+// set by traceline / tracebox
+float          trace_allsolid;
+float          trace_startsolid;
+float          trace_fraction;
+vector         trace_endpos;
+vector         trace_plane_normal;
+float          trace_plane_dist;
+entity         trace_ent;
+float          trace_inopen;
+float          trace_inwater;
+
+//
+// required prog functions
+//
+void()         CSQC_Init;
+void()         CSQC_Shutdown;
+float(float f, float t, float n)       CSQC_InputEvent;
+void(float w, float h)         CSQC_UpdateView;
+bool(string s) CSQC_ConsoleCommand;
+
+//these fields are read and set by the default player physics
+vector         pmove_org;
+vector         pmove_vel;
+vector         pmove_mins;
+vector         pmove_maxs;
+//retrieved from the current movement commands (read by player physics)
+float          input_timelength;
+vector         input_angles;
+vector         input_movevalues;       //forwards, right, up.
+int                    input_buttons;          //attack, use, jump (default physics only uses jump)
+
+float          movevar_gravity;
+float          movevar_stopspeed;
+float          movevar_maxspeed;
+float          movevar_spectatormaxspeed;      //used by NOCLIP movetypes.
+float          movevar_accelerate;
+float          movevar_airaccelerate;
+float          movevar_wateraccelerate;
+float          movevar_friction;
+float          movevar_waterfriction;
+float          movevar_entgravity;     //the local player's gravity field. Is a multiple (1 is the normal value)
+
+//================================================
+void           end_sys_globals;                // flag for structure dumping
+//================================================
+
+/*
+==============================================================================
+
+                       SOURCE FOR ENTVARS_T C STRUCTURE
+                       MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
+
+==============================================================================
+*/
+
+//
+// system fields (*** = do not set in prog code, maintained by C code)
+//
+.int           modelindex;             // *** model index in the precached list
+.vector                absmin, absmax; // *** origin + mins / maxs
+
+.int           entnum; // *** the ent number as on the server
+.float         drawmask;
+.void()                predraw;
+
+.float         movetype;
+.float         solid;
+
+.vector                origin;                 // ***
+.vector                oldorigin;              // ***
+.vector                velocity;
+.vector                angles;
+.vector                avelocity;
+
+.string                classname;              // spawn function
+.string                model;
+.int           frame;
+.int           skin;
+.int           effects;
+
+.vector                mins, maxs;             // bounding box extents reletive to origin
+.vector                size;                   // maxs - mins
+
+.void()                touch;
+.void()                use;
+.void()                think;
+.void()                blocked;                // for doors or plats, called when can't push other
+
+.float         nextthink;
+
+.entity                chain;
+
+.string                netname;
+
+.entity        enemy;
+
+.int           flags;
+
+.int           colormap;
+
+.entity                owner;          // who launched a missile
+
+//================================================
+void           end_sys_fields;                 // flag for structure dumping
+//================================================
+
+/*
+==============================================================================
+
+                       OPTIONAL FIELDS AND GLOBALS
+
+==============================================================================
+*/
+
+// Additional OPTIONAL Fields and Globals
+float          intermission; // indicates intermission state (0 = normal, 1 = scores, 2 = finale text)
+
+vector         view_angles; // same as input_angles
+vector         view_punchangle; // from server
+vector         view_punchvector; // from server
+
+/*
+==============================================================================
+
+                       CONSTANT DEFINITIONS
+
+==============================================================================
+*/
+
+const int MASK_ENGINE                  = 1;
+const int MASK_ENGINEVIEWMODELS        = 2;
+const int MASK_NORMAL                  = 4;
+
+const int RF_VIEWMODEL                 = 1;
+const int RF_EXTERNALMODEL             = 2;
+const int RF_DEPTHHACK                 = 4;
+const int RF_ADDITIVE                  = 8;
+const int RF_USEAXIS                   = 16;
+
+const int VF_MIN                               = 1;    //(vector)
+const int VF_MIN_X                             = 2;    //(float)
+const int VF_MIN_Y                             = 3;    //(float)
+const int VF_SIZE                              = 4;    //(vector) (viewport size)
+const int VF_SIZE_Y                            = 5;    //(float)
+const int VF_SIZE_X                            = 6;    //(float)
+const int VF_VIEWPORT                  = 7;    //(vector, vector)
+const int VF_FOV                               = 8;    //(vector)
+const int VF_FOVX                              = 9;    //(float)
+const int VF_FOVY                              = 10;   //(float)
+const int VF_ORIGIN                            = 11;   //(vector)
+const int VF_ORIGIN_X                  = 12;   //(float)
+const int VF_ORIGIN_Y                  = 13;   //(float)
+const int VF_ORIGIN_Z                  = 14;   //(float)
+const int VF_ANGLES                            = 15;   //(vector)
+const int VF_ANGLES_X                  = 16;   //(float)
+const int VF_ANGLES_Y                  = 17;   //(float)
+const int VF_ANGLES_Z                  = 18;   //(float)
+const int VF_DRAWWORLD                 = 19;   //(float)
+const int VF_DRAWENGINESBAR            = 20;   //(float)
+const int VF_DRAWCROSSHAIR             = 21;   //(float)
+
+const int VF_CL_VIEWANGLES             = 33;   //(vector)
+const int VF_CL_VIEWANGLES_X   = 34;   //(float)
+const int VF_CL_VIEWANGLES_Y   = 35;   //(float)
+const int VF_CL_VIEWANGLES_Z   = 36;   //(float)
+
+const int VF_PERSPECTIVE       = 200;
+
+//const int STAT_HEALTH                        = 0;
+//const int STAT_WEAPONMODEL   = 2;
+//const int STAT_AMMO                  = 3;
+//const int STAT_ARMOR                 = 4;
+//const int STAT_WEAPONFRAME   = 5;
+//const int STAT_SHELLS                        = 6;
+//const int STAT_NAILS                 = 7;
+//const int STAT_ROCKETS               = 8;
+//const int STAT_CELLS                 = 9;
+//const int STAT_ACTIVEWEAPON  = 10;
+//const int STAT_TOTALSECRETS  = 11;
+//const int STAT_TOTALMONSTERS = 12;
+//const int STAT_SECRETS               = 13;
+//const int STAT_MONSTERS              = 14;
+//const int STAT_ITEMS                 = 15;
+//const int STAT_VIEWHEIGHT            = 16;
+
+// Quake Sound Constants
+const int CHAN_AUTO                            = 0;
+const int CHAN_WEAPON                  = 1;
+const int CHAN_VOICE                   = 2;
+const int CHAN_ITEM                            = 3;
+const int CHAN_BODY                            = 4;
+
+const int ATTN_NONE                            = 0;
+const int ATTN_NORM                            = 1;
+const int ATTN_IDLE                            = 2;
+const int ATTN_STATIC                  = 3;
+
+// Frik File Constants
+const int FILE_READ                            = 0;
+const int FILE_APPEND                  = 1;
+const int FILE_WRITE                   = 2;
+
+// Quake Point Contents
+const int CONTENT_EMPTY                        = -1;
+const int CONTENT_SOLID                        = -2;
+const int CONTENT_WATER                        = -3;
+const int CONTENT_SLIME                        = -4;
+const int CONTENT_LAVA                 = -5;
+const int CONTENT_SKY                  = -6;
+
+// Quake Solid Constants
+const int SOLID_NOT                            = 0;
+const int SOLID_TRIGGER                        = 1;
+const int SOLID_BBOX                   = 2;
+const int SOLID_SLIDEBOX               = 3;
+const int SOLID_BSP                            = 4;
+const int SOLID_CORPSE                 = 5;
+
+// Quake Move Constants
+const int MOVE_NORMAL                  = 0;
+const int MOVE_NOMONSTERS              = 1;
+const int MOVE_MISSILE                 = 2;
+
+const float EXTRA_LOW                  = -99999999;
+const float EXTRA_HIGH                 = 99999999;
+
+const vector VEC_1                             = '1 1 1';
+const vector VEC_0                             = '0 0 0';
+const vector VEC_M1                            = '-1 -1 -1';
+
+//const float M_PI                             = 3.14159265358979323846;
+
+vector VEC_HULL_MIN                            = '-16 -16 -24';
+vector VEC_HULL_MAX                            = '16 16 32';
+
+// Quake Temporary Entity Constants
+const int TE_SPIKE                             = 0;
+const int TE_SUPERSPIKE                        = 1;
+const int TE_GUNSHOT                   = 2;
+const int TE_EXPLOSION                 = 3;
+const int TE_TAREXPLOSION              = 4;
+const int TE_LIGHTNING1                        = 5;
+const int TE_LIGHTNING2                        = 6;
+const int TE_WIZSPIKE                  = 7;
+const int TE_KNIGHTSPIKE               = 8;
+const int TE_LIGHTNING3                        = 9;
+const int TE_LAVASPLASH                        = 10;
+const int TE_TELEPORT                  = 11;
+const int TE_EXPLOSION2                        = 12;
+
+// Darkplaces Additions
+const int TE_EXPLOSIONRGB              = 53;
+const int TE_GUNSHOTQUAD               = 57;
+const int TE_EXPLOSIONQUAD             = 70;
+const int TE_SPIKEQUAD                 = 58;
+const int TE_SUPERSPIKEQUAD            = 59;
+
+// PFlags for Dynamic Lights
+const int PFLAGS_NOSHADOW              = 1;
+const int PFLAGS_CORONA                        = 2;
+const int PFLAGS_FULLDYNAMIC   = 128;
+
+const int EF_ADDITIVE                  = 32;
+const int EF_BLUE                              = 64;
+const int EF_FLAME                             = 1024;
+const int EF_FULLBRIGHT                        = 512;
+const int EF_NODEPTHTEST               = 8192;
+const int EF_NODRAW                            = 16;
+const int EF_NOSHADOW                  = 4096;
+const int EF_RED                               = 128;
+const int EF_STARDUST                  = 2048;
+const int EF_SELECTABLE                = 16384;
+
+const int PFL_ONGROUND                 = 1;
+const int PFL_CROUCH                   = 2;
+const int PFL_DEAD                             = 4;
+const int PFL_GIBBED                   = 8;
+
+// draw flags
+const int DRAWFLAG_NORMAL              = 0;
+const int DRAWFLAG_ADDITIVE    = 1;
+const int DRAWFLAG_MODULATE    = 2;
+const int DRAWFLAG_2XMODULATE  = 3;
+const int DRAWFLAG_SCREEN              = 4;
+const int DRAWFLAG_MIPMAP              = 0x100; // only for R_BeginPolygon
+
+/*
+==============================================================================
+
+                       BUILTIN DEFINITIONS
+                       EXTENSIONS ARE NOT ADDED HERE, BUT BELOW!
+
+==============================================================================
+*/
+
+void(vector ang) makevectors = #1;
+void(entity e, vector o) setorigin = #2;
+void(entity e, string m) setmodel = #3;
+void(entity e, vector min, vector max) setsize = #4;
+
+void() break_to_debugger = #6;
+float() random = #7;
+void(entity e, float chan, string samp) sound = #8;
+vector(vector v) normalize = #9;
+void(string e) error = #10;
+void(string e) objerror = #11;
+float(vector v) vlen = #12;
+float(vector v) vectoyaw = #13;
+entity() spawn = #14;
+void(entity e) remove = #15;
+float(vector v1, vector v2, float tryents, entity ignoreentity) traceline = #16;
+
+entity(entity start, .string fld, string match) find = #18;
+void(string s) precache_sound = #19;
+void(string s) precache_model = #20;
+
+entity(vector org, float rad) findradius = #22;
+
+void(string s, ...) dprint = #25;
+string(float f) ftos = #26;
+string(vector v) vtos = #27;
+void() coredump = #28;
+void() traceon = #29;
+void() traceoff = #30;
+void(entity e) eprint = #31;
+// settrace optional
+float(float yaw, float dist, float settrace) walkmove = #32;
+
+float() droptofloor = #34;
+void(float style, string value) lightstyle = #35;
+int(float v) rint      = #36;
+int(float v) floor     = #37;
+int(float v) ceil      = #38;
+
+float(entity e) checkbottom = #40;
+float(vector v) pointcontents = #41;
+
+float(float f) fabs = #43;
+
+float(string s) cvar = #45;
+void(string s, ...) localcmd = #46;
+entity(entity e) nextent = #47;
+void(vector o, vector d, float color, float count) particle = #48;
+void() ChangeYaw = #49;
+
+vector(vector v) vectoangles = #51;
+vector(vector v, vector w) vectoangles2 = #51;
+
+float(float f) sin = #60;
+float(float f) cos = #61;
+float(float f) sqrt = #62;
+void(entity ent) changepitch = #63;
+void(entity e, entity ignore) tracetoss = #64;
+string(entity ent) etos = #65;
+
+string(string s) precache_file = #68;
+void(entity e) makestatic = #69;
+
+void(string name, string value) cvar_set = #72;
+
+void(vector pos, string samp, float vol, float atten) ambientsound = #74;
+string(string s) precache_model2 = #75;
+string(string s) precache_sound2 = #76;
+string(string s) precache_file2 = #77;
+
+float(string s) stof = #81;
+
+
+void(vector v1, vector min, vector max, vector v2, float nomonsters, entity forent) tracebox = #90;
+vector() randomvec = #91;
+vector(vector org) getlight = #92;
+vector(vector org, float lpflags) getlight2 = #92;
+vector getlight_dir;
+vector getlight_ambient;
+vector getlight_diffuse;
+const float LP_LIGHTMAP        = 1;
+const float LP_RTWORLD = 2;
+const float LP_DYNLIGHT = 4;
+const float LP_COMPLETE = 7;
+
+float(string name, string value) registercvar = #93;
+float( float a, ... ) min = #94;
+float( float b, ... ) max = #95;
+float(float minimum, float val, float maximum) bound = #96;
+float(float f, float f) pow = #97;
+entity(entity start, .float fld, float match) findfloat = #98;
+float(string s) checkextension = #99;
+// FrikaC and Telejano range #100-#199
+
+int(string filename, int mode) fopen = #110;
+void(float fhandle) fclose = #111;
+string(float fhandle) fgets = #112;
+void(float fhandle, string s) fputs = #113;
+float(string s) strlen = #114;
+string(...) strcat = #115;
+string(string s, float start, float length) substring = #116;
+vector(string) stov = #117;
+string(string s) strzone = #118;
+void(string s) strunzone = #119;
+
+// FTEQW range #200-#299
+
+float(float number, float quantity) bitshift = #218;
+
+//float(string str, string sub[, float startpos]) strstrofs = #221;
+int(string str, string sub, float startpos) strstrofs = #221;
+int(string str, float ofs) str2chr = #222;
+string(int c, ...) chr2str = #223;
+string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
+string(float chars, string s, ...) strpad = #225;
+string(string info, string key, string value, ...) infoadd = #226;
+string(string info, string key) infoget = #227;
+int(string s1, string s2) strcmp = #228;
+int(string s1, string s2, float len) strncmp = #228;
+int(string s1, string s2) strcasecmp = #229;
+int(string s1, string s2, float len) strncasecmp = #230;
+
+// CSQC range #300-#399
+void() clearscene = #300;
+void(float mask) addentities = #301;
+void(entity ent) addentity = #302;
+float(float property, ...) setproperty = #303;
+float(float property) getproperty = #309;
+vector(float property) getpropertyvec = #309;
+void() renderscene = #304;
+void(vector org, float radius, vector lightcolours) adddynamiclight = #305;
+void(vector org, float radius, vector lightcolours, float style, string cubemapname, float pflags) adddynamiclight2 = #305;
+//void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon = #306;
+void(string texturename, float flag, ...) R_BeginPolygon = #306;
+void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex = #307;
+void() R_EndPolygon = #308;
+vector (vector v) cs_unproject = #310;
+vector (vector v) cs_project = #311;
+
+void(float width, vector pos1, vector pos2, float flag) drawline = #315;
+float(string name) iscachedpic = #316;
+string(string name, ...) precache_pic = #317;
+string(string name) precache_cubemap = #317;
+vector(string picname) draw_getimagesize = #318;
+void(string name) freepic = #319;
+float(vector position, float character, vector scale, vector rgb, float alpha, float flag) drawcharacter = #320;
+float(vector position, string text, vector scale, vector rgb, float alpha, float flag) drawstring = #321;
+float(vector position, string pic, vector size, vector rgb, float alpha, float flag) drawpic = #322;
+float(vector position, vector size, vector rgb, float alpha, float flag) drawfill = #323;
+void(float x, float y, float width, float height) drawsetcliparea = #324;
+void(void) drawresetcliparea = #325;
+float(vector position, string text, vector scale, float alpha, float flag) drawcolorcodedstring = #326;
+vector(vector position, string text, vector scale, vector rgb, float alpha, float flag) drawcolorcodedstring2 = #326;
+
+float(int stnum) getstatf = #330;
+int(int stnum, ...) getstati = #331; // can optionally take first bit and count
+string(float firststnum) getstats = #332;
+void(entity e, float mdlindex) setmodelindex = #333;
+string(float mdlindex) modelnameforindex = #334;
+int(string effectname) particleeffectnum = #335;
+void(entity ent, float effectnum, vector start, vector end) trailparticles = #336;
+//void(float effectnum, vector origin [, vector dir, float count]) pointparticles = #337;
+void(float effectnum, vector origin , vector dir, float count) pointparticles = #337;
+void(string s, ...) centerprint = #338;
+void(string s, ...) print = #339;
+string(float keynum) keynumtostring = #340;
+float(string keyname) stringtokeynum = #341;
+string(float keynum) getkeybind = #342;
+void(float usecursor) setcursormode = #343;
+vector() getmousepos = #344;
+float(float framenum) getinputstate = #345;
+void(float sens) setsensitivityscale = #346;
+void(...) runstandardplayerphysics = #347; // this may or may not take a player ent
+string(float playernum, string keyname) getplayerkeyvalue = #348;
+float() isdemo = #349;
+float() isserver = #350;
+void(vector origin, vector forward, vector right, vector up) SetListener = #351;
+void(string cmdname) registercommand = #352;
+float(entity ent) wasfreed = #353;
+string(string key) serverkey = #354;
+
+// Use proper case; refer to the id1 Write* functions!
+int() ReadByte         = #360;
+int() ReadChar         = #361;
+int() ReadShort                = #362;
+int() ReadLong         = #363;
+float() ReadCoord      = #364;
+float() ReadAngle      = #365;
+string() ReadString    = #366;
+float() ReadFloat      = #367;
+
+// LordHavoc's range #400-#499
+void(entity from, entity to) copyentity = #400;
+
+entity(.string fld, string match) findchain = #402;
+entity(.float fld, float match) findchainfloat = #403;
+void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404;
+void(vector org, vector velocity, float howmany) te_blood = #405;
+void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406;
+void(vector org, vector color) te_explosionrgb = #407;
+void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408;
+void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409;
+void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410;
+void(vector org, vector vel, float howmany) te_spark = #411;
+void(vector org) te_gunshotquad = #412;
+void(vector org) te_spikequad = #413;
+void(vector org) te_superspikequad = #414;
+void(vector org) te_explosionquad = #415;
+void(vector org) te_smallflash = #416;
+void(vector org, float radius, float lifetime, vector color) te_customflash = #417;
+void(vector org) te_gunshot = #418;
+void(vector org) te_spike = #419;
+void(vector org) te_superspike = #420;
+void(vector org) te_explosion = #421;
+void(vector org) te_tarexplosion = #422;
+void(vector org) te_wizspike = #423;
+void(vector org) te_knightspike = #424;
+void(vector org) te_lavasplash = #425;
+void(vector org) te_teleport = #426;
+void(vector org, float colorstart, float colorlength) te_explosion2 = #427;
+void(entity own, vector start, vector end) te_lightning1 = #428;
+void(entity own, vector start, vector end) te_lightning2 = #429;
+void(entity own, vector start, vector end) te_lightning3 = #430;
+void(entity own, vector start, vector end) te_beam = #431;
+void(vector dir) vectorvectors = #432;
+void(vector org) te_plasmaburn = #433;
+//float(entity e, float s) getsurfacenumpoints = #434;
+//vector(entity e, float s, float n) getsurfacepoint = #435;
+//vector(entity e, float s) getsurfacenormal = #436;
+//string(entity e, float s) getsurfacetexture = #437;
+//float(entity e, vector p) getsurfacenearpoint = #438;
+//vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
+
+int(string s) tokenize = #441;
+string(float n) argv = #442;
+void(entity e, entity tagentity, string tagname) setattachment = #443;
+float(string pattern, float caseinsensitive, float quiet) search_begin = #444;
+void(float handle) search_end = #445;
+float(float handle) search_getsize = #446;
+string(float handle, float num) search_getfilename = #447;
+string(string s) cvar_string = #448;
+entity(entity start, .float fld, float match) findflags = #449;
+entity(.float fld, float match) findchainflags = #450;
+int(entity ent, string tagname) gettagindex = #451;
+vector(entity ent, float tagindex) gettaginfo = #452;
+
+void(vector org, vector vel, float howmany) te_flamejet = #457;
+
+entity(float num) entitybyindex = #459;
+int() buf_create = #460;
+void(float bufhandle) buf_del = #461;
+float(float bufhandle) buf_getsize = #462;
+void(float bufhandle_from, float bufhandle_to) buf_copy = #463;
+void(float bufhandle, float sortpower, float backward) buf_sort = #464;
+string(float bufhandle, string glue) buf_implode = #465;
+string(float bufhandle, float string_index) bufstr_get = #466;
+void(float bufhandle, float string_index, string str) bufstr_set = #467;
+float(float bufhandle, string str, float order) bufstr_add = #468;
+void(float bufhandle, float string_index) bufstr_free = #469;
+
+//float(float s) asin = #471;
+//float(float c) acos = #472;
+//float(float t) atan = #473;
+//float(float c, float s) atan2 = #474;
+//float(float a) tan = #475;
+float(string s) strippedstringlen = #476;
+float(string s) strlennocol = #476; // This is the correct name for the function, but not removing the decolorizedstring mapping.
+string(string s) decolorizedstring = #477;
+string(string s) strdecolorize = #477; // This is the correct name for the function, but not removing the decolorizedstring mapping.
+string(float uselocaltime, string format, ...) strftime = #478;
+string(string s) strtolower = #480;
+string(string s) strtoupper = #481;
+string(string s) cvar_defstring = #482;
+void(vector origin, string sample, float volume, float attenuation) pointsound = #483;
+string(string search, string replace, string subject) strreplace = #484;
+string(string search, string replace, string subject) strireplace = #485;
+//vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
+#ifdef SUPPORT_GECKO
+float gecko_create( string name ) = #487;
+void gecko_destroy( string name ) = #488;
+void gecko_navigate( string name, string URI ) = #489;
+float gecko_keyevent( string name, float key, float eventtype ) = #490;
+void gecko_mousemove( string name, float x, float y ) = #491;
+void gecko_resize( string name, float w, float h ) = #492;
+vector gecko_get_texture_extent( string name ) = #493;
+#else
+
+#endif
+
+/*
+==============================================================================
+
+                       EXTENSION DEFINITIONS
+
+==============================================================================
+*/
+
+// DP_CSQC_SPAWNPARTICLE
+// idea: VorteX
+// darkplaces implementation: VorteX
+// constant definitions:
+// particle base behavior:
+float PT_ALPHASTATIC = 1;
+float PT_STATIC = 2;
+float PT_SPARK = 3;
+float PT_BEAM = 4;
+float PT_RAIN = 5;
+float PT_RAINDECAL = 6;
+float PT_SNOW = 7;
+float PT_BUBBLE = 8;
+float PT_BLOOD = 9;
+float PT_SMOKE = 10;
+float PT_DECAL = 11;
+float PT_ENTITYPARTICLE = 12;
+// particle blendtypes:
+float PBLEND_ALPHA = 0;
+float PBLEND_ADD = 1;
+float PBLEND_INVMOD = 2;
+// particle orientation:
+float PARTICLE_BILLBOARD = 0;
+float PARTICLE_SPARK = 1;
+float PARTICLE_ORIENTED_DOUBLESIDED = 2;
+float PARTICLE_BEAM = 3;
+// global definitions:
+float particle_type; // one of PT_
+float particle_blendmode; // one of PBLEND_ values
+float particle_orientation; // one of PARTICLE_ values
+vector particle_color1;
+vector particle_color2;
+float particle_tex; // number of chunk in particlefont
+float particle_size;
+float particle_sizeincrease;
+float particle_alpha;
+float particle_alphafade;
+float particle_time;
+float particle_gravity;
+float particle_bounce;
+float particle_airfriction;
+float particle_liquidfriction;
+float particle_originjitter;
+float particle_velocityjitter;
+float particle_qualityreduction; // enable culling of this particle when FPS is low
+float particle_stretch;
+vector particle_staincolor1;
+vector particle_staincolor2;
+float particle_staintex;
+float particle_stainalpha;
+float particle_stainsize;
+float particle_delayspawn;
+float particle_delaycollision;
+float particle_angle;
+float particle_spin;
+// builtin definitions:
+float(float max_themes) initparticlespawner = #522; // check fields/globals for integration and enable particle spawner, return 1 is succeded, otherwise returns 0
+void() resetparticle = #523; // reset p_ globals to default theme #0
+void(float theme) particletheme = #524; // restore p_ globals from saved theme
+float() particlethemesave = #525; // save p_ globals to new particletheme and return it's index
+void(float theme) particlethemeupdate = #525; // save p_ globals to new particletheme and return it's index
+void(float theme) particlethemefree = #526; // delete a particle theme
+float(vector org, vector vel) spawnparticle = #527; // returns 0 when failed, 1 when spawned
+float(vector org, vector vel, float theme) quickparticle = #527; // not reading globals, just theme, returns 0 when failed, 1 when spawned
+float(vector org, vector vel, float delay, float collisiondelay) delayedparticle = #528;
+float(vector org, vector vel, float delay, float collisiondelay, float theme) quickdelayedparticle = #528;
+// description: this builtin provides an easy and flexible way to spawn particles,
+// it is not created as replace for DP_SV_POINTPARTICLES but as an addition to it.
+// With this extension you can create a specific particles like rain particles, or entity particles
+// notes:
+// 1) 0 is default particle template, it could be changed
+// 2) color vectors could have value 0-255 of each component
+// restrictions: max themes could be between 4 and 2048
+// warning: you should call initparticlespawner() at very beginning BEFORE all other particle spawner functions
+// function to query particle info
+// don't remove this function as it protects all particle_ globals from FTEQCC/FRIKQCC non-referenced removal optimisation
+void() printparticle =
+{
+       // vortex: this also protects from 'non-referenced' optimisation on some compilers
+       print("PARTICLE:\n");
+       print(strcat("  type: ", ftos(particle_type), "\n"));
+       print(strcat("  blendmode: ", ftos(particle_blendmode), "\n"));
+       print(strcat("  orientation: ", ftos(particle_orientation), "\n"));
+       print(strcat("  color1: ", vtos(particle_color1), "\n"));
+       print(strcat("  color2: ", vtos(particle_color2), "\n"));
+       print(strcat("  tex: ", ftos(particle_tex), "\n"));
+       print(strcat("  size: ", ftos(particle_size), "\n"));
+       print(strcat("  sizeincrease: ", ftos(particle_sizeincrease), "\n"));
+       print(strcat("  alpha: ", ftos(particle_alpha), "\n"));
+       print(strcat("  alphafade: ", ftos(particle_alphafade), "\n"));
+       print(strcat("  time: ", ftos(particle_time), "\n"));
+       print(strcat("  gravity: ", ftos(particle_gravity), "\n"));
+       print(strcat("  bounce: ", ftos(particle_bounce), "\n"));
+       print(strcat("  airfriction: ", ftos(particle_airfriction), "\n"));
+       print(strcat("  liquidfriction: ", ftos(particle_liquidfriction), "\n"));
+       print(strcat("  originjitter: ", ftos(particle_originjitter), "\n"));
+       print(strcat("  velocityjitter: ", ftos(particle_velocityjitter), "\n"));
+       print(strcat("  qualityreduction: ", ftos(particle_qualityreduction), "\n"));
+       print(strcat("  stretch: ", ftos(particle_stretch), "\n"));
+       print(strcat("  staincolor1: ", vtos(particle_staincolor1), "\n"));
+       print(strcat("  staincolor2: ", vtos(particle_staincolor2), "\n"));
+       print(strcat("  staintex: ", ftos(particle_staintex), "\n"));
+       print(strcat("  stainalpha: ", ftos(particle_stainalpha), "\n"));
+       print(strcat("  stainsize: ", ftos(particle_stainsize), "\n"));
+       print(strcat("  delayspawn: ", ftos(particle_delayspawn), "\n"));
+       print(strcat("  delaycollision: ", ftos(particle_delaycollision), "\n"));
+       print(strcat("  angle: ", ftos(particle_angle), "\n"));
+       print(strcat("  spin: ", ftos(particle_spin), "\n"));
+}
+
+// DP_CSQC_ENTITYTRANSPARENTSORTING_OFFSET
+// idea: VorteX
+// darkplaces implementation: VorteX
+float RF_USETRANSPARENTOFFSET = 64; // enables transparent origin offsetting
+// global definitions
+float transparent_offset; // should be set before entity is added
+// description: offset a model's meshes origin used for transparent sorting. Could be used to tweak sorting bugs on very large transparent entities or hacking transparent sorting order for certain objects
+// example: transparent_offset = 1000000; // entity always appear on background of other transparents
+// note: offset is done in view forward axis
+
+// DP_CSQC_ENTITYWORLDOBJECT
+// idea: VorteX
+// darkplaces implementation: VorteX
+const float RF_WORLDOBJECT = 128;
+// description: when renderflag is set, engine will not use culling methods for this entity, e.g. it will always be drawn
+// useful for large outdoor objects (like asteroids on sky horizon or sky models)
+
+// DP_CSQC_ENTITYMODELLIGHT
+// idea: VorteX
+// darkplaces implementation: VorteX
+const float RF_MODELLIGHT = 4096;
+.vector modellight_ambient;
+.vector modellight_diffuse;
+.vector modellight_dir;
+// description: allows CSQC to override directional model lightning on entity
+
+// DP_CSQC_SETPAUSE
+// idea: VorteX
+// darkplaces implementation: VorteX
+// builtin definitions:
+void(float ispaused) setpause = #531;
+// description: provides ability to set pause in local games (similar to one set once console is activated)
+// not stopping sound/cd track, useful for inventory screens, ingame menus with input etc.
+
+// DP_CSQC_QUERYRENDERENTITY
+// idea: VorteX
+// darkplaces implementation: VorteX
+// constant definitions:
+// render entity fields:
+float E_ACTIVE             = 0; // float 0/1
+float E_ORIGIN      = 1; // vector
+float E_FORWARD     = 2; // vector
+float E_RIGHT       = 3; // vector
+float E_UP          = 4; // vector
+float E_SCALE       = 5; // float
+float E_ORIGINANDVECTORS = 6; // returns origin, + sets v_* vectors to orientation
+float E_ALPHA       = 7; // float
+float E_COLORMOD    = 8; // vector
+float E_PANTSCOLOR  = 9; // vector
+float E_SHIRTCOLOR  = 10; // vector
+float E_SKIN        = 11; // float
+float E_MINS        = 12; // vector
+float E_MAXS        = 13; // vector
+float E_ABSMIN      = 14; // vector
+float E_ABSMAX      = 15; // vector
+float E_LIGHT       = 16; // vector - modellight
+// builtin definitions:
+float(float entitynum, float fldnum) getentity = #504;
+vector(float entitynum, float fldnum) getentityvec = #504;
+// description: allows to query parms from render entities, especially useful with attaching CSQC ents to
+// server entities networked and interpolated by engine (monsters, players), number of entity is it's SVQC number
+// you can send it via tempentity/CSQC entity message. Note that this builtin doesnt know about entity removing/reallocating
+// so it's meaning to work for short period of time, dont use it on missiles/grenades whatever will be removed next five seconds
+
+//DP_GFX_FONTS
+//idea: Blub\0, divVerent
+//darkplaces implementation: Blub\0
+//console commands:
+//  loadfont fontname fontmaps size1 size2 ...
+//   A font can simply be gfx/tgafile (freetype fonts doent need extension),
+//   or alternatively you can specify multiple fonts and faces
+//   Like this: gfx/vera-sans:2,gfx/fallback:1
+//   to load face 2 of the font gfx/vera-sans and use face 1
+//   of gfx/fallback as fallback font
+//   You can also specify a list of font sizes to load, like this:
+//   loadfont console gfx/conchars,gfx/fallback 8 12 16 24 32
+//   In many cases, 8 12 16 24 32 should be a good choice.
+//   for slots see:
+//constant definitions:
+float drawfont;            // set it before drawstring()/drawchar() calls
+float FONT_DEFAULT = 0;    // 'default'
+float FONT_CONSOLE = 1;    // 'console', REALLY should be fixed width (ls!)
+float FONT_SBAR = 2;       // 'sbar', used on hud, must be fixed width
+float FONT_NOTIFY = 3;     // 'notify', used on sprint/bprint
+float FONT_CHAT = 4;       // 'chat'
+float FONT_CENTERPRINT = 5;// 'centerprint'
+float FONT_INFOBAR = 6;    // 'infobar'
+float FONT_MENU = 7;       // 'menu', should be fixed width
+float FONT_USER0 = 8;      // 'user0', userdefined fonts
+float FONT_USER1 = 9;      // 'user1', userdefined fonts
+float FONT_USER2 = 10;     // 'user2', userdefined fonts
+float FONT_USER3 = 11;     // 'user3', userdefined fonts
+float FONT_USER4 = 12;     // 'user4', userdefined fonts
+float FONT_USER5 = 13;     // 'user5', userdefined fonts
+float FONT_USER6 = 14;     // 'user6', userdefined fonts
+float FONT_USER7 = 15;     // 'user7' slot, userdefined fonts
+//builtin definitions:
+float findfont(string s) = #356; // find font by fontname and return it's index
+float loadfont(string fontname, string fontmaps, string sizes, float slot, float fix_scale, float fix_voffset) = #357;
+// loads font immediately so stringwidth() function can be used just after builtin call
+// returns a font slotnum (which is used to set drawfont to)
+// first 3 parms are identical to "loadfont" console command ones
+// slot could be one of FONT_ constants or result of findfont() or -1 to not use it
+// if slot is given, font will be loaded to this slotnum and fontname become new title for it
+// this way you can rename user* fonts to something more usable
+// fix_* parms let you fix badly made fonts by applying some transformations to them
+// fix_scale : per-character center-oriented scale (doesn't change line height at all)
+// fix_voffset : vertical offset for each character, it's a multiplier to character height
+float stringwidth(string text, float allowColorCodes, vector size) = #327; // get a width of string with given font and char size
+float stringwidth_menu(string text, float allowColorCodes, vector size) = #468; // in menu.dat it has different builtin #
+//description: engine support for custom fonts in console, hud, qc etc.
+// limits:
+//  max 128 chars for font name
+//  max 3 font fallbacks
+//  max 8 sizes per font
+
+//DP_GFX_FONTS_FREETYPE
+//idea: Blub\0, divVerent
+//darkplaces implementation: Blub\0
+//cvar definitions:
+//   r_font_disable_freetype 0/1 : disable freetype fonts loading (uttetly disables freetype library initialization)
+//   r_font_antialias 0/1 : antialiasing when loading font
+//   r_font_hint 0/1/2/3  : hinting when loading font, 0 is no hinting, 1 light autohinting , 2 full autohinting, 3 full hinting
+//   r_font_postprocess_blur X      : font outline blur amount
+//   r_font_postprocess_outline X   : font outline width
+//   r_font_postprocess_shadow_x X  : font outline shadow x shift amount, applied during outlining
+//   r_font_postprocess_shadow_y X  : font outline shadow y shift amount, applied during outlining
+//   r_font_postprocess_shadow_z X  : font outline shadow z shift amount, applied during blurring
+//description: engine support for truetype/freetype fonts
+//so .AFM+.PFB/.OTF/.TTF files could be stuffed as fontmaps in loadfont()
+//(console command version will support them as well)
+
+//DP_CSQC_BINDMAPS
+//idea: daemon, motorsep
+//darkplaces implementation: divVerent
+//builtin definitions:
+string(float key, float bindmap) getkeybind_bindmap = #342;
+float(float key, string bind, float bindmap) setkeybind_bindmap = #630;
+vector(void) getbindmaps = #631;
+float(vector bm) setbindmaps = #632;
+string(string command, float bindmap) findkeysforcommand = #610;
+//<already in EXT_CSQC> float(string key) stringtokeynum = #341;
+//<already in EXT_CSQC> string(float keynum) keynumtostring = #340;
+//description: key bind setting/getting including support for switchable
+//bindmaps.
+
+//DP_CRYPTO
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions: (CSQC)
+float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513;
+//description:
+//use -1 as buffer handle to justs end delim as postdata
+
+//DP_CSQC_MAINVIEW
+//idea: divVerent
+//darkplaces implementation: divVerent
+//constant definitions:
+const int VF_MAINVIEW         = 400;
+//use setproperty(VF_MAINVIEW, 1); before calling R_RenderView for the render
+//that shall become the "main" view, which is e.g. used by PRYDON_CLIENTCURSOR
+//this flag is set for the first scene, and not cleared by R_ClearScene
+//this flag is automatically cleared by R_RenderView
+//so when not using this extension, the first view rendered is the main view
+
+//DP_CSQC_MINFPS_QUALITY
+//idea: divVerent
+//darkplaces implementation: divVerent
+//constant definitions:
+const int VF_MINFPS_QUALITY   = 401;
+//use getproperty(VF_MINFPS_QUALITY); to do CSQC based LOD based on cl_minfps
+//1 should lead to an unmodified view
+
+//DP_CSQC_V_CALCREFDEF_WIP1
+//DP_CSQC_V_CALCREFDEF_WIP2
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions:
+void(entity e, float refdefflags) V_CalcRefdef = #640;
+//constant definitions:
+const int PMF_DUCKED = 4;
+const int PMF_ONGROUND = 8;
+const int REFDEFFLAG_TELEPORTED = 1;
+const int REFDEFFLAG_JUMPING = 2;
+const int REFDEFFLAG_DEAD = 4;
+const int REFDEFFLAG_INTERMISSION = 8;
+//- use this on the player entity after performing prediction
+//- pass REFDEFFLAG_TELEPORTED if the player teleported since last frame
+//- pass REFDEFFLAG_JUMPING if jump button is pressed
+//- pass REFDEFFLAG_DEAD if dead (DP_CSQC_V_CALCREFDEF_WIP2)
+//- pass REFDEFFLAG_INTERMISSION if in intermission (DP_CSQC_V_CALCREFDEF_WIP2)
+//- the player entity needs to have origin, velocity, pmove_flags set according
+//  to prediction (the above two PMF_ flags are used in the player's pmove_flags)
+//- NOTE: to check for this, ALSO OR a check with DP_CSQC_V_CALCREFDEF to also support
+//  the finished extension once done
+
+// assorted builtins
+float  drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #328;
+vector drawgetimagesize(string pic) = #318;
+const float SPA_POSITION =  0;
+const float SPA_S_AXIS =  1;
+const float SPA_T_AXIS =  2;
+const float SPA_R_AXIS =  3;
+const float SPA_TEXCOORDS0 =  4;
+const float SPA_LIGHTMAP0_TEXCOORDS =  5;
+const float SPA_LIGHTMAP_COLOR =  6;
+float (entity e, float s)                                              getsurfacenumpoints = #434;
+vector (entity e, float s, float n)                                    getsurfacepoint = #435;
+vector (entity e, float s)                                             getsurfacenormal = #436;
+string (entity e, float s)                                             getsurfacetexture = #437;
+float (entity e, vector p)                                             getsurfacenearpoint = #438;
+vector (entity e, float s, vector p)                                   getsurfaceclippedpoint = #439;
+vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
+float(entity e, float s) getsurfacenumtriangles = #628;
+vector(entity e, float s, float n) getsurfacetriangle = #629;
+
+//DP_QC_ASINACOSATANATAN2TAN
+//idea: Urre
+//darkplaces implementation: LordHavoc
+//constant definitions:
+float DEG2RAD = 0.0174532925199432957692369076848861271344287188854172545609719144;
+float RAD2DEG = 57.2957795130823208767981548141051703324054724665643215491602438612;
+float PI      = 3.1415926535897932384626433832795028841971693993751058209749445923;
+//builtin definitions:
+float(float s) asin = #471; // returns angle in radians for a given sin() value, the result is in the range -PI*0.5 to PI*0.5
+float(float c) acos = #472; // returns angle in radians for a given cos() value, the result is in the range 0 to PI
+float(float t) atan = #473; // returns angle in radians for a given tan() value, the result is in the range -PI*0.5 to PI*0.5
+float(float c, float s) atan2 = #474; // returns angle in radians for a given cos() and sin() value pair, the result is in the range -PI to PI (this is identical to vectoyaw except it returns radians rather than degrees)
+float(float a) tan = #475; // returns tangent value (which is simply sin(a)/cos(a)) for the given angle in radians, the result is in the range -infinity to +infinity
+//description:
+//useful math functions for analyzing vectors, note that these all use angles in radians (just like the cos/sin functions) not degrees unlike makevectors/vectoyaw/vectoangles, so be sure to do the appropriate conversions (multiply by DEG2RAD or RAD2DEG as needed).
+//note: atan2 can take unnormalized vectors (just like vectoyaw), and the function was included only for completeness (more often you want vectoyaw or vectoangles), atan2(v_x,v_y) * RAD2DEG gives the same result as vectoyaw(v)
+
+//DP_QC_SPRINTF
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions:
+string(string format, ...) sprintf = #627;
+//description:
+//you know sprintf :P
+//supported stuff:
+//  %
+//  optional: <argpos>$ for the argument to format
+//  flags: #0- +
+//  optional: <width>, *, or *<argpos>$ for the field width
+//  optional: .<precision>, .*, or .*<argpos>$ for the precision
+//  length modifiers: h for forcing a float, l for forcing an int/entity (by default, %d etc. cast a float to int)
+//  conversions:
+//    d takes a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an int
+//    i takes an int/entity if no length is specified or i is, and a float if h is specified as length, and cast it to an int
+//    ouxXc take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an unsigned int
+//    eEfFgG take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to a double
+//    s takes a string
+//    vV takes a vector, and processes the three components as if it were a gG for all three components, separated by space
+//    For conversions s and c, the flag # makes precision and width interpreted
+//      as byte count, by default it is interpreted as character count in UTF-8
+//      enabled engines. No other conversions can create wide characters, and #
+//      has another meaning in these.
+
+//DP_QC_GETTIME
+//idea: tZork
+//darkplaces implementation: tZork, divVerent
+//constant definitions:
+float GETTIME_FRAMESTART = 0; // time of start of frame
+float GETTIME_REALTIME = 1; // current time (may be OS specific)
+float GETTIME_HIRES = 2; // like REALTIME, but may reset between QC invocations and thus can be higher precision
+float GETTIME_UPTIME = 3; // time since start of the engine
+//builtin definitions:
+float(float tmr) gettime = #519;
+//description:
+//some timers to query...
+
+//DP_QC_GETTIME_CDTRACK
+//idea: divVerent
+//darkplaces implementation: divVerent
+//constant definitions:
+float GETTIME_CDTRACK = 4;
+//description:
+//returns the playing time of the current cdtrack when passed to gettime()
+//see DP_END_GETSOUNDTIME for similar functionality but for entity sound channels
+
+//DP_QC_TOKENIZEBYSEPARATOR
+//idea: Electro, SavageX, LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+int(string s, string separator1, ...) tokenizebyseparator = #479;
+//description:
+//this function returns tokens separated by any of the supplied separator strings, example:
+//numnumbers = tokenizebyseparator("10.2.3.4", ".");
+//returns 4 and the tokens are "10" "2" "3" "4"
+//possibly useful for parsing IPv4 addresses (such as "1.2.3.4") and IPv6 addresses (such as "[1234:5678:9abc:def0:1234:5678:9abc:def0]:26000")
+
+//DP_QC_TOKENIZE_CONSOLE
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions:
+int(string s) tokenize_console = #514;
+int(float i) argv_start_index = #515;
+int(float i) argv_end_index = #516;
+//description:
+//this function returns tokens separated just like the console does
+//also, functions are provided to get the index of the first and last character of each token in the original string
+//Passing negative values to them, or to argv, will be treated as indexes from the LAST token (like lists work in Perl). So argv(-1) will return the LAST token.
+
+//DP_SND_SOUND7_WIP1
+//DP_SND_SOUND7_WIP2
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions:
+void(entity e, float chan, string samp, float vol, float atten, float speed, float flags) sound7 = #8;
+float SOUNDFLAG_RELIABLE = 1;
+//description:
+//plays a sound, with some more flags
+//extensions to sound():
+//- channel may be in the range from -128 to 127; channels -128 to 0 are "auto",
+//  i.e. support multiple sounds at once, but cannot be stopped/restarted
+//- a value 0 in the speed parameter means no change; otherwise, it is a
+//  percentage of playback speed ("pitch shifting"). 100 is normal pitch, 50 is
+//  half speed, 200 is double speed, etc. (DP_SND_SOUND7_WIP2)
+//- the flag SOUNDFLAG_RELIABLE can be specified, which makes the sound send
+//  to MSG_ALL (reliable) instead of MSG_BROADCAST (unreliable, default);
+//  similarily, SOUNDFLAG_RELIABLE_TO_ONE sends to MSG_ONE
+//- channel 0 is controlled by snd_channel0volume; channel 1 and -1 by
+//  snd_channel1volume, etc. (so, a channel shares the cvar with its respective
+//  auto-channel); however, the mod MUST define snd_channel8volume and upwards
+//  in default.cfg if they are to be used, as the engine does not create them
+//  to not litter the cvar list
+//- this extension applies to CSQC as well; CSQC_Event_Sound will get speed and
+//  flags as extra 7th and 8th argument
+//- WIP2 ideas: SOUNDFLAG_RELIABLE_TO_ONE, SOUNDFLAG_NOPHS, SOUNDFLAG_FORCELOOP
+//- NOTE: to check for this, ALSO OR a check with DP_SND_SOUND7 to also support
+//  the finished extension once done
+
+//DP_PRECACHE_PIC_FLAGS
+//idea: divVerent
+//darkplaces implementation: divVerent
+//constant definitions:
+float PRECACHE_PIC_FROMWAD = 1; // this one actually is part of EXT_CSQC
+float PRECACHE_PIC_NOTPERSISTENT = 2; // picture may get deallocated when unused
+float PRECACHE_PIC_MIPMAP = 8; // mipmap the texture for possibly better downscaling at memory expense
+//notes: these constants are given as optional second argument to precache_pic()
+
+//DP_QC_TRACE_MOVETYPE_WORLDONLY
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//constant definitions:
+float MOVE_WORLDONLY = 3;
+//description:
+//allows traces to hit only world (ignoring all entities, unlike MOVE_NOMONSTERS which hits all bmodels), use as the nomonsters parameter to trace functions
+
+//DP_SND_GETSOUNDTIME
+//idea: VorteX
+//darkplaces implementation: VorteX
+//constant definitions:
+float(entity e, float channel) getsoundtime = #533; // get currently sound playing position on entity channel, -1 if not playing or error
+float(string sample) soundlength = #534; // returns length of sound sample in seconds, -1 on error (sound not precached, sound system not initialized etc.)
+//description: provides opportunity to query length of sound samples and realtime tracking of sound playing on entities (similar to DP_GETTIME_CDTRACK)
+//note: beware dedicated server not running sound engine at all, so in dedicated mode this builtins will not work in server progs
+//note also: menu progs not supporting getsoundtime() (will give a warning) since it has no sound playing on entities
+//examples of use:
+//  - QC-driven looped sounds
+//  - QC events when sound playing is finished
+//  - toggleable ambientsounds
+//  - subtitles
+
+//DP_QC_NUM_FOR_EDICT
+//idea: Blub\0
+//darkplaces implementation: Blub\0
+//Function to get the number of an entity - a clean way.
+float(entity num) num_for_edict = #512;
+
+//DP_TRACE_HITCONTENTSMASK_SURFACEINFO
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//globals:
+.int dphitcontentsmask; // if non-zero on the entity passed to traceline/tracebox/tracetoss this will override the normal collidable contents rules and instead hit these contents values (for example AI can use tracelines that hit DONOTENTER if it wants to, by simply changing this field on the entity passed to traceline), this affects normal movement as well as trace calls
+float trace_dpstartcontents; // DPCONTENTS_ value at start position of trace
+int trace_dphitcontents; // DPCONTENTS_ value of impacted surface (not contents at impact point, just contents of the surface that was hit)
+int trace_dphitq3surfaceflags; // Q3SURFACEFLAG_ value of impacted surface
+string trace_dphittexturename; // texture name of impacted surface
+//constants:
+const int DPCONTENTS_SOLID = 1; // hit a bmodel, not a bounding box
+const int DPCONTENTS_WATER = 2;
+const int DPCONTENTS_SLIME = 4;
+const int DPCONTENTS_LAVA = 8;
+const int DPCONTENTS_SKY = 16;
+const int DPCONTENTS_BODY = 32; // hit a bounding box, not a bmodel
+const int DPCONTENTS_CORPSE = 64; // hit a SOLID_CORPSE entity
+const int DPCONTENTS_NODROP = 128; // an area where backpacks should not spawn
+const int DPCONTENTS_PLAYERCLIP = 256; // blocks player movement
+const int DPCONTENTS_MONSTERCLIP = 512; // blocks monster movement
+const int DPCONTENTS_DONOTENTER = 1024; // AI hint brush
+const int DPCONTENTS_LIQUIDSMASK = 14; // WATER | SLIME | LAVA
+const int DPCONTENTS_BOTCLIP = 2048; // AI hint brush
+const int DPCONTENTS_OPAQUE = 4096; // only fully opaque brushes get this (may be useful for line of sight checks)
+const int Q3SURFACEFLAG_NODAMAGE = 1;
+const int Q3SURFACEFLAG_SLICK = 2; // low friction surface
+const int Q3SURFACEFLAG_SKY = 4; // sky surface (also has NOIMPACT and NOMARKS set)
+const int Q3SURFACEFLAG_LADDER = 8; // climbable surface
+const int Q3SURFACEFLAG_NOIMPACT = 16; // projectiles should remove themselves on impact (this is set on sky)
+const int Q3SURFACEFLAG_NOMARKS = 32; // projectiles should not leave marks, such as decals (this is set on sky)
+const int Q3SURFACEFLAG_FLESH = 64; // projectiles should do a fleshy effect (blood?) on impact
+const int Q3SURFACEFLAG_NODRAW = 128; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_HINT = 256; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_SKIP = 512; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_NOLIGHTMAP = 1024; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_POINTLIGHT = 2048; // compiler hint (not important to qc)
+const int Q3SURFACEFLAG_METALSTEPS = 4096; // walking on this surface should make metal step sounds
+const int Q3SURFACEFLAG_NOSTEPS = 8192; // walking on this surface should not make footstep sounds
+const int Q3SURFACEFLAG_NONSOLID = 16384; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_LIGHTFILTER = 32768; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_ALPHASHADOW = 65536; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_NODLIGHT = 131072; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_DUST = 262144; // translucent 'light beam' effect (not important to qc)
+//description:
+//adds additional information after a traceline/tracebox/tracetoss call.
+//also (very important) sets trace_* globals before calling .touch functions,
+//this allows them to inspect the nature of the collision (for example
+//determining if a projectile hit sky), clears trace_* variables for the other
+//object in a touch event (that is to say, a projectile moving will see the
+//trace results in its .touch function, but the player it hit will see very
+//little information in the trace_ variables as it was not moving at the time)
+
+//DP_QC_CVAR_TYPE
+//idea: divVerent
+//DarkPlaces implementation: divVerent
+//builtin definitions:
+float(string name) cvar_type = #495;
+const int CVAR_TYPEFLAG_EXISTS = 1;
+const int CVAR_TYPEFLAG_SAVED = 2;
+const int CVAR_TYPEFLAG_PRIVATE = 4;
+const int CVAR_TYPEFLAG_ENGINE = 8;
+const int CVAR_TYPEFLAG_HASDESCRIPTION = 16;
+const int CVAR_TYPEFLAG_READONLY = 32;
+
+//DP_QC_CRC16
+//idea: divVerent
+//darkplaces implementation: divVerent
+//Some hash function to build hash tables with. This has to be be the CRC-16-CCITT that is also required for the QuakeWorld download protocol.
+//When caseinsensitive is set, the CRC is calculated of the lower cased string.
+int(bool caseinsensitive, string s, ...) crc16 = #494;
+
+//DP_QC_URI_ESCAPE
+//idea: divVerent
+//darkplaces implementation: divVerent
+//URI::Escape's functionality
+string(string in) uri_escape = #510;
+string(string in) uri_unescape = #511;
+
+//DP_QC_DIGEST
+//idea: motorsep, Spike
+//DarkPlaces implementation: divVerent
+//builtin definitions:
+string(string digest, string data, ...) digest_hex = #639;
+//description:
+//returns a given hex digest of given data
+//the returned digest is always encoded in hexadecimal
+//only the "MD4" digest is always supported!
+//if the given digest is not supported, string_null is returned
+//the digest string is matched case sensitively, use "MD4", not "md4"!
+
+//DP_QC_DIGEST_SHA256
+//idea: motorsep, Spike
+//DarkPlaces implementation: divVerent
+//description:
+//"SHA256" is also an allowed digest type
+
+//DP_QC_LOG
+//darkplaces implementation: divVerent
+//builtin definitions:
+float log(float f) = #532;
+//description:
+//logarithm
+
+//FTE_CSQC_SKELETONOBJECTS
+//idea: Spike, LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+// all skeleton numbers are 1-based (0 being no skeleton)
+// all bone numbers are 1-based (0 being invalid)
+float(float modlindex) skel_create = #263; // create a skeleton (be sure to assign this value into .skeletonindex for use), returns skeleton index (1 or higher) on success, returns 0 on failure (for example if the modelindex is not skeletal), it is recommended that you create a new skeleton if you change modelindex, as the skeleton uses the hierarchy from the model.
+float(float skel, entity ent, float modlindex, float retainfrac, float firstbone, float lastbone) skel_build = #264; // blend in a percentage of standard animation, 0 replaces entirely, 1 does nothing, 0.5 blends half, etc, and this only alters the bones in the specified range for which out of bounds values like 0,100000 are safe (uses .frame, .frame2, .frame3, .frame4, .lerpfrac, .lerpfrac3, .lerpfrac4, .frame1time, .frame2time, .frame3time, .frame4time), returns skel on success, 0 on failure
+float(float skel) skel_get_numbones = #265; // returns how many bones exist in the created skeleton, 0 if skeleton does not exist
+string(float skel, float bonenum) skel_get_bonename = #266; // returns name of bone (as a tempstring), "" if invalid bonenum (< 1 for example) or skeleton does not exist
+int(float skel, float bonenum) skel_get_boneparent = #267; // returns parent num for supplied bonenum, 0 if bonenum has no parent or bone does not exist (returned value is always less than bonenum, you can loop on this)
+int(float skel, string tagname) skel_find_bone = #268; // get number of bone with specified name, 0 on failure, bonenum (1-based) on success, same as using gettagindex but takes modelindex instead of entity
+vector(float skel, float bonenum) skel_get_bonerel = #269; // get matrix of bone in skeleton relative to its parent - sets v_forward, v_right, v_up, returns origin (relative to parent bone)
+vector(float skel, float bonenum) skel_get_boneabs = #270; // get matrix of bone in skeleton in model space - sets v_forward, v_right, v_up, returns origin (relative to entity)
+void(float skel, float bonenum, vector org) skel_set_bone = #271; // set matrix of bone relative to its parent, reads v_forward, v_right, v_up, takes origin as parameter (relative to parent bone)
+void(float skel, float bonenum, vector org) skel_mul_bone = #272; // transform bone matrix (relative to its parent) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bone)
+void(float skel, float startbone, float endbone, vector org) skel_mul_bones = #273; // transform bone matrices (relative to their parents) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bones)
+void(float skeldst, float skelsrc, float startbone, float endbone) skel_copybones = #274; // copy bone matrices (relative to their parents) from one skeleton to another, useful for copying a skeleton to a corpse
+void(float skel) skel_delete = #275; // deletes skeleton at the beginning of the next frame (you can add the entity, delete the skeleton, renderscene, and it will still work)
+float(float modlindex, string framename) frameforname = #276; // finds number of a specified frame in the animation, returns -1 if no match found
+float(float modlindex, float framenum) frameduration = #277; // returns the intended play time (in seconds) of the specified framegroup, if it does not exist the result is 0, if it is a single frame it may be a small value around 0.1 or 0.
+//fields:
+.float skeletonindex; // active skeleton overriding standard animation on model
+.int frame; // primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
+.int frame2; // secondary framegroup animation (strength = lerpfrac)
+.int frame3; // tertiary framegroup animation (strength = lerpfrac3)
+.int frame4; // quaternary framegroup animation (strength = lerpfrac4)
+.float lerpfrac; // strength of framegroup blend
+.float lerpfrac3; // strength of framegroup blend
+.float lerpfrac4; // strength of framegroup blend
+.float frame1time; // start time of framegroup animation
+.float frame2time; // start time of framegroup animation
+.float frame3time; // start time of framegroup animation
+.float frame4time; // start time of framegroup animation
+//description:
+//this extension provides a way to do complex skeletal animation on an entity.
+//
+//see also DP_SKELETONOBJECTS (this extension implemented on server as well as client)
+//
+//notes:
+//each model contains its own skeleton, reusing a skeleton with incompatible models will yield garbage (or not render).
+//each model contains its own animation data, you can use animations from other model files (for example saving out all character animations as separate model files).
+//if an engine supports loading an animation-only file format such as .md5anim in FTEQW, it can be used to animate any model with a compatible skeleton.
+//proper use of this extension may require understanding matrix transforms (v_forward, v_right, v_up, origin), and you must keep in mind that v_right is negative for this purpose.
+//
+//features include:
+//multiple animations blended together.
+//animating a model with animations from another model with a compatible skeleton.
+//restricting animation blends to certain bones of a model - for example independent animation of legs, torso, head.
+//custom bone controllers - for example making eyes track a target location.
+//
+//
+//
+//example code follows...
+//
+//this helper function lets you identify (by parentage) what group a bone
+//belongs to - for example "torso", "leftarm", would return 1 ("torso") for
+//all children of the bone named "torso", unless they are children of
+//"leftarm" (which is a child of "torso") which would return 2 instead...
+float(float skel, float bonenum, string g1, string g2, string g3, string g4, string g5, string g6) example_skel_findbonegroup =
+{
+       string bonename;
+       while (bonenum >= 0)
+       {
+               bonename = skel_get_bonename(skel, bonenum);
+               if (bonename == g1) return 1;
+               if (bonename == g2) return 2;
+               if (bonename == g3) return 3;
+               if (bonename == g4) return 4;
+               if (bonename == g5) return 5;
+               if (bonename == g6) return 6;
+               bonenum = skel_get_boneparent(skel, bonenum);
+       }
+       return 0;
+};
+// create a skeletonindex for our player using current modelindex
+void() example_skel_player_setup =
+{
+       self.skeletonindex = skel_create(self.modelindex);
+};
+// setup bones of skeleton based on an animation
+// note: animmodelindex can be a different model than self.modelindex
+void(float animmodelindex, float framegroup, float framegroupstarttime) example_skel_player_update_begin =
+{
+       // start with our standard animation
+       self.frame = framegroup;
+       self.frame2 = 0;
+       self.frame3 = 0;
+       self.frame4 = 0;
+       self.frame1time = framegroupstarttime;
+       self.frame2time = 0;
+       self.frame3time = 0;
+       self.frame4time = 0;
+       self.lerpfrac = 0;
+       self.lerpfrac3 = 0;
+       self.lerpfrac4 = 0;
+       skel_build(self.skeletonindex, self, animmodelindex, 0, 0, 100000);
+};
+// apply a different framegroup animation to bones with a specified parent
+void(float animmodelindex, float framegroup, float framegroupstarttime, float blendalpha, string groupbonename, string excludegroupname1, string excludegroupname2) example_skel_player_update_applyoverride =
+{
+       self.frame = framegroup;
+       self.frame2 = 0;
+       self.frame3 = 0;
+       self.frame4 = 0;
+       self.frame1time = framegroupstarttime;
+       self.frame2time = 0;
+       self.frame3time = 0;
+       self.frame4time = 0;
+       self.lerpfrac = 0;
+       self.lerpfrac3 = 0;
+       self.lerpfrac4 = 0;
+       float bonenum = 0;
+       float numbones = skel_get_numbones(self.skeletonindex);
+       while (bonenum < numbones)
+       {
+               if (example_skel_findbonegroup(self.skeletonindex, bonenum, groupbonename, excludegroupname1, excludegroupname2, "", "", "") == 1)
+                       skel_build(self.skeletonindex, self, animmodelindex, 1 - blendalpha, bonenum, bonenum + 1);
+               bonenum = bonenum + 1;
+       }
+};
+// make eyes point at a target location, be sure v_forward, v_right, v_up are set correctly before calling
+void(vector eyetarget, string bonename) example_skel_player_update_eyetarget =
+{
+       float bonenum = skel_find_bone(self.skeletonindex, bonename) - 1;
+       if (bonenum < 0)
+               return;
+       vector oldforward = v_forward;
+       vector oldright = v_right;
+       vector oldup = v_up;
+       vector v = eyetarget - self.origin;
+       vector modeleyetarget;
+       modeleyetarget.x =   v * v_forward;
+       modeleyetarget.y = 0-v * v_right;
+       modeleyetarget.z =   v * v_up;
+       // this is an eyeball, make it point at the target location
+       // first get all the data we can...
+       vector relorg = skel_get_bonerel(self.skeletonindex, bonenum);
+       vector relforward = v_forward;
+       vector relright = v_right;
+       vector relup = v_up;
+       vector boneorg = skel_get_boneabs(self.skeletonindex, bonenum);
+       vector boneforward = v_forward;
+       vector boneright = v_right;
+       vector boneup = v_up;
+       vector parentorg = skel_get_boneabs(self.skeletonindex, skel_get_boneparent(self.skeletonindex, bonenum));
+       vector parentforward = v_forward;
+       vector parentright = v_right;
+       vector parentup = v_up;
+       // get the vector from the eyeball to the target
+       vector u = modeleyetarget - boneorg;
+       // now transform it inversely by the parent matrix to produce new rel vectors
+       v.x = u * parentforward;
+       v.y = u * parentright;
+       v.z = u * parentup;
+       vector ang = vectoangles2(v, relup);
+       ang.x = 0 - ang.x;
+       makevectors(ang);
+       // set the relative bone matrix
+       skel_set_bone(self.skeletonindex, bonenum, relorg);
+       // restore caller's v_ vectors
+       v_forward = oldforward;
+       v_right = oldright;
+       v_up = oldup;
+};
+// delete skeleton when we're done with it
+// note: skeleton remains valid until next frame when it is really deleted
+void() example_skel_player_delete =
+{
+       skel_delete(self.skeletonindex);
+       self.skeletonindex = 0;
+};
+//
+// END OF EXAMPLES FOR FTE_CSQC_SKELETONOBJECTS
+//
+
+//DP_QC_ENTITYDATA
+//idea: KrimZon
+//darkplaces implementation: KrimZon
+//builtin definitions:
+float() numentityfields = #496;
+string(float fieldnum) entityfieldname = #497;
+float(float fieldnum) entityfieldtype = #498;
+string(float fieldnum, entity ent) getentityfieldstring = #499;
+float(float fieldnum, entity ent, string s) putentityfieldstring = #500;
+//constants:
+//Returned by entityfieldtype
+float FIELD_STRING   = 1;
+float FIELD_FLOAT    = 2;
+float FIELD_VECTOR   = 3;
+float FIELD_ENTITY   = 4;
+float FIELD_FUNCTION = 6;
+//description:
+//Versatile functions intended for storing data from specific entities between level changes, but can be customized for some kind of partial savegame.
+//WARNING: .entity fields cannot be saved and restored between map loads as they will leave dangling pointers.
+//numentityfields returns the number of entity fields. NOT offsets. Vectors comprise 4 fields: v, v_x, v_y and v_z.
+//entityfieldname returns the name as a string, eg. "origin" or "classname" or whatever.
+//entityfieldtype returns a value that the constants represent, but the field may be of another type in more exotic progs.dat formats or compilers.
+//getentityfieldstring returns data as would be written to a savegame, eg... "0.05" (float), "0 0 1" (vector), or "Hello World!" (string). Function names can also be returned.
+//putentityfieldstring puts the data returned by getentityfieldstring back into the entity.
+
+//DP_QC_ENTITYSTRING
+void(string s) loadfromdata = #529;
+void(string s) loadfromfile = #530;
+void(string s) callfunction = #605;
+void(float fh, entity e) writetofile = #606;
+float(string s) isfunction = #607;
+void(entity e, string s) parseentitydata = #608;
+
+//DP_COVERAGE
+//idea: divVerent
+//darkplaces implementation: divVerent
+//function definitions:
+void coverage() = #642;  // Reports a coverage event. The engine counts for each of the calls to this builtin whether it has been called.
+
+// assorted builtins
+//const int STAT_MOVEVARS_TICRATE              = 240;
+//const int STAT_MOVEVARS_TIMESCALE            = 241;
+//const int STAT_FRAGLIMIT                             = 235;
+//const int STAT_TIMELIMIT                             = 236;
+//const int STAT_MOVEVARS_GRAVITY       = 242;
+string(void) ReadPicture                               = #501;
+const int PARTICLES_USEALPHA = 1;
+float particles_alphamin, particles_alphamax;
+const int PARTICLES_USECOLOR = 2;
+vector particles_colormin, particles_colormax;
+const int PARTICLES_USEFADE = 4;  // fades the COUNT (fade alpha using alphamin/alphamax)
+float particles_fade;
+const int PARTICLES_DRAWASTRAIL = 128;
+void(float effectindex, entity own, vector org_from, vector org_to, vector dir_from, vector dir_to, float countmultiplier, float flags) boxparticles = #502;
+float trace_networkentity;
+const int RF_FULLBRIGHT        = 256;
+const int RF_NOSHADOW  = 512;
+const int RF_DYNAMICMODELLIGHT = 8192;
+
+float gettaginfo_parent;
+string gettaginfo_name;
+vector gettaginfo_offset;
+vector gettaginfo_forward;
+vector gettaginfo_right;
+vector gettaginfo_up;
+float checkpvs(vector viewpos, entity viewee) = #240;
+
+#pragma noref 0
+
+#endif
diff --git a/qcsrc/dpdefs/dpextensions.qc b/qcsrc/dpdefs/dpextensions.qc
deleted file mode 100644 (file)
index ef86a02..0000000
+++ /dev/null
@@ -1,2566 +0,0 @@
-
-//DarkPlaces supported extension list, draft version 1.04
-
-//things that don't have extensions yet:
-.float disableclientprediction;
-
-//definitions that id Software left out:
-//these are passed as the 'nomonsters' parameter to traceline/tracebox (yes really this was supported in all quake engines, nomonsters is misnamed)
-float MOVE_NORMAL = 0; // same as FALSE
-float MOVE_NOMONSTERS = 1; // same as TRUE
-float MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE
-
-//checkextension function
-//idea: expected by almost everyone
-//darkplaces implementation: LordHavoc
-float(string s) checkextension = #99;
-//description:
-//check if (cvar("pr_checkextension")) before calling this, this is the only
-//guaranteed extension to be present in the extension system, it allows you
-//to check if an extension is available, by name, to check for an extension
-//use code like this:
-//// (it is recommended this code be placed in worldspawn or a worldspawn called function somewhere)
-//if (cvar("pr_checkextension"))
-//if (checkextension("DP_SV_SETCOLOR"))
-//     ext_setcolor = TRUE;
-//from then on you can check ext_setcolor to know if that extension is available
-
-//BX_WAL_SUPPORT
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//description:
-//indicates the engine supports .wal textures for filenames in the textures/ directory
-//(note: DarkPlaces has supported this since 2001 or 2002, but did not advertise it as an extension, then I noticed Betwix was advertising it and added the extension accordingly)
-
-//DP_BUTTONCHAT
-//idea: Vermeulen
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float buttonchat;
-//description:
-//true if the player is currently chatting (in messagemode, menus or console)
-
-//DP_BUTTONUSE
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float buttonuse;
-//client console commands:
-//+use
-//-use
-//description:
-//made +use and -use commands work, they now control the .buttonuse field (.button1 was used by many mods for other purposes).
-
-//DP_CL_LOADSKY
-//idea: Nehahra, LordHavoc
-//darkplaces implementation: LordHavoc
-//client console commands:
-//"loadsky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, use "" to revert to quake sky, note: this is the same as Quake2 skybox naming)
-//description:
-//sets global skybox for the map for this client (can be stuffed to a client by QC), does not hurt much to repeatedly execute this command, please don't use this in mods if it can be avoided (only if changing skybox is REALLY needed, otherwise please use DP_GFX_SKYBOX).
-
-//DP_CON_SET
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//description:
-//indicates this engine supports the "set" console command which creates or sets a non-archived cvar (not saved to config.cfg on exit), it is recommended that set and seta commands be placed in default.cfg for mod-specific cvars.
-
-//DP_CON_SETA
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//description:
-//indicates this engine supports the "seta" console command which creates or sets an archived cvar (saved to config.cfg on exit), it is recommended that set and seta commands be placed in default.cfg for mod-specific cvars.
-
-//DP_CON_ALIASPARAMETERS
-//idea: many
-//darkplaces implementation: Black
-//description:
-//indicates this engine supports aliases containing $1 through $9 parameter macros (which when called will expand to the parameters passed to the alias, for example alias test "say $2 $1", then you can type test hi there and it will execute say there hi), as well as $0 (name of the alias) and $* (all parameters $1 onward).
-
-//DP_CON_EXPANDCVAR
-//idea: many, PHP
-//darkplaces implementation: Black
-//description:
-//indicates this engine supports console commandlines containing $cvarname which will expand to the contents of that cvar as a parameter, for instance say my fov is $fov, will say "my fov is 90", or similar.
-
-//DP_CON_STARTMAP
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//adds two engine-called aliases named startmap_sp and startmap_dm which are called when the engine tries to start a singleplayer game from the menu (startmap_sp) or the -listen or -dedicated options are used or the engine is a dedicated server (uses startmap_dm), these allow a mod or game to specify their own map instead of start, and also distinguish between singleplayer and -listen/-dedicated, also these need not be a simple "map start" command, they can do other things if desired, startmap_sp and startmap_dm both default to "map start".
-
-//DP_EF_ADDITIVE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float   EF_ADDITIVE     = 32;
-//description:
-//additive blending when this object is rendered
-
-//DP_EF_BLUE
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//effects bit:
-float   EF_BLUE         = 64;
-//description:
-//entity emits blue light (used for quad)
-
-//DP_EF_DOUBLESIDED
-//idea: LordHavoc
-//darkplaces implementation: [515] and LordHavoc
-//effects bit:
-float EF_DOUBLESIDED = 32768;
-//description:
-//render entity as double sided (backfaces are visible, I.E. you see the 'interior' of the model, rather than just the front), can be occasionally useful on transparent stuff.
-
-//DP_EF_DYNAMICMODELLIGHT
-//idea: C.Brutail, divVerent, maikmerten
-//darkplaces implementation: divVerent
-//effects bit:
-float   EF_DYNAMICMODELLIGHT     = 131072;
-//description:
-//force dynamic model light on the entity, even if it's a BSP model (or anything else with lightmaps or light colors)
-
-//DP_EF_FLAME
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float   EF_FLAME        = 1024;
-//description:
-//entity is on fire
-
-//DP_EF_FULLBRIGHT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float   EF_FULLBRIGHT   = 512;
-//description:
-//entity is always brightly lit
-
-//DP_EF_NODEPTHTEST
-//idea: Supa
-//darkplaces implementation: LordHavoc
-//effects bit:
-float   EF_NODEPTHTEST       = 8192;
-//description:
-//makes entity show up to client even through walls, useful with EF_ADDITIVE for special indicators like where team bases are in a map, so that people don't get lost
-
-//DP_EF_NODRAW
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//effects bit:
-float   EF_NODRAW       = 16;
-//description:
-//prevents server from sending entity to client (forced invisible, even if it would have been a light source or other such things)
-
-//DP_EF_NOGUNBOB
-//idea: Chris Page, Dresk
-//darkplaces implementation: LordHAvoc
-//effects bit:
-float   EF_NOGUNBOB     = 256;
-//description:
-//this has different meanings depending on the entity it is used on:
-//player entity - prevents gun bobbing on player.viewmodel
-//viewmodelforclient entity - prevents gun bobbing on an entity attached to the player's view
-//other entities - no effect
-//uses:
-//disabling gun bobbing on a diving mask or other model used as a .viewmodel.
-//disabling gun bobbing on view-relative models meant to be part of the heads up display.  (note: if fov is changed these entities may be off-screen, or too near the center of the screen, so use fov 90 in this case)
-
-//DP_EF_NOSHADOW
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float   EF_NOSHADOW     = 4096;
-//description:
-//realtime lights will not cast shadows from this entity (but can still illuminate it)
-
-//DP_EF_RED
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//effects bit:
-float   EF_RED          = 128;
-//description:
-//entity emits red light (used for invulnerability)
-
-//DP_EF_RESTARTANIM_BIT
-//idea: id software
-//darkplaces implementation: divVerent
-//effects bit:
-float   EF_RESTARTANIM_BIT = 1048576;
-//description:
-//when toggled, the current animation is restarted. Useful for weapon animation.
-//to toggle this bit in QC, you can do:
-//  self.effects += (EF_RESTARTANIM_BIT - 2 * (self.effects & EF_RESTARTANIM_BIT));
-
-//DP_EF_STARDUST
-//idea: MythWorks Inc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float   EF_STARDUST     = 2048;
-//description:
-//entity emits bouncing sparkles in every direction
-
-//DP_EF_TELEPORT_BIT
-//idea: id software
-//darkplaces implementation: divVerent
-//effects bit:
-float   EF_TELEPORT_BIT = 2097152;
-//description:
-//when toggled, interpolation of the entity is skipped for one frame. Useful for teleporting.
-//to toggle this bit in QC, you can do:
-//  self.effects += (EF_TELEPORT_BIT - 2 * (self.effects & EF_TELEPORT_BIT));
-
-//DP_ENT_ALPHA
-//idea: Nehahra
-//darkplaces implementation: LordHavoc
-//fields:
-.float alpha;
-//description:
-//controls opacity of the entity, 0.0 is forced to be 1.0 (otherwise everything would be invisible), use -1 if you want to make something invisible, 1.0 is solid (like normal).
-
-//DP_ENT_COLORMOD
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definition:
-.vector colormod;
-//description:
-//controls color of the entity, '0 0 0', is forced to be '1 1 1' (otherwise everything would be black), used for tinting objects, for instance using '1 0.6 0.4' on an ogre would give you an orange ogre (order is red green blue), note the colors can go up to '8 8 8' (8x as bright as normal).
-
-//DP_ENT_CUSTOMCOLORMAP
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//if .colormap is set to 1024 + pants + shirt * 16, those colors will be used for colormapping the entity, rather than looking up a colormap by player number.
-
-/*
-//NOTE: no longer supported by darkplaces because all entities are delta compressed now
-//DP_ENT_DELTACOMPRESS // no longer supported
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_DELTA = 8388608;
-//description:
-//(obsolete) applies delta compression to the network updates of the entity, making updates smaller, this might cause some unreliable behavior in packet loss situations, so it should only be used on numerous (nails/plasma shots/etc) or unimportant objects (gibs/shell casings/bullet holes/etc).
-*/
-
-//DP_ENT_EXTERIORMODELTOCLIENT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//fields:
-.entity exteriormodeltoclient;
-//description:
-//the entity is visible to all clients with one exception: if the specified client is using first person view (not using chase_active) the entity will not be shown.  Also if tag attachments are supported any entities attached to the player entity will not be drawn in first person.
-
-//DP_ENT_GLOW
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float glow_color;
-.float glow_size;
-.float glow_trail;
-//description:
-//customizable glowing light effect on the entity, glow_color is a paletted (8bit) color in the range 0-255 (note: 0 and 254 are white), glow_size is 0 or higher (up to the engine what limit to cap it to, darkplaces imposes a 1020 limit), if glow_trail is true it will leave a trail of particles of the same color as the light.
-
-//DP_ENT_GLOWMOD
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definition:
-.vector glowmod;
-//description:
-//controls color of the entity's glow texture (fullbrights), '0 0 0', is forced to be '1 1 1' (otherwise everything would be black), used for tinting objects, see colormod (same color restrictions apply).
-
-//DP_ENT_LOWPRECISION
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_LOWPRECISION = 4194304;
-//description:
-//uses low quality origin coordinates, reducing network traffic compared to the default high precision, intended for numerous objects (projectiles/gibs/bullet holes/etc).
-
-//DP_ENT_SCALE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float scale;
-//description:
-//controls rendering scale of the object, 0 is forced to be 1, darkplaces uses 1/16th accuracy and a limit of 15.9375, can be used to make an object larger or smaller.
-
-//DP_ENT_TRAILEFFECTNUM
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float traileffectnum;
-//description:
-//use a custom effectinfo.txt effect on this entity, assign it like this:
-//self.traileffectnum = particleeffectnum("mycustomeffect");
-//this will do both the dlight and particle trail as described in the effect, basically equivalent to trailparticles() in CSQC but performed on a server entity.
-
-//DP_ENT_VIEWMODEL
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.entity viewmodelforclient;
-//description:
-//this is a very special capability, attachs the entity to the view of the client specified, origin and angles become relative to the view of that client, all effects can be used (multiple skins on a weapon model etc)...  the entity is not visible to any other client.
-
-//DP_GFX_EXTERNALTEXTURES
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//loads external textures found in various directories (tenebrae compatible)...
-/*
-in all examples .tga is merely the base texture, it can be any of these:
-.tga (base texture)
-_glow.tga (fullbrights or other glowing overlay stuff, NOTE: this is done using additive blend, not alpha)
-_pants.tga (pants overlay for colormapping on models, this should be shades of grey (it is tinted by pants color) and black wherever the base texture is not black, as this is an additive blend)
-_shirt.tga (same idea as pants, but for shirt color)
-_diffuse.tga (this may be used instead of base texture for per pixel lighting)
-_gloss.tga (specular texture for per pixel lighting, note this can be in color (tenebrae only supports greyscale))
-_norm.tga (normalmap texture for per pixel lighting)
-_bump.tga (bumpmap, converted to normalmap at load time, supported only for reasons of tenebrae compatibility)
-_luma.tga (same as _glow but supported only for reasons of tenebrae compatibility)
-
-due to glquake's incomplete Targa(r) loader, this section describes
-required Targa(r) features support:
-types:
-type 1 (uncompressed 8bit paletted with 24bit/32bit palette)
-type 2 (uncompressed 24bit/32bit true color, glquake supported this)
-type 3 (uncompressed 8bit greyscale)
-type 9 (RLE compressed 8bit paletted with 24bit/32bit palette)
-type 10 (RLE compressed 24bit/32bit true color, glquake supported this)
-type 11 (RLE compressed 8bit greyscale)
-attribute bit 0x20 (Origin At Top Left, top to bottom, left to right)
-
-image formats guaranteed to be supported: tga, pcx, lmp
-image formats that are optional: png, jpg
-
-mdl/spr/spr32 examples:
-skins are named _A (A being a number) and skingroups are named like _A_B
-these act as suffixes on the model name...
-example names for skin _2_1 of model "progs/armor.mdl":
-game/override/progs/armor.mdl_2_1.tga
-game/textures/progs/armor.mdl_2_1.tga
-game/progs/armor.mdl_2_1.tga
-example names for skin _0 of the model "progs/armor.mdl":
-game/override/progs/armor.mdl_0.tga
-game/textures/progs/armor.mdl_0.tga
-game/progs/armor.mdl_0.tga
-note that there can be more skins files (of the _0 naming) than the mdl
-contains, this is only useful to save space in the .mdl file if classic quake
-compatibility is not a concern.
-
-bsp/md2/md3 examples:
-example names for the texture "quake" of model "maps/start.bsp":
-game/override/quake.tga
-game/textures/quake.tga
-game/quake.tga
-
-sbar/menu/console textures: for example the texture "conchars" (console font) in gfx.wad
-game/override/gfx/conchars.tga
-game/textures/gfx/conchars.tga
-game/gfx/conchars.tga
-*/
-
-//DP_GFX_EXTERNALTEXTURES_PERMAPTEXTURES
-//idea: Fuh?
-//darkplaces implementation: LordHavoc
-//description:
-//Q1BSP and HLBSP map loading loads external textures found in textures/<mapname>/ as well as textures/.
-//Where mapname is the bsp filename minus the extension (typically .bsp) and minus maps/ if it is in maps/ (any other path is not removed)
-//example:
-//maps/e1m1.bsp uses textures in the directory textures/e1m1/ and falls back to textures/
-//maps/b_batt0.bsp uses textures in the directory textures/b_batt0.bsp and falls back to textures/
-//as a more extreme example:
-//progs/something/blah.bsp uses textures in the directory textures/progs/something/blah/ and falls back to textures/
-
-//DP_GFX_FOG
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//worldspawn fields:
-//"fog" (parameters: "density red green blue", example: "0.1 0.3 0.3 0.3")
-//description:
-//global fog for the map, can not be changed by QC
-
-//DP_GFX_QUAKE3MODELTAGS
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//field definitions:
-.entity tag_entity; // entity this is attached to (call setattachment to set this)
-.float tag_index; // which tag on that entity (0 is relative to the entity, > 0 is an index into the tags on the model if it has any) (call setattachment to set this)
-//builtin definitions:
-void(entity e, entity tagentity, string tagname) setattachment = #443; // attachs e to a tag on tagentity (note: use "" to attach to entity origin/angles instead of a tag)
-//description:
-//allows entities to be visually attached to model tags (which follow animations perfectly) on other entities, for example attaching a weapon to a player's hand, or upper body attached to lower body, allowing it to change angles and frame separately (note: origin and angles are relative to the tag, use '0 0 0' for both if you want it to follow exactly, this is similar to viewmodelforclient's behavior).
-//note 2: if the tag is not found, it defaults to "" (attach to origin/angles of entity)
-//note 3: attaching to world turns off attachment
-//note 4: the entity that this is attached to must be visible for this to work
-//note 5: if an entity is attached to the player entity it will not be drawn in first person.
-
-//DP_GFX_SKINFILES
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//alias models (mdl, md2, md3) can have .skin files to replace conventional texture naming, these have a naming format such as:
-//progs/test.md3_0.skin
-//progs/test.md3_1.skin
-//...
-//
-//these files contain replace commands (replace meshname shadername), example:
-//replace "helmet" "progs/test/helmet1.tga" // this is a mesh shader replacement
-//replace "teamstripes" "progs/test/redstripes.tga"
-//replace "visor" "common/nodraw" // this makes the visor mesh invisible
-////it is not possible to rename tags using this format
-//
-//Or the Quake3 syntax (100% compatible with Quake3's .skin files):
-//helmet,progs/test/helmet1.tga // this is a mesh shader replacement
-//teamstripes,progs/test/redstripes.tga
-//visor,common/nodraw // this makes the visor mesh invisible
-//tag_camera, // this defines that the first tag in the model is called tag_camera
-//tag_test, // this defines that the second tag in the model is called tag_test
-//
-//any names that are not replaced are automatically show up as a grey checkerboard to indicate the error status, and "common/nodraw" is a special case that is invisible.
-//this feature is intended to allow multiple skin sets on md3 models (which otherwise only have one skin set).
-//other commands might be added someday but it is not expected.
-
-//DP_GFX_SKYBOX
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//worldspawn fields:
-//"sky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, note: "sky" is also used the same way by Quake2)
-//description:
-//global skybox for the map, can not be changed by QC
-
-//DP_UTF8
-//idea: Blub\0, divVerent
-//darkplaces implementation: Blub\0
-//cvar definitions:
-//   utf8_enable: enable utf8 encoding
-//description: utf8 characters are allowed inside cvars, protocol strings, files, progs strings, etc.,
-//and count as 1 char for string functions like strlen, substring, etc.
-// note: utf8_enable is run-time cvar, could be changed during execution
-// note: beware that str2chr() could return value bigger than 255 once utf8 is enabled
-
-//DP_HALFLIFE_MAP
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//simply indicates that the engine supports HalfLife maps (BSP version 30, NOT the QER RGBA ones which are also version 30).
-
-//DP_HALFLIFE_MAP_CVAR
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//cvars:
-//halflifebsp 0/1
-//description:
-//engine sets this cvar when loading a map to indicate if it is halflife format or not.
-
-//DP_HALFLIFE_SPRITE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//simply indicates that the engine supports HalfLife sprites.
-
-//DP_INPUTBUTTONS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float button3;
-.float button4;
-.float button5;
-.float button6;
-.float button7;
-.float button8;
-.float button9;
-.float button10;
-.float button11;
-.float button12;
-.float button13;
-.float button14;
-.float button15;
-.float button16;
-//description:
-//set to the state of the +button3, +button4, +button5, +button6, +button7, and +button8 buttons from the client, this does not involve protocol changes (the extra 6 button bits were simply not used).
-//the exact mapping of protocol button bits on the server is:
-//self.button0 = (bits & 1) != 0;
-///* button1 is skipped because mods abuse it as a variable, and accordingly it has no bit */
-//self.button2 = (bits & 2) != 0;
-//self.button3 = (bits & 4) != 0;
-//self.button4 = (bits & 8) != 0;
-//self.button5 = (bits & 16) != 0;
-//self.button6 = (bits & 32) != 0;
-//self.button7 = (bits & 64) != 0;
-//self.button8 = (bits & 128) != 0;
-
-// DP_LIGHTSTYLE_STATICVALUE
-// idea: VorteX
-// darkplaces implementation: VorteX
-// description: allows alternative 'static' lightstyle syntax : "=value"
-// examples: "=0.5", "=2.0", "=2.75"
-// could be used to control switchable lights or making styled lights with brightness > 2
-// Warning: this extension is experimental. It safely works in CSQC, but SVQC use is limited by the fact
-// that other engines (which do not support this extension) could connect to a game and misunderstand this kind of lightstyle syntax
-
-//DP_LITSPRITES
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//indicates this engine supports lighting on sprites, any sprite with ! in its filename (both on disk and in the qc) will be lit rather than having forced EF_FULLBRIGHT (EF_FULLBRIGHT on the entity can still force these sprites to not be lit).
-
-//DP_LITSUPPORT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//indicates this engine loads .lit files for any quake1 format .bsp files it loads to enhance maps with colored lighting.
-//implementation description: these files begin with the header QLIT followed by version number 1 (as little endian 32bit), the rest of the file is a replacement lightmaps lump, except being 3x as large as the lightmaps lump of the map it matches up with (and yes the between-lightmap padding is expanded 3x to keep this consistent), so the lightmap offset in each surface is simply multiplied by 3 during loading to properly index the lit data, and the lit file is loaded instead of the lightmap lump, other renderer changes are needed to display these of course...  see the litsupport.zip sample code (almost a tutorial) at http://icculus.org/twilight/darkplaces for more information.
-
-//DP_MONSTERWALK
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//MOVETYPE_WALK is permitted on non-clients, so bots can move smoothly, run off ledges, etc, just like a real player.
-
-//DP_MOVETYPEBOUNCEMISSILE
-//idea: id Software
-//darkplaces implementation: id Software
-//movetype definitions:
-//float MOVETYPE_BOUNCEMISSILE = 11; // already in defs.qc
-//description:
-//MOVETYPE_BOUNCE but without gravity, and with full reflection (no speed loss like grenades have), in other words - bouncing laser bolts.
-
-//DP_MOVETYPEFLYWORLDONLY
-//idea: Samual
-//darkplaces implementation: Samual
-//movetype definitions:
-float MOVETYPE_FLY_WORLDONLY = 33;
-//description:
-//like MOVETYPE_FLY, but does all traces with MOVE_WORLDONLY, and is ignored by MOVETYPE_PUSH. Should only be combined with SOLID_NOT and SOLID_TRIGGER.
-
-//DP_NULL_MODEL
-//idea: Chris
-//darkplaces implementation: divVerent
-//definitions:
-//string dp_null_model = "null";
-//description:
-//setmodel(e, "null"); makes an entity invisible, have a zero bbox, but
-//networked. useful for shared CSQC entities.
-
-//DP_MOVETYPEFOLLOW
-//idea: id Software, LordHavoc (redesigned)
-//darkplaces implementation: LordHavoc
-//movetype definitions:
-float MOVETYPE_FOLLOW = 12;
-//description:
-//MOVETYPE_FOLLOW implemented, this uses existing entity fields in unusual ways:
-//aiment - the entity this is attached to.
-//punchangle - the original angles when the follow began.
-//view_ofs - the relative origin (note that this is un-rotated by punchangle, and that is actually the only purpose of punchangle).
-//v_angle - the relative angles.
-//here's an example of how you would set a bullet hole sprite to follow a bmodel it was created on, even if the bmodel rotates:
-//hole.movetype = MOVETYPE_FOLLOW; // make the hole follow
-//hole.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid
-//hole.aiment = bmodel; // make the hole follow bmodel
-//hole.punchangle = bmodel.angles; // the original angles of bmodel
-//hole.view_ofs = hole.origin - bmodel.origin; // relative origin
-//hole.v_angle = hole.angles - bmodel.angles; // relative angles
-
-//DP_QC_ASINACOSATANATAN2TAN
-//idea: Urre
-//darkplaces implementation: LordHavoc
-//constant definitions:
-float DEG2RAD = 0.0174532925199432957692369076848861271344287188854172545609719144;
-float RAD2DEG = 57.2957795130823208767981548141051703324054724665643215491602438612;
-float PI      = 3.1415926535897932384626433832795028841971693993751058209749445923;
-//builtin definitions:
-float(float s) asin = #471; // returns angle in radians for a given sin() value, the result is in the range -PI*0.5 to PI*0.5
-float(float c) acos = #472; // returns angle in radians for a given cos() value, the result is in the range 0 to PI
-float(float t) atan = #473; // returns angle in radians for a given tan() value, the result is in the range -PI*0.5 to PI*0.5
-float(float c, float s) atan2 = #474; // returns angle in radians for a given cos() and sin() value pair, the result is in the range -PI to PI (this is identical to vectoyaw except it returns radians rather than degrees)
-float(float a) tan = #475; // returns tangent value (which is simply sin(a)/cos(a)) for the given angle in radians, the result is in the range -infinity to +infinity
-//description:
-//useful math functions for analyzing vectors, note that these all use angles in radians (just like the cos/sin functions) not degrees unlike makevectors/vectoyaw/vectoangles, so be sure to do the appropriate conversions (multiply by DEG2RAD or RAD2DEG as needed).
-//note: atan2 can take unnormalized vectors (just like vectoyaw), and the function was included only for completeness (more often you want vectoyaw or vectoangles), atan2(v_x,v_y) * RAD2DEG gives the same result as vectoyaw(v)
-
-//DP_QC_AUTOCVARS
-//idea: divVerent
-//darkplaces implementation: divVerent
-//description:
-//allows QC variables to be bound to cvars
-//(works for float, string, vector types)
-//example:
-// float autocvar_developer;
-// float autocvar_registered;
-// string autocvar__cl_name;
-//NOTE: copying a string-typed autocvar to another variable/field, and then
-//changing the cvar or returning from progs is UNDEFINED. Writing to autocvar
-//globals is UNDEFINED. Accessing autocvar globals after changing that cvar in
-//the same frame by any means other than cvar_set() from the same QC VM is
-//IMPLEMENTATION DEFINED (an implementation may either yield the previous, or
-//the current, value). Changing them via cvar_set() in the same QC VM
-//immediately must reflect on the autocvar globals. Whether autocvar globals,
-//after restoring a savegame, have the cvar's current value, or the original
-//value at time of saving, is UNDEFINED. Restoring a savegame however must not
-//restore the cvar values themselves.
-//In case the cvar does NOT exist, then it is automatically created with the
-//value of the autocvar initializer, if given. This is possible with e.g.
-//frikqcc and fteqcc the following way:
-// var float autocvar_whatever = 42;
-//If no initializer is given, the cvar will be initialized to a string
-//equivalent to the NULL value of the given data type, that is, the empty
-//string, 0, or '0 0 0'. However, when automatic cvar creation took place, a
-//warning is printed to the game console.
-//NOTE: to prevent an ambiguity with float names for vector types, autocvar
-//names MUST NOT end with _x, _y or _z!
-
-//DP_QC_CHANGEPITCH
-//idea: id Software
-//darkplaces implementation: id Software
-//field definitions:
-.float idealpitch;
-.float pitch_speed;
-//builtin definitions:
-void(entity ent) changepitch = #63;
-//description:
-//equivalent to changeyaw, ent is normally self. (this was a Q2 builtin)
-
-//DP_QC_COPYENTITY
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(entity from, entity to) copyentity = #400;
-//description:
-//copies all data in the entity to another entity.
-
-//DP_QC_CRC16
-//idea: divVerent
-//darkplaces implementation: divVerent
-//Some hash function to build hash tables with. This has to be be the CRC-16-CCITT that is also required for the QuakeWorld download protocol.
-//When caseinsensitive is set, the CRC is calculated of the lower cased string.
-float(float caseinsensitive, string s, ...) crc16 = #494;
-
-//DP_QC_CVAR_DEFSTRING
-//idea: id Software (Doom3), LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-string(string s) cvar_defstring = #482;
-//description:
-//returns the default value of a cvar, as a tempstring.
-
-//DP_QC_CVAR_DESCRIPTION
-//idea: divVerent
-//DarkPlaces implementation: divVerent
-//builtin definitions:
-string(string name) cvar_description = #518;
-//description:
-//returns the description of a cvar
-
-//DP_QC_CVAR_STRING
-//idea: VorteX
-//DarkPlaces implementation: VorteX, LordHavoc
-//builtin definitions:
-string(string s) cvar_string = #448;
-//description:
-//returns the value of a cvar, as a tempstring.
-
-//DP_QC_CVAR_TYPE
-//idea: divVerent
-//DarkPlaces implementation: divVerent
-//builtin definitions:
-float(string name) cvar_type = #495;
-float CVAR_TYPEFLAG_EXISTS = 1;
-float CVAR_TYPEFLAG_SAVED = 2;
-float CVAR_TYPEFLAG_PRIVATE = 4;
-float CVAR_TYPEFLAG_ENGINE = 8;
-float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
-float CVAR_TYPEFLAG_READONLY = 32;
-
-//DP_QC_DIGEST
-//idea: motorsep, Spike
-//DarkPlaces implementation: divVerent
-//builtin definitions:
-string(string digest, string data, ...) digest_hex = #639;
-//description:
-//returns a given hex digest of given data
-//the returned digest is always encoded in hexadecimal
-//only the "MD4" digest is always supported!
-//if the given digest is not supported, string_null is returned
-//the digest string is matched case sensitively, use "MD4", not "md4"!
-
-//DP_QC_DIGEST_SHA256
-//idea: motorsep, Spike
-//DarkPlaces implementation: divVerent
-//description:
-//"SHA256" is also an allowed digest type
-
-//DP_QC_EDICT_NUM
-//idea: 515
-//DarkPlaces implementation: LordHavoc
-//builtin definitions:
-entity(float entnum) edict_num = #459;
-float(entity ent) wasfreed = #353; // same as in EXT_CSQC extension
-//description:
-//edict_num returns the entity corresponding to a given number, this works even for freed entities, but you should call wasfreed(ent) to see if is currently active.
-//wasfreed returns whether an entity slot is currently free (entities that have never spawned are free, entities that have had remove called on them are also free).
-
-//DP_QC_ENTITYDATA
-//idea: KrimZon
-//darkplaces implementation: KrimZon
-//builtin definitions:
-float() numentityfields = #496;
-string(float fieldnum) entityfieldname = #497;
-float(float fieldnum) entityfieldtype = #498;
-string(float fieldnum, entity ent) getentityfieldstring = #499;
-float(float fieldnum, entity ent, string s) putentityfieldstring = #500;
-//constants:
-//Returned by entityfieldtype
-float FIELD_STRING   = 1;
-float FIELD_FLOAT    = 2;
-float FIELD_VECTOR   = 3;
-float FIELD_ENTITY   = 4;
-float FIELD_FUNCTION = 6;
-//description:
-//Versatile functions intended for storing data from specific entities between level changes, but can be customized for some kind of partial savegame.
-//WARNING: .entity fields cannot be saved and restored between map loads as they will leave dangling pointers.
-//numentityfields returns the number of entity fields. NOT offsets. Vectors comprise 4 fields: v, v_x, v_y and v_z.
-//entityfieldname returns the name as a string, eg. "origin" or "classname" or whatever.
-//entityfieldtype returns a value that the constants represent, but the field may be of another type in more exotic progs.dat formats or compilers.
-//getentityfieldstring returns data as would be written to a savegame, eg... "0.05" (float), "0 0 1" (vector), or "Hello World!" (string). Function names can also be returned.
-//putentityfieldstring puts the data returned by getentityfieldstring back into the entity.
-
-//DP_QC_ENTITYSTRING
-void(string s) loadfromdata = #529;
-void(string s) loadfromfile = #530;
-void(string s) callfunction = #605;
-void(float fh, entity e) writetofile = #606;
-float(string s) isfunction = #607;
-void(entity e, string s) parseentitydata = #608;
-
-//DP_QC_ETOS
-//idea: id Software
-//darkplaces implementation: id Software
-//builtin definitions:
-string(entity ent) etos = #65;
-//description:
-//prints "entity 1" or similar into a string. (this was a Q2 builtin)
-
-//DP_QC_EXTRESPONSEPACKET
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions:
-string(void) getextresponse = #624;
-//description:
-//returns a string of the form "\"ipaddress:port\" data...", or the NULL string
-//if no packet was found. Packets can be queued into the client/server by
-//sending a packet starting with "\xFF\xFF\xFF\xFFextResponse " to the
-//listening port.
-
-//DP_QC_FINDCHAIN
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-entity(.string fld, string match) findchain = #402;
-//description:
-//similar to find() but returns a chain of entities like findradius.
-
-//DP_QC_FINDCHAIN_TOFIELD
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions:
-entity(.string fld, float match, .entity tofield) findradius_tofield = #22;
-entity(.string fld, string match, .entity tofield) findchain_tofield = #402;
-entity(.string fld, float match, .entity tofield) findchainflags_tofield = #450;
-entity(.string fld, float match, .entity tofield) findchainfloat_tofield = #403;
-//description:
-//similar to findchain() etc, but stores the chain into .tofield instead of .chain
-//actually, the .entity tofield is an optional field of the the existing findchain* functions
-
-//DP_QC_FINDCHAINFLAGS
-//idea: Sajt
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-entity(.float fld, float match) findchainflags = #450;
-//description:
-//similar to findflags() but returns a chain of entities like findradius.
-
-//DP_QC_FINDCHAINFLOAT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-entity(.entity fld, entity match) findchainentity = #403;
-entity(.float fld, float match) findchainfloat = #403;
-//description:
-//similar to findentity()/findfloat() but returns a chain of entities like findradius.
-
-//DP_QC_FINDFLAGS
-//idea: Sajt
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-entity(entity start, .float fld, float match) findflags = #449;
-//description:
-//finds an entity with the specified flag set in the field, similar to find()
-
-//DP_QC_FINDFLOAT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-entity(entity start, .entity fld, entity match) findentity = #98;
-entity(entity start, .float fld, float match) findfloat = #98;
-//description:
-//finds an entity or float field value, similar to find(), but for entity and float fields.
-
-//DP_QC_FS_SEARCH
-//idea: Black
-//darkplaces implementation: Black
-//builtin definitions:
-float(string pattern, float caseinsensitive, float quiet) search_begin = #444;
-void(float handle) search_end = #445;
-float(float handle) search_getsize = #446;
-string(float handle, float num) search_getfilename = #447;
-//description:
-//search_begin performs a filename search with the specified pattern (for example "maps/*.bsp") and stores the results in a search slot (minimum of 128 supported by any engine with this extension), the other functions take this returned search slot number, be sure to search_free when done (they are also freed on progs reload).
-//search_end frees a search slot (also done at progs reload).
-//search_getsize returns how many filenames were found.
-//search_getfilename returns a filename from the search.
-
-//DP_QC_GETLIGHT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-vector(vector org) getlight = #92;
-//description:
-//returns the lighting at the requested location (in color), 0-255 range (can exceed 255).
-
-//DP_QC_GETSURFACE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-float(entity e, float s) getsurfacenumpoints = #434;
-vector(entity e, float s, float n) getsurfacepoint = #435;
-vector(entity e, float s) getsurfacenormal = #436;
-string(entity e, float s) getsurfacetexture = #437;
-float(entity e, vector p) getsurfacenearpoint = #438;
-vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
-//description:
-//functions to query surface information.
-
-//DP_QC_GETSURFACEPOINTATTRIBUTE
-//idea: BlackHC
-//darkplaces implementation: BlackHC
-// constants
-float SPA_POSITION = 0;
-float SPA_S_AXIS = 1;
-float SPA_T_AXIS = 2;
-float SPA_R_AXIS = 3; // same as SPA_NORMAL
-float SPA_TEXCOORDS0 = 4;
-float SPA_LIGHTMAP0_TEXCOORDS = 5;
-float SPA_LIGHTMAP0_COLOR = 6;
-//builtin definitions:
-vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
-
-//description:
-//function to query extended information about a point on a certain surface
-
-//DP_QC_GETSURFACETRIANGLE
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions:
-float(entity e, float s) getsurfacenumtriangles = #628;
-vector(entity e, float s, float n) getsurfacetriangle = #629;
-//description:
-//function to query triangles of a surface
-
-//DP_QC_GETTAGINFO
-//idea: VorteX, LordHavoc
-//DarkPlaces implementation: VorteX
-//builtin definitions:
-float(entity ent, string tagname) gettagindex = #451;
-vector(entity ent, float tagindex) gettaginfo = #452;
-//description:
-//gettagindex returns the number of a tag on an entity, this number is the same as set by setattachment (in the .tag_index field), allowing the qc to save a little cpu time by keeping the number around if it wishes (this could already be done by calling setattachment and saving off the tag_index).
-//gettaginfo returns the origin of the tag in worldspace and sets v_forward, v_right, and v_up to the current orientation of the tag in worldspace, this automatically resolves all dependencies (attachments, including viewmodelforclient), this means you could fire a shot from a tag on a gun entity attached to the view for example.
-
-//DP_QC_GETTAGINFO_BONEPROPERTIES
-//idea: daemon
-//DarkPlaces implementation: divVerent
-//global definitions:
-float gettaginfo_parent;
-string gettaginfo_name;
-vector gettaginfo_offset;
-vector gettaginfo_forward;
-vector gettaginfo_right;
-vector gettaginfo_up;
-//description:
-//when this extension is present, gettaginfo fills in some globals with info about the bone that had been queried
-//gettaginfo_parent is set to the number of the parent bone, or 0 if it is a root bone
-//gettaginfo_name is set to the name of the bone whose index had been specified in gettaginfo
-//gettaginfo_offset, gettaginfo_forward, gettaginfo_right, gettaginfo_up contain the transformation matrix of the bone relative to its parent. Note that the matrix may contain a scaling component.
-
-//DP_QC_GETTIME
-//idea: tZork
-//darkplaces implementation: tZork, divVerent
-//constant definitions:
-float GETTIME_FRAMESTART = 0; // time of start of frame
-float GETTIME_REALTIME = 1; // current time (may be OS specific)
-float GETTIME_HIRES = 2; // like REALTIME, but may reset between QC invocations and thus can be higher precision
-float GETTIME_UPTIME = 3; // time since start of the engine
-//builtin definitions:
-float(float tmr) gettime = #519;
-//description:
-//some timers to query...
-
-//DP_QC_GETTIME_CDTRACK
-//idea: divVerent
-//darkplaces implementation: divVerent
-//constant definitions:
-float GETTIME_CDTRACK = 4;
-//description:
-//returns the playing time of the current cdtrack when passed to gettime()
-//see DP_END_GETSOUNDTIME for similar functionality but for entity sound channels
-
-//DP_QC_I18N
-//idea: divVerent
-//darkplaces implementation: divVerent
-//description:
-//
-//The engine supports translating by gettext compatible .po files.
-//progs.dat uses progs.dat.<LANGUAGE>.po
-//menu.dat uses menu.dat.<LANGUAGE>.po
-//csprogs.dat uses csprogs.dat.<LANGUAGE>.po
-//
-//To create a string that can be translated, define it as
-//  string dotranslate_FILENOTFOUND = "File not found";
-//Note: if the compiler does constant folding, this will only work if there is
-//no other "File not found" string in the progs!
-//
-//Alternatively, if using the Xonotic patched fteqcc compiler, you can simplify
-//this by using _("File not found") directly in the source code.
-//
-//The language is set by the "prvm_language" cvar: if prvm_language is set to
-//"de", it will read progs.dat.de.po for translating strings in progs.dat.
-//
-//If prvm_language is set to the special name "dump", progs.dat.pot will be
-//written, which is a translation template to be edited by filling out the
-//msgstr entries.
-
-//DP_QC_LOG
-//darkplaces implementation: divVerent
-//builtin definitions:
-float log(float f) = #532;
-//description:
-//logarithm
-
-//DP_QC_MINMAXBOUND
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-float(float a, float b, ...) min = #94;
-float(float a, float b, float c) min3 = #94;
-float(float a, float b, float c, float d) min4 = #94;
-float(float a, float b, float c, float d, float e) min5 = #94;
-float(float a, float b, float c, float d, float e, float f) min6 = #94;
-float(float a, float b, float c, float d, float e, float f, float g) min7 = #94;
-float(float a, float b, float c, float d, float e, float f, float g, float h) min8 = #94;
-float(float a, float b, ...) max = #95;
-float(float a, float b, float c) max3 = #95;
-float(float a, float b, float c, float d) max4 = #95;
-float(float a, float b, float c, float d, float e) max5 = #95;
-float(float a, float b, float c, float d, float e, float f) max6 = #95;
-float(float a, float b, float c, float d, float e, float f, float g) max7 = #95;
-float(float a, float b, float c, float d, float e, float f, float g, float h) max8 = #95;
-float(float minimum, float val, float maximum) bound = #96;
-//description:
-//min returns the lowest of all the supplied numbers.
-//max returns the highest of all the supplied numbers.
-//bound clamps the value to the range and returns it.
-
-//DP_QC_MULTIPLETEMPSTRINGS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//this extension makes all builtins returning tempstrings (ftos for example)
-//cycle through a pool of multiple tempstrings (at least 16), allowing
-//multiple ftos results to be gathered before putting them to use, normal
-//quake only had 1 tempstring, causing many headaches.
-//
-//Note that for longer term storage (or compatibility on engines having
-//FRIK_FILE but not this extension) the FRIK_FILE extension's
-//strzone/strunzone builtins provide similar functionality (slower though).
-//
-//NOTE: this extension is superseded by DP_QC_UNLIMITEDTEMPSTRINGS
-
-//DP_QC_NUM_FOR_EDICT
-//idea: Blub\0
-//darkplaces implementation: Blub\0
-//Function to get the number of an entity - a clean way.
-float(entity num) num_for_edict = #512;
-
-//DP_QC_RANDOMVEC
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-vector() randomvec = #91;
-//description:
-//returns a vector of length < 1, much quicker version of this QC: do {v_x = random()*2-1;v_y = random()*2-1;v_z = random()*2-1;} while(vlen(v) > 1)
-
-//DP_QC_SINCOSSQRTPOW
-//idea: id Software, LordHavoc
-//darkplaces implementation: id Software, LordHavoc
-//builtin definitions:
-float(float val) sin = #60;
-float(float val) cos = #61;
-float(float val) sqrt = #62;
-float(float a, float b) pow = #97;
-//description:
-//useful math functions, sine of val, cosine of val, square root of val, and raise a to power b, respectively.
-
-//DP_QC_SPRINTF
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions:
-string(string format, ...) sprintf = #627;
-//description:
-//you know sprintf :P
-//supported stuff:
-//  %
-//  optional: <argpos>$ for the argument to format
-//  flags: #0- +
-//  optional: <width>, *, or *<argpos>$ for the field width
-//  optional: .<precision>, .*, or .*<argpos>$ for the precision
-//  length modifiers: h for forcing a float, l for forcing an int/entity (by default, %d etc. cast a float to int)
-//  conversions:
-//    d takes a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an int
-//    i takes an int/entity if no length is specified or i is, and a float if h is specified as length, and cast it to an int
-//    ouxXc take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an unsigned int
-//    eEfFgG take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to a double
-//    s takes a string
-//    vV takes a vector, and processes the three components as if it were a gG for all three components, separated by space
-//    For conversions s and c, the flag # makes precision and width interpreted
-//      as byte count, by default it is interpreted as character count in UTF-8
-//      enabled engines. No other conversions can create wide characters, and #
-//      has another meaning in these. When in character count mode, color codes
-//      are ignored. To get UTF-8 semantics WITHOUT color code parsing, use
-//      the + flag.
-
-//DP_QC_STRFTIME
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-string(float uselocaltime, string format, ...) strftime = #478;
-//description:
-//provides the ability to get the local (in your timezone) or world (Universal Coordinated Time) time as a string using the formatting of your choice:
-//example: "%Y-%m-%d %H:%M:%S"   (result looks like: 2007-02-08 01:03:15)
-//note: "%F %T" gives the same result as "%Y-%m-%d %H:%M:%S" (ISO 8601 date format and 24-hour time)
-//for more format codes please do a web search for strftime 3 and you should find the man(3) pages for this standard C function.
-//
-//practical uses:
-//changing day/night cycle (shops closing, monsters going on the prowl) in an RPG, for this you probably want to use s = strftime(TRUE, "%H");hour = stof(s);
-//printing current date/time for competitive multiplayer games, such as the beginning/end of each round in real world time.
-//activating eastereggs in singleplayer games on certain dates.
-//
-//note: some codes such as %x and %X use your locale settings and thus may not make sense to international users, it is not advisable to use these as the server and clients may be in different countries.
-//note: if you display local time to a player, it would be a good idea to note whether it is local time using a string like "%F %T (local)", and otherwise use "%F %T (UTC)".
-//note: be aware that if the game is saved and reloaded a week later the date and time will be different, so if activating eastereggs in a singleplayer game or something you may want to only check when a level is loaded and then keep the same easteregg state throughout the level so that the easteregg does not deactivate when reloading from a savegame (also be aware that precaches should not depend on such date/time code because reloading a savegame often scrambles the precaches if so!).
-//note: this function can return a NULL string (you can check for it with if (!s)) if the localtime/gmtime functions returned NULL in the engine code, such as if those functions don't work on this platform (consoles perhaps?), so be aware that this may return nothing.
-
-//DP_QC_STRINGCOLORFUNCTIONS
-//idea: Dresk
-//darkplaces implementation: Dresk
-//builtin definitions:
-float(string s) strlennocol = #476; // returns how many characters are in a string, minus color codes
-string(string s) strdecolorize = #477; // returns a string minus the color codes of the string provided
-//description:
-//provides additional functionality to strings by supporting functions that isolate and identify strings with color codes
-
-//DP_QC_STRING_CASE_FUNCTIONS
-//idea: Dresk
-//darkplaces implementation: LordHavoc / Dresk
-//builtin definitions:
-string(string s) strtolower = #480; // returns the passed in string in pure lowercase form
-string(string s) strtoupper = #481; // returns the passed in string in pure uppercase form
-//description:
-//provides simple string uppercase and lowercase functions
-
-//DP_QC_TOKENIZEBYSEPARATOR
-//idea: Electro, SavageX, LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-float(string s, string separator1, ...) tokenizebyseparator = #479;
-//description:
-//this function returns tokens separated by any of the supplied separator strings, example:
-//numnumbers = tokenizebyseparator("10.2.3.4", ".");
-//returns 4 and the tokens are "10" "2" "3" "4"
-//possibly useful for parsing IPv4 addresses (such as "1.2.3.4") and IPv6 addresses (such as "[1234:5678:9abc:def0:1234:5678:9abc:def0]:26000")
-
-//DP_QC_TOKENIZE_CONSOLE
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions:
-float(string s) tokenize_console = #514;
-float(float i) argv_start_index = #515;
-float(float i) argv_end_index = #516;
-//description:
-//this function returns tokens separated just like the console does
-//also, functions are provided to get the index of the first and last character of each token in the original string
-//Passing negative values to them, or to argv, will be treated as indexes from the LAST token (like lists work in Perl). So argv(-1) will return the LAST token.
-
-//DP_QC_TRACEBOX
-//idea: id Software
-//darkplaces implementation: id Software
-//builtin definitions:
-void(vector v1, vector min, vector max, vector v2, float nomonsters, entity forent) tracebox = #90;
-//description:
-//similar to traceline but much more useful, traces a box of the size specified (technical note: in quake1 and halflife bsp maps the mins and maxs will be rounded up to one of the hull sizes, quake3 bsp does not have this problem, this is the case with normal moving entities as well).
-
-//DP_QC_TRACETOSS
-//idea: id Software
-//darkplaces implementation: id Software
-//builtin definitions:
-void(entity ent, entity ignore) tracetoss = #64;
-//description:
-//simulates movement of the entity as if it is MOVETYPE_TOSS and starting with it's current state (location, velocity, etc), returns relevant trace_ variables (trace_fraction is always 0, all other values are supported - trace_ent, trace_endpos, trace_plane_normal), does not actually alter the entity.
-
-//DP_QC_TRACE_MOVETYPE_HITMODEL
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//constant definitions:
-float MOVE_HITMODEL = 4;
-//description:
-//allows traces to hit alias models (not sprites!) instead of entity boxes, use as the nomonsters parameter to trace functions, note that you can hit invisible model entities (alpha < 0 or EF_NODRAW or model "", it only checks modelindex)
-
-//DP_QC_TRACE_MOVETYPE_WORLDONLY
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//constant definitions:
-float MOVE_WORLDONLY = 3;
-//description:
-//allows traces to hit only world (ignoring all entities, unlike MOVE_NOMONSTERS which hits all bmodels), use as the nomonsters parameter to trace functions
-
-//DP_QC_UNLIMITEDTEMPSTRINGS
-//idea: divVerent
-//darkplaces implementation: LordHavoc
-//description:
-//this extension alters Quake behavior such that instead of reusing a single
-//tempstring (or multiple) there are an unlimited number of tempstrings, which
-//are removed only when a QC function invoked by the engine returns,
-//eliminating almost all imaginable concerns with string handling in QuakeC.
-//
-//in short:
-//you can now use and abuse tempstrings as much as you like, you still have to
-//use strzone (FRIK_FILE) for permanent storage however.
-//
-//
-//
-//implementation notes for other engine coders:
-//these tempstrings are expected to be stored in a contiguous buffer in memory
-//which may be fixed size or controlled by a cvar, or automatically grown on
-//demand (in the case of DarkPlaces).
-//
-//this concept is similar to quake's Zone system, however these are all freed
-//when the QC interpreter returns.
-//
-//this is basically a poor man's garbage collection system for strings.
-
-//DP_QC_VECTOANGLES_WITH_ROLL
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-vector(vector forward, vector up) vectoangles2 = #51; // same number as vectoangles
-//description:
-//variant of vectoangles that takes an up vector to calculate roll angle (also uses this to calculate yaw correctly if the forward is straight up or straight down)
-//note: just like normal vectoangles you need to negate the pitch of the returned angles if you want to feed them to makevectors or assign to self.v_angle
-
-//DP_QC_VECTORVECTORS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector dir) vectorvectors = #432;
-//description:
-//creates v_forward, v_right, and v_up vectors given a forward vector, similar to makevectors except it takes a forward direction vector instead of angles.
-
-//DP_QC_WHICHPACK
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions:
-string(string filename) whichpack = #503;
-//description:
-//returns the name of the pak/pk3/whatever containing the given file, in the same path space as FRIK_FILE functions use (that is, possibly with a path name prefix)
-
-//DP_QC_URI_ESCAPE
-//idea: divVerent
-//darkplaces implementation: divVerent
-//URI::Escape's functionality
-string(string in) uri_escape = #510;
-string(string in) uri_unescape = #511;
-
-//DP_QC_URI_GET
-//idea: divVerent
-//darkplaces implementation: divVerent
-//loads text from an URL into a string
-//returns 1 on success of initiation, 0 if there are too many concurrent
-//connections already or if the URL is invalid
-//the following callback will receive the data and MUST exist!
-//  void(float id, float status, string data) URI_Get_Callback;
-//status is either
-//  negative for an internal error,
-//  0 for success, or
-//  the HTTP response code on server error (e.g. 404)
-//if 1 is returned by uri_get, the callback will be called in the future
-float(string url, float id) uri_get = #513;
-
-//DP_QC_URI_POST
-//idea: divVerent
-//darkplaces implementation: divVerent
-//loads text from an URL into a string after POSTing via HTTP
-//works like uri_get, but uri_post sends data with Content-Type: content_type to the server
-//and uri_post sends the string buffer buf, joined using the delimiter delim
-float(string url, float id, string content_type, string data) uri_post = #513;
-float(string url, float id, string content_type, string delim, float buf) uri_postbuf = #513;
-
-//DP_SKELETONOBJECTS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//this extension indicates that FTE_CSQC_SKELETONOBJECTS functionality is available in server QC (as well as CSQC).
-
-//DP_SV_SPAWNFUNC_PREFIX
-//idea: divVerent
-//darkplaces implementation: divVerent
-//Make functions whose name start with spawnfunc_ take precedence as spawn function for loading entities.
-//Useful if you have a field ammo_shells (required in any Quake mod) but want to support spawn functions called ammo_shells (like in Q3A).
-//Optionally, you can declare a global "float require_spawnfunc_prefix;" which will require ANY spawn function to start with that prefix.
-
-
-//DP_QUAKE2_MODEL
-//idea: quake community
-//darkplaces implementation: LordHavoc
-//description:
-//shows that the engine supports Quake2 .md2 files.
-
-//DP_QUAKE2_SPRITE
-//idea: LordHavoc
-//darkplaces implementation: Elric
-//description:
-//shows that the engine supports Quake2 .sp2 files.
-
-//DP_QUAKE3_MAP
-//idea: quake community
-//darkplaces implementation: LordHavoc
-//description:
-//shows that the engine supports Quake3 .bsp files.
-
-//DP_QUAKE3_MODEL
-//idea: quake community
-//darkplaces implementation: LordHavoc
-//description:
-//shows that the engine supports Quake3 .md3 files.
-
-//DP_REGISTERCVAR
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-float(string name, string value) registercvar = #93;
-//description:
-//adds a new console cvar to the server console (in singleplayer this is the player's console), the cvar exists until the mod is unloaded or the game quits.
-//NOTE: DP_CON_SET is much better.
-
-//DP_SND_DIRECTIONLESSATTNNONE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//make sounds with ATTN_NONE have no spatialization (enabling easy use as music sources).
-
-//DP_SND_FAKETRACKS
-//idea: requested
-
-//darkplaces implementation: Elric
-//description:
-//the engine plays sound/cdtracks/track001.wav instead of cd track 1 and so on if found, this allows games and mods to have music tracks without using ambientsound.
-//Note: also plays .ogg with DP_SND_OGGVORBIS extension.
-
-//DP_SND_SOUND7_WIP1
-//DP_SND_SOUND7_WIP2
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions:
-void(entity e, float chan, string samp, float vol, float atten, float speed, float flags) sound7 = #8;
-float SOUNDFLAG_RELIABLE = 1;
-//description:
-//plays a sound, with some more flags
-//extensions to sound():
-//- channel may be in the range from -128 to 127; channels -128 to 0 are "auto",
-//  i.e. support multiple sounds at once, but cannot be stopped/restarted
-//- a value 0 in the speed parameter means no change; otherwise, it is a
-//  percentage of playback speed ("pitch shifting"). 100 is normal pitch, 50 is
-//  half speed, 200 is double speed, etc. (DP_SND_SOUND7_WIP2)
-//- the flag SOUNDFLAG_RELIABLE can be specified, which makes the sound send
-//  to MSG_ALL (reliable) instead of MSG_BROADCAST (unreliable, default);
-//  similarily, SOUNDFLAG_RELIABLE_TO_ONE sends to MSG_ONE
-//- channel 0 is controlled by snd_channel0volume; channel 1 and -1 by
-//  snd_channel1volume, etc. (so, a channel shares the cvar with its respective
-//  auto-channel); however, the mod MUST define snd_channel8volume and upwards
-//  in default.cfg if they are to be used, as the engine does not create them
-//  to not litter the cvar list
-//- this extension applies to CSQC as well; CSQC_Event_Sound will get speed and
-//  flags as extra 7th and 8th argument
-//- WIP2 ideas: SOUNDFLAG_RELIABLE_TO_ONE, SOUNDFLAG_NOPHS, SOUNDFLAG_FORCELOOP
-//- NOTE: to check for this, ALSO OR a check with DP_SND_SOUND7 to also support
-//  the finished extension once done
-
-//DP_SND_OGGVORBIS
-//idea: Transfusion
-//darkplaces implementation: Elric
-//description:
-//the engine supports loading Ogg Vorbis sound files.  Use either the .ogg filename directly, or a .wav of the same name (will try to load the .wav first and then .ogg).
-
-//DP_SND_STEREOWAV
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//the engine supports stereo WAV files.  (useful with DP_SND_DIRECTIONLESSATTNNONE for music)
-
-//DP_SND_GETSOUNDTIME
-//idea: VorteX
-//darkplaces implementation: VorteX
-//constant definitions:
-float(entity e, float channel) getsoundtime = #533; // get currently sound playing position on entity channel, -1 if not playing or error
-float(string sample) soundlength = #534; // returns length of sound sample in seconds, -1 on error (sound not precached, sound system not initialized etc.)
-//description: provides opportunity to query length of sound samples and realtime tracking of sound playing on entities (similar to DP_GETTIME_CDTRACK)
-//note: beware dedicated server not running sound engine at all, so in dedicated mode this builtins will not work in server progs
-//note also: menu progs not supporting getsoundtime() (will give a warning) since it has no sound playing on entities
-//examples of use:
-//  - QC-driven looped sounds
-//  - QC events when sound playing is finished
-//  - toggleable ambientsounds
-//  - subtitles
-
-//DP_VIDEO_DPV
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//console commands:
-//  playvideo <videoname> - start playing video
-//  stopvideo - stops current video
-//description: indicated that engine support playing videos in DPV format
-
-//DP_VIDEO_SUBTITLES
-//idea: VorteX
-//darkplaces implementation: VorteX
-//cvars:
-//  cl_video_subtitles - toggles subtitles showing
-//  cl_video_subtitles_lines - how many lines to reserve for subtitles
-//  cl_video_subtitles_textsize - font size
-//console commands:
-//  playvideo <videoname> <custom_subtitles_file> - start playing video
-//  stopvideo - stops current video
-//description: indicates that engine support subtitles on videos
-//subtitles stored in external text files, each video file has it's default subtitles file ( <videoname>.dpsubs )
-//example: for video/act1.dpv default subtitles file will be video/act1.dpsubs
-//also video could be played with custom subtitles file by utilizing second parm of playvideo command
-//syntax of .dpsubs files: each line in .dpsubs file defines 1 subtitle, there are three tokens:
-//   <start> <end> "string"
-//   start: subtitle start time in seconds
-//     end: subtitle time-to-show in seconds, if 0 - subtitle will be showed until next subtitle is started,
-//          if below 0 - show until next subtitles minus this number of seconds
-//    text: subtitle text, color codes (Q3-style and ^xRGB) are allowed
-//example of subtitle file:
-//   3 0       "Vengeance! Vengeance for my eternity of suffering!"
-//   9 0       "Whelp! As if you knew what eternity was!"
-//   13        0       "Grovel before your true master."
-//   17        0       "Never!"
-//   18        7       "I'll hack you from crotch to gizzard and feed what's left of you to your brides..."
-
-//DP_SOLIDCORPSE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//solid definitions:
-float SOLID_CORPSE = 5;
-//description:
-//the entity will not collide with SOLID_CORPSE and SOLID_SLIDEBOX entities (and likewise they will not collide with it), this is useful if you want dead bodies that are shootable but do not obstruct movement by players and monsters, note that if you traceline with a SOLID_SLIDEBOX entity as the ignoreent, it will ignore SOLID_CORPSE entities, this is desirable for visibility and movement traces, but not for bullets, for the traceline to hit SOLID_CORPSE you must temporarily force the player (or whatever) to SOLID_BBOX and then restore to SOLID_SLIDEBOX after the traceline.
-
-//DP_SPRITE32
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//the engine supports .spr32 sprites.
-
-//DP_SV_BOTCLIENT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//constants:
-float CLIENTTYPE_DISCONNECTED = 0;
-float CLIENTTYPE_REAL = 1;
-float CLIENTTYPE_BOT = 2;
-float CLIENTTYPE_NOTACLIENT = 3;
-//builtin definitions:
-entity() spawnclient = #454; // like spawn but for client slots (also calls relevant connect/spawn functions), returns world if no clients available
-float(entity clent) clienttype = #455; // returns one of the CLIENTTYPE_* constants
-//description:
-//spawns a client with no network connection, to allow bots to use client slots with no hacks.
-//How to use:
-/*
-       // to spawn a bot
-       local entity oldself;
-       oldself = self;
-       self = spawnclient();
-       if (!self)
-       {
-               bprint("Can not add bot, server full.\n");
-               self = oldself;
-               return;
-       }
-       self.netname = "Yoyobot";
-       self.clientcolors = 12 * 16 + 4; // yellow (12) shirt and red (4) pants
-       ClientConnect();
-       PutClientInServer();
-       self = oldself;
-
-       // to remove all bots
-       local entity head;
-       head = find(world, classname, "player");
-       while (head)
-       {
-               if (clienttype(head) == CLIENTTYPE_BOT)
-                       dropclient(head);
-               head = find(head, classname, "player");
-       }
-
-       // to identify if a client is a bot (for example in PlayerPreThink)
-       if (clienttype(self) == CLIENTTYPE_BOT)
-               botthink();
-*/
-//see also DP_SV_CLIENTCOLORS DP_SV_CLIENTNAME DP_SV_DROPCLIENT
-//How it works:
-//creates a new client, calls SetNewParms and stores the parms, and returns the client.
-//this intentionally does not call SV_SendServerinfo to allow the QuakeC a chance to set the netname and clientcolors fields before actually spawning the bot by calling ClientConnect and PutClientInServer manually
-//on level change ClientConnect and PutClientInServer are called by the engine to spawn in the bot (this is why clienttype() exists to tell you on the next level what type of client this is).
-//parms work the same on bot clients as they do on real clients, and do carry from level to level
-
-//DP_SV_BOUNCEFACTOR
-//idea: divVerent
-//darkplaces implementation: divVerent
-//field definitions:
-.float bouncefactor; // velocity multiplier after a bounce
-.float bouncestop; // bounce stops if velocity to bounce plane is < bouncestop * gravity AFTER the bounce
-//description:
-//allows qc to customize MOVETYPE_BOUNCE a bit
-
-//DP_SV_CLIENTCAMERA
-//idea: LordHavoc, others
-//darkplaces implementation: Black
-//field definitions:
-.entity clientcamera; // override camera entity
-//description:
-//allows another entity to be the camera for a client, for example a remote camera, this is similar to sending svc_setview manually except that it also changes the network culling appropriately.
-
-//DP_SV_CLIENTCOLORS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float clientcolors; // colors of the client (format: pants + shirt * 16)
-//description:
-//allows qc to read and modify the client colors associated with a client entity (not particularly useful on other entities), and automatically sends out any appropriate network updates if changed
-
-//DP_SV_CLIENTNAME
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//description:
-//allows qc to modify the client's .netname, and automatically sends out any appropriate network updates if changed
-
-//DP_SV_CUSTOMIZEENTITYFORCLIENT
-//idea: LordHavoc
-//darkplaces implementation: [515] and LordHavoc
-//field definitions:
-.float() customizeentityforclient; // self = this entity, other = client entity
-//description:
-//allows qc to modify an entity before it is sent to each client, the function returns TRUE if it should send, FALSE if it should not, and is fully capable of editing the entity's fields, this allows cloaked players to appear less transparent to their teammates, navigation markers to only show to their team, etc
-//tips on writing customize functions:
-//it is a good idea to return FALSE early in the function if possible to reduce cpu usage, because this function may be called many thousands of times per frame if there are many customized entities on a 64+ player server.
-//you are free to change anything in self, but please do not change any other entities (the results may be very inconsistent).
-//example ideas for use of this extension:
-//making icons over teammates' heads which are only visible to teammates.  for exasmple: float() playericon_customizeentityforclient = {return self.owner.team == other.team;};
-//making cloaked players more visible to their teammates than their enemies.  for example: float() player_customizeentityforclient = {if (self.items & IT_CLOAKING) {if (self.team == other.team) self.alpha = 0.6;else self.alpha = 0.1;} return TRUE;};
-//making explosion models that face the viewer (does not work well with chase_active).  for example: float() explosion_customizeentityforclient = {self.angles = vectoangles(other.origin + other.view_ofs - self.origin);self.angles_x = 0 - self.angles_x;};
-//implementation notes:
-//entity customization is done before per-client culling (visibility for instance) because the entity may be doing setorigin to display itself in different locations on different clients, may be altering its .modelindex, .effects and other fields important to culling, so customized entities increase cpu usage (non-customized entities can use all the early culling they want however, as they are not changing on a per client basis).
-
-//DP_SV_DISCARDABLEDEMO
-//idea: parasti
-//darkplaces implementation: parasti
-//field definitions:
-.float discardabledemo;
-//description:
-//when this field is set to a non-zero value on a player entity, a possibly recorded server-side demo for the player is discarded
-//Note that this extension only works if:
-//  auto demos are enabled (the cvar sv_autodemo_perclient is set)
-//  discarding demos is enabled (the cvar sv_autodemo_perclient_discardable is set)
-
-//DP_SV_DRAWONLYTOCLIENT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.entity drawonlytoclient;
-//description:
-//the entity is only visible to the specified client.
-
-//DP_SV_DROPCLIENT
-//idea: FrikaC
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(entity clent) dropclient = #453;
-//description:
-//causes the server to immediately drop the client, more reliable than stuffcmd(clent, "disconnect\n"); which could be intentionally ignored by the client engine
-
-//DP_SV_EFFECT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404;
-//SVC definitions:
-//float svc_effect = #52; // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate
-//float svc_effect2 = #53; // [vector] org [short] modelindex [byte] startframe [byte] framecount [byte] framerate
-//description:
-//clientside playback of simple custom sprite effects (explosion sprites, etc).
-
-//DP_SV_ENTITYCONTENTSTRANSITION
-//idea: Dresk
-//darkplaces implementation: Dresk
-//field definitions:
-.void(float nOriginalContents, float nNewContents) contentstransition;
-//description:
-//This field function, when provided, is triggered on an entity when the contents (ie. liquid / water / etc) is changed.
-//The first parameter provides the entities original contents, prior to the transition.  The second parameter provides the new contents.
-//NOTE: If this field function is provided on an entity, the standard watersplash sound IS SUPPRESSED to allow for authors to create their own transition sounds.
-
-//DP_SV_MOVETYPESTEP_LANDEVENT
-//idea: Dresk
-//darkplaces implementation: Dresk
-//field definitions:
-.void(vector vImpactVelocity) movetypesteplandevent;
-//description:
-//This field function, when provided, is triggered on a MOVETYPE_STEP entity when it experiences  "land event".
-// The standard engine behavior for this event is to play the sv_sound_land CVar sound.
-//The parameter provides the velocity of the entity at the time of the impact.  The z value may therefore be used to calculate how "hard" the entity struck the surface.
-//NOTE: If this field function is provided on a MOVETYPE_STEP entity, the standard sv_sound_land sound IS SUPPRESSED to allow for authors to create their own feedback.
-
-//DP_SV_POINTSOUND
-//idea: Dresk
-//darkplaces implementation: Dresk
-//builtin definitions:
-void(vector origin, string sample, float volume, float attenuation) pointsound = #483;
-//description:
-//Similar to the standard QC sound function, this function takes an origin instead of an entity and omits the channel parameter.
-// This allows sounds to be played at arbitrary origins without spawning entities.
-
-//DP_SV_ONENTITYNOSPAWNFUNCTION
-//idea: Dresk
-//darkplaces implementation: Dresk
-//engine-called QC prototypes:
-//void() SV_OnEntityNoSpawnFunction;
-//description:
-// This function is called whenever an entity on the server has no spawn function, and therefore has no defined QC behavior.
-// You may as such dictate the behavior as to what happens to the entity.
-// To mimic the engine's default behavior, simply call remove(self).
-
-//DP_SV_ONENTITYPREPOSTSPAWNFUNCTION
-//idea: divVerent
-//darkplaces implementation: divVerent
-//engine-called QC prototypes:
-//void() SV_OnEntityPreSpawnFunction;
-//void() SV_OnEntityPostSpawnFunction;
-//description:
-// These functions are called BEFORE or AFTER an entity is spawned the regular way.
-// You may as such dictate the behavior as to what happens to the entity.
-// SV_OnEntityPreSpawnFunction is called before even looking for the spawn function, so you can even change its classname in there. If it remove()s the entity, the spawn function will not be looked for.
-// SV_OnEntityPostSpawnFunction is called ONLY after its spawn function or SV_OnEntityNoSpawnFunction was called, and skipped if the entity got removed by either.
-
-//DP_SV_MODELFLAGS_AS_EFFECTS
-//idea: LordHavoc, Dresk
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float modelflags;
-//constant definitions:
-float EF_NOMODELFLAGS = 8388608; // ignore any effects in a model file and substitute your own
-float MF_ROCKET  =   1; // leave a trail
-float MF_GRENADE =   2; // leave a trail
-float MF_GIB     =   4; // leave a trail
-float MF_ROTATE  =   8; // rotate (bonus items)
-float MF_TRACER  =  16; // green split trail
-float MF_ZOMGIB  =  32; // small blood trail
-float MF_TRACER2 =  64; // orange split trail
-float MF_TRACER3 = 128; // purple trail
-//description:
-//this extension allows model flags to be specified on entities so you can add a rocket trail and glow to any entity, etc.
-//setting any of these will override the flags the model already has, to disable the model's flags without supplying any of your own you must use EF_NOMODELFLAGS.
-//
-//silly example modification #1 to W_FireRocket in weapons.qc:
-//missile.effects = EF_NOMODELFLAGS; // rocket without a glow/fire trail
-//silly example modification #2 to W_FireRocket in weapons.qc:
-//missile.modelflags = MF_GIB; // leave a blood trail instead of glow/fire trail
-//
-//note: you can not combine multiple kinds of trail, only one of them will be active, you can combine MF_ROTATE and the other MF_ flags however, and using EF_NOMODELFLAGS along with these does no harm.
-//
-//note to engine coders: they are internally encoded in the protocol as extra EF_ flags (shift the values left 24 bits and send them in the protocol that way), so no protocol change was required (however 32bit effects is a protocol extension itself), within the engine they are referred to as EF_ for the 24bit shifted values.
-
-//DP_SV_NETADDRESS
-//idea: Dresk
-//darkplaces implementation: Dresk
-//field definitions:
-.string netaddress;
-//description:
-// provides the netaddress of the associated entity (ie. 127.0.0.1) and "null/botclient" if the netconnection of the entity is invalid
-
-//DP_SV_NODRAWTOCLIENT
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.entity nodrawtoclient;
-//description:
-//the entity is not visible to the specified client.
-
-//DP_SV_PING
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float ping;
-//description:
-//continuously updated field indicating client's ping (based on average of last 16 packet time differences).
-
-//DP_SV_PING_PACKETLOSS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float ping_packetloss;
-.float ping_movementloss;
-//description:
-//continuously updated field indicating client's packet loss, and movement loss (i.e. packet loss affecting player movement).
-
-//DP_SV_POINTPARTICLES
-//idea: Spike
-//darkplaces implementation: LordHavoc
-//function definitions:
-float(string effectname) particleeffectnum = #335; // same as in CSQC
-void(entity ent, float effectnum, vector start, vector end) trailparticles = #336; // same as in CSQC
-void(float effectnum, vector org, vector vel, float howmany) pointparticles = #337; // same as in CSQC
-//SVC definitions:
-//float svc_trailparticles = 60; // [short] entnum [short] effectnum [vector] start [vector] end
-//float svc_pointparticles = 61; // [short] effectnum [vector] start [vector] velocity [short] count
-//float svc_pointparticles1 = 62; // [short] effectnum [vector] start, same as svc_pointparticles except velocity is zero and count is 1
-//description:
-//provides the ability to spawn non-standard particle effects, typically these are defined in a particle effect information file such as effectinfo.txt in darkplaces.
-//this is a port of particle effect features from clientside QC (EXT_CSQC) to server QC, as these effects are potentially useful to all games even if they do not make use of EXT_CSQC.
-//warning: server must have same order of effects in effectinfo.txt as client does or the numbers would not match up, except for standard quake effects which are always the same numbers.
-
-//DP_SV_PUNCHVECTOR
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.vector punchvector;
-//description:
-//offsets client view in worldspace, similar to view_ofs but all 3 components are used and are sent with at least 8 bits of fraction, this allows the view to be kicked around by damage or hard landings or whatever else, note that unlike punchangle this is not faded over time, it is up to the mod to fade it (see also DP_SV_PLAYERPHYSICS).
-
-//DP_SV_PLAYERPHYSICS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.vector movement;
-//cvar definitions:
-//"sv_playerphysicsqc" (0/1, default 1, allows user to disable qc player physics)
-//engine-called QC prototypes:
-//void() SV_PlayerPhysics;
-//description:
-//.movement vector contains the movement input from the player, allowing QC to do as it wishs with the input, and SV_PlayerPhysics will completely replace the player physics if present (works for all MOVETYPE's), see darkplaces mod source for example of this function (in playermovement.qc, adds HalfLife ladders support, as well as acceleration/deceleration while airborn (rather than the quake sudden-stop while airborn), and simplifies the physics a bit)
-
-//DP_PHYSICS_ODE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//globals:
-//new movetypes:
-const float MOVETYPE_PHYSICS = 32; // need to be set before any physics_* builtins applied
-//new solid types (deprecated):
-const float SOLID_PHYSICS_BOX = 32;
-const float SOLID_PHYSICS_SPHERE = 33;
-const float SOLID_PHYSICS_CAPSULE = 34;
-const float SOLID_PHYSICS_TRIMESH = 35;
-const float SOLID_PHYSICS_CYLINDER = 36;
-//geometry types:
-const float GEOMTYPE_NONE = -1;       // entity will be entirely skipped by ODE
-const float GEOMTYPE_SOLID = 0;       // geometry type will be set based on .solid field
-const float GEOMTYPE_BOX = 1;         // entity bound box
-const float GEOMTYPE_SPHERE = 2;      // sphere with radius picked from x axis of entity bound box
-const float GEOMTYPE_CAPSULE = 3;     // with leading axis automatically determined from longest one, radius is picked as minimal of the rest 2 axes
-const float GEOMTYPE_TRIMESH = 4;     // triangle mesh
-const float GEOMTYPE_CYLINDER = 5;    // like capsule but not capped
-                                      // note that ODE's builtin cylinder support is experimental, somewhat bugged and unfinished (no cylinder-cylinder collision)
-                                                                         // to use properly working cylinder should build ODE with LIBCCD extension
-const float GEOMTYPE_CAPSULE_X = 6;   // capsule with fixed leading axis
-const float GEOMTYPE_CAPSULE_Y = 7;
-const float GEOMTYPE_CAPSULE_Z = 8;
-const float GEOMTYPE_CYLINDER_X        = 9;  // cylinder with fixed leading axis
-const float GEOMTYPE_CYLINDER_Y        = 10;
-const float GEOMTYPE_CYLINDER_Z        = 11;
-//joint types:
-const float JOINTTYPE_NONE = 0;
-const float JOINTTYPE_POINT = 1;
-const float JOINTTYPE_HINGE = 2;
-const float JOINTTYPE_SLIDER = 3;
-const float JOINTTYPE_UNIVERSAL = 4;
-const float JOINTTYPE_HINGE2 = 5;
-const float JOINTTYPE_FIXED = -1;
-//force types:
-const float FORCETYPE_NONE = 0;
-const float FORCETYPE_FORCE = 1; // applied at center of mass
-const float FORCETYPE_FORCEATPOS = 2;
-const float FORCETYPE_TORQUE = 3;
-// common joint properties:
-// .entity aiment; // connected objects
-// .entity enemy; // connected objects, forces
-// .vector movedir;
-//   for a spring:
-//     movedir_x = spring constant (force multiplier, must be > 0)
-//     movedir_y = spring dampening constant to prevent oscillation (must be > 0)
-//     movedir_z = spring stop position (+/-)
-//   for a motor:
-//     movedir_x = desired motor velocity
-//     movedir_y = -1 * max motor force to use
-//     movedir_z = stop position (+/-), set to 0 for no stop
-//   note that ODE does not support both in one anyway
-//   for a force:
-//     force vector to apply
-//field definitions:
-.float  geomtype;     // see GEOMTYPE_*, a more correct way to set collision shape, allows to set SOLID_CORPSE and trimesh collisions
-.float  maxcontacts;  // maximum number of contacts to make for this object, lesser = faster (but setting it too low will could make object pass though walls), default is 16, maximum is 32
-.float  mass;         // ODE mass, standart value is 1
-.vector massofs;      // offsets a mass center out of object center, if not set a center of model bounds is used
-.float  friction;     // a friction of object, get multiplied by second objects's friction on contact
-.float  bouncefactor;
-.float  bouncestop;
-.float  jointtype;    // type of joint
-.float  forcetype;    // type of force
-.float  erp;          // error restitution parameter, makes ODE solver attempt to fix errors in contacts,
-                      // bringing together 2 joints or fixing object being stuch in other object,
-                                 // a value of 0.1 will fix slightly, a value of 1.0 attempts to fix whole error in one frame
-                                 // use with care as high values makes system unstable and likely to explode
-//builtin definitions:
-void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object
-void(entity e, vector force, vector force_pos) physics_addforce = #541; // deprecated, apply a force from certain origin, length of force vector is power of force
-void(entity e, vector torque) physics_addtorque = #542; // deprecated, add relative torque
-//description: provides Open Dynamics Engine support, requires extenal dll to be present or engine compiled with statical link option
-//be sure to checkextension for it to know if library is loaded and ready, also to enable physics set "physics_ode" cvar to 1
-//note: this extension is highly experimental and may be unstable
-
-//DP_SV_PRINT
-//idea: id Software (QuakeWorld Server)
-//darkplaces implementation: Black, LordHavoc
-void(string s, ...) print = #339; // same number as in EXT_CSQC
-//description:
-//this is identical to dprint except that it always prints regardless of the developer cvar.
-
-//DP_SV_PRECACHEANYTIME
-//idea: id Software (Quake2)
-//darkplaces implementation: LordHavoc
-//description:
-//this extension allows precache_model and precache_sound (and any variants) to be used during the game (with automatic messages to clients to precache the new model/sound indices), also setmodel/sound/ambientsound can be called without precaching first (they will cause an automatic precache).
-
-//DP_SV_QCSTATUS
-//idea: divVerent
-//darkplaces implementation: divVerent
-//1. A global variable
-string worldstatus;
-//Its content is set as "qcstatus" field in the rules.
-//It may be at most 255 characters, and must not contain newlines or backslashes.
-//2. A per-client field
-.string clientstatus;
-//It is sent instead of the "frags" in status responses.
-//It should always be set in a way so that stof(player.clientstatus) is a meaningful score value. Other info may be appended. If used this way, the cvar sv_status_use_qcstatus may be set to 1, and then this value will replace the frags in "status".
-//Currently, qstat does not support this and will not show player info if used and set to anything other than ftos(some integer).
-
-//DP_SV_ROTATINGBMODEL
-//idea: id Software
-//darkplaces implementation: LordHavoc
-//description:
-//this extension merely indicates that MOVETYPE_PUSH supports avelocity, allowing rotating brush models to be created, they rotate around their origin (needs rotation supporting qbsp/light utilities because id ones expected bmodel entity origins to be '0 0 0', recommend setting "origin" key in the entity fields in the map before compiling, there may be other methods depending on your qbsp, most are more complicated however).
-//tip: level designers can create a func_wall with an origin, and avelocity (for example "avelocity" "0 90 0"), and "nextthink" "99999999" to make a rotating bmodel without any qc modifications, such entities will be solid in stock quake but will not rotate)
-
-//DP_SV_SETCOLOR
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(entity ent, float colors) setcolor = #401;
-//engine called QC functions (optional):
-//void(float color) SV_ChangeTeam;
-//description:
-//setcolor sets the color on a client and updates internal color information accordingly (equivalent to stuffing a "color" command but immediate)
-//SV_ChangeTeam is called by the engine whenever a "color" command is recieved, it may decide to do anything it pleases with the color passed by the client, including rejecting it (by doing nothing), or calling setcolor to apply it, preventing team changes is one use for this.
-//the color format is pants + shirt * 16 (0-255 potentially)
-
-//DP_SV_SLOWMO
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//cvars:
-//"slowmo" (0+, default 1)
-//description:
-//sets the time scale of the server, mainly intended for use in singleplayer by the player, however potentially useful for mods, so here's an extension for it.
-//range is 0 to infinite, recommended values to try are 0.1 (very slow, 10% speed), 1 (normal speed), 5 (500% speed).
-
-//DP_SV_WRITEPICTURE
-//idea: divVerent
-//darkplaces implementation: divVerent
-//builtin definitions:
-void(float to, string s, float sz) WritePicture = #501;
-//description:
-//writes a picture to the data stream so CSQC can read it using ReadPicture, which has the definition
-//  string(void) ReadPicture = #501;
-//The picture data is sent as at most sz bytes, by compressing to low quality
-//JPEG. The data being sent will be equivalent to:
-//  WriteString(to, s);
-//  WriteShort(to, imagesize);
-//  for(i = 0; i < imagesize; ++i)
-//    WriteByte(to, [the i-th byte of the compressed JPEG image]);
-
-//DP_SV_WRITEUNTERMINATEDSTRING
-//idea: FrikaC
-//darkplaces implementation: Sajt
-//builtin definitions:
-void(float to, string s) WriteUnterminatedString = #456;
-//description:
-//like WriteString, but does not write a terminating 0 after the string. This means you can include things like a player's netname in the middle of a string sent over the network. Just be sure to end it up with either a call to WriteString (which includes the trailing 0) or WriteByte(0) to terminate it yourself.
-//A historical note: this extension was suggested by FrikaC years ago, more recently Shadowalker has been badmouthing LordHavoc and Spike for stealing 'his' extension writestring2 which does exactly the same thing but uses a different builtin number and name and extension string, this argument hinges on the idea that it was his idea in the first place, which is incorrect as FrikaC first suggested it and used a rough equivalent of it in his FrikBot mod years ago involving WriteByte calls on each character.
-
-//DP_TE_BLOOD
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org, vector velocity, float howmany) te_blood = #405;
-//temp entity definitions:
-float TE_BLOOD = 50;
-//protocol:
-//vector origin
-//byte xvelocity (-128 to +127)
-//byte yvelocity (-128 to +127)
-//byte zvelocity (-128 to +127)
-//byte count (0 to 255, how much blood)
-//description:
-//creates a blood effect.
-
-//DP_TE_BLOODSHOWER
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406;
-//temp entity definitions:
-//float TE_BLOODSHOWER = 52;
-//protocol:
-//vector mins (minimum corner of the cube)
-//vector maxs (maximum corner of the cube)
-//coord explosionspeed (velocity of blood particles flying out of the center)
-//short count (number of blood particles)
-//description:
-//creates an exploding shower of blood, for making gibbings more convincing.
-
-//DP_TE_CUSTOMFLASH
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org, float radius, float lifetime, vector color) te_customflash = #417;
-//temp entity definitions:
-//float TE_CUSTOMFLASH = 73;
-//protocol:
-//vector origin
-//byte radius ((MSG_ReadByte() + 1) * 8, meaning 8-2048 unit radius)
-//byte lifetime ((MSG_ReadByte() + 1) / 256.0, meaning approximately 0-1 second lifetime)
-//byte red (0.0 to 1.0 converted to 0-255)
-//byte green (0.0 to 1.0 converted to 0-255)
-//byte blue (0.0 to 1.0 converted to 0-255)
-//description:
-//creates a customized light flash.
-
-//DP_TE_EXPLOSIONRGB
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org, vector color) te_explosionrgb = #407;
-//temp entity definitions:
-//float TE_EXPLOSIONRGB = 53;
-//protocol:
-//vector origin
-//byte red (0.0 to 1.0 converted to 0 to 255)
-//byte green (0.0 to 1.0 converted to 0 to 255)
-//byte blue (0.0 to 1.0 converted to 0 to 255)
-//description:
-//creates a colored explosion effect.
-
-//DP_TE_FLAMEJET
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org, vector vel, float howmany) te_flamejet = #457;
-//temp entity definitions:
-//float TE_FLAMEJET = 74;
-//protocol:
-//vector origin
-//vector velocity
-//byte count (0 to 255, how many flame particles)
-//description:
-//creates a single puff of flame particles.  (not very useful really)
-
-//DP_TE_PARTICLECUBE
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408;
-//temp entity definitions:
-//float TE_PARTICLECUBE = 54;
-//protocol:
-//vector mins (minimum corner of the cube)
-//vector maxs (maximum corner of the cube)
-//vector velocity
-//short count
-//byte color (palette color)
-//byte gravity (TRUE or FALSE, FIXME should this be a scaler instead?)
-//coord randomvel (how much to jitter the velocity)
-//description:
-//creates a cloud of particles, useful for forcefields but quite customizable.
-
-//DP_TE_PARTICLERAIN
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409;
-//temp entity definitions:
-//float TE_PARTICLERAIN = 55;
-//protocol:
-//vector mins (minimum corner of the cube)
-//vector maxs (maximum corner of the cube)
-//vector velocity (velocity of particles)
-//short count (number of particles)
-//byte color (8bit palette color)
-//description:
-//creates a shower of rain, the rain will appear either at the top (if falling down) or bottom (if falling up) of the cube.
-
-//DP_TE_PARTICLESNOW
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410;
-//temp entity definitions:
-//float TE_PARTICLERAIN = 56;
-//protocol:
-//vector mins (minimum corner of the cube)
-//vector maxs (maximum corner of the cube)
-//vector velocity (velocity of particles)
-//short count (number of particles)
-//byte color (8bit palette color)
-//description:
-//creates a shower of snow, the snow will appear either at the top (if falling down) or bottom (if falling up) of the cube, low velocities are advisable for convincing snow.
-
-//DP_TE_PLASMABURN
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org) te_plasmaburn = #433;
-//temp entity definitions:
-//float TE_PLASMABURN = 75;
-//protocol:
-//vector origin
-//description:
-//creates a small light flash (radius 200, time 0.2) and marks the walls.
-
-//DP_TE_QUADEFFECTS1
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org) te_gunshotquad = #412;
-void(vector org) te_spikequad = #413;
-void(vector org) te_superspikequad = #414;
-void(vector org) te_explosionquad = #415;
-//temp entity definitions:
-//float   TE_GUNSHOTQUAD  = 57; // [vector] origin
-//float   TE_SPIKEQUAD    = 58; // [vector] origin
-//float   TE_SUPERSPIKEQUAD = 59; // [vector] origin
-//float   TE_EXPLOSIONQUAD = 70; // [vector] origin
-//protocol:
-//vector origin
-//description:
-//all of these just take a location, and are equivalent in function (but not appearance :) to the original TE_GUNSHOT, etc.
-
-//DP_TE_SMALLFLASH
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org) te_smallflash = #416;
-//temp entity definitions:
-//float TE_SMALLFLASH = 72;
-//protocol:
-//vector origin
-//description:
-//creates a small light flash (radius 200, time 0.2).
-
-//DP_TE_SPARK
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org, vector vel, float howmany) te_spark = #411;
-//temp entity definitions:
-//float TE_SPARK = 51;
-//protocol:
-//vector origin
-//byte xvelocity (-128 to 127)
-//byte yvelocity (-128 to 127)
-//byte zvelocity (-128 to 127)
-//byte count (number of sparks)
-//description:
-//creates a shower of sparks and a smoke puff.
-
-//DP_TE_STANDARDEFFECTBUILTINS
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-void(vector org) te_gunshot = #418;
-void(vector org) te_spike = #419;
-void(vector org) te_superspike = #420;
-void(vector org) te_explosion = #421;
-void(vector org) te_tarexplosion = #422;
-void(vector org) te_wizspike = #423;
-void(vector org) te_knightspike = #424;
-void(vector org) te_lavasplash = #425;
-void(vector org) te_teleport = #426;
-void(vector org, float color, float colorlength) te_explosion2 = #427;
-void(entity own, vector start, vector end) te_lightning1 = #428;
-void(entity own, vector start, vector end) te_lightning2 = #429;
-void(entity own, vector start, vector end) te_lightning3 = #430;
-void(entity own, vector start, vector end) te_beam = #431;
-//description:
-//to make life easier on mod coders.
-
-//DP_TRACE_HITCONTENTSMASK_SURFACEINFO
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//globals:
-.float dphitcontentsmask; // if non-zero on the entity passed to traceline/tracebox/tracetoss this will override the normal collidable contents rules and instead hit these contents values (for example AI can use tracelines that hit DONOTENTER if it wants to, by simply changing this field on the entity passed to traceline), this affects normal movement as well as trace calls
-float trace_dpstartcontents; // DPCONTENTS_ value at start position of trace
-float trace_dphitcontents; // DPCONTENTS_ value of impacted surface (not contents at impact point, just contents of the surface that was hit)
-float trace_dphitq3surfaceflags; // Q3SURFACEFLAG_ value of impacted surface
-string trace_dphittexturename; // texture name of impacted surface
-//constants:
-float DPCONTENTS_SOLID = 1; // hit a bmodel, not a bounding box
-float DPCONTENTS_WATER = 2;
-float DPCONTENTS_SLIME = 4;
-float DPCONTENTS_LAVA = 8;
-float DPCONTENTS_SKY = 16;
-float DPCONTENTS_BODY = 32; // hit a bounding box, not a bmodel
-float DPCONTENTS_CORPSE = 64; // hit a SOLID_CORPSE entity
-float DPCONTENTS_NODROP = 128; // an area where backpacks should not spawn
-float DPCONTENTS_PLAYERCLIP = 256; // blocks player movement
-float DPCONTENTS_MONSTERCLIP = 512; // blocks monster movement
-float DPCONTENTS_DONOTENTER = 1024; // AI hint brush
-float DPCONTENTS_LIQUIDSMASK = 14; // WATER | SLIME | LAVA
-float DPCONTENTS_BOTCLIP = 2048; // AI hint brush
-float DPCONTENTS_OPAQUE = 4096; // only fully opaque brushes get this (may be useful for line of sight checks)
-float Q3SURFACEFLAG_NODAMAGE = 1;
-float Q3SURFACEFLAG_SLICK = 2; // low friction surface
-float Q3SURFACEFLAG_SKY = 4; // sky surface (also has NOIMPACT and NOMARKS set)
-float Q3SURFACEFLAG_LADDER = 8; // climbable surface
-float Q3SURFACEFLAG_NOIMPACT = 16; // projectiles should remove themselves on impact (this is set on sky)
-float Q3SURFACEFLAG_NOMARKS = 32; // projectiles should not leave marks, such as decals (this is set on sky)
-float Q3SURFACEFLAG_FLESH = 64; // projectiles should do a fleshy effect (blood?) on impact
-float Q3SURFACEFLAG_NODRAW = 128; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_HINT = 256; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_SKIP = 512; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_NOLIGHTMAP = 1024; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_POINTLIGHT = 2048; // compiler hint (not important to qc)
-float Q3SURFACEFLAG_METALSTEPS = 4096; // walking on this surface should make metal step sounds
-float Q3SURFACEFLAG_NOSTEPS = 8192; // walking on this surface should not make footstep sounds
-float Q3SURFACEFLAG_NONSOLID = 16384; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_LIGHTFILTER = 32768; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_ALPHASHADOW = 65536; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_NODLIGHT = 131072; // compiler hint (not important to qc)
-//float Q3SURFACEFLAG_DUST = 262144; // translucent 'light beam' effect (not important to qc)
-//description:
-//adds additional information after a traceline/tracebox/tracetoss call.
-//also (very important) sets trace_* globals before calling .touch functions,
-//this allows them to inspect the nature of the collision (for example
-//determining if a projectile hit sky), clears trace_* variables for the other
-//object in a touch event (that is to say, a projectile moving will see the
-//trace results in its .touch function, but the player it hit will see very
-//little information in the trace_ variables as it was not moving at the time)
-
-//DP_VIEWZOOM
-//idea: LordHavoc
-//darkplaces implementation: LordHavoc
-//field definitions:
-.float viewzoom;
-//description:
-//scales fov and sensitivity of player, valid range is 0 to 1 (intended for sniper rifle zooming, and such)
-
-//EXT_BITSHIFT
-//idea: Spike
-//darkplaces implementation: [515]
-//builtin definitions:
-float(float number, float quantity) bitshift = #218;
-//description:
-//multiplies number by a power of 2 corresponding to quantity (0 = *1, 1 = *2, 2 = *4, 3 = *8, -1 = /2, -2 = /4x, etc), and rounds down (due to integer math) like other bit operations do (& and | and the like).
-//note: it is faster to use multiply if you are shifting by a constant, avoiding the quakec function call cost, however that does not do a floor for you.
-
-//FRIK_FILE
-//idea: FrikaC
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-float(string s) stof = #81; // get numerical value from a string
-float(string filename, float mode) fopen = #110; // opens a file inside quake/gamedir/data/ (mode is FILE_READ, FILE_APPEND, or FILE_WRITE), returns fhandle >= 0 if successful, or fhandle < 0 if unable to open file for any reason
-void(float fhandle) fclose = #111; // closes a file
-string(float fhandle) fgets = #112; // reads a line of text from the file and returns as a tempstring
-void(float fhandle, string s, ...) fputs = #113; // writes a line of text to the end of the file
-float(string s) strlen = #114; // returns how many characters are in a string
-string(string s1, string s2, ...) strcat = #115; // concatenates two or more strings (for example "abc", "def" would return "abcdef") and returns as a tempstring
-string(string s, float start, float length) substring = #116; // returns a section of a string as a tempstring - see FTE_STRINGS for enhanced version
-vector(string s) stov = #117; // returns vector value from a string
-string(string s, ...) strzone = #118; // makes a copy of a string into the string zone and returns it, this is often used to keep around a tempstring for longer periods of time (tempstrings are replaced often)
-void(string s) strunzone = #119; // removes a copy of a string from the string zone (you can not use that string again or it may crash!!!)
-//constants:
-float FILE_READ = 0;
-float FILE_APPEND = 1;
-float FILE_WRITE = 2;
-//cvars:
-//pr_zone_min_strings : default 64 (64k), min 64 (64k), max 8192 (8mb)
-//description:
-//provides text file access functions and string manipulation functions, note that you may want to set pr_zone_min_strings in the worldspawn function if 64k is not enough string zone space.
-//
-//NOTE: strzone functionality is partially superseded by
-//DP_QC_UNLIMITEDTEMPSTRINGS when longterm storage is not needed
-//NOTE: substring is upgraded by FTE_STRINGS extension with negative start/length handling identical to php 5.2.0
-
-//FTE_CSQC_SKELETONOBJECTS
-//idea: Spike, LordHavoc
-//darkplaces implementation: LordHavoc
-//builtin definitions:
-// all skeleton numbers are 1-based (0 being no skeleton)
-// all bone numbers are 1-based (0 being invalid)
-float(float modlindex) skel_create = #263; // create a skeleton (be sure to assign this value into .skeletonindex for use), returns skeleton index (1 or higher) on success, returns 0 on failure (for example if the modelindex is not skeletal), it is recommended that you create a new skeleton if you change modelindex, as the skeleton uses the hierarchy from the model.
-float(float skel, entity ent, float modlindex, float retainfrac, float firstbone, float lastbone) skel_build = #264; // blend in a percentage of standard animation, 0 replaces entirely, 1 does nothing, 0.5 blends half, etc, and this only alters the bones in the specified range for which out of bounds values like 0,100000 are safe (uses .frame, .frame2, .frame3, .frame4, .lerpfrac, .lerpfrac3, .lerpfrac4, .frame1time, .frame2time, .frame3time, .frame4time), returns skel on success, 0 on failure
-float(float skel) skel_get_numbones = #265; // returns how many bones exist in the created skeleton, 0 if skeleton does not exist
-string(float skel, float bonenum) skel_get_bonename = #266; // returns name of bone (as a tempstring), "" if invalid bonenum (< 1 for example) or skeleton does not exist
-float(float skel, float bonenum) skel_get_boneparent = #267; // returns parent num for supplied bonenum, 0 if bonenum has no parent or bone does not exist (returned value is always less than bonenum, you can loop on this)
-float(float skel, string tagname) skel_find_bone = #268; // get number of bone with specified name, 0 on failure, bonenum (1-based) on success, same as using gettagindex but takes modelindex instead of entity
-vector(float skel, float bonenum) skel_get_bonerel = #269; // get matrix of bone in skeleton relative to its parent - sets v_forward, v_right, v_up, returns origin (relative to parent bone)
-vector(float skel, float bonenum) skel_get_boneabs = #270; // get matrix of bone in skeleton in model space - sets v_forward, v_right, v_up, returns origin (relative to entity)
-void(float skel, float bonenum, vector org) skel_set_bone = #271; // set matrix of bone relative to its parent, reads v_forward, v_right, v_up, takes origin as parameter (relative to parent bone)
-void(float skel, float bonenum, vector org) skel_mul_bone = #272; // transform bone matrix (relative to its parent) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bone)
-void(float skel, float startbone, float endbone, vector org) skel_mul_bones = #273; // transform bone matrices (relative to their parents) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bones)
-void(float skeldst, float skelsrc, float startbone, float endbone) skel_copybones = #274; // copy bone matrices (relative to their parents) from one skeleton to another, useful for copying a skeleton to a corpse
-void(float skel) skel_delete = #275; // deletes skeleton at the beginning of the next frame (you can add the entity, delete the skeleton, renderscene, and it will still work)
-float(float modlindex, string framename) frameforname = #276; // finds number of a specified frame in the animation, returns -1 if no match found
-float(float modlindex, float framenum) frameduration = #277; // returns the intended play time (in seconds) of the specified framegroup, if it does not exist the result is 0, if it is a single frame it may be a small value around 0.1 or 0.
-//fields:
-.float skeletonindex; // active skeleton overriding standard animation on model
-.float frame; // primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
-.float frame2; // secondary framegroup animation (strength = lerpfrac)
-.float frame3; // tertiary framegroup animation (strength = lerpfrac3)
-.float frame4; // quaternary framegroup animation (strength = lerpfrac4)
-.float lerpfrac; // strength of framegroup blend
-.float lerpfrac3; // strength of framegroup blend
-.float lerpfrac4; // strength of framegroup blend
-.float frame1time; // start time of framegroup animation
-.float frame2time; // start time of framegroup animation
-.float frame3time; // start time of framegroup animation
-.float frame4time; // start time of framegroup animation
-//description:
-//this extension provides a way to do complex skeletal animation on an entity.
-//
-//see also DP_SKELETONOBJECTS (this extension implemented on server as well as client)
-//
-//notes:
-//each model contains its own skeleton, reusing a skeleton with incompatible models will yield garbage (or not render).
-//each model contains its own animation data, you can use animations from other model files (for example saving out all character animations as separate model files).
-//if an engine supports loading an animation-only file format such as .md5anim in FTEQW, it can be used to animate any model with a compatible skeleton.
-//proper use of this extension may require understanding matrix transforms (v_forward, v_right, v_up, origin), and you must keep in mind that v_right is negative for this purpose.
-//
-//features include:
-//multiple animations blended together.
-//animating a model with animations from another model with a compatible skeleton.
-//restricting animation blends to certain bones of a model - for example independent animation of legs, torso, head.
-//custom bone controllers - for example making eyes track a target location.
-//
-//
-//
-//example code follows...
-//
-//this helper function lets you identify (by parentage) what group a bone
-//belongs to - for example "torso", "leftarm", would return 1 ("torso") for
-//all children of the bone named "torso", unless they are children of
-//"leftarm" (which is a child of "torso") which would return 2 instead...
-float(float skel, float bonenum, string g1, string g2, string g3, string g4, string g5, string g6) example_skel_findbonegroup =
-{
-       local string bonename;
-       while (bonenum >= 0)
-       {
-               bonename = skel_get_bonename(skel, bonenum);
-               if (bonename == g1) return 1;
-               if (bonename == g2) return 2;
-               if (bonename == g3) return 3;
-               if (bonename == g4) return 4;
-               if (bonename == g5) return 5;
-               if (bonename == g6) return 6;
-               bonenum = skel_get_boneparent(skel, bonenum);
-       }
-       return 0;
-};
-// create a skeletonindex for our player using current modelindex
-void() example_skel_player_setup =
-{
-       self.skeletonindex = skel_create(self.modelindex);
-};
-// setup bones of skeleton based on an animation
-// note: animmodelindex can be a different model than self.modelindex
-void(float animmodelindex, float framegroup, float framegroupstarttime) example_skel_player_update_begin =
-{
-       // start with our standard animation
-       self.frame = framegroup;
-       self.frame2 = 0;
-       self.frame3 = 0;
-       self.frame4 = 0;
-       self.frame1time = framegroupstarttime;
-       self.frame2time = 0;
-       self.frame3time = 0;
-       self.frame4time = 0;
-       self.lerpfrac = 0;
-       self.lerpfrac3 = 0;
-       self.lerpfrac4 = 0;
-       skel_build(self.skeletonindex, self, animmodelindex, 0, 0, 100000);
-};
-// apply a different framegroup animation to bones with a specified parent
-void(float animmodelindex, float framegroup, float framegroupstarttime, float blendalpha, string groupbonename, string excludegroupname1, string excludegroupname2) example_skel_player_update_applyoverride =
-{
-       local float bonenum;
-       local float numbones;
-       self.frame = framegroup;
-       self.frame2 = 0;
-       self.frame3 = 0;
-       self.frame4 = 0;
-       self.frame1time = framegroupstarttime;
-       self.frame2time = 0;
-       self.frame3time = 0;
-       self.frame4time = 0;
-       self.lerpfrac = 0;
-       self.lerpfrac3 = 0;
-       self.lerpfrac4 = 0;
-       bonenum = 0;
-       numbones = skel_get_numbones(self.skeletonindex);
-       while (bonenum < numbones)
-       {
-               if (example_skel_findbonegroup(self.skeletonindex, bonenum, groupbonename, excludegroupname1, excludegroupname2, "", "", "") == 1)
-                       skel_build(self.skeletonindex, self, animmodelindex, 1 - blendalpha, bonenum, bonenum + 1);
-               bonenum = bonenum + 1;
-       }
-};
-// make eyes point at a target location, be sure v_forward, v_right, v_up are set correctly before calling
-void(vector eyetarget, string bonename) example_skel_player_update_eyetarget =
-{
-       local float bonenum;
-       local vector ang;
-       local vector oldforward, oldright, oldup;
-       local vector relforward, relright, relup, relorg;
-       local vector boneforward, boneright, boneup, boneorg;
-       local vector parentforward, parentright, parentup, parentorg;
-       local vector u, v;
-       local vector modeleyetarget;
-       bonenum = skel_find_bone(self.skeletonindex, bonename) - 1;
-       if (bonenum < 0)
-               return;
-       oldforward = v_forward;
-       oldright = v_right;
-       oldup = v_up;
-       v = eyetarget - self.origin;
-       modeleyetarget_x =   v * v_forward;
-       modeleyetarget_y = 0-v * v_right;
-       modeleyetarget_z =   v * v_up;
-       // this is an eyeball, make it point at the target location
-       // first get all the data we can...
-       relorg = skel_get_bonerel(self.skeletonindex, bonenum);
-       relforward = v_forward;
-       relright = v_right;
-       relup = v_up;
-       boneorg = skel_get_boneabs(self.skeletonindex, bonenum);
-       boneforward = v_forward;
-       boneright = v_right;
-       boneup = v_up;
-       parentorg = skel_get_boneabs(self.skeletonindex, skel_get_boneparent(self.skeletonindex, bonenum));
-       parentforward = v_forward;
-       parentright = v_right;
-       parentup = v_up;
-       // get the vector from the eyeball to the target
-       u = modeleyetarget - boneorg;
-       // now transform it inversely by the parent matrix to produce new rel vectors
-       v_x = u * parentforward;
-       v_y = u * parentright;
-       v_z = u * parentup;
-       ang = vectoangles2(v, relup);
-       ang_x = 0 - ang_x;
-       makevectors(ang);
-       // set the relative bone matrix
-       skel_set_bone(self.skeletonindex, bonenum, relorg);
-       // restore caller's v_ vectors
-       v_forward = oldforward;
-       v_right = oldright;
-       v_up = oldup;
-};
-// delete skeleton when we're done with it
-// note: skeleton remains valid until next frame when it is really deleted
-void() example_skel_player_delete =
-{
-       skel_delete(self.skeletonindex);
-       self.skeletonindex = 0;
-};
-//
-// END OF EXAMPLES FOR FTE_CSQC_SKELETONOBJECTS
-//
-
-//KRIMZON_SV_PARSECLIENTCOMMAND
-//idea: KrimZon
-//darkplaces implementation: KrimZon, LordHavoc
-//engine-called QC prototypes:
-//void(string s) SV_ParseClientCommand;
-//builtin definitions:
-void(entity e, string s) clientcommand = #440;
-float(string s) tokenize = #441;
-string(float n) argv = #442;
-//description:
-//provides QC the ability to completely control server interpretation of client commands ("say" and "color" for example, clientcommand is necessary for this and substring (FRIK_FILE) is useful) as well as adding new commands (tokenize, argv, and stof (FRIK_FILE) are useful for this)), whenever a clc_stringcmd is received the QC function is called, and it is up to the QC to decide what (if anything) to do with it
-
-//NEH_CMD_PLAY2
-//idea: Nehahra
-//darkplaces implementation: LordHavoc
-//description:
-//shows that the engine supports the "play2" console command (plays a sound without spatialization).
-
-//NEH_RESTOREGAME
-//idea: Nehahra
-//darkplaces implementation: LordHavoc
-//engine-called QC prototypes:
-//void() RestoreGame;
-//description:
-//when a savegame is loaded, this function is called
-
-//NEXUIZ_PLAYERMODEL
-//idea: Nexuiz
-//darkplaces implementation: Black
-//console commands:
-//playermodel <name> - FIXME: EXAMPLE NEEDED
-//playerskin <name> - FIXME: EXAMPLE NEEDED
-//field definitions:
-.string playermodel; // name of player model sent by client
-.string playerskin; // name of player skin sent by client
-//description:
-//these client properties are used by Nexuiz.
-
-//NXQ_GFX_LETTERBOX
-//idea: nxQuake
-//darkplaces implementation: LordHavoc
-//description:
-//shows that the engine supports the "r_letterbox" console variable, set to values in the range 0-100 this restricts the view vertically (and turns off sbar and crosshair), value is a 0-100 percentage of how much to constrict the view, <=0 = normal view height, 25 = 75% of normal view height, 50 = 50%, 75 = 25%, >=100 = no view
-
-//PRYDON_CLIENTCURSOR
-//idea: FrikaC
-//darkplaces implementation: LordHavoc
-//effects bit:
-float EF_SELECTABLE = 16384; // allows cursor to highlight entity (brighten)
-//field definitions:
-.float cursor_active; // true if cl_prydoncursor mode is on
-.vector cursor_screen; // screen position of cursor as -1 to +1 in _x and _y (_z unused)
-.vector cursor_trace_start; // position of camera
-.vector cursor_trace_endpos; // position of cursor in world (as traced from camera)
-.entity cursor_trace_ent; // entity the cursor is pointing at (server forces this to world if the entity is currently free at time of receipt)
-//cvar definitions:
-//cl_prydoncursor (0/1+, default 0, 1 and above use cursors named gfx/prydoncursor%03i.lmp - or .tga and such if DP_GFX_EXTERNALTEXTURES is implemented)
-//description:
-//shows that the engine supports the cl_prydoncursor cvar, this puts a clientside mouse pointer on the screen and feeds input to the server for the QuakeC to use as it sees fit.
-//the mouse pointer triggers button4 if cursor is at left edge of screen, button5 if at right edge of screen, button6 if at top edge of screen, button7 if at bottom edge of screen.
-//the clientside trace skips transparent entities (except those marked EF_SELECTABLE).
-//the selected entity highlights only if EF_SELECTABLE is set, a typical selection method would be doubling the brightness of the entity by some means (such as colormod[] *= 2).
-//intended to be used by Prydon Gate.
-
-//TENEBRAE_GFX_DLIGHTS
-//idea: Tenebrae
-//darkplaces implementation: LordHavoc
-//fields:
-.float light_lev; // radius (does not affect brightness), typical value 350
-.vector color; // color (does not affect radius), typical value '1 1 1' (bright white), can be up to '255 255 255' (nuclear blast)
-.float style; // light style (like normal light entities, flickering torches or switchable, etc)
-.float pflags; // flags (see PFLAGS_ constants)
-.vector angles; // orientation of the light
-.float skin; // cubemap filter number, can be 1-255 (0 is assumed to be none, and tenebrae only allows 16-255), this selects a projective light filter, a value of 1 loads cubemaps/1posx.tga and cubemaps/1negx.tga and posy, negy, posz, and negz, similar to skybox but some sides need to be rotated or flipped
-//constants:
-float PFLAGS_NOSHADOW = 1; // light does not cast shadows
-float PFLAGS_CORONA = 2; // light has a corona flare
-float PFLAGS_FULLDYNAMIC = 128; // light enable (without this set no light is produced!)
-//description:
-//more powerful dynamic light settings
-//warning: it is best not to use cubemaps on a light entity that has a model, as using a skin number that a model does not have will cause issues in glquake, and produce warnings in darkplaces (use developer 1 to see them)
-//changes compared to tenebrae (because they're too 'leet' for standards):
-//note: networking should send entities with PFLAGS_FULLDYNAMIC set even if they have no model (lights in general do not have a model, nor should they)
-//EF_FULLDYNAMIC effects flag replaced by PFLAGS_FULLDYNAMIC flag (EF_FULLDYNAMIC conflicts with EF_NODRAW)
-
-//TW_SV_STEPCONTROL
-//idea: Transfusion
-//darkplaces implementation: LordHavoc
-//cvars:
-//sv_jumpstep (0/1, default 1)
-//sv_stepheight (default 18)
-//description:
-//sv_jumpstep allows stepping up onto stairs while airborn, sv_stepheight controls how high a single step can be.
-
-//FTE_QC_CHECKPVS
-//idea: Urre
-//darkplaces implementation: divVerent
-//builtin definitions:
-float checkpvs(vector viewpos, entity viewee) = #240;
-//description:
-//returns true if viewee can be seen from viewpos according to PVS data
-
-//FTE_STRINGS
-//idea: many
-//darkplaces implementation: KrimZon
-//builtin definitions:
-float(string str, string sub, float startpos) strstrofs = #221; // returns the offset into a string of the matching text, or -1 if not found, case sensitive
-float(string str, float ofs) str2chr = #222; // returns the character at the specified offset as an integer, or 0 if an invalid index, or byte value - 256 if the engine supports UTF8 and the byte is part of an extended character
-string(float c, ...) chr2str = #223; // returns a string representing the character given, if the engine supports UTF8 this may be a multi-byte sequence (length may be more than 1) for characters over 127.
-string(float ccase, float calpha, float cnum, string s, ...) strconv = #224; // reformat a string with special color characters in the font, DO NOT USE THIS ON UTF8 ENGINES (if you are lucky they will emit ^4 and such color codes instead), the parameter values are 0=same/1=lower/2=upper for ccase, 0=same/1=white/2=red/5=alternate/6=alternate-alternate for redalpha, 0=same/1=white/2=red/3=redspecial/4=whitespecial/5=alternate/6=alternate-alternate for rednum.
-string(float chars, string s, ...) strpad = #225; // pad string with spaces to a specified length, < 0 = left padding, > 0 = right padding
-string(string info, string key, string value, ...) infoadd = #226; // sets or adds a key/value pair to an infostring - note: forbidden characters are \ and "
-string(string info, string key) infoget = #227; // gets a key/value pair in an infostring, returns value or null if not found
-float(string s1, string s2) strcmp = #228; // compare two strings
-float(string s1, string s2, float len) strncmp = #228; // compare two strings up to the specified number of characters, if their length differs and is within the specified limit the result will be negative, otherwise it is the difference in value of their first non-matching character.
-float(string s1, string s2) strcasecmp = #229; // compare two strings with case-insensitive matching, characters a-z are considered equivalent to the matching A-Z character, no other differences, and this does not consider special characters equal even if they look similar
-float(string s1, string s2, float len) strncasecmp = #230; // same as strcasecmp but with a length limit, see strncmp
-//string(string s, float start, float length) substring = #116; // see note below
-//description:
-//various string manipulation functions
-//note: substring also exists in FRIK_FILE but this extension adds negative start and length as valid cases (see note above), substring is consistent with the php 5.2.0 substr function (not 5.2.3 behavior)
-//substring returns a section of a string as a tempstring, if given negative
-// start the start is measured back from the end of the string, if given a
-// negative length the length is the offset back from the end of the string to
-// stop at, rather than being relative to start, if start is negative and
-// larger than length it is treated as 0.
-// examples of substring:
-// substring("blah", -3, 3) returns "lah"
-// substring("blah", 3, 3) returns "h"
-// substring("blah", -10, 3) returns "bla"
-// substring("blah", -10, -3) returns "b"
-
-//DP_CON_BESTWEAPON
-//idea: many
-//darkplaces implementation: divVerent
-//description:
-//allows QC to register weapon properties for use by the bestweapon command, for mods that change required ammo count or type for the weapons
-//it is done using console commands sent via stuffcmd:
-//  register_bestweapon quake
-//  register_bestweapon clear
-//  register_bestweapon <shortname> <impulse> <itemcode> <activeweaponcode> <ammostat> <ammomin>
-//for example, this is what Quake uses:
-//  register_bestweapon 1 1 4096 4096 6 0 // STAT_SHELLS is 6
-//  register_bestweapon 2 2    1    1 6 1
-//  register_bestweapon 3 3    2    2 6 1
-//  register_bestweapon 4 4    4    4 7 1 // STAT_NAILS is 7
-//  register_bestweapon 5 5    8    8 7 1
-//  register_bestweapon 6 6   16   16 8 1 // STAT_ROCKETS is 8
-//  register_bestweapon 7 7   32   32 8 1
-//  register_bestweapon 8 8   64   64 9 1 // STAT_CELLS is 9
-//after each map client initialization, this is reset back to Quake settings. So you should send these data in ClientConnect.
-//also, this extension introduces a new "cycleweapon" command to the user.
-
-//DP_QC_STRINGBUFFERS
-//idea: ??
-//darkplaces implementation: LordHavoc
-//functions to manage string buffer objects - that is, arbitrary length string arrays that are handled by the engine
-float() buf_create = #460;
-void(float bufhandle) buf_del = #461;
-float(float bufhandle) buf_getsize = #462;
-void(float bufhandle_from, float bufhandle_to) buf_copy = #463;
-void(float bufhandle, float sortpower, float backward) buf_sort = #464;
-string(float bufhandle, string glue) buf_implode = #465;
-string(float bufhandle, float string_index) bufstr_get = #466;
-void(float bufhandle, float string_index, string str) bufstr_set = #467;
-float(float bufhandle, string str, float order) bufstr_add = #468;
-void(float bufhandle, float string_index) bufstr_free = #469;
-
-//DP_QC_STRINGBUFFERS_CVARLIST
-//idea: divVerent
-//darkplaces implementation: divVerent
-//functions to list cvars and store their names into a stringbuffer
-//cvars that start with pattern but not with antipattern will be stored into the buffer
-void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517;
-
-//DP_QC_STRINGBUFFERS_EXT_WIP
-//idea: VorteX
-//darkplaces implementation: VorteX
-//constant definitions:
-const float MATCH_AUTO = 0;
-const float MATCH_WHOLE = 1;
-const float MATCH_LEFT = 2;
-const float MATCH_RIGHT = 3;
-const float MATCH_MIDDLE = 4;
-const float MATCH_PATTERN = 5;
-//builtin definitions:
-float(string filename, float bufhandle) buf_loadfile = #535; // append each line of file as new buffer string, return 1 if succesful
-float(float filehandle, float bufhandle, float startpos, float numstrings) buf_writefile = #536; // writes buffer strings as lines, returns 1 if succesful
-float(float bufhandle, string match, float matchrule, float startpos, float step) bufstr_find = #537; // returns string index
-float(string s, string pattern, float matchrule) matchpattern = #538; // returns 0/1
-float(string s, string pattern, float matchrule, float pos) matchpatternofs = #538;
-//description:
-//provides a set of functions to manipulate with string buffers
-//pattern wildcards: * - any character (or no characters), ? - any 1 character
-//Warning: This extension is work-in-progress, it may be changed/revamped/removed at any time, dont use it if you dont want any trouble
-//wip note: UTF8 is not supported yet
-
-//DP_QC_STRREPLACE
-//idea: Sajt
-//darkplaces implementation: Sajt
-//builtin definitions:
-string(string search, string replace, string subject) strreplace = #484;
-string(string search, string replace, string subject) strireplace = #485;
-//description:
-//strreplace replaces all occurrences of 'search' with 'replace' in the string 'subject', and returns the result as a tempstring.
-//strireplace does the same but uses case-insensitive matching of the 'search' term
-
-//DP_SV_SHUTDOWN
-//idea: divVerent
-//darkplaces implementation: divVerent
-//A function that gets called just before progs exit. To save persistent data from.
-//It is not called on a crash or error.
-//void SV_Shutdown();
-
-//EXT_CSQC
-// #232 void(float index, float type, .void field) SV_AddStat (EXT_CSQC)
-void(float index, float type, ...) addstat = #232;
-
-//ZQ_PAUSE
-//idea: ZQuake
-//darkplaces implementation: GreEn`mArine
-//builtin definitions:
-void(float pause) setpause = #531;
-//function definitions:
-//void(float elapsedtime) SV_PausedTic;
-//description:
-//during pause the world is not updated (time does not advance), SV_PausedTic is the only function you can be sure will be called at regular intervals during the pause, elapsedtime is the current system time in seconds since the pause started (not affected by slowmo or anything else).
-//
-//calling setpause(0) will end a pause immediately.
-//
-//Note: it is worth considering that network-related functions may be called during the pause (including customizeentityforclient for example), and it is also important to consider the continued use of the KRIMZON_SV_PARSECLIENTCOMMAND extension while paused (chatting players, etc), players may also join/leave during the pause.  In other words, the only things that are not called are think and other time-related functions.
-
-
-
-
-// EXPERIMENTAL (not finalized) EXTENSIONS:
-
-//DP_CRYPTO
-//idea: divVerent
-//darkplaces implementation: divVerent
-//field definitions: (SVQC)
-.string crypto_keyfp; // fingerprint of CA key the player used to authenticate, or string_null if not verified
-.string crypto_mykeyfp; // fingerprint of CA key the server used to authenticate to the player, or string_null if not verified
-.string crypto_idfp; // fingerprint of ID used by the player entity, or string_null if not identified
-.string crypto_encryptmethod; // the string "AES128" if encrypting, and string_null if plaintext
-.string crypto_signmethod; // the string "HMAC-SHA256" if signing, and string_null if plaintext
-// there is no field crypto_myidfp, as that info contains no additional information the QC may have a use for
-//builtin definitions: (SVQC)
-float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513;
-//description:
-//use -1 as buffer handle to justs end delim as postdata
diff --git a/qcsrc/dpdefs/dpextensions.qh b/qcsrc/dpdefs/dpextensions.qh
new file mode 100644 (file)
index 0000000..109e919
--- /dev/null
@@ -0,0 +1,2563 @@
+#ifndef DPEXTENSIONS_H
+#define DPEXTENSIONS_H
+//DarkPlaces supported extension list, draft version 1.04
+
+//things that don't have extensions yet:
+.float disableclientprediction;
+
+//definitions that id Software left out:
+//these are passed as the 'nomonsters' parameter to traceline/tracebox (yes really this was supported in all quake engines, nomonsters is misnamed)
+float MOVE_NORMAL = 0; // same as false
+float MOVE_NOMONSTERS = 1; // same as true
+float MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE
+
+//checkextension function
+//idea: expected by almost everyone
+//darkplaces implementation: LordHavoc
+float(string s) checkextension = #99;
+//description:
+//check if (cvar("pr_checkextension")) before calling this, this is the only
+//guaranteed extension to be present in the extension system, it allows you
+//to check if an extension is available, by name, to check for an extension
+//use code like this:
+//// (it is recommended this code be placed in worldspawn or a worldspawn called function somewhere)
+//if (cvar("pr_checkextension"))
+//if (checkextension("DP_SV_SETCOLOR"))
+//     ext_setcolor = true;
+//from then on you can check ext_setcolor to know if that extension is available
+
+//BX_WAL_SUPPORT
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//description:
+//indicates the engine supports .wal textures for filenames in the textures/ directory
+//(note: DarkPlaces has supported this since 2001 or 2002, but did not advertise it as an extension, then I noticed Betwix was advertising it and added the extension accordingly)
+
+//DP_BUTTONCHAT
+//idea: Vermeulen
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float buttonchat;
+//description:
+//true if the player is currently chatting (in messagemode, menus or console)
+
+//DP_BUTTONUSE
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float buttonuse;
+//client console commands:
+//+use
+//-use
+//description:
+//made +use and -use commands work, they now control the .buttonuse field (.button1 was used by many mods for other purposes).
+
+//DP_CL_LOADSKY
+//idea: Nehahra, LordHavoc
+//darkplaces implementation: LordHavoc
+//client console commands:
+//"loadsky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, use "" to revert to quake sky, note: this is the same as Quake2 skybox naming)
+//description:
+//sets global skybox for the map for this client (can be stuffed to a client by QC), does not hurt much to repeatedly execute this command, please don't use this in mods if it can be avoided (only if changing skybox is REALLY needed, otherwise please use DP_GFX_SKYBOX).
+
+//DP_CON_SET
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//description:
+//indicates this engine supports the "set" console command which creates or sets a non-archived cvar (not saved to config.cfg on exit), it is recommended that set and seta commands be placed in default.cfg for mod-specific cvars.
+
+//DP_CON_SETA
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//description:
+//indicates this engine supports the "seta" console command which creates or sets an archived cvar (saved to config.cfg on exit), it is recommended that set and seta commands be placed in default.cfg for mod-specific cvars.
+
+//DP_CON_ALIASPARAMETERS
+//idea: many
+//darkplaces implementation: Black
+//description:
+//indicates this engine supports aliases containing $1 through $9 parameter macros (which when called will expand to the parameters passed to the alias, for example alias test "say $2 $1", then you can type test hi there and it will execute say there hi), as well as $0 (name of the alias) and $* (all parameters $1 onward).
+
+//DP_CON_EXPANDCVAR
+//idea: many, PHP
+//darkplaces implementation: Black
+//description:
+//indicates this engine supports console commandlines containing $cvarname which will expand to the contents of that cvar as a parameter, for instance say my fov is $fov, will say "my fov is 90", or similar.
+
+//DP_CON_STARTMAP
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//adds two engine-called aliases named startmap_sp and startmap_dm which are called when the engine tries to start a singleplayer game from the menu (startmap_sp) or the -listen or -dedicated options are used or the engine is a dedicated server (uses startmap_dm), these allow a mod or game to specify their own map instead of start, and also distinguish between singleplayer and -listen/-dedicated, also these need not be a simple "map start" command, they can do other things if desired, startmap_sp and startmap_dm both default to "map start".
+
+//DP_EF_ADDITIVE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//effects bit:
+const int   EF_ADDITIVE     = 32;
+//description:
+//additive blending when this object is rendered
+
+//DP_EF_BLUE
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//effects bit:
+const int   EF_BLUE         = 64;
+//description:
+//entity emits blue light (used for quad)
+
+//DP_EF_DOUBLESIDED
+//idea: LordHavoc
+//darkplaces implementation: [515] and LordHavoc
+//effects bit:
+const int EF_DOUBLESIDED = 32768;
+//description:
+//render entity as double sided (backfaces are visible, I.E. you see the 'interior' of the model, rather than just the front), can be occasionally useful on transparent stuff.
+
+//DP_EF_DYNAMICMODELLIGHT
+//idea: C.Brutail, divVerent, maikmerten
+//darkplaces implementation: divVerent
+//effects bit:
+const int   EF_DYNAMICMODELLIGHT     = 131072;
+//description:
+//force dynamic model light on the entity, even if it's a BSP model (or anything else with lightmaps or light colors)
+
+//DP_EF_FLAME
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//effects bit:
+const int   EF_FLAME        = 1024;
+//description:
+//entity is on fire
+
+//DP_EF_FULLBRIGHT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//effects bit:
+const int   EF_FULLBRIGHT   = 512;
+//description:
+//entity is always brightly lit
+
+//DP_EF_NODEPTHTEST
+//idea: Supa
+//darkplaces implementation: LordHavoc
+//effects bit:
+const int   EF_NODEPTHTEST       = 8192;
+//description:
+//makes entity show up to client even through walls, useful with EF_ADDITIVE for special indicators like where team bases are in a map, so that people don't get lost
+
+//DP_EF_NODRAW
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//effects bit:
+const int   EF_NODRAW       = 16;
+//description:
+//prevents server from sending entity to client (forced invisible, even if it would have been a light source or other such things)
+
+//DP_EF_NOGUNBOB
+//idea: Chris Page, Dresk
+//darkplaces implementation: LordHAvoc
+//effects bit:
+const int   EF_NOGUNBOB     = 256;
+//description:
+//this has different meanings depending on the entity it is used on:
+//player entity - prevents gun bobbing on player.viewmodel
+//viewmodelforclient entity - prevents gun bobbing on an entity attached to the player's view
+//other entities - no effect
+//uses:
+//disabling gun bobbing on a diving mask or other model used as a .viewmodel.
+//disabling gun bobbing on view-relative models meant to be part of the heads up display.  (note: if fov is changed these entities may be off-screen, or too near the center of the screen, so use fov 90 in this case)
+
+//DP_EF_NOSHADOW
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//effects bit:
+const int   EF_NOSHADOW     = 4096;
+//description:
+//realtime lights will not cast shadows from this entity (but can still illuminate it)
+
+//DP_EF_RED
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//effects bit:
+const int   EF_RED          = 128;
+//description:
+//entity emits red light (used for invulnerability)
+
+//DP_EF_RESTARTANIM_BIT
+//idea: id software
+//darkplaces implementation: divVerent
+//effects bit:
+const int   EF_RESTARTANIM_BIT = 1048576;
+//description:
+//when toggled, the current animation is restarted. Useful for weapon animation.
+//to toggle this bit in QC, you can do:
+//  self.effects += (EF_RESTARTANIM_BIT - 2 * (self.effects & EF_RESTARTANIM_BIT));
+
+//DP_EF_STARDUST
+//idea: MythWorks Inc
+//darkplaces implementation: LordHavoc
+//effects bit:
+const int   EF_STARDUST     = 2048;
+//description:
+//entity emits bouncing sparkles in every direction
+
+//DP_EF_TELEPORT_BIT
+//idea: id software
+//darkplaces implementation: divVerent
+//effects bit:
+const int   EF_TELEPORT_BIT = 2097152;
+//description:
+//when toggled, interpolation of the entity is skipped for one frame. Useful for teleporting.
+//to toggle this bit in QC, you can do:
+//  self.effects += (EF_TELEPORT_BIT - 2 * (self.effects & EF_TELEPORT_BIT));
+
+//DP_ENT_ALPHA
+//idea: Nehahra
+//darkplaces implementation: LordHavoc
+//fields:
+.float alpha;
+//description:
+//controls opacity of the entity, 0.0 is forced to be 1.0 (otherwise everything would be invisible), use -1 if you want to make something invisible, 1.0 is solid (like normal).
+
+//DP_ENT_COLORMOD
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definition:
+.vector colormod;
+//description:
+//controls color of the entity, '0 0 0', is forced to be '1 1 1' (otherwise everything would be black), used for tinting objects, for instance using '1 0.6 0.4' on an ogre would give you an orange ogre (order is red green blue), note the colors can go up to '8 8 8' (8x as bright as normal).
+
+//DP_ENT_CUSTOMCOLORMAP
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//if .colormap is set to 1024 + pants + shirt * 16, those colors will be used for colormapping the entity, rather than looking up a colormap by player number.
+
+/*
+//NOTE: no longer supported by darkplaces because all entities are delta compressed now
+//DP_ENT_DELTACOMPRESS // no longer supported
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//effects bit:
+float EF_DELTA = 8388608;
+//description:
+//(obsolete) applies delta compression to the network updates of the entity, making updates smaller, this might cause some unreliable behavior in packet loss situations, so it should only be used on numerous (nails/plasma shots/etc) or unimportant objects (gibs/shell casings/bullet holes/etc).
+*/
+
+//DP_ENT_EXTERIORMODELTOCLIENT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//fields:
+.entity exteriormodeltoclient;
+//description:
+//the entity is visible to all clients with one exception: if the specified client is using first person view (not using chase_active) the entity will not be shown.  Also if tag attachments are supported any entities attached to the player entity will not be drawn in first person.
+
+//DP_ENT_GLOW
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float glow_color;
+.float glow_size;
+.float glow_trail;
+//description:
+//customizable glowing light effect on the entity, glow_color is a paletted (8bit) color in the range 0-255 (note: 0 and 254 are white), glow_size is 0 or higher (up to the engine what limit to cap it to, darkplaces imposes a 1020 limit), if glow_trail is true it will leave a trail of particles of the same color as the light.
+
+//DP_ENT_GLOWMOD
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definition:
+.vector glowmod;
+//description:
+//controls color of the entity's glow texture (fullbrights), '0 0 0', is forced to be '1 1 1' (otherwise everything would be black), used for tinting objects, see colormod (same color restrictions apply).
+
+//DP_ENT_LOWPRECISION
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//effects bit:
+const int EF_LOWPRECISION = 4194304;
+//description:
+//uses low quality origin coordinates, reducing network traffic compared to the default high precision, intended for numerous objects (projectiles/gibs/bullet holes/etc).
+
+//DP_ENT_SCALE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float scale;
+//description:
+//controls rendering scale of the object, 0 is forced to be 1, darkplaces uses 1/16th accuracy and a limit of 15.9375, can be used to make an object larger or smaller.
+
+//DP_ENT_TRAILEFFECTNUM
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float traileffectnum;
+//description:
+//use a custom effectinfo.txt effect on this entity, assign it like this:
+//self.traileffectnum = particleeffectnum("mycustomeffect");
+//this will do both the dlight and particle trail as described in the effect, basically equivalent to trailparticles() in CSQC but performed on a server entity.
+
+//DP_ENT_VIEWMODEL
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.entity viewmodelforclient;
+//description:
+//this is a very special capability, attachs the entity to the view of the client specified, origin and angles become relative to the view of that client, all effects can be used (multiple skins on a weapon model etc)...  the entity is not visible to any other client.
+
+//DP_GFX_EXTERNALTEXTURES
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//loads external textures found in various directories (tenebrae compatible)...
+/*
+in all examples .tga is merely the base texture, it can be any of these:
+.tga (base texture)
+_glow.tga (fullbrights or other glowing overlay stuff, NOTE: this is done using additive blend, not alpha)
+_pants.tga (pants overlay for colormapping on models, this should be shades of grey (it is tinted by pants color) and black wherever the base texture is not black, as this is an additive blend)
+_shirt.tga (same idea as pants, but for shirt color)
+_diffuse.tga (this may be used instead of base texture for per pixel lighting)
+_gloss.tga (specular texture for per pixel lighting, note this can be in color (tenebrae only supports greyscale))
+_norm.tga (normalmap texture for per pixel lighting)
+_bump.tga (bumpmap, converted to normalmap at load time, supported only for reasons of tenebrae compatibility)
+_luma.tga (same as _glow but supported only for reasons of tenebrae compatibility)
+
+due to glquake's incomplete Targa(r) loader, this section describes
+required Targa(r) features support:
+types:
+type 1 (uncompressed 8bit paletted with 24bit/32bit palette)
+type 2 (uncompressed 24bit/32bit true color, glquake supported this)
+type 3 (uncompressed 8bit greyscale)
+type 9 (RLE compressed 8bit paletted with 24bit/32bit palette)
+type 10 (RLE compressed 24bit/32bit true color, glquake supported this)
+type 11 (RLE compressed 8bit greyscale)
+attribute bit 0x20 (Origin At Top Left, top to bottom, left to right)
+
+image formats guaranteed to be supported: tga, pcx, lmp
+image formats that are optional: png, jpg
+
+mdl/spr/spr32 examples:
+skins are named _A (A being a number) and skingroups are named like _A_B
+these act as suffixes on the model name...
+example names for skin _2_1 of model "progs/armor.mdl":
+game/override/progs/armor.mdl_2_1.tga
+game/textures/progs/armor.mdl_2_1.tga
+game/progs/armor.mdl_2_1.tga
+example names for skin _0 of the model "progs/armor.mdl":
+game/override/progs/armor.mdl_0.tga
+game/textures/progs/armor.mdl_0.tga
+game/progs/armor.mdl_0.tga
+note that there can be more skins files (of the _0 naming) than the mdl
+contains, this is only useful to save space in the .mdl file if classic quake
+compatibility is not a concern.
+
+bsp/md2/md3 examples:
+example names for the texture "quake" of model "maps/start.bsp":
+game/override/quake.tga
+game/textures/quake.tga
+game/quake.tga
+
+sbar/menu/console textures: for example the texture "conchars" (console font) in gfx.wad
+game/override/gfx/conchars.tga
+game/textures/gfx/conchars.tga
+game/gfx/conchars.tga
+*/
+
+//DP_GFX_EXTERNALTEXTURES_PERMAPTEXTURES
+//idea: Fuh?
+//darkplaces implementation: LordHavoc
+//description:
+//Q1BSP and HLBSP map loading loads external textures found in textures/<mapname>/ as well as textures/.
+//Where mapname is the bsp filename minus the extension (typically .bsp) and minus maps/ if it is in maps/ (any other path is not removed)
+//example:
+//maps/e1m1.bsp uses textures in the directory textures/e1m1/ and falls back to textures/
+//maps/b_batt0.bsp uses textures in the directory textures/b_batt0.bsp and falls back to textures/
+//as a more extreme example:
+//progs/something/blah.bsp uses textures in the directory textures/progs/something/blah/ and falls back to textures/
+
+//DP_GFX_FOG
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//worldspawn fields:
+//"fog" (parameters: "density red green blue", example: "0.1 0.3 0.3 0.3")
+//description:
+//global fog for the map, can not be changed by QC
+
+//DP_GFX_QUAKE3MODELTAGS
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//field definitions:
+.entity tag_entity; // entity this is attached to (call setattachment to set this)
+.float tag_index; // which tag on that entity (0 is relative to the entity, > 0 is an index into the tags on the model if it has any) (call setattachment to set this)
+//builtin definitions:
+void(entity e, entity tagentity, string tagname) setattachment = #443; // attachs e to a tag on tagentity (note: use "" to attach to entity origin/angles instead of a tag)
+//description:
+//allows entities to be visually attached to model tags (which follow animations perfectly) on other entities, for example attaching a weapon to a player's hand, or upper body attached to lower body, allowing it to change angles and frame separately (note: origin and angles are relative to the tag, use '0 0 0' for both if you want it to follow exactly, this is similar to viewmodelforclient's behavior).
+//note 2: if the tag is not found, it defaults to "" (attach to origin/angles of entity)
+//note 3: attaching to world turns off attachment
+//note 4: the entity that this is attached to must be visible for this to work
+//note 5: if an entity is attached to the player entity it will not be drawn in first person.
+
+//DP_GFX_SKINFILES
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//alias models (mdl, md2, md3) can have .skin files to replace conventional texture naming, these have a naming format such as:
+//progs/test.md3_0.skin
+//progs/test.md3_1.skin
+//...
+//
+//these files contain replace commands (replace meshname shadername), example:
+//replace "helmet" "progs/test/helmet1.tga" // this is a mesh shader replacement
+//replace "teamstripes" "progs/test/redstripes.tga"
+//replace "visor" "common/nodraw" // this makes the visor mesh invisible
+////it is not possible to rename tags using this format
+//
+//Or the Quake3 syntax (100% compatible with Quake3's .skin files):
+//helmet,progs/test/helmet1.tga // this is a mesh shader replacement
+//teamstripes,progs/test/redstripes.tga
+//visor,common/nodraw // this makes the visor mesh invisible
+//tag_camera, // this defines that the first tag in the model is called tag_camera
+//tag_test, // this defines that the second tag in the model is called tag_test
+//
+//any names that are not replaced are automatically show up as a grey checkerboard to indicate the error status, and "common/nodraw" is a special case that is invisible.
+//this feature is intended to allow multiple skin sets on md3 models (which otherwise only have one skin set).
+//other commands might be added someday but it is not expected.
+
+//DP_GFX_SKYBOX
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//worldspawn fields:
+//"sky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, note: "sky" is also used the same way by Quake2)
+//description:
+//global skybox for the map, can not be changed by QC
+
+//DP_UTF8
+//idea: Blub\0, divVerent
+//darkplaces implementation: Blub\0
+//cvar definitions:
+//   utf8_enable: enable utf8 encoding
+//description: utf8 characters are allowed inside cvars, protocol strings, files, progs strings, etc., 
+//and count as 1 char for string functions like strlen, substring, etc.
+// note: utf8_enable is run-time cvar, could be changed during execution
+// note: beware that str2chr() could return value bigger than 255 once utf8 is enabled
+
+//DP_HALFLIFE_MAP
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//simply indicates that the engine supports HalfLife maps (BSP version 30, NOT the QER RGBA ones which are also version 30).
+
+//DP_HALFLIFE_MAP_CVAR
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//cvars:
+//halflifebsp 0/1
+//description:
+//engine sets this cvar when loading a map to indicate if it is halflife format or not.
+
+//DP_HALFLIFE_SPRITE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//simply indicates that the engine supports HalfLife sprites.
+
+//DP_INPUTBUTTONS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float button3;
+.float button4;
+.float button5;
+.float button6;
+.float button7;
+.float button8;
+.float button9;
+.float button10;
+.float button11;
+.float button12;
+.float button13;
+.float button14;
+.float button15;
+.float button16;
+//description:
+//set to the state of the +button3, +button4, +button5, +button6, +button7, and +button8 buttons from the client, this does not involve protocol changes (the extra 6 button bits were simply not used).
+//the exact mapping of protocol button bits on the server is:
+//self.button0 = (bits & 1) != 0;
+///* button1 is skipped because mods abuse it as a variable, and accordingly it has no bit */
+//self.button2 = (bits & 2) != 0;
+//self.button3 = (bits & 4) != 0;
+//self.button4 = (bits & 8) != 0;
+//self.button5 = (bits & 16) != 0;
+//self.button6 = (bits & 32) != 0;
+//self.button7 = (bits & 64) != 0;
+//self.button8 = (bits & 128) != 0;
+
+// DP_LIGHTSTYLE_STATICVALUE
+// idea: VorteX
+// darkplaces implementation: VorteX
+// description: allows alternative 'static' lightstyle syntax : "=value"
+// examples: "=0.5", "=2.0", "=2.75"
+// could be used to control switchable lights or making styled lights with brightness > 2
+// Warning: this extension is experimental. It safely works in CSQC, but SVQC use is limited by the fact 
+// that other engines (which do not support this extension) could connect to a game and misunderstand this kind of lightstyle syntax
+
+//DP_LITSPRITES
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//indicates this engine supports lighting on sprites, any sprite with ! in its filename (both on disk and in the qc) will be lit rather than having forced EF_FULLBRIGHT (EF_FULLBRIGHT on the entity can still force these sprites to not be lit).
+
+//DP_LITSUPPORT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//indicates this engine loads .lit files for any quake1 format .bsp files it loads to enhance maps with colored lighting.
+//implementation description: these files begin with the header QLIT followed by version number 1 (as little endian 32bit), the rest of the file is a replacement lightmaps lump, except being 3x as large as the lightmaps lump of the map it matches up with (and yes the between-lightmap padding is expanded 3x to keep this consistent), so the lightmap offset in each surface is simply multiplied by 3 during loading to properly index the lit data, and the lit file is loaded instead of the lightmap lump, other renderer changes are needed to display these of course...  see the litsupport.zip sample code (almost a tutorial) at http://icculus.org/twilight/darkplaces for more information.
+
+//DP_MONSTERWALK
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//MOVETYPE_WALK is permitted on non-clients, so bots can move smoothly, run off ledges, etc, just like a real player.
+
+//DP_MOVETYPEBOUNCEMISSILE
+//idea: id Software
+//darkplaces implementation: id Software
+//movetype definitions:
+//float MOVETYPE_BOUNCEMISSILE = 11; // already in defs.qc
+//description:
+//MOVETYPE_BOUNCE but without gravity, and with full reflection (no speed loss like grenades have), in other words - bouncing laser bolts.
+
+//DP_MOVETYPEFLYWORLDONLY
+//idea: Samual
+//darkplaces implementation: Samual
+//movetype definitions:
+float MOVETYPE_FLY_WORLDONLY = 33;
+//description:
+//like MOVETYPE_FLY, but does all traces with MOVE_WORLDONLY, and is ignored by MOVETYPE_PUSH. Should only be combined with SOLID_NOT and SOLID_TRIGGER.
+
+//DP_NULL_MODEL
+//idea: Chris
+//darkplaces implementation: divVerent
+//definitions:
+//string dp_null_model = "null";
+//description:
+//setmodel(e, "null"); makes an entity invisible, have a zero bbox, but
+//networked. useful for shared CSQC entities.
+
+//DP_MOVETYPEFOLLOW
+//idea: id Software, LordHavoc (redesigned)
+//darkplaces implementation: LordHavoc
+//movetype definitions:
+float MOVETYPE_FOLLOW = 12;
+//description:
+//MOVETYPE_FOLLOW implemented, this uses existing entity fields in unusual ways:
+//aiment - the entity this is attached to.
+//punchangle - the original angles when the follow began.
+//view_ofs - the relative origin (note that this is un-rotated by punchangle, and that is actually the only purpose of punchangle).
+//v_angle - the relative angles.
+//here's an example of how you would set a bullet hole sprite to follow a bmodel it was created on, even if the bmodel rotates:
+//hole.movetype = MOVETYPE_FOLLOW; // make the hole follow
+//hole.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid
+//hole.aiment = bmodel; // make the hole follow bmodel
+//hole.punchangle = bmodel.angles; // the original angles of bmodel
+//hole.view_ofs = hole.origin - bmodel.origin; // relative origin
+//hole.v_angle = hole.angles - bmodel.angles; // relative angles
+
+//DP_QC_ASINACOSATANATAN2TAN
+//idea: Urre
+//darkplaces implementation: LordHavoc
+//constant definitions:
+float DEG2RAD = 0.0174532925199432957692369076848861271344287188854172545609719144;
+float RAD2DEG = 57.2957795130823208767981548141051703324054724665643215491602438612;
+float PI      = 3.1415926535897932384626433832795028841971693993751058209749445923;
+//builtin definitions:
+float(float s) asin = #471; // returns angle in radians for a given sin() value, the result is in the range -PI*0.5 to PI*0.5
+float(float c) acos = #472; // returns angle in radians for a given cos() value, the result is in the range 0 to PI
+float(float t) atan = #473; // returns angle in radians for a given tan() value, the result is in the range -PI*0.5 to PI*0.5
+float(float c, float s) atan2 = #474; // returns angle in radians for a given cos() and sin() value pair, the result is in the range -PI to PI (this is identical to vectoyaw except it returns radians rather than degrees)
+float(float a) tan = #475; // returns tangent value (which is simply sin(a)/cos(a)) for the given angle in radians, the result is in the range -infinity to +infinity
+//description:
+//useful math functions for analyzing vectors, note that these all use angles in radians (just like the cos/sin functions) not degrees unlike makevectors/vectoyaw/vectoangles, so be sure to do the appropriate conversions (multiply by DEG2RAD or RAD2DEG as needed).
+//note: atan2 can take unnormalized vectors (just like vectoyaw), and the function was included only for completeness (more often you want vectoyaw or vectoangles), atan2(v_x,v_y) * RAD2DEG gives the same result as vectoyaw(v)
+
+//DP_QC_AUTOCVARS
+//idea: divVerent
+//darkplaces implementation: divVerent
+//description:
+//allows QC variables to be bound to cvars
+//(works for float, string, vector types)
+//example:
+// float autocvar_developer;
+// float autocvar_registered;
+// string autocvar__cl_name;
+//NOTE: copying a string-typed autocvar to another variable/field, and then
+//changing the cvar or returning from progs is UNDEFINED. Writing to autocvar
+//globals is UNDEFINED. Accessing autocvar globals after changing that cvar in
+//the same frame by any means other than cvar_set() from the same QC VM is
+//IMPLEMENTATION DEFINED (an implementation may either yield the previous, or
+//the current, value). Changing them via cvar_set() in the same QC VM
+//immediately must reflect on the autocvar globals. Whether autocvar globals,
+//after restoring a savegame, have the cvar's current value, or the original
+//value at time of saving, is UNDEFINED. Restoring a savegame however must not
+//restore the cvar values themselves.
+//In case the cvar does NOT exist, then it is automatically created with the
+//value of the autocvar initializer, if given. This is possible with e.g.
+//frikqcc and fteqcc the following way:
+// var float autocvar_whatever = 42;
+//If no initializer is given, the cvar will be initialized to a string
+//equivalent to the NULL value of the given data type, that is, the empty
+//string, 0, or '0 0 0'. However, when automatic cvar creation took place, a
+//warning is printed to the game console.
+//NOTE: to prevent an ambiguity with float names for vector types, autocvar
+//names MUST NOT end with _x, _y or _z!
+
+//DP_QC_CHANGEPITCH
+//idea: id Software
+//darkplaces implementation: id Software
+//field definitions:
+.float idealpitch;
+.float pitch_speed;
+//builtin definitions:
+void(entity ent) changepitch = #63;
+//description:
+//equivalent to changeyaw, ent is normally self. (this was a Q2 builtin)
+
+//DP_QC_COPYENTITY
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(entity from, entity to) copyentity = #400;
+//description:
+//copies all data in the entity to another entity.
+
+//DP_QC_CRC16
+//idea: divVerent
+//darkplaces implementation: divVerent
+//Some hash function to build hash tables with. This has to be be the CRC-16-CCITT that is also required for the QuakeWorld download protocol.
+//When caseinsensitive is set, the CRC is calculated of the lower cased string.
+float(float caseinsensitive, string s, ...) crc16 = #494;
+
+//DP_QC_CVAR_DEFSTRING
+//idea: id Software (Doom3), LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+string(string s) cvar_defstring = #482;
+//description:
+//returns the default value of a cvar, as a tempstring.
+
+//DP_QC_CVAR_DESCRIPTION
+//idea: divVerent
+//DarkPlaces implementation: divVerent
+//builtin definitions:
+string(string name) cvar_description = #518;
+//description:
+//returns the description of a cvar
+
+//DP_QC_CVAR_STRING
+//idea: VorteX
+//DarkPlaces implementation: VorteX, LordHavoc
+//builtin definitions:
+string(string s) cvar_string = #448;
+//description:
+//returns the value of a cvar, as a tempstring.
+
+//DP_QC_CVAR_TYPE
+//idea: divVerent
+//DarkPlaces implementation: divVerent
+//builtin definitions:
+float(string name) cvar_type = #495;
+float CVAR_TYPEFLAG_EXISTS = 1;
+float CVAR_TYPEFLAG_SAVED = 2;
+float CVAR_TYPEFLAG_PRIVATE = 4;
+float CVAR_TYPEFLAG_ENGINE = 8;
+float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
+float CVAR_TYPEFLAG_READONLY = 32;
+
+//DP_QC_DIGEST
+//idea: motorsep, Spike
+//DarkPlaces implementation: divVerent
+//builtin definitions:
+string(string digest, string data, ...) digest_hex = #639;
+//description:
+//returns a given hex digest of given data
+//the returned digest is always encoded in hexadecimal
+//only the "MD4" digest is always supported!
+//if the given digest is not supported, string_null is returned
+//the digest string is matched case sensitively, use "MD4", not "md4"!
+
+//DP_QC_DIGEST_SHA256
+//idea: motorsep, Spike
+//DarkPlaces implementation: divVerent
+//description:
+//"SHA256" is also an allowed digest type
+
+//DP_QC_EDICT_NUM
+//idea: 515
+//DarkPlaces implementation: LordHavoc
+//builtin definitions:
+entity(float entnum) edict_num = #459;
+float(entity ent) wasfreed = #353; // same as in EXT_CSQC extension
+//description:
+//edict_num returns the entity corresponding to a given number, this works even for freed entities, but you should call wasfreed(ent) to see if is currently active.
+//wasfreed returns whether an entity slot is currently free (entities that have never spawned are free, entities that have had remove called on them are also free).
+
+//DP_QC_ENTITYDATA
+//idea: KrimZon
+//darkplaces implementation: KrimZon
+//builtin definitions:
+float() numentityfields = #496;
+string(float fieldnum) entityfieldname = #497;
+float(float fieldnum) entityfieldtype = #498;
+string(float fieldnum, entity ent) getentityfieldstring = #499;
+float(float fieldnum, entity ent, string s) putentityfieldstring = #500;
+//constants:
+//Returned by entityfieldtype
+float FIELD_STRING   = 1;
+float FIELD_FLOAT    = 2;
+float FIELD_VECTOR   = 3;
+float FIELD_ENTITY   = 4;
+float FIELD_FUNCTION = 6;
+//description:
+//Versatile functions intended for storing data from specific entities between level changes, but can be customized for some kind of partial savegame.
+//WARNING: .entity fields cannot be saved and restored between map loads as they will leave dangling pointers.
+//numentityfields returns the number of entity fields. NOT offsets. Vectors comprise 4 fields: v, v_x, v_y and v_z.
+//entityfieldname returns the name as a string, eg. "origin" or "classname" or whatever.
+//entityfieldtype returns a value that the constants represent, but the field may be of another type in more exotic progs.dat formats or compilers.
+//getentityfieldstring returns data as would be written to a savegame, eg... "0.05" (float), "0 0 1" (vector), or "Hello World!" (string). Function names can also be returned.
+//putentityfieldstring puts the data returned by getentityfieldstring back into the entity.
+
+//DP_QC_ENTITYSTRING
+void(string s) loadfromdata = #529;
+void(string s) loadfromfile = #530;
+void(string s) callfunction = #605;
+void(float fh, entity e) writetofile = #606;
+float(string s) isfunction = #607;
+void(entity e, string s) parseentitydata = #608;
+
+//DP_QC_ETOS
+//idea: id Software
+//darkplaces implementation: id Software
+//builtin definitions:
+string(entity ent) etos = #65;
+//description:
+//prints "entity 1" or similar into a string. (this was a Q2 builtin)
+
+//DP_QC_EXTRESPONSEPACKET
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions:
+string(void) getextresponse = #624;
+//description:
+//returns a string of the form "\"ipaddress:port\" data...", or the NULL string
+//if no packet was found. Packets can be queued into the client/server by
+//sending a packet starting with "\xFF\xFF\xFF\xFFextResponse " to the
+//listening port.
+
+//DP_QC_FINDCHAIN
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+entity(.string fld, string match) findchain = #402;
+//description:
+//similar to find() but returns a chain of entities like findradius.
+
+//DP_QC_FINDCHAIN_TOFIELD
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions:
+entity(.string fld, float match, .entity tofield) findradius_tofield = #22;
+entity(.string fld, string match, .entity tofield) findchain_tofield = #402;
+entity(.string fld, float match, .entity tofield) findchainflags_tofield = #450;
+entity(.string fld, float match, .entity tofield) findchainfloat_tofield = #403;
+//description:
+//similar to findchain() etc, but stores the chain into .tofield instead of .chain
+//actually, the .entity tofield is an optional field of the the existing findchain* functions
+
+//DP_QC_FINDCHAINFLAGS
+//idea: Sajt
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+entity(.float fld, float match) findchainflags = #450;
+//description:
+//similar to findflags() but returns a chain of entities like findradius.
+
+//DP_QC_FINDCHAINFLOAT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+entity(.entity fld, entity match) findchainentity = #403;
+entity(.float fld, float match) findchainfloat = #403;
+//description:
+//similar to findentity()/findfloat() but returns a chain of entities like findradius.
+
+//DP_QC_FINDFLAGS
+//idea: Sajt
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+entity(entity start, .float fld, float match) findflags = #449;
+//description:
+//finds an entity with the specified flag set in the field, similar to find()
+
+//DP_QC_FINDFLOAT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+entity(entity start, .entity fld, entity match) findentity = #98;
+entity(entity start, .float fld, float match) findfloat = #98;
+//description:
+//finds an entity or float field value, similar to find(), but for entity and float fields.
+
+//DP_QC_FS_SEARCH
+//idea: Black
+//darkplaces implementation: Black
+//builtin definitions:
+float(string pattern, float caseinsensitive, float quiet) search_begin = #444;
+void(float handle) search_end = #445;
+float(float handle) search_getsize = #446;
+string(float handle, float num) search_getfilename = #447;
+//description:
+//search_begin performs a filename search with the specified pattern (for example "maps/*.bsp") and stores the results in a search slot (minimum of 128 supported by any engine with this extension), the other functions take this returned search slot number, be sure to search_free when done (they are also freed on progs reload).
+//search_end frees a search slot (also done at progs reload).
+//search_getsize returns how many filenames were found.
+//search_getfilename returns a filename from the search.
+
+//DP_QC_GETLIGHT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+vector(vector org) getlight = #92;
+//description:
+//returns the lighting at the requested location (in color), 0-255 range (can exceed 255).
+
+//DP_QC_GETSURFACE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+float(entity e, float s) getsurfacenumpoints = #434;
+vector(entity e, float s, float n) getsurfacepoint = #435;
+vector(entity e, float s) getsurfacenormal = #436;
+string(entity e, float s) getsurfacetexture = #437;
+float(entity e, vector p) getsurfacenearpoint = #438;
+vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
+//description:
+//functions to query surface information.
+
+//DP_QC_GETSURFACEPOINTATTRIBUTE
+//idea: BlackHC
+//darkplaces implementation: BlackHC
+// constants
+float SPA_POSITION = 0;
+float SPA_S_AXIS = 1;
+float SPA_T_AXIS = 2;
+float SPA_R_AXIS = 3; // same as SPA_NORMAL
+float SPA_TEXCOORDS0 = 4;
+float SPA_LIGHTMAP0_TEXCOORDS = 5;
+float SPA_LIGHTMAP0_COLOR = 6;
+//builtin definitions:
+vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
+
+//description:
+//function to query extended information about a point on a certain surface
+
+//DP_QC_GETSURFACETRIANGLE
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions:
+float(entity e, float s) getsurfacenumtriangles = #628;
+vector(entity e, float s, float n) getsurfacetriangle = #629;
+//description:
+//function to query triangles of a surface
+
+//DP_QC_GETTAGINFO
+//idea: VorteX, LordHavoc
+//DarkPlaces implementation: VorteX
+//builtin definitions:
+int(entity ent, string tagname) gettagindex = #451;
+vector(entity ent, float tagindex) gettaginfo = #452;
+//description:
+//gettagindex returns the number of a tag on an entity, this number is the same as set by setattachment (in the .tag_index field), allowing the qc to save a little cpu time by keeping the number around if it wishes (this could already be done by calling setattachment and saving off the tag_index).
+//gettaginfo returns the origin of the tag in worldspace and sets v_forward, v_right, and v_up to the current orientation of the tag in worldspace, this automatically resolves all dependencies (attachments, including viewmodelforclient), this means you could fire a shot from a tag on a gun entity attached to the view for example.
+
+//DP_QC_GETTAGINFO_BONEPROPERTIES
+//idea: daemon
+//DarkPlaces implementation: divVerent
+//global definitions:
+float gettaginfo_parent;
+string gettaginfo_name;
+vector gettaginfo_offset;
+vector gettaginfo_forward;
+vector gettaginfo_right;
+vector gettaginfo_up;
+//description:
+//when this extension is present, gettaginfo fills in some globals with info about the bone that had been queried
+//gettaginfo_parent is set to the number of the parent bone, or 0 if it is a root bone
+//gettaginfo_name is set to the name of the bone whose index had been specified in gettaginfo
+//gettaginfo_offset, gettaginfo_forward, gettaginfo_right, gettaginfo_up contain the transformation matrix of the bone relative to its parent. Note that the matrix may contain a scaling component.
+
+//DP_QC_GETTIME
+//idea: tZork
+//darkplaces implementation: tZork, divVerent
+//constant definitions:
+float GETTIME_FRAMESTART = 0; // time of start of frame
+float GETTIME_REALTIME = 1; // current time (may be OS specific)
+float GETTIME_HIRES = 2; // like REALTIME, but may reset between QC invocations and thus can be higher precision
+float GETTIME_UPTIME = 3; // time since start of the engine
+//builtin definitions:
+float(float tmr) gettime = #519;
+//description:
+//some timers to query...
+
+//DP_QC_GETTIME_CDTRACK
+//idea: divVerent
+//darkplaces implementation: divVerent
+//constant definitions:
+float GETTIME_CDTRACK = 4;
+//description:
+//returns the playing time of the current cdtrack when passed to gettime()
+//see DP_END_GETSOUNDTIME for similar functionality but for entity sound channels
+
+//DP_QC_I18N
+//idea: divVerent
+//darkplaces implementation: divVerent
+//description:
+//
+//The engine supports translating by gettext compatible .po files.
+//progs.dat uses progs.dat.<LANGUAGE>.po
+//menu.dat uses menu.dat.<LANGUAGE>.po
+//csprogs.dat uses csprogs.dat.<LANGUAGE>.po
+//
+//To create a string that can be translated, define it as
+//  string dotranslate_FILENOTFOUND = "File not found";
+//Note: if the compiler does constant folding, this will only work if there is
+//no other "File not found" string in the progs!
+//
+//Alternatively, if using the Xonotic patched fteqcc compiler, you can simplify
+//this by using _("File not found") directly in the source code.
+//
+//The language is set by the "prvm_language" cvar: if prvm_language is set to
+//"de", it will read progs.dat.de.po for translating strings in progs.dat.
+//
+//If prvm_language is set to the special name "dump", progs.dat.pot will be
+//written, which is a translation template to be edited by filling out the
+//msgstr entries.
+
+//DP_QC_LOG
+//darkplaces implementation: divVerent
+//builtin definitions:
+float log(float f) = #532;
+//description:
+//logarithm
+
+//DP_QC_MINMAXBOUND
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+float(float a, float b, ...) min = #94;
+float(float a, float b, float c) min3 = #94;
+float(float a, float b, float c, float d) min4 = #94;
+float(float a, float b, float c, float d, float e) min5 = #94;
+float(float a, float b, float c, float d, float e, float f) min6 = #94;
+float(float a, float b, float c, float d, float e, float f, float g) min7 = #94;
+float(float a, float b, float c, float d, float e, float f, float g, float h) min8 = #94;
+float(float a, float b, ...) max = #95;
+float(float a, float b, float c) max3 = #95;
+float(float a, float b, float c, float d) max4 = #95;
+float(float a, float b, float c, float d, float e) max5 = #95;
+float(float a, float b, float c, float d, float e, float f) max6 = #95;
+float(float a, float b, float c, float d, float e, float f, float g) max7 = #95;
+float(float a, float b, float c, float d, float e, float f, float g, float h) max8 = #95;
+float(float minimum, float val, float maximum) bound = #96;
+//description:
+//min returns the lowest of all the supplied numbers.
+//max returns the highest of all the supplied numbers.
+//bound clamps the value to the range and returns it.
+
+//DP_QC_MULTIPLETEMPSTRINGS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//this extension makes all builtins returning tempstrings (ftos for example)
+//cycle through a pool of multiple tempstrings (at least 16), allowing
+//multiple ftos results to be gathered before putting them to use, normal
+//quake only had 1 tempstring, causing many headaches.
+//
+//Note that for longer term storage (or compatibility on engines having
+//FRIK_FILE but not this extension) the FRIK_FILE extension's
+//strzone/strunzone builtins provide similar functionality (slower though).
+//
+//NOTE: this extension is superseded by DP_QC_UNLIMITEDTEMPSTRINGS
+
+//DP_QC_NUM_FOR_EDICT
+//idea: Blub\0
+//darkplaces implementation: Blub\0
+//Function to get the number of an entity - a clean way.
+float(entity num) num_for_edict = #512;
+
+//DP_QC_RANDOMVEC
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+vector() randomvec = #91;
+//description:
+//returns a vector of length < 1, much quicker version of this QC: do {v_x = random()*2-1;v_y = random()*2-1;v_z = random()*2-1;} while(vlen(v) > 1)
+
+//DP_QC_SINCOSSQRTPOW
+//idea: id Software, LordHavoc
+//darkplaces implementation: id Software, LordHavoc
+//builtin definitions:
+float(float val) sin = #60;
+float(float val) cos = #61;
+float(float val) sqrt = #62;
+float(float a, float b) pow = #97;
+//description:
+//useful math functions, sine of val, cosine of val, square root of val, and raise a to power b, respectively.
+
+//DP_QC_SPRINTF
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions:
+string(string format, ...) sprintf = #627;
+//description:
+//you know sprintf :P
+//supported stuff:
+//  %
+//  optional: <argpos>$ for the argument to format
+//  flags: #0- +
+//  optional: <width>, *, or *<argpos>$ for the field width
+//  optional: .<precision>, .*, or .*<argpos>$ for the precision
+//  length modifiers: h for forcing a float, l for forcing an int/entity (by default, %d etc. cast a float to int)
+//  conversions:
+//    d takes a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an int
+//    i takes an int/entity if no length is specified or i is, and a float if h is specified as length, and cast it to an int
+//    ouxXc take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an unsigned int
+//    eEfFgG take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to a double
+//    s takes a string
+//    vV takes a vector, and processes the three components as if it were a gG for all three components, separated by space
+//    For conversions s and c, the flag # makes precision and width interpreted
+//      as byte count, by default it is interpreted as character count in UTF-8
+//      enabled engines. No other conversions can create wide characters, and #
+//      has another meaning in these. When in character count mode, color codes
+//      are ignored. To get UTF-8 semantics WITHOUT color code parsing, use
+//      the + flag.
+
+//DP_QC_STRFTIME
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+string(float uselocaltime, string format, ...) strftime = #478;
+//description:
+//provides the ability to get the local (in your timezone) or world (Universal Coordinated Time) time as a string using the formatting of your choice:
+//example: "%Y-%m-%d %H:%M:%S"   (result looks like: 2007-02-08 01:03:15)
+//note: "%F %T" gives the same result as "%Y-%m-%d %H:%M:%S" (ISO 8601 date format and 24-hour time)
+//for more format codes please do a web search for strftime 3 and you should find the man(3) pages for this standard C function.
+//
+//practical uses:
+//changing day/night cycle (shops closing, monsters going on the prowl) in an RPG, for this you probably want to use s = strftime(true, "%H");hour = stof(s);
+//printing current date/time for competitive multiplayer games, such as the beginning/end of each round in real world time.
+//activating eastereggs in singleplayer games on certain dates.
+//
+//note: some codes such as %x and %X use your locale settings and thus may not make sense to international users, it is not advisable to use these as the server and clients may be in different countries.
+//note: if you display local time to a player, it would be a good idea to note whether it is local time using a string like "%F %T (local)", and otherwise use "%F %T (UTC)".
+//note: be aware that if the game is saved and reloaded a week later the date and time will be different, so if activating eastereggs in a singleplayer game or something you may want to only check when a level is loaded and then keep the same easteregg state throughout the level so that the easteregg does not deactivate when reloading from a savegame (also be aware that precaches should not depend on such date/time code because reloading a savegame often scrambles the precaches if so!).
+//note: this function can return a NULL string (you can check for it with if (!s)) if the localtime/gmtime functions returned NULL in the engine code, such as if those functions don't work on this platform (consoles perhaps?), so be aware that this may return nothing.
+
+//DP_QC_STRINGCOLORFUNCTIONS
+//idea: Dresk
+//darkplaces implementation: Dresk
+//builtin definitions:
+float(string s) strlennocol = #476; // returns how many characters are in a string, minus color codes
+string(string s) strdecolorize = #477; // returns a string minus the color codes of the string provided
+//description:
+//provides additional functionality to strings by supporting functions that isolate and identify strings with color codes
+
+//DP_QC_STRING_CASE_FUNCTIONS
+//idea: Dresk
+//darkplaces implementation: LordHavoc / Dresk
+//builtin definitions:
+string(string s) strtolower = #480; // returns the passed in string in pure lowercase form
+string(string s) strtoupper = #481; // returns the passed in string in pure uppercase form
+//description:
+//provides simple string uppercase and lowercase functions
+
+//DP_QC_TOKENIZEBYSEPARATOR
+//idea: Electro, SavageX, LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+int(string s, string separator1, ...) tokenizebyseparator = #479;
+//description:
+//this function returns tokens separated by any of the supplied separator strings, example:
+//numnumbers = tokenizebyseparator("10.2.3.4", ".");
+//returns 4 and the tokens are "10" "2" "3" "4"
+//possibly useful for parsing IPv4 addresses (such as "1.2.3.4") and IPv6 addresses (such as "[1234:5678:9abc:def0:1234:5678:9abc:def0]:26000")
+
+//DP_QC_TOKENIZE_CONSOLE
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions:
+int(string s) tokenize_console = #514;
+int(float i) argv_start_index = #515;
+int(float i) argv_end_index = #516;
+//description:
+//this function returns tokens separated just like the console does
+//also, functions are provided to get the index of the first and last character of each token in the original string
+//Passing negative values to them, or to argv, will be treated as indexes from the LAST token (like lists work in Perl). So argv(-1) will return the LAST token.
+
+//DP_QC_TRACEBOX
+//idea: id Software
+//darkplaces implementation: id Software
+//builtin definitions:
+void(vector v1, vector min, vector max, vector v2, float nomonsters, entity forent) tracebox = #90;
+//description:
+//similar to traceline but much more useful, traces a box of the size specified (technical note: in quake1 and halflife bsp maps the mins and maxs will be rounded up to one of the hull sizes, quake3 bsp does not have this problem, this is the case with normal moving entities as well).
+
+//DP_QC_TRACETOSS
+//idea: id Software
+//darkplaces implementation: id Software
+//builtin definitions:
+void(entity ent, entity ignore) tracetoss = #64;
+//description:
+//simulates movement of the entity as if it is MOVETYPE_TOSS and starting with it's current state (location, velocity, etc), returns relevant trace_ variables (trace_fraction is always 0, all other values are supported - trace_ent, trace_endpos, trace_plane_normal), does not actually alter the entity.
+
+//DP_QC_TRACE_MOVETYPE_HITMODEL
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//constant definitions:
+float MOVE_HITMODEL = 4;
+//description:
+//allows traces to hit alias models (not sprites!) instead of entity boxes, use as the nomonsters parameter to trace functions, note that you can hit invisible model entities (alpha < 0 or EF_NODRAW or model "", it only checks modelindex)
+
+//DP_QC_TRACE_MOVETYPE_WORLDONLY
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//constant definitions:
+float MOVE_WORLDONLY = 3;
+//description:
+//allows traces to hit only world (ignoring all entities, unlike MOVE_NOMONSTERS which hits all bmodels), use as the nomonsters parameter to trace functions
+
+//DP_QC_UNLIMITEDTEMPSTRINGS
+//idea: divVerent
+//darkplaces implementation: LordHavoc
+//description:
+//this extension alters Quake behavior such that instead of reusing a single
+//tempstring (or multiple) there are an unlimited number of tempstrings, which
+//are removed only when a QC function invoked by the engine returns,
+//eliminating almost all imaginable concerns with string handling in QuakeC.
+//
+//in short:
+//you can now use and abuse tempstrings as much as you like, you still have to
+//use strzone (FRIK_FILE) for permanent storage however.
+//
+//
+//
+//implementation notes for other engine coders:
+//these tempstrings are expected to be stored in a contiguous buffer in memory
+//which may be fixed size or controlled by a cvar, or automatically grown on
+//demand (in the case of DarkPlaces).
+//
+//this concept is similar to quake's Zone system, however these are all freed
+//when the QC interpreter returns.
+//
+//this is basically a poor man's garbage collection system for strings.
+
+//DP_QC_VECTOANGLES_WITH_ROLL
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+vector(vector forward, vector up) vectoangles2 = #51; // same number as vectoangles
+//description:
+//variant of vectoangles that takes an up vector to calculate roll angle (also uses this to calculate yaw correctly if the forward is straight up or straight down)
+//note: just like normal vectoangles you need to negate the pitch of the returned angles if you want to feed them to makevectors or assign to self.v_angle
+
+//DP_QC_VECTORVECTORS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector dir) vectorvectors = #432;
+//description:
+//creates v_forward, v_right, and v_up vectors given a forward vector, similar to makevectors except it takes a forward direction vector instead of angles.
+
+//DP_QC_WHICHPACK
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions:
+string(string filename) whichpack = #503;
+//description:
+//returns the name of the pak/pk3/whatever containing the given file, in the same path space as FRIK_FILE functions use (that is, possibly with a path name prefix)
+
+//DP_QC_URI_ESCAPE
+//idea: divVerent
+//darkplaces implementation: divVerent
+//URI::Escape's functionality
+string(string in) uri_escape = #510;
+string(string in) uri_unescape = #511;
+
+//DP_QC_URI_GET
+//idea: divVerent
+//darkplaces implementation: divVerent
+//loads text from an URL into a string
+//returns 1 on success of initiation, 0 if there are too many concurrent
+//connections already or if the URL is invalid
+//the following callback will receive the data and MUST exist!
+//  void(float id, float status, string data) URI_Get_Callback;
+//status is either
+//  negative for an internal error,
+//  0 for success, or
+//  the HTTP response code on server error (e.g. 404)
+//if 1 is returned by uri_get, the callback will be called in the future
+float(string url, float id) uri_get = #513;
+
+//DP_QC_URI_POST
+//idea: divVerent
+//darkplaces implementation: divVerent
+//loads text from an URL into a string after POSTing via HTTP
+//works like uri_get, but uri_post sends data with Content-Type: content_type to the server
+//and uri_post sends the string buffer buf, joined using the delimiter delim
+float(string url, float id, string content_type, string data) uri_post = #513;
+float(string url, float id, string content_type, string delim, float buf) uri_postbuf = #513;
+
+//DP_SKELETONOBJECTS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//this extension indicates that FTE_CSQC_SKELETONOBJECTS functionality is available in server QC (as well as CSQC).
+
+//DP_SV_SPAWNFUNC_PREFIX
+//idea: divVerent
+//darkplaces implementation: divVerent
+//Make functions whose name start with spawnfunc_ take precedence as spawn function for loading entities.
+//Useful if you have a field ammo_shells (required in any Quake mod) but want to support spawn functions called ammo_shells (like in Q3A).
+//Optionally, you can declare a global "float require_spawnfunc_prefix;" which will require ANY spawn function to start with that prefix.
+
+
+//DP_QUAKE2_MODEL
+//idea: quake community
+//darkplaces implementation: LordHavoc
+//description:
+//shows that the engine supports Quake2 .md2 files.
+
+//DP_QUAKE2_SPRITE
+//idea: LordHavoc
+//darkplaces implementation: Elric
+//description:
+//shows that the engine supports Quake2 .sp2 files.
+
+//DP_QUAKE3_MAP
+//idea: quake community
+//darkplaces implementation: LordHavoc
+//description:
+//shows that the engine supports Quake3 .bsp files.
+
+//DP_QUAKE3_MODEL
+//idea: quake community
+//darkplaces implementation: LordHavoc
+//description:
+//shows that the engine supports Quake3 .md3 files.
+
+//DP_REGISTERCVAR
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+float(string name, string value) registercvar = #93;
+//description:
+//adds a new console cvar to the server console (in singleplayer this is the player's console), the cvar exists until the mod is unloaded or the game quits.
+//NOTE: DP_CON_SET is much better.
+
+//DP_SND_DIRECTIONLESSATTNNONE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//make sounds with ATTN_NONE have no spatialization (enabling easy use as music sources).
+
+//DP_SND_FAKETRACKS
+//idea: requested
+
+//darkplaces implementation: Elric
+//description:
+//the engine plays sound/cdtracks/track001.wav instead of cd track 1 and so on if found, this allows games and mods to have music tracks without using ambientsound.
+//Note: also plays .ogg with DP_SND_OGGVORBIS extension.
+
+//DP_SND_SOUND7_WIP1
+//DP_SND_SOUND7_WIP2
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions:
+void(entity e, float chan, string samp, float vol, float atten, float speed, float flags) sound7 = #8;
+float SOUNDFLAG_RELIABLE = 1;
+//description:
+//plays a sound, with some more flags
+//extensions to sound():
+//- channel may be in the range from -128 to 127; channels -128 to 0 are "auto",
+//  i.e. support multiple sounds at once, but cannot be stopped/restarted
+//- a value 0 in the speed parameter means no change; otherwise, it is a
+//  percentage of playback speed ("pitch shifting"). 100 is normal pitch, 50 is
+//  half speed, 200 is double speed, etc. (DP_SND_SOUND7_WIP2)
+//- the flag SOUNDFLAG_RELIABLE can be specified, which makes the sound send
+//  to MSG_ALL (reliable) instead of MSG_BROADCAST (unreliable, default);
+//  similarily, SOUNDFLAG_RELIABLE_TO_ONE sends to MSG_ONE
+//- channel 0 is controlled by snd_channel0volume; channel 1 and -1 by
+//  snd_channel1volume, etc. (so, a channel shares the cvar with its respective
+//  auto-channel); however, the mod MUST define snd_channel8volume and upwards
+//  in default.cfg if they are to be used, as the engine does not create them
+//  to not litter the cvar list
+//- this extension applies to CSQC as well; CSQC_Event_Sound will get speed and
+//  flags as extra 7th and 8th argument
+//- WIP2 ideas: SOUNDFLAG_RELIABLE_TO_ONE, SOUNDFLAG_NOPHS, SOUNDFLAG_FORCELOOP
+//- NOTE: to check for this, ALSO OR a check with DP_SND_SOUND7 to also support
+//  the finished extension once done
+
+//DP_SND_OGGVORBIS
+//idea: Transfusion
+//darkplaces implementation: Elric
+//description:
+//the engine supports loading Ogg Vorbis sound files.  Use either the .ogg filename directly, or a .wav of the same name (will try to load the .wav first and then .ogg).
+
+//DP_SND_STEREOWAV
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//the engine supports stereo WAV files.  (useful with DP_SND_DIRECTIONLESSATTNNONE for music)
+
+//DP_SND_GETSOUNDTIME
+//idea: VorteX
+//darkplaces implementation: VorteX
+//constant definitions:
+float(entity e, float channel) getsoundtime = #533; // get currently sound playing position on entity channel, -1 if not playing or error
+float(string sample) soundlength = #534; // returns length of sound sample in seconds, -1 on error (sound not precached, sound system not initialized etc.)
+//description: provides opportunity to query length of sound samples and realtime tracking of sound playing on entities (similar to DP_GETTIME_CDTRACK)
+//note: beware dedicated server not running sound engine at all, so in dedicated mode this builtins will not work in server progs
+//note also: menu progs not supporting getsoundtime() (will give a warning) since it has no sound playing on entities
+//examples of use:
+//  - QC-driven looped sounds
+//  - QC events when sound playing is finished
+//  - toggleable ambientsounds
+//  - subtitles
+
+//DP_VIDEO_DPV
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//console commands:
+//  playvideo <videoname> - start playing video
+//  stopvideo - stops current video
+//description: indicated that engine support playing videos in DPV format
+
+//DP_VIDEO_SUBTITLES
+//idea: VorteX
+//darkplaces implementation: VorteX
+//cvars:
+//  cl_video_subtitles - toggles subtitles showing
+//  cl_video_subtitles_lines - how many lines to reserve for subtitles
+//  cl_video_subtitles_textsize - font size
+//console commands:
+//  playvideo <videoname> <custom_subtitles_file> - start playing video
+//  stopvideo - stops current video
+//description: indicates that engine support subtitles on videos
+//subtitles stored in external text files, each video file has it's default subtitles file ( <videoname>.dpsubs )
+//example: for video/act1.dpv default subtitles file will be video/act1.dpsubs
+//also video could be played with custom subtitles file by utilizing second parm of playvideo command
+//syntax of .dpsubs files: each line in .dpsubs file defines 1 subtitle, there are three tokens:
+//   <start> <end> "string"
+//   start: subtitle start time in seconds
+//     end: subtitle time-to-show in seconds, if 0 - subtitle will be showed until next subtitle is started, 
+//          if below 0 - show until next subtitles minus this number of seconds
+//    text: subtitle text, color codes (Q3-style and ^xRGB) are allowed
+//example of subtitle file:
+//   3 0       "Vengeance! Vengeance for my eternity of suffering!"
+//   9 0       "Whelp! As if you knew what eternity was!"
+//   13        0       "Grovel before your true master."
+//   17        0       "Never!" 
+//   18        7       "I'll hack you from crotch to gizzard and feed what's left of you to your brides..."
+
+//DP_SOLIDCORPSE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//solid definitions:
+float SOLID_CORPSE = 5;
+//description:
+//the entity will not collide with SOLID_CORPSE and SOLID_SLIDEBOX entities (and likewise they will not collide with it), this is useful if you want dead bodies that are shootable but do not obstruct movement by players and monsters, note that if you traceline with a SOLID_SLIDEBOX entity as the ignoreent, it will ignore SOLID_CORPSE entities, this is desirable for visibility and movement traces, but not for bullets, for the traceline to hit SOLID_CORPSE you must temporarily force the player (or whatever) to SOLID_BBOX and then restore to SOLID_SLIDEBOX after the traceline.
+
+//DP_SPRITE32
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//the engine supports .spr32 sprites.
+
+//DP_SV_BOTCLIENT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//constants:
+float CLIENTTYPE_DISCONNECTED = 0;
+float CLIENTTYPE_REAL = 1;
+float CLIENTTYPE_BOT = 2;
+float CLIENTTYPE_NOTACLIENT = 3;
+//builtin definitions:
+entity() spawnclient = #454; // like spawn but for client slots (also calls relevant connect/spawn functions), returns world if no clients available
+float(entity clent) clienttype = #455; // returns one of the CLIENTTYPE_* constants
+//description:
+//spawns a client with no network connection, to allow bots to use client slots with no hacks.
+//How to use:
+/*
+       // to spawn a bot
+       local entity oldself;
+       oldself = self;
+       self = spawnclient();
+       if (!self)
+       {
+               bprint("Can not add bot, server full.\n");
+               self = oldself;
+               return;
+       }
+       self.netname = "Yoyobot";
+       self.clientcolors = 12 * 16 + 4; // yellow (12) shirt and red (4) pants
+       ClientConnect();
+       PutClientInServer();
+       self = oldself;
+
+       // to remove all bots
+       local entity head;
+       head = find(world, classname, "player");
+       while (head)
+       {
+               if (clienttype(head) == CLIENTTYPE_BOT)
+                       dropclient(head);
+               head = find(head, classname, "player");
+       }
+
+       // to identify if a client is a bot (for example in PlayerPreThink)
+       if (clienttype(self) == CLIENTTYPE_BOT)
+               botthink();
+*/
+//see also DP_SV_CLIENTCOLORS DP_SV_CLIENTNAME DP_SV_DROPCLIENT
+//How it works:
+//creates a new client, calls SetNewParms and stores the parms, and returns the client.
+//this intentionally does not call SV_SendServerinfo to allow the QuakeC a chance to set the netname and clientcolors fields before actually spawning the bot by calling ClientConnect and PutClientInServer manually
+//on level change ClientConnect and PutClientInServer are called by the engine to spawn in the bot (this is why clienttype() exists to tell you on the next level what type of client this is).
+//parms work the same on bot clients as they do on real clients, and do carry from level to level
+
+//DP_SV_BOUNCEFACTOR
+//idea: divVerent
+//darkplaces implementation: divVerent
+//field definitions:
+.float bouncefactor; // velocity multiplier after a bounce
+.float bouncestop; // bounce stops if velocity to bounce plane is < bouncestop * gravity AFTER the bounce
+//description:
+//allows qc to customize MOVETYPE_BOUNCE a bit
+
+//DP_SV_CLIENTCAMERA
+//idea: LordHavoc, others
+//darkplaces implementation: Black
+//field definitions:
+.entity clientcamera; // override camera entity
+//description:
+//allows another entity to be the camera for a client, for example a remote camera, this is similar to sending svc_setview manually except that it also changes the network culling appropriately.
+
+//DP_SV_CLIENTCOLORS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float clientcolors; // colors of the client (format: pants + shirt * 16)
+//description:
+//allows qc to read and modify the client colors associated with a client entity (not particularly useful on other entities), and automatically sends out any appropriate network updates if changed
+
+//DP_SV_CLIENTNAME
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//description:
+//allows qc to modify the client's .netname, and automatically sends out any appropriate network updates if changed
+
+//DP_SV_CUSTOMIZEENTITYFORCLIENT
+//idea: LordHavoc
+//darkplaces implementation: [515] and LordHavoc
+//field definitions:
+.float() customizeentityforclient; // self = this entity, other = client entity
+//description:
+//allows qc to modify an entity before it is sent to each client, the function returns true if it should send, false if it should not, and is fully capable of editing the entity's fields, this allows cloaked players to appear less transparent to their teammates, navigation markers to only show to their team, etc
+//tips on writing customize functions:
+//it is a good idea to return false early in the function if possible to reduce cpu usage, because this function may be called many thousands of times per frame if there are many customized entities on a 64+ player server.
+//you are free to change anything in self, but please do not change any other entities (the results may be very inconsistent).
+//example ideas for use of this extension:
+//making icons over teammates' heads which are only visible to teammates.  for exasmple: float() playericon_customizeentityforclient = {return self.owner.team == other.team;};
+//making cloaked players more visible to their teammates than their enemies.  for example: float() player_customizeentityforclient = {if (self.items & IT_CLOAKING) {if (self.team == other.team) self.alpha = 0.6;else self.alpha = 0.1;} return true;};
+//making explosion models that face the viewer (does not work well with chase_active).  for example: float() explosion_customizeentityforclient = {self.angles = vectoangles(other.origin + other.view_ofs - self.origin);self.angles_x = 0 - self.angles_x;};
+//implementation notes:
+//entity customization is done before per-client culling (visibility for instance) because the entity may be doing setorigin to display itself in different locations on different clients, may be altering its .modelindex, .effects and other fields important to culling, so customized entities increase cpu usage (non-customized entities can use all the early culling they want however, as they are not changing on a per client basis).
+
+//DP_SV_DISCARDABLEDEMO
+//idea: parasti
+//darkplaces implementation: parasti
+//field definitions:
+.float discardabledemo;
+//description:
+//when this field is set to a non-zero value on a player entity, a possibly recorded server-side demo for the player is discarded
+//Note that this extension only works if:
+//  auto demos are enabled (the cvar sv_autodemo_perclient is set)
+//  discarding demos is enabled (the cvar sv_autodemo_perclient_discardable is set)
+
+//DP_SV_DRAWONLYTOCLIENT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.entity drawonlytoclient;
+//description:
+//the entity is only visible to the specified client.
+
+//DP_SV_DROPCLIENT
+//idea: FrikaC
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(entity clent) dropclient = #453;
+//description:
+//causes the server to immediately drop the client, more reliable than stuffcmd(clent, "disconnect\n"); which could be intentionally ignored by the client engine
+
+//DP_SV_EFFECT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404;
+//SVC definitions:
+//float svc_effect = #52; // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate
+//float svc_effect2 = #53; // [vector] org [short] modelindex [byte] startframe [byte] framecount [byte] framerate
+//description:
+//clientside playback of simple custom sprite effects (explosion sprites, etc).
+
+//DP_SV_ENTITYCONTENTSTRANSITION
+//idea: Dresk
+//darkplaces implementation: Dresk
+//field definitions:
+.void(float nOriginalContents, float nNewContents) contentstransition;
+//description:
+//This field function, when provided, is triggered on an entity when the contents (ie. liquid / water / etc) is changed.
+//The first parameter provides the entities original contents, prior to the transition.  The second parameter provides the new contents.
+//NOTE: If this field function is provided on an entity, the standard watersplash sound IS SUPPRESSED to allow for authors to create their own transition sounds.
+
+//DP_SV_MOVETYPESTEP_LANDEVENT
+//idea: Dresk
+//darkplaces implementation: Dresk
+//field definitions:
+.void(vector vImpactVelocity) movetypesteplandevent;
+//description:
+//This field function, when provided, is triggered on a MOVETYPE_STEP entity when it experiences  "land event".
+// The standard engine behavior for this event is to play the sv_sound_land CVar sound.
+//The parameter provides the velocity of the entity at the time of the impact.  The z value may therefore be used to calculate how "hard" the entity struck the surface.
+//NOTE: If this field function is provided on a MOVETYPE_STEP entity, the standard sv_sound_land sound IS SUPPRESSED to allow for authors to create their own feedback.
+
+//DP_SV_POINTSOUND
+//idea: Dresk
+//darkplaces implementation: Dresk
+//builtin definitions:
+void(vector origin, string sample, float volume, float attenuation) pointsound = #483;
+//description:
+//Similar to the standard QC sound function, this function takes an origin instead of an entity and omits the channel parameter.
+// This allows sounds to be played at arbitrary origins without spawning entities.
+
+//DP_SV_ONENTITYNOSPAWNFUNCTION
+//idea: Dresk
+//darkplaces implementation: Dresk
+//engine-called QC prototypes:
+//void() SV_OnEntityNoSpawnFunction;
+//description:
+// This function is called whenever an entity on the server has no spawn function, and therefore has no defined QC behavior.
+// You may as such dictate the behavior as to what happens to the entity.
+// To mimic the engine's default behavior, simply call remove(self).
+
+//DP_SV_ONENTITYPREPOSTSPAWNFUNCTION
+//idea: divVerent
+//darkplaces implementation: divVerent
+//engine-called QC prototypes:
+//void() SV_OnEntityPreSpawnFunction;
+//void() SV_OnEntityPostSpawnFunction;
+//description:
+// These functions are called BEFORE or AFTER an entity is spawned the regular way.
+// You may as such dictate the behavior as to what happens to the entity.
+// SV_OnEntityPreSpawnFunction is called before even looking for the spawn function, so you can even change its classname in there. If it remove()s the entity, the spawn function will not be looked for.
+// SV_OnEntityPostSpawnFunction is called ONLY after its spawn function or SV_OnEntityNoSpawnFunction was called, and skipped if the entity got removed by either.
+
+//DP_SV_MODELFLAGS_AS_EFFECTS
+//idea: LordHavoc, Dresk
+//darkplaces implementation: LordHavoc
+//field definitions:
+.int modelflags;
+//constant definitions:
+float EF_NOMODELFLAGS = 8388608; // ignore any effects in a model file and substitute your own
+float MF_ROCKET  =   1; // leave a trail
+float MF_GRENADE =   2; // leave a trail
+float MF_GIB     =   4; // leave a trail
+float MF_ROTATE  =   8; // rotate (bonus items)
+float MF_TRACER  =  16; // green split trail
+float MF_ZOMGIB  =  32; // small blood trail
+float MF_TRACER2 =  64; // orange split trail
+float MF_TRACER3 = 128; // purple trail
+//description:
+//this extension allows model flags to be specified on entities so you can add a rocket trail and glow to any entity, etc.
+//setting any of these will override the flags the model already has, to disable the model's flags without supplying any of your own you must use EF_NOMODELFLAGS.
+//
+//silly example modification #1 to W_FireRocket in weapons.qc:
+//missile.effects = EF_NOMODELFLAGS; // rocket without a glow/fire trail
+//silly example modification #2 to W_FireRocket in weapons.qc:
+//missile.modelflags = MF_GIB; // leave a blood trail instead of glow/fire trail
+//
+//note: you can not combine multiple kinds of trail, only one of them will be active, you can combine MF_ROTATE and the other MF_ flags however, and using EF_NOMODELFLAGS along with these does no harm.
+//
+//note to engine coders: they are internally encoded in the protocol as extra EF_ flags (shift the values left 24 bits and send them in the protocol that way), so no protocol change was required (however 32bit effects is a protocol extension itself), within the engine they are referred to as EF_ for the 24bit shifted values.
+
+//DP_SV_NETADDRESS
+//idea: Dresk
+//darkplaces implementation: Dresk
+//field definitions:
+.string netaddress;
+//description:
+// provides the netaddress of the associated entity (ie. 127.0.0.1) and "null/botclient" if the netconnection of the entity is invalid
+
+//DP_SV_NODRAWTOCLIENT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.entity nodrawtoclient;
+//description:
+//the entity is not visible to the specified client.
+
+//DP_SV_PING
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float ping;
+//description:
+//continuously updated field indicating client's ping (based on average of last 16 packet time differences).
+
+//DP_SV_PING_PACKETLOSS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float ping_packetloss;
+.float ping_movementloss;
+//description:
+//continuously updated field indicating client's packet loss, and movement loss (i.e. packet loss affecting player movement).
+
+//DP_SV_POINTPARTICLES
+//idea: Spike
+//darkplaces implementation: LordHavoc
+//function definitions:
+int(string effectname) particleeffectnum = #335; // same as in CSQC
+void(entity ent, float effectnum, vector start, vector end) trailparticles = #336; // same as in CSQC
+void(float effectnum, vector org, vector vel, float howmany) pointparticles = #337; // same as in CSQC
+//SVC definitions:
+//float svc_trailparticles = 60; // [short] entnum [short] effectnum [vector] start [vector] end
+//float svc_pointparticles = 61; // [short] effectnum [vector] start [vector] velocity [short] count
+//float svc_pointparticles1 = 62; // [short] effectnum [vector] start, same as svc_pointparticles except velocity is zero and count is 1
+//description:
+//provides the ability to spawn non-standard particle effects, typically these are defined in a particle effect information file such as effectinfo.txt in darkplaces.
+//this is a port of particle effect features from clientside QC (EXT_CSQC) to server QC, as these effects are potentially useful to all games even if they do not make use of EXT_CSQC.
+//warning: server must have same order of effects in effectinfo.txt as client does or the numbers would not match up, except for standard quake effects which are always the same numbers.
+
+//DP_SV_PUNCHVECTOR
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.vector punchvector;
+//description:
+//offsets client view in worldspace, similar to view_ofs but all 3 components are used and are sent with at least 8 bits of fraction, this allows the view to be kicked around by damage or hard landings or whatever else, note that unlike punchangle this is not faded over time, it is up to the mod to fade it (see also DP_SV_PLAYERPHYSICS).
+
+//DP_SV_PLAYERPHYSICS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.vector movement;
+//cvar definitions:
+//"sv_playerphysicsqc" (0/1, default 1, allows user to disable qc player physics)
+//engine-called QC prototypes:
+//void() SV_PlayerPhysics;
+//description:
+//.movement vector contains the movement input from the player, allowing QC to do as it wishs with the input, and SV_PlayerPhysics will completely replace the player physics if present (works for all MOVETYPE's), see darkplaces mod source for example of this function (in playermovement.qc, adds HalfLife ladders support, as well as acceleration/deceleration while airborn (rather than the quake sudden-stop while airborn), and simplifies the physics a bit)
+
+//DP_PHYSICS_ODE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//globals:
+//new movetypes:
+const float MOVETYPE_PHYSICS = 32; // need to be set before any physics_* builtins applied
+//new solid types (deprecated):
+const float SOLID_PHYSICS_BOX = 32;
+const float SOLID_PHYSICS_SPHERE = 33;
+const float SOLID_PHYSICS_CAPSULE = 34;
+const float SOLID_PHYSICS_TRIMESH = 35;
+const float SOLID_PHYSICS_CYLINDER = 36;
+//geometry types:
+const float GEOMTYPE_NONE = -1;       // entity will be entirely skipped by ODE
+const float GEOMTYPE_SOLID = 0;       // geometry type will be set based on .solid field
+const float GEOMTYPE_BOX = 1;         // entity bound box
+const float GEOMTYPE_SPHERE = 2;      // sphere with radius picked from x axis of entity bound box
+const float GEOMTYPE_CAPSULE = 3;     // with leading axis automatically determined from longest one, radius is picked as minimal of the rest 2 axes
+const float GEOMTYPE_TRIMESH = 4;     // triangle mesh
+const float GEOMTYPE_CYLINDER = 5;    // like capsule but not capped
+                                      // note that ODE's builtin cylinder support is experimental, somewhat bugged and unfinished (no cylinder-cylinder collision)
+                                                                         // to use properly working cylinder should build ODE with LIBCCD extension
+const float GEOMTYPE_CAPSULE_X = 6;   // capsule with fixed leading axis
+const float GEOMTYPE_CAPSULE_Y = 7;
+const float GEOMTYPE_CAPSULE_Z = 8;
+const float GEOMTYPE_CYLINDER_X        = 9;  // cylinder with fixed leading axis
+const float GEOMTYPE_CYLINDER_Y        = 10;
+const float GEOMTYPE_CYLINDER_Z        = 11;
+//joint types:
+const float JOINTTYPE_NONE = 0;
+const float JOINTTYPE_POINT = 1;
+const float JOINTTYPE_HINGE = 2;
+const float JOINTTYPE_SLIDER = 3;
+const float JOINTTYPE_UNIVERSAL = 4;
+const float JOINTTYPE_HINGE2 = 5;
+const float JOINTTYPE_FIXED = -1;
+//force types:
+const float FORCETYPE_NONE = 0;
+const float FORCETYPE_FORCE = 1; // applied at center of mass
+const float FORCETYPE_FORCEATPOS = 2;
+const float FORCETYPE_TORQUE = 3;
+// common joint properties:
+// .entity aiment; // connected objects
+// .entity enemy; // connected objects, forces
+// .vector movedir;
+//   for a spring:
+//     movedir_x = spring constant (force multiplier, must be > 0)
+//     movedir_y = spring dampening constant to prevent oscillation (must be > 0)
+//     movedir_z = spring stop position (+/-)
+//   for a motor:
+//     movedir_x = desired motor velocity
+//     movedir_y = -1 * max motor force to use
+//     movedir_z = stop position (+/-), set to 0 for no stop
+//   note that ODE does not support both in one anyway
+//   for a force:
+//     force vector to apply
+//field definitions:
+.float  geomtype;     // see GEOMTYPE_*, a more correct way to set collision shape, allows to set SOLID_CORPSE and trimesh collisions
+.float  maxcontacts;  // maximum number of contacts to make for this object, lesser = faster (but setting it too low will could make object pass though walls), default is 16, maximum is 32
+.float  mass;         // ODE mass, standart value is 1
+.vector massofs;      // offsets a mass center out of object center, if not set a center of model bounds is used
+.float  friction;     // a friction of object, get multiplied by second objects's friction on contact
+.float  bouncefactor;
+.float  bouncestop; 
+.float  jointtype;    // type of joint
+.float  forcetype;    // type of force
+.float  erp;          // error restitution parameter, makes ODE solver attempt to fix errors in contacts, 
+                      // bringing together 2 joints or fixing object being stuch in other object, 
+                                 // a value of 0.1 will fix slightly, a value of 1.0 attempts to fix whole error in one frame
+                                 // use with care as high values makes system unstable and likely to explode
+//builtin definitions:
+void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object
+void(entity e, vector force, vector force_pos) physics_addforce = #541; // deprecated, apply a force from certain origin, length of force vector is power of force
+void(entity e, vector torque) physics_addtorque = #542; // deprecated, add relative torque
+//description: provides Open Dynamics Engine support, requires extenal dll to be present or engine compiled with statical link option
+//be sure to checkextension for it to know if library is loaded and ready, also to enable physics set "physics_ode" cvar to 1
+//note: this extension is highly experimental and may be unstable
+
+//DP_SV_PRINT
+//idea: id Software (QuakeWorld Server)
+//darkplaces implementation: Black, LordHavoc
+void(string s, ...) print = #339; // same number as in EXT_CSQC
+//description:
+//this is identical to dprint except that it always prints regardless of the developer cvar.
+
+//DP_SV_PRECACHEANYTIME
+//idea: id Software (Quake2)
+//darkplaces implementation: LordHavoc
+//description:
+//this extension allows precache_model and precache_sound (and any variants) to be used during the game (with automatic messages to clients to precache the new model/sound indices), also setmodel/sound/ambientsound can be called without precaching first (they will cause an automatic precache).
+
+//DP_SV_QCSTATUS
+//idea: divVerent
+//darkplaces implementation: divVerent
+//1. A global variable
+string worldstatus;
+//Its content is set as "qcstatus" field in the rules.
+//It may be at most 255 characters, and must not contain newlines or backslashes.
+//2. A per-client field
+.string clientstatus;
+//It is sent instead of the "frags" in status responses.
+//It should always be set in a way so that stof(player.clientstatus) is a meaningful score value. Other info may be appended. If used this way, the cvar sv_status_use_qcstatus may be set to 1, and then this value will replace the frags in "status".
+//Currently, qstat does not support this and will not show player info if used and set to anything other than ftos(some integer).
+
+//DP_SV_ROTATINGBMODEL
+//idea: id Software
+//darkplaces implementation: LordHavoc
+//description:
+//this extension merely indicates that MOVETYPE_PUSH supports avelocity, allowing rotating brush models to be created, they rotate around their origin (needs rotation supporting qbsp/light utilities because id ones expected bmodel entity origins to be '0 0 0', recommend setting "origin" key in the entity fields in the map before compiling, there may be other methods depending on your qbsp, most are more complicated however).
+//tip: level designers can create a func_wall with an origin, and avelocity (for example "avelocity" "0 90 0"), and "nextthink" "99999999" to make a rotating bmodel without any qc modifications, such entities will be solid in stock quake but will not rotate)
+
+//DP_SV_SETCOLOR
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(entity ent, float colors) setcolor = #401;
+//engine called QC functions (optional):
+//void(float color) SV_ChangeTeam;
+//description:
+//setcolor sets the color on a client and updates internal color information accordingly (equivalent to stuffing a "color" command but immediate)
+//SV_ChangeTeam is called by the engine whenever a "color" command is recieved, it may decide to do anything it pleases with the color passed by the client, including rejecting it (by doing nothing), or calling setcolor to apply it, preventing team changes is one use for this.
+//the color format is pants + shirt * 16 (0-255 potentially)
+
+//DP_SV_SLOWMO
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//cvars:
+//"slowmo" (0+, default 1)
+//description:
+//sets the time scale of the server, mainly intended for use in singleplayer by the player, however potentially useful for mods, so here's an extension for it.
+//range is 0 to infinite, recommended values to try are 0.1 (very slow, 10% speed), 1 (normal speed), 5 (500% speed).
+
+//DP_SV_WRITEPICTURE
+//idea: divVerent
+//darkplaces implementation: divVerent
+//builtin definitions:
+void(float to, string s, float sz) WritePicture = #501;
+//description:
+//writes a picture to the data stream so CSQC can read it using ReadPicture, which has the definition
+//  string(void) ReadPicture = #501;
+//The picture data is sent as at most sz bytes, by compressing to low quality
+//JPEG. The data being sent will be equivalent to:
+//  WriteString(to, s);
+//  WriteShort(to, imagesize);
+//  for(i = 0; i < imagesize; ++i)
+//    WriteByte(to, [the i-th byte of the compressed JPEG image]);
+
+//DP_SV_WRITEUNTERMINATEDSTRING
+//idea: FrikaC
+//darkplaces implementation: Sajt
+//builtin definitions:
+void(float to, string s) WriteUnterminatedString = #456;
+//description:
+//like WriteString, but does not write a terminating 0 after the string. This means you can include things like a player's netname in the middle of a string sent over the network. Just be sure to end it up with either a call to WriteString (which includes the trailing 0) or WriteByte(0) to terminate it yourself.
+//A historical note: this extension was suggested by FrikaC years ago, more recently Shadowalker has been badmouthing LordHavoc and Spike for stealing 'his' extension writestring2 which does exactly the same thing but uses a different builtin number and name and extension string, this argument hinges on the idea that it was his idea in the first place, which is incorrect as FrikaC first suggested it and used a rough equivalent of it in his FrikBot mod years ago involving WriteByte calls on each character.
+
+//DP_TE_BLOOD
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org, vector velocity, float howmany) te_blood = #405;
+//temp entity definitions:
+float TE_BLOOD = 50;
+//protocol:
+//vector origin
+//byte xvelocity (-128 to +127)
+//byte yvelocity (-128 to +127)
+//byte zvelocity (-128 to +127)
+//byte count (0 to 255, how much blood)
+//description:
+//creates a blood effect.
+
+//DP_TE_BLOODSHOWER
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406;
+//temp entity definitions:
+//float TE_BLOODSHOWER = 52;
+//protocol:
+//vector mins (minimum corner of the cube)
+//vector maxs (maximum corner of the cube)
+//coord explosionspeed (velocity of blood particles flying out of the center)
+//short count (number of blood particles)
+//description:
+//creates an exploding shower of blood, for making gibbings more convincing.
+
+//DP_TE_CUSTOMFLASH
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org, float radius, float lifetime, vector color) te_customflash = #417;
+//temp entity definitions:
+//float TE_CUSTOMFLASH = 73;
+//protocol:
+//vector origin
+//byte radius ((MSG_ReadByte() + 1) * 8, meaning 8-2048 unit radius)
+//byte lifetime ((MSG_ReadByte() + 1) / 256.0, meaning approximately 0-1 second lifetime)
+//byte red (0.0 to 1.0 converted to 0-255)
+//byte green (0.0 to 1.0 converted to 0-255)
+//byte blue (0.0 to 1.0 converted to 0-255)
+//description:
+//creates a customized light flash.
+
+//DP_TE_EXPLOSIONRGB
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org, vector color) te_explosionrgb = #407;
+//temp entity definitions:
+//float TE_EXPLOSIONRGB = 53;
+//protocol:
+//vector origin
+//byte red (0.0 to 1.0 converted to 0 to 255)
+//byte green (0.0 to 1.0 converted to 0 to 255)
+//byte blue (0.0 to 1.0 converted to 0 to 255)
+//description:
+//creates a colored explosion effect.
+
+//DP_TE_FLAMEJET
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org, vector vel, float howmany) te_flamejet = #457;
+//temp entity definitions:
+//float TE_FLAMEJET = 74;
+//protocol:
+//vector origin
+//vector velocity
+//byte count (0 to 255, how many flame particles)
+//description:
+//creates a single puff of flame particles.  (not very useful really)
+
+//DP_TE_PARTICLECUBE
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408;
+//temp entity definitions:
+//float TE_PARTICLECUBE = 54;
+//protocol:
+//vector mins (minimum corner of the cube)
+//vector maxs (maximum corner of the cube)
+//vector velocity
+//short count
+//byte color (palette color)
+//byte gravity (true or false, FIXME should this be a scaler instead?)
+//coord randomvel (how much to jitter the velocity)
+//description:
+//creates a cloud of particles, useful for forcefields but quite customizable.
+
+//DP_TE_PARTICLERAIN
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409;
+//temp entity definitions:
+//float TE_PARTICLERAIN = 55;
+//protocol:
+//vector mins (minimum corner of the cube)
+//vector maxs (maximum corner of the cube)
+//vector velocity (velocity of particles)
+//short count (number of particles)
+//byte color (8bit palette color)
+//description:
+//creates a shower of rain, the rain will appear either at the top (if falling down) or bottom (if falling up) of the cube.
+
+//DP_TE_PARTICLESNOW
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410;
+//temp entity definitions:
+//float TE_PARTICLERAIN = 56;
+//protocol:
+//vector mins (minimum corner of the cube)
+//vector maxs (maximum corner of the cube)
+//vector velocity (velocity of particles)
+//short count (number of particles)
+//byte color (8bit palette color)
+//description:
+//creates a shower of snow, the snow will appear either at the top (if falling down) or bottom (if falling up) of the cube, low velocities are advisable for convincing snow.
+
+//DP_TE_PLASMABURN
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org) te_plasmaburn = #433;
+//temp entity definitions:
+//float TE_PLASMABURN = 75;
+//protocol:
+//vector origin
+//description:
+//creates a small light flash (radius 200, time 0.2) and marks the walls.
+
+//DP_TE_QUADEFFECTS1
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org) te_gunshotquad = #412;
+void(vector org) te_spikequad = #413;
+void(vector org) te_superspikequad = #414;
+void(vector org) te_explosionquad = #415;
+//temp entity definitions:
+//float   TE_GUNSHOTQUAD  = 57; // [vector] origin
+//float   TE_SPIKEQUAD    = 58; // [vector] origin
+//float   TE_SUPERSPIKEQUAD = 59; // [vector] origin
+//float   TE_EXPLOSIONQUAD = 70; // [vector] origin
+//protocol:
+//vector origin
+//description:
+//all of these just take a location, and are equivalent in function (but not appearance :) to the original TE_GUNSHOT, etc.
+
+//DP_TE_SMALLFLASH
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org) te_smallflash = #416;
+//temp entity definitions:
+//float TE_SMALLFLASH = 72;
+//protocol:
+//vector origin
+//description:
+//creates a small light flash (radius 200, time 0.2).
+
+//DP_TE_SPARK
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org, vector vel, float howmany) te_spark = #411;
+//temp entity definitions:
+//float TE_SPARK = 51;
+//protocol:
+//vector origin
+//byte xvelocity (-128 to 127)
+//byte yvelocity (-128 to 127)
+//byte zvelocity (-128 to 127)
+//byte count (number of sparks)
+//description:
+//creates a shower of sparks and a smoke puff.
+
+//DP_TE_STANDARDEFFECTBUILTINS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+void(vector org) te_gunshot = #418;
+void(vector org) te_spike = #419;
+void(vector org) te_superspike = #420;
+void(vector org) te_explosion = #421;
+void(vector org) te_tarexplosion = #422;
+void(vector org) te_wizspike = #423;
+void(vector org) te_knightspike = #424;
+void(vector org) te_lavasplash = #425;
+void(vector org) te_teleport = #426;
+void(vector org, float color, float colorlength) te_explosion2 = #427;
+void(entity own, vector start, vector end) te_lightning1 = #428;
+void(entity own, vector start, vector end) te_lightning2 = #429;
+void(entity own, vector start, vector end) te_lightning3 = #430;
+void(entity own, vector start, vector end) te_beam = #431;
+//description:
+//to make life easier on mod coders.
+
+//DP_TRACE_HITCONTENTSMASK_SURFACEINFO
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//globals:
+.int dphitcontentsmask; // if non-zero on the entity passed to traceline/tracebox/tracetoss this will override the normal collidable contents rules and instead hit these contents values (for example AI can use tracelines that hit DONOTENTER if it wants to, by simply changing this field on the entity passed to traceline), this affects normal movement as well as trace calls
+int trace_dpstartcontents; // DPCONTENTS_ value at start position of trace
+int trace_dphitcontents; // DPCONTENTS_ value of impacted surface (not contents at impact point, just contents of the surface that was hit)
+int trace_dphitq3surfaceflags; // Q3SURFACEFLAG_ value of impacted surface
+string trace_dphittexturename; // texture name of impacted surface
+//constants:
+const int DPCONTENTS_SOLID = 1; // hit a bmodel, not a bounding box
+const int DPCONTENTS_WATER = 2;
+const int DPCONTENTS_SLIME = 4;
+const int DPCONTENTS_LAVA = 8;
+const int DPCONTENTS_SKY = 16;
+const int DPCONTENTS_BODY = 32; // hit a bounding box, not a bmodel
+const int DPCONTENTS_CORPSE = 64; // hit a SOLID_CORPSE entity
+const int DPCONTENTS_NODROP = 128; // an area where backpacks should not spawn
+const int DPCONTENTS_PLAYERCLIP = 256; // blocks player movement
+const int DPCONTENTS_MONSTERCLIP = 512; // blocks monster movement
+const int DPCONTENTS_DONOTENTER = 1024; // AI hint brush
+const int DPCONTENTS_LIQUIDSMASK = 14; // WATER | SLIME | LAVA
+const int DPCONTENTS_BOTCLIP = 2048; // AI hint brush
+const int DPCONTENTS_OPAQUE = 4096; // only fully opaque brushes get this (may be useful for line of sight checks)
+const int Q3SURFACEFLAG_NODAMAGE = 1;
+const int Q3SURFACEFLAG_SLICK = 2; // low friction surface
+const int Q3SURFACEFLAG_SKY = 4; // sky surface (also has NOIMPACT and NOMARKS set)
+const int Q3SURFACEFLAG_LADDER = 8; // climbable surface
+const int Q3SURFACEFLAG_NOIMPACT = 16; // projectiles should remove themselves on impact (this is set on sky)
+const int Q3SURFACEFLAG_NOMARKS = 32; // projectiles should not leave marks, such as decals (this is set on sky)
+const int Q3SURFACEFLAG_FLESH = 64; // projectiles should do a fleshy effect (blood?) on impact
+const int Q3SURFACEFLAG_NODRAW = 128; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_HINT = 256; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_SKIP = 512; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_NOLIGHTMAP = 1024; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_POINTLIGHT = 2048; // compiler hint (not important to qc)
+const int Q3SURFACEFLAG_METALSTEPS = 4096; // walking on this surface should make metal step sounds
+const int Q3SURFACEFLAG_NOSTEPS = 8192; // walking on this surface should not make footstep sounds
+const int Q3SURFACEFLAG_NONSOLID = 16384; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_LIGHTFILTER = 32768; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_ALPHASHADOW = 65536; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_NODLIGHT = 131072; // compiler hint (not important to qc)
+//float Q3SURFACEFLAG_DUST = 262144; // translucent 'light beam' effect (not important to qc)
+//description:
+//adds additional information after a traceline/tracebox/tracetoss call.
+//also (very important) sets trace_* globals before calling .touch functions,
+//this allows them to inspect the nature of the collision (for example
+//determining if a projectile hit sky), clears trace_* variables for the other
+//object in a touch event (that is to say, a projectile moving will see the
+//trace results in its .touch function, but the player it hit will see very
+//little information in the trace_ variables as it was not moving at the time)
+
+//DP_VIEWZOOM
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//field definitions:
+.float viewzoom;
+//description:
+//scales fov and sensitivity of player, valid range is 0 to 1 (intended for sniper rifle zooming, and such)
+
+//EXT_BITSHIFT
+//idea: Spike
+//darkplaces implementation: [515]
+//builtin definitions:
+float(float number, float quantity) bitshift = #218;
+//description:
+//multiplies number by a power of 2 corresponding to quantity (0 = *1, 1 = *2, 2 = *4, 3 = *8, -1 = /2, -2 = /4x, etc), and rounds down (due to integer math) like other bit operations do (& and | and the like).
+//note: it is faster to use multiply if you are shifting by a constant, avoiding the quakec function call cost, however that does not do a floor for you.
+
+//FRIK_FILE
+//idea: FrikaC
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+float(string s) stof = #81; // get numerical value from a string
+float(string filename, float mode) fopen = #110; // opens a file inside quake/gamedir/data/ (mode is FILE_READ, FILE_APPEND, or FILE_WRITE), returns fhandle >= 0 if successful, or fhandle < 0 if unable to open file for any reason
+void(float fhandle) fclose = #111; // closes a file
+string(float fhandle) fgets = #112; // reads a line of text from the file and returns as a tempstring
+void(float fhandle, string s, ...) fputs = #113; // writes a line of text to the end of the file
+int(string s) strlen = #114; // returns how many characters are in a string
+string(string s1, string s2, ...) strcat = #115; // concatenates two or more strings (for example "abc", "def" would return "abcdef") and returns as a tempstring
+string(string s, float start, float length) substring = #116; // returns a section of a string as a tempstring - see FTE_STRINGS for enhanced version
+vector(string s) stov = #117; // returns vector value from a string
+string(string s, ...) strzone = #118; // makes a copy of a string into the string zone and returns it, this is often used to keep around a tempstring for longer periods of time (tempstrings are replaced often)
+void(string s) strunzone = #119; // removes a copy of a string from the string zone (you can not use that string again or it may crash!!!)
+//constants:
+float FILE_READ = 0;
+float FILE_APPEND = 1;
+float FILE_WRITE = 2;
+//cvars:
+//pr_zone_min_strings : default 64 (64k), min 64 (64k), max 8192 (8mb)
+//description:
+//provides text file access functions and string manipulation functions, note that you may want to set pr_zone_min_strings in the worldspawn function if 64k is not enough string zone space.
+//
+//NOTE: strzone functionality is partially superseded by
+//DP_QC_UNLIMITEDTEMPSTRINGS when longterm storage is not needed
+//NOTE: substring is upgraded by FTE_STRINGS extension with negative start/length handling identical to php 5.2.0
+
+//FTE_CSQC_SKELETONOBJECTS
+//idea: Spike, LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+// all skeleton numbers are 1-based (0 being no skeleton)
+// all bone numbers are 1-based (0 being invalid)
+float(float modlindex) skel_create = #263; // create a skeleton (be sure to assign this value into .skeletonindex for use), returns skeleton index (1 or higher) on success, returns 0 on failure (for example if the modelindex is not skeletal), it is recommended that you create a new skeleton if you change modelindex, as the skeleton uses the hierarchy from the model.
+float(float skel, entity ent, float modlindex, float retainfrac, float firstbone, float lastbone) skel_build = #264; // blend in a percentage of standard animation, 0 replaces entirely, 1 does nothing, 0.5 blends half, etc, and this only alters the bones in the specified range for which out of bounds values like 0,100000 are safe (uses .frame, .frame2, .frame3, .frame4, .lerpfrac, .lerpfrac3, .lerpfrac4, .frame1time, .frame2time, .frame3time, .frame4time), returns skel on success, 0 on failure
+float(float skel) skel_get_numbones = #265; // returns how many bones exist in the created skeleton, 0 if skeleton does not exist
+string(float skel, float bonenum) skel_get_bonename = #266; // returns name of bone (as a tempstring), "" if invalid bonenum (< 1 for example) or skeleton does not exist
+int(float skel, float bonenum) skel_get_boneparent = #267; // returns parent num for supplied bonenum, 0 if bonenum has no parent or bone does not exist (returned value is always less than bonenum, you can loop on this)
+int(float skel, string tagname) skel_find_bone = #268; // get number of bone with specified name, 0 on failure, bonenum (1-based) on success, same as using gettagindex but takes modelindex instead of entity
+vector(float skel, float bonenum) skel_get_bonerel = #269; // get matrix of bone in skeleton relative to its parent - sets v_forward, v_right, v_up, returns origin (relative to parent bone)
+vector(float skel, float bonenum) skel_get_boneabs = #270; // get matrix of bone in skeleton in model space - sets v_forward, v_right, v_up, returns origin (relative to entity)
+void(float skel, float bonenum, vector org) skel_set_bone = #271; // set matrix of bone relative to its parent, reads v_forward, v_right, v_up, takes origin as parameter (relative to parent bone)
+void(float skel, float bonenum, vector org) skel_mul_bone = #272; // transform bone matrix (relative to its parent) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bone)
+void(float skel, float startbone, float endbone, vector org) skel_mul_bones = #273; // transform bone matrices (relative to their parents) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bones)
+void(float skeldst, float skelsrc, float startbone, float endbone) skel_copybones = #274; // copy bone matrices (relative to their parents) from one skeleton to another, useful for copying a skeleton to a corpse
+void(float skel) skel_delete = #275; // deletes skeleton at the beginning of the next frame (you can add the entity, delete the skeleton, renderscene, and it will still work)
+float(float modlindex, string framename) frameforname = #276; // finds number of a specified frame in the animation, returns -1 if no match found
+float(float modlindex, float framenum) frameduration = #277; // returns the intended play time (in seconds) of the specified framegroup, if it does not exist the result is 0, if it is a single frame it may be a small value around 0.1 or 0.
+//fields:
+.int skeletonindex; // active skeleton overriding standard animation on model
+.int frame; // primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
+.int frame2; // secondary framegroup animation (strength = lerpfrac)
+.float frame3; // tertiary framegroup animation (strength = lerpfrac3)
+.float frame4; // quaternary framegroup animation (strength = lerpfrac4)
+.float lerpfrac; // strength of framegroup blend
+.float lerpfrac3; // strength of framegroup blend
+.float lerpfrac4; // strength of framegroup blend
+.float frame1time; // start time of framegroup animation
+.float frame2time; // start time of framegroup animation
+.float frame3time; // start time of framegroup animation
+.float frame4time; // start time of framegroup animation
+//description:
+//this extension provides a way to do complex skeletal animation on an entity.
+//
+//see also DP_SKELETONOBJECTS (this extension implemented on server as well as client)
+//
+//notes:
+//each model contains its own skeleton, reusing a skeleton with incompatible models will yield garbage (or not render).
+//each model contains its own animation data, you can use animations from other model files (for example saving out all character animations as separate model files).
+//if an engine supports loading an animation-only file format such as .md5anim in FTEQW, it can be used to animate any model with a compatible skeleton.
+//proper use of this extension may require understanding matrix transforms (v_forward, v_right, v_up, origin), and you must keep in mind that v_right is negative for this purpose.
+//
+//features include:
+//multiple animations blended together.
+//animating a model with animations from another model with a compatible skeleton.
+//restricting animation blends to certain bones of a model - for example independent animation of legs, torso, head.
+//custom bone controllers - for example making eyes track a target location.
+//
+//
+//
+//example code follows...
+//
+//this helper function lets you identify (by parentage) what group a bone
+//belongs to - for example "torso", "leftarm", would return 1 ("torso") for
+//all children of the bone named "torso", unless they are children of
+//"leftarm" (which is a child of "torso") which would return 2 instead...
+float(float skel, float bonenum, string g1, string g2, string g3, string g4, string g5, string g6) example_skel_findbonegroup =
+{
+       while (bonenum >= 0)
+       {
+               string bonename = skel_get_bonename(skel, bonenum);
+               if (bonename == g1) return 1;
+               if (bonename == g2) return 2;
+               if (bonename == g3) return 3;
+               if (bonename == g4) return 4;
+               if (bonename == g5) return 5;
+               if (bonename == g6) return 6;
+               bonenum = skel_get_boneparent(skel, bonenum);
+       }
+       return 0;
+};
+// create a skeletonindex for our player using current modelindex
+void() example_skel_player_setup =
+{
+       self.skeletonindex = skel_create(self.modelindex);
+};
+// setup bones of skeleton based on an animation
+// note: animmodelindex can be a different model than self.modelindex
+void(float animmodelindex, float framegroup, float framegroupstarttime) example_skel_player_update_begin =
+{
+       // start with our standard animation
+       self.frame = framegroup;
+       self.frame2 = 0;
+       self.frame3 = 0;
+       self.frame4 = 0;
+       self.frame1time = framegroupstarttime;
+       self.frame2time = 0;
+       self.frame3time = 0;
+       self.frame4time = 0;
+       self.lerpfrac = 0;
+       self.lerpfrac3 = 0;
+       self.lerpfrac4 = 0;
+       skel_build(self.skeletonindex, self, animmodelindex, 0, 0, 100000);
+};
+// apply a different framegroup animation to bones with a specified parent
+void(float animmodelindex, float framegroup, float framegroupstarttime, float blendalpha, string groupbonename, string excludegroupname1, string excludegroupname2) example_skel_player_update_applyoverride =
+{
+       self.frame = framegroup;
+       self.frame2 = 0;
+       self.frame3 = 0;
+       self.frame4 = 0;
+       self.frame1time = framegroupstarttime;
+       self.frame2time = 0;
+       self.frame3time = 0;
+       self.frame4time = 0;
+       self.lerpfrac = 0;
+       self.lerpfrac3 = 0;
+       self.lerpfrac4 = 0;
+       float bonenum = 0;
+       float numbones = skel_get_numbones(self.skeletonindex);
+       while (bonenum < numbones)
+       {
+               if (example_skel_findbonegroup(self.skeletonindex, bonenum, groupbonename, excludegroupname1, excludegroupname2, "", "", "") == 1)
+                       skel_build(self.skeletonindex, self, animmodelindex, 1 - blendalpha, bonenum, bonenum + 1);
+               bonenum = bonenum + 1;
+       }
+};
+// make eyes point at a target location, be sure v_forward, v_right, v_up are set correctly before calling
+void(vector eyetarget, string bonename) example_skel_player_update_eyetarget =
+{
+       float bonenum = skel_find_bone(self.skeletonindex, bonename) - 1;
+       if (bonenum < 0)
+               return;
+       vector oldforward = v_forward;
+       vector oldright = v_right;
+       vector oldup = v_up;
+       vector v = eyetarget - self.origin;
+       vector modeleyetarget;
+       modeleyetarget.x =   v * v_forward;
+       modeleyetarget.y = 0-v * v_right;
+       modeleyetarget.z =   v * v_up;
+       // this is an eyeball, make it point at the target location
+       // first get all the data we can...
+       vector relorg = skel_get_bonerel(self.skeletonindex, bonenum);
+       vector relforward = v_forward;
+       vector relright = v_right;
+       vector relup = v_up;
+       vector boneorg = skel_get_boneabs(self.skeletonindex, bonenum);
+       vector boneforward = v_forward;
+       vector boneright = v_right;
+       vector boneup = v_up;
+       vector parentorg = skel_get_boneabs(self.skeletonindex, skel_get_boneparent(self.skeletonindex, bonenum));
+       vector parentforward = v_forward;
+       vector parentright = v_right;
+       vector parentup = v_up;
+       // get the vector from the eyeball to the target
+       vector u = modeleyetarget - boneorg;
+       // now transform it inversely by the parent matrix to produce new rel vectors
+       v.x = u * parentforward;
+       v.y = u * parentright;
+       v.z = u * parentup;
+       vector ang = vectoangles2(v, relup);
+       ang.x = 0 - ang.x;
+       makevectors(ang);
+       // set the relative bone matrix
+       skel_set_bone(self.skeletonindex, bonenum, relorg);
+       // restore caller's v_ vectors
+       v_forward = oldforward;
+       v_right = oldright;
+       v_up = oldup;
+};
+// delete skeleton when we're done with it
+// note: skeleton remains valid until next frame when it is really deleted
+void() example_skel_player_delete =
+{
+       skel_delete(self.skeletonindex);
+       self.skeletonindex = 0;
+};
+//
+// END OF EXAMPLES FOR FTE_CSQC_SKELETONOBJECTS
+//
+
+//KRIMZON_SV_PARSECLIENTCOMMAND
+//idea: KrimZon
+//darkplaces implementation: KrimZon, LordHavoc
+//engine-called QC prototypes:
+//void(string s) SV_ParseClientCommand;
+//builtin definitions:
+void(entity e, string s) clientcommand = #440;
+int(string s) tokenize = #441;
+string(float n) argv = #442;
+//description:
+//provides QC the ability to completely control server interpretation of client commands ("say" and "color" for example, clientcommand is necessary for this and substring (FRIK_FILE) is useful) as well as adding new commands (tokenize, argv, and stof (FRIK_FILE) are useful for this)), whenever a clc_stringcmd is received the QC function is called, and it is up to the QC to decide what (if anything) to do with it
+
+//NEH_CMD_PLAY2
+//idea: Nehahra
+//darkplaces implementation: LordHavoc
+//description:
+//shows that the engine supports the "play2" console command (plays a sound without spatialization).
+
+//NEH_RESTOREGAME
+//idea: Nehahra
+//darkplaces implementation: LordHavoc
+//engine-called QC prototypes:
+//void() RestoreGame;
+//description:
+//when a savegame is loaded, this function is called
+
+//NEXUIZ_PLAYERMODEL
+//idea: Nexuiz
+//darkplaces implementation: Black
+//console commands:
+//playermodel <name> - FIXME: EXAMPLE NEEDED
+//playerskin <name> - FIXME: EXAMPLE NEEDED
+//field definitions:
+.string playermodel; // name of player model sent by client
+.string playerskin; // name of player skin sent by client
+//description:
+//these client properties are used by Nexuiz.
+
+//NXQ_GFX_LETTERBOX
+//idea: nxQuake
+//darkplaces implementation: LordHavoc
+//description:
+//shows that the engine supports the "r_letterbox" console variable, set to values in the range 0-100 this restricts the view vertically (and turns off sbar and crosshair), value is a 0-100 percentage of how much to constrict the view, <=0 = normal view height, 25 = 75% of normal view height, 50 = 50%, 75 = 25%, >=100 = no view
+
+//PRYDON_CLIENTCURSOR
+//idea: FrikaC
+//darkplaces implementation: LordHavoc
+//effects bit:
+const int EF_SELECTABLE = 16384; // allows cursor to highlight entity (brighten)
+//field definitions:
+.float cursor_active; // true if cl_prydoncursor mode is on
+.vector cursor_screen; // screen position of cursor as -1 to +1 in _x and _y (_z unused)
+.vector cursor_trace_start; // position of camera
+.vector cursor_trace_endpos; // position of cursor in world (as traced from camera)
+.entity cursor_trace_ent; // entity the cursor is pointing at (server forces this to world if the entity is currently free at time of receipt)
+//cvar definitions:
+//cl_prydoncursor (0/1+, default 0, 1 and above use cursors named gfx/prydoncursor%03i.lmp - or .tga and such if DP_GFX_EXTERNALTEXTURES is implemented)
+//description:
+//shows that the engine supports the cl_prydoncursor cvar, this puts a clientside mouse pointer on the screen and feeds input to the server for the QuakeC to use as it sees fit.
+//the mouse pointer triggers button4 if cursor is at left edge of screen, button5 if at right edge of screen, button6 if at top edge of screen, button7 if at bottom edge of screen.
+//the clientside trace skips transparent entities (except those marked EF_SELECTABLE).
+//the selected entity highlights only if EF_SELECTABLE is set, a typical selection method would be doubling the brightness of the entity by some means (such as colormod[] *= 2).
+//intended to be used by Prydon Gate.
+
+//TENEBRAE_GFX_DLIGHTS
+//idea: Tenebrae
+//darkplaces implementation: LordHavoc
+//fields:
+.float light_lev; // radius (does not affect brightness), typical value 350
+.vector color; // color (does not affect radius), typical value '1 1 1' (bright white), can be up to '255 255 255' (nuclear blast)
+.float style; // light style (like normal light entities, flickering torches or switchable, etc)
+.float pflags; // flags (see PFLAGS_ constants)
+.vector angles; // orientation of the light
+.int skin; // cubemap filter number, can be 1-255 (0 is assumed to be none, and tenebrae only allows 16-255), this selects a projective light filter, a value of 1 loads cubemaps/1posx.tga and cubemaps/1negx.tga and posy, negy, posz, and negz, similar to skybox but some sides need to be rotated or flipped
+//constants:
+float PFLAGS_NOSHADOW = 1; // light does not cast shadows
+float PFLAGS_CORONA = 2; // light has a corona flare
+float PFLAGS_FULLDYNAMIC = 128; // light enable (without this set no light is produced!)
+//description:
+//more powerful dynamic light settings
+//warning: it is best not to use cubemaps on a light entity that has a model, as using a skin number that a model does not have will cause issues in glquake, and produce warnings in darkplaces (use developer 1 to see them)
+//changes compared to tenebrae (because they're too 'leet' for standards):
+//note: networking should send entities with PFLAGS_FULLDYNAMIC set even if they have no model (lights in general do not have a model, nor should they)
+//EF_FULLDYNAMIC effects flag replaced by PFLAGS_FULLDYNAMIC flag (EF_FULLDYNAMIC conflicts with EF_NODRAW)
+
+//TW_SV_STEPCONTROL
+//idea: Transfusion
+//darkplaces implementation: LordHavoc
+//cvars:
+//sv_jumpstep (0/1, default 1)
+//sv_stepheight (default 18)
+//description:
+//sv_jumpstep allows stepping up onto stairs while airborn, sv_stepheight controls how high a single step can be.
+
+//FTE_QC_CHECKPVS
+//idea: Urre
+//darkplaces implementation: divVerent
+//builtin definitions:
+float checkpvs(vector viewpos, entity viewee) = #240;
+//description:
+//returns true if viewee can be seen from viewpos according to PVS data
+
+//FTE_STRINGS
+//idea: many
+//darkplaces implementation: KrimZon
+//builtin definitions:
+int(string str, string sub, float startpos) strstrofs = #221; // returns the offset into a string of the matching text, or -1 if not found, case sensitive
+int(string str, float ofs) str2chr = #222; // returns the character at the specified offset as an integer, or 0 if an invalid index, or byte value - 256 if the engine supports UTF8 and the byte is part of an extended character
+string(int c, ...) chr2str = #223; // returns a string representing the character given, if the engine supports UTF8 this may be a multi-byte sequence (length may be more than 1) for characters over 127.
+string(float ccase, float calpha, float cnum, string s, ...) strconv = #224; // reformat a string with special color characters in the font, DO NOT USE THIS ON UTF8 ENGINES (if you are lucky they will emit ^4 and such color codes instead), the parameter values are 0=same/1=lower/2=upper for ccase, 0=same/1=white/2=red/5=alternate/6=alternate-alternate for redalpha, 0=same/1=white/2=red/3=redspecial/4=whitespecial/5=alternate/6=alternate-alternate for rednum.
+string(float chars, string s, ...) strpad = #225; // pad string with spaces to a specified length, < 0 = left padding, > 0 = right padding
+string(string info, string key, string value, ...) infoadd = #226; // sets or adds a key/value pair to an infostring - note: forbidden characters are \ and "
+string(string info, string key) infoget = #227; // gets a key/value pair in an infostring, returns value or null if not found
+int(string s1, string s2) strcmp = #228; // compare two strings
+int(string s1, string s2, float len) strncmp = #228; // compare two strings up to the specified number of characters, if their length differs and is within the specified limit the result will be negative, otherwise it is the difference in value of their first non-matching character.
+int(string s1, string s2) strcasecmp = #229; // compare two strings with case-insensitive matching, characters a-z are considered equivalent to the matching A-Z character, no other differences, and this does not consider special characters equal even if they look similar
+int(string s1, string s2, float len) strncasecmp = #230; // same as strcasecmp but with a length limit, see strncmp
+//string(string s, float start, float length) substring = #116; // see note below
+//description:
+//various string manipulation functions
+//note: substring also exists in FRIK_FILE but this extension adds negative start and length as valid cases (see note above), substring is consistent with the php 5.2.0 substr function (not 5.2.3 behavior)
+//substring returns a section of a string as a tempstring, if given negative
+// start the start is measured back from the end of the string, if given a
+// negative length the length is the offset back from the end of the string to
+// stop at, rather than being relative to start, if start is negative and
+// larger than length it is treated as 0.
+// examples of substring:
+// substring("blah", -3, 3) returns "lah"
+// substring("blah", 3, 3) returns "h"
+// substring("blah", -10, 3) returns "bla"
+// substring("blah", -10, -3) returns "b"
+
+//DP_CON_BESTWEAPON
+//idea: many
+//darkplaces implementation: divVerent
+//description:
+//allows QC to register weapon properties for use by the bestweapon command, for mods that change required ammo count or type for the weapons
+//it is done using console commands sent via stuffcmd:
+//  register_bestweapon quake
+//  register_bestweapon clear
+//  register_bestweapon <shortname> <impulse> <itemcode> <activeweaponcode> <ammostat> <ammomin>
+//for example, this is what Quake uses:
+//  register_bestweapon 1 1 4096 4096 6 0 // STAT_SHELLS is 6
+//  register_bestweapon 2 2    1    1 6 1
+//  register_bestweapon 3 3    2    2 6 1
+//  register_bestweapon 4 4    4    4 7 1 // STAT_NAILS is 7
+//  register_bestweapon 5 5    8    8 7 1
+//  register_bestweapon 6 6   16   16 8 1 // STAT_ROCKETS is 8
+//  register_bestweapon 7 7   32   32 8 1
+//  register_bestweapon 8 8   64   64 9 1 // STAT_CELLS is 9
+//after each map client initialization, this is reset back to Quake settings. So you should send these data in ClientConnect.
+//also, this extension introduces a new "cycleweapon" command to the user.
+
+//DP_QC_STRINGBUFFERS
+//idea: ??
+//darkplaces implementation: LordHavoc
+//functions to manage string buffer objects - that is, arbitrary length string arrays that are handled by the engine
+int() buf_create = #460;
+void(float bufhandle) buf_del = #461;
+float(float bufhandle) buf_getsize = #462;
+void(float bufhandle_from, float bufhandle_to) buf_copy = #463;
+void(float bufhandle, float sortpower, float backward) buf_sort = #464;
+string(float bufhandle, string glue) buf_implode = #465;
+string(float bufhandle, float string_index) bufstr_get = #466;
+void(float bufhandle, float string_index, string str) bufstr_set = #467;
+float(float bufhandle, string str, float order) bufstr_add = #468;
+void(float bufhandle, float string_index) bufstr_free = #469;
+
+//DP_QC_STRINGBUFFERS_CVARLIST
+//idea: divVerent
+//darkplaces implementation: divVerent
+//functions to list cvars and store their names into a stringbuffer
+//cvars that start with pattern but not with antipattern will be stored into the buffer
+void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517;
+
+//DP_QC_STRINGBUFFERS_EXT_WIP
+//idea: VorteX
+//darkplaces implementation: VorteX
+//constant definitions:
+const float MATCH_AUTO = 0;
+const float MATCH_WHOLE = 1;
+const float MATCH_LEFT = 2;
+const float MATCH_RIGHT = 3;
+const float MATCH_MIDDLE = 4;
+const float MATCH_PATTERN = 5;
+//builtin definitions:
+float(string filename, float bufhandle) buf_loadfile = #535; // append each line of file as new buffer string, return 1 if succesful
+float(float filehandle, float bufhandle, float startpos, float numstrings) buf_writefile = #536; // writes buffer strings as lines, returns 1 if succesful
+float(float bufhandle, string match, float matchrule, float startpos, float step) bufstr_find = #537; // returns string index
+float(string s, string pattern, float matchrule) matchpattern = #538; // returns 0/1
+float(string s, string pattern, float matchrule, float pos) matchpatternofs = #538;
+//description:
+//provides a set of functions to manipulate with string buffers
+//pattern wildcards: * - any character (or no characters), ? - any 1 character
+//Warning: This extension is work-in-progress, it may be changed/revamped/removed at any time, dont use it if you dont want any trouble
+//wip note: UTF8 is not supported yet
+
+//DP_QC_STRREPLACE
+//idea: Sajt
+//darkplaces implementation: Sajt
+//builtin definitions:
+string(string search, string replace, string subject) strreplace = #484;
+string(string search, string replace, string subject) strireplace = #485;
+//description:
+//strreplace replaces all occurrences of 'search' with 'replace' in the string 'subject', and returns the result as a tempstring.
+//strireplace does the same but uses case-insensitive matching of the 'search' term
+
+//DP_SV_SHUTDOWN
+//idea: divVerent
+//darkplaces implementation: divVerent
+//A function that gets called just before progs exit. To save persistent data from.
+//It is not called on a crash or error.
+//void SV_Shutdown();
+
+//EXT_CSQC
+// #232 void(float index, float type, .void field) SV_AddStat (EXT_CSQC)
+void(float index, float type, ...) addstat = #232;
+
+//ZQ_PAUSE
+//idea: ZQuake
+//darkplaces implementation: GreEn`mArine
+//builtin definitions:
+void(float pause) setpause = #531;
+//function definitions:
+//void(float elapsedtime) SV_PausedTic;
+//description:
+//during pause the world is not updated (time does not advance), SV_PausedTic is the only function you can be sure will be called at regular intervals during the pause, elapsedtime is the current system time in seconds since the pause started (not affected by slowmo or anything else).
+//
+//calling setpause(0) will end a pause immediately.
+//
+//Note: it is worth considering that network-related functions may be called during the pause (including customizeentityforclient for example), and it is also important to consider the continued use of the KRIMZON_SV_PARSECLIENTCOMMAND extension while paused (chatting players, etc), players may also join/leave during the pause.  In other words, the only things that are not called are think and other time-related functions.
+
+//DP_COVERAGE
+//idea: divVerent
+//darkplaces implementation: divVerent
+//function definitions:
+void coverage() = #642;  // Reports a coverage event. The engine counts for each of the calls to this builtin whether it has been called.
+
+
+// EXPERIMENTAL (not finalized) EXTENSIONS:
+
+//DP_CRYPTO
+//idea: divVerent
+//darkplaces implementation: divVerent
+//field definitions: (SVQC)
+.string crypto_keyfp; // fingerprint of CA key the player used to authenticate
+.string crypto_mykeyfp; // fingerprint of CA key the server used to authenticate to the player
+.string crypto_idfp; // fingerprint of ID used by the player entity, or string_null if not identified
+.float crypto_idfp_signed; // set if the player's ID has been signed
+.string crypto_encryptmethod; // the string "AES128" if encrypting, and string_null if plaintext
+.string crypto_signmethod; // the string "HMAC-SHA256" if signing, and string_null if plaintext
+// there is no field crypto_myidfp, as that info contains no additional information the QC may have a use for
+//builtin definitions: (SVQC)
+float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513;
+//description:
+//use -1 as buffer handle to justs end delim as postdata
+#endif
diff --git a/qcsrc/dpdefs/keycodes.qc b/qcsrc/dpdefs/keycodes.qc
deleted file mode 100644 (file)
index 65fe815..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-///////////////////////////
-// key constants
-
-//
-// these are the key numbers that should be passed to Key_Event
-//
-float K_TAB                    =       9;
-float K_ENTER          =       13;
-float K_ESCAPE         =       27;
-float K_SPACE          =       32;
-
-// normal keys should be passed as lowercased ascii
-
-float K_BACKSPACE      =       127;
-float K_UPARROW                =       128;
-float K_DOWNARROW      =       129;
-float K_LEFTARROW      =       130;
-float K_RIGHTARROW     =       131;
-
-float K_ALT            =       132;
-float K_CTRL   =       133;
-float K_SHIFT  =       134;
-
-float K_F1             =       135;
-float K_F2             =       136;
-float K_F3             =       137;
-float K_F4             =       138;
-float K_F5             =       139;
-float K_F6             =       140;
-float K_F7             =       141;
-float K_F8             =       142;
-float K_F9             =       143;
-float K_F10            =       144;
-float K_F11            =       145;
-float K_F12            =       146;
-
-float K_INS            =       147;
-float K_DEL            =       148;
-float K_PGDN   =       149;
-float K_PGUP   =       150;
-float K_HOME   =       151;
-float K_END            =       152;
-
-float K_NUMLOCK                = 154;
-float K_CAPSLOCK       = 155;
-float K_SCROLLLOCK     = 156;
-
-float K_KP_0   =       157;
-float K_KP_INS =       157; // same as K_KP_0
-float K_KP_1   =       158;
-float K_KP_END =       158; // same as K_KP_1
-float K_KP_2   =       159;
-float K_KP_DOWNARROW = 159; // same as K_KP_2
-float K_KP_3   =       160;
-float K_KP_PGDN = 160; // same as K_KP_3
-float K_KP_4   =       161;
-float K_KP_LEFTARROW = 161; // same as K_KP_4
-float K_KP_5   =       162;
-float K_KP_6   =       163;
-float K_KP_RIGHTARROW = 163; // same as K_KP_6
-float K_KP_7   =       164;
-float K_KP_HOME = 164; // same as K_KP_7
-float K_KP_8   =       165;
-float K_KP_UPARROW = 165; // same as K_KP_8
-float K_KP_9   = 166;
-float K_KP_PGUP = 166; // same as K_KP_9
-float K_KP_PERIOD = 167;
-float K_KP_DEL = 167; // same as K_KP_PERIOD
-float K_KP_DIVIDE = 168;
-float K_KP_SLASH = 168; // same as K_KP_DIVIDE
-float K_KP_MULTIPLY = 169;
-float K_KP_MINUS       = 170;
-float K_KP_PLUS                = 171;
-float K_KP_ENTER       = 172;
-float K_KP_EQUALS      = 173;
-
-// mouse buttons generate virtual keys
-float K_PAUSE  =       153;
-
-//
-// joystick buttons
-//
-float K_JOY1 = 768;
-float K_JOY2 = 769;
-float K_JOY3 = 770;
-float K_JOY4 = 771;
-
-//
-//
-// aux keys are for multi-buttoned joysticks to generate so they can use
-// the normal binding process
-//
-float K_AUX1   =       772;
-float K_AUX2   =       773;
-float K_AUX3   =       774;
-float K_AUX4   =       775;
-float K_AUX5   =       776;
-float K_AUX6   =       777;
-float K_AUX7   =       778;
-float K_AUX8   =       779;
-float K_AUX9   =       780;
-float K_AUX10  =       781;
-float K_AUX11  =       782;
-float K_AUX12  =       783;
-float K_AUX13  =       784;
-float K_AUX14  =       785;
-float K_AUX15  =       786;
-float K_AUX16  =       787;
-float K_AUX17  =       788;
-float K_AUX18  =       789;
-float K_AUX19  =       790;
-float K_AUX20  =       791;
-float K_AUX21  =       792;
-float K_AUX22  =       793;
-float K_AUX23  =       794;
-float K_AUX24  =       795;
-float K_AUX25  =       796;
-float K_AUX26  =       797;
-float K_AUX27  =       798;
-float K_AUX28  =       799;
-float K_AUX29  =       800;
-float K_AUX30  =       801;
-float K_AUX31  =       802;
-float K_AUX32  =       803;
-
-//
-// mouse buttons generate virtual keys
-//
-float K_MOUSE1         =       512;
-float K_MOUSE2         =       513;
-float K_MOUSE3         =       514;
-float K_MWHEELUP       =       515;
-float K_MWHEELDOWN     =       516;
-float K_MOUSE4         =       517;
-float K_MOUSE5         =       518;
-float K_MOUSE6         =       519;
-float K_MOUSE7         =       520;
-float K_MOUSE8         =       521;
-float K_MOUSE9         =       522;
-float K_MOUSE10                =       523;
-float K_MOUSE11                =       524;
-float K_MOUSE12                =       525;
-float K_MOUSE13                =       526;
-float K_MOUSE14                =       527;
-float K_MOUSE15                =       528;
-float K_MOUSE16                =       529;
-
diff --git a/qcsrc/dpdefs/keycodes.qh b/qcsrc/dpdefs/keycodes.qh
new file mode 100644 (file)
index 0000000..d742308
--- /dev/null
@@ -0,0 +1,155 @@
+#ifndef KEYCODES_H
+#define KEYCODES_H
+
+#pragma noref 1
+
+///////////////////////////
+// key constants
+
+//
+// these are the key numbers that should be passed to Key_Event
+//
+int K_TAB                      = 9;
+int K_ENTER                = 13;
+int K_ESCAPE           = 27;
+int K_SPACE                = 32;
+
+// normal keys should be passed as lowercased ascii
+
+int K_BACKSPACE            = 127;
+int K_UPARROW          = 128;
+int K_DOWNARROW            = 129;
+int K_LEFTARROW            = 130;
+int K_RIGHTARROW       = 131;
+
+int K_ALT                  = 132;
+int K_CTRL             = 133;
+int K_SHIFT            = 134;
+
+int K_F1                   = 135;
+int K_F2                   = 136;
+int K_F3                   = 137;
+int K_F4                   = 138;
+int K_F5                   = 139;
+int K_F6                   = 140;
+int K_F7                   = 141;
+int K_F8                   = 142;
+int K_F9                   = 143;
+int K_F10                  = 144;
+int K_F11                  = 145;
+int K_F12                  = 146;
+
+int K_INS                  = 147;
+int K_DEL                  = 148;
+int K_PGDN             = 149;
+int K_PGUP             = 150;
+int K_HOME             = 151;
+int K_END                  = 152;
+
+int K_NUMLOCK          = 154;
+int K_CAPSLOCK     = 155;
+int K_SCROLLLOCK       = 156;
+
+int K_KP_0             = 157;
+int K_KP_INS       = 157; // same as K_KP_0
+int K_KP_1             = 158;
+int K_KP_END       = 158; // same as K_KP_1
+int K_KP_2             = 159;
+int K_KP_DOWNARROW  = 159; // same as K_KP_2
+int K_KP_3             = 160;
+int K_KP_PGDN       = 160; // same as K_KP_3
+int K_KP_4             = 161;
+int K_KP_LEFTARROW  = 161; // same as K_KP_4
+int K_KP_5             = 162;
+int K_KP_6             = 163;
+int K_KP_RIGHTARROW = 163; // same as K_KP_6
+int K_KP_7             = 164;
+int K_KP_HOME       = 164; // same as K_KP_7
+int K_KP_8             = 165;
+int K_KP_UPARROW    = 165; // same as K_KP_8
+int K_KP_9             = 166;
+int K_KP_PGUP       = 166; // same as K_KP_9
+int K_KP_PERIOD     = 167;
+int K_KP_DEL        = 167; // same as K_KP_PERIOD
+int K_KP_DIVIDE     = 168;
+int K_KP_SLASH      = 168; // same as K_KP_DIVIDE
+int K_KP_MULTIPLY   = 169;
+int K_KP_MINUS     = 170;
+int K_KP_PLUS          = 171;
+int K_KP_ENTER     = 172;
+int K_KP_EQUALS            = 173;
+
+// mouse buttons generate virtual keys
+int K_PAUSE            = 153;
+
+//
+// joystick buttons
+//
+int K_JOY1          = 768;
+int K_JOY2          = 769;
+int K_JOY3          = 770;
+int K_JOY4          = 771;
+
+//
+//
+// aux keys are for multi-buttoned joysticks to generate so they can use
+// the normal binding process
+//
+int K_AUX1             = 772;
+int K_AUX2             = 773;
+int K_AUX3             = 774;
+int K_AUX4             = 775;
+int K_AUX5             = 776;
+int K_AUX6             = 777;
+int K_AUX7             = 778;
+int K_AUX8             = 779;
+int K_AUX9             = 780;
+int K_AUX10            = 781;
+int K_AUX11            = 782;
+int K_AUX12            = 783;
+int K_AUX13            = 784;
+int K_AUX14            = 785;
+int K_AUX15            = 786;
+int K_AUX16            = 787;
+int K_AUX17            = 788;
+int K_AUX18            = 789;
+int K_AUX19            = 790;
+int K_AUX20            = 791;
+int K_AUX21            = 792;
+int K_AUX22            = 793;
+int K_AUX23            = 794;
+int K_AUX24            = 795;
+int K_AUX25            = 796;
+int K_AUX26            = 797;
+int K_AUX27            = 798;
+int K_AUX28            = 799;
+int K_AUX29            = 800;
+int K_AUX30            = 801;
+int K_AUX31            = 802;
+int K_AUX32            = 803;
+
+//
+// mouse buttons generate virtual keys
+//
+int K_MOUSE1           = 512;
+int K_MOUSE2           = 513;
+int K_MOUSE3           = 514;
+int K_MWHEELUP     = 515;
+int K_MWHEELDOWN       = 516;
+int K_MOUSE4           = 517;
+int K_MOUSE5           = 518;
+int K_MOUSE6           = 519;
+int K_MOUSE7           = 520;
+int K_MOUSE8           = 521;
+int K_MOUSE9           = 522;
+int K_MOUSE10          = 523;
+int K_MOUSE11          = 524;
+int K_MOUSE12          = 525;
+int K_MOUSE13          = 526;
+int K_MOUSE14          = 527;
+int K_MOUSE15          = 528;
+int K_MOUSE16          = 529;
+
+#pragma noref 0
+
+#endif
diff --git a/qcsrc/dpdefs/menudefs.qc b/qcsrc/dpdefs/menudefs.qc
deleted file mode 100644 (file)
index 0d6c253..0000000
+++ /dev/null
@@ -1,577 +0,0 @@
-//////////////////////////////////////////////////////////
-// sys globals
-
-entity self;
-
-/////////////////////////////////////////////////////////
-void           end_sys_globals;
-/////////////////////////////////////////////////////////
-// sys fields
-
-/////////////////////////////////////////////////////////
-void           end_sys_fields;
-/////////////////////////////////////////////////////////
-// sys functions
-
-void() m_init;
-void(float keynr, float ascii) m_keydown;
-void(float width, float height) m_draw;
-void(float mode) m_toggle;
-void() m_shutdown;
-// optional: float(float) m_gethostcachecategory;
-
-/////////////////////////////////////////////////////////
-// sys constants
-///////////////////////////
-// key dest constants
-
-float KEY_UNKNOWN      =       -1;
-float KEY_GAME                 =       0;
-float KEY_MENU         =       2;
-float KEY_MENU_GRABBED =       3;
-
-///////////////////////////
-// file constants
-
-float FILE_READ = 0;
-float FILE_APPEND = 1;
-float FILE_WRITE = 2;
-
-///////////////////////////
-// logical constants (just for completeness)
-
-float TRUE     = 1;
-float FALSE = 0;
-
-///////////////////////////
-// boolean constants
-
-float true = 1;
-float false = 0;
-
-///////////////////////////
-// msg constants
-
-float MSG_BROADCAST            = 0;            // unreliable to all
-float MSG_ONE                  = 1;            // reliable to one (msg_entity)
-float MSG_ALL                  = 2;            // reliable to all
-float MSG_INIT                 = 3;            // write to the init string
-
-/////////////////////////////
-// mouse target constants
-
-float MT_MENU = 1;
-float MT_CLIENT = 2;
-
-/////////////////////////
-// client state constants
-
-float CS_DEDICATED             = 0;
-float CS_DISCONNECTED  = 1;
-float CS_CONNECTED             = 2;
-
-///////////////////////////
-// blend flags
-
-float DRAWFLAG_NORMAL          = 0;
-float DRAWFLAG_ADDITIVE        = 1;
-float DRAWFLAG_MODULATE        = 2;
-float DRAWFLAG_2XMODULATE   = 3;
-
-///////////////////////////
-// null entity (actually it is the same like the world entity)
-
-entity null_entity;
-
-///////////////////////////
-// error constants
-
-// file handling
-float ERR_CANNOTOPEN                   = -1; // fopen
-float ERR_NOTENOUGHFILEHANDLES         = -2; // fopen
-float ERR_INVALIDMODE                  = -3; // fopen
-float ERR_BADFILENAME                  = -4; // fopen
-
-// drawing functions
-
-float ERR_NULLSTRING                   = -1;
-float ERR_BADDRAWFLAG                  = -2;
-float ERR_BADSCALE                             = -3;
-float ERR_BADSIZE                              = -3; // same as ERR_BADSCALE
-float ERR_NOTCACHED                            = -4;
-
-// server list stuff
-float SLIST_HOSTCACHEVIEWCOUNT  = 0;
-float SLIST_HOSTCACHETOTALCOUNT = 1;
-float SLIST_MASTERQUERYCOUNT   = 2;
-float SLIST_MASTERREPLYCOUNT   = 3;
-float SLIST_SERVERQUERYCOUNT   = 4;
-float SLIST_SERVERREPLYCOUNT   = 5;
-float SLIST_SORTFIELD          = 6;
-float SLIST_SORTDESCENDING     = 7;
-float SLIST_LEGACY_LINE1       = 1024;
-float SLIST_LEGACY_LINE2       = 1025;
-float SLIST_TEST_CONTAINS      = 0;
-float SLIST_TEST_NOTCONTAIN    = 1;
-float SLIST_TEST_LESSEQUAL     = 2;
-float SLIST_TEST_LESS          = 3;
-float SLIST_TEST_EQUAL         = 4;
-float SLIST_TEST_GREATER       = 5;
-float SLIST_TEST_GREATEREQUAL  = 6;
-float SLIST_TEST_NOTEQUAL      = 7;
-float SLIST_TEST_STARTSWITH    = 8;
-float SLIST_TEST_NOTSTARTSWITH = 9;
-float SLIST_MASK_AND = 0;
-float SLIST_MASK_OR  = 512;
-
-// font stuff
-float FONT_DEFAULT     = 0;
-float FONT_CONSOLE     = 1;
-float FONT_SBAR        = 2;
-float FONT_NOTIFY      = 3;
-float FONT_CHAT        = 4;
-float FONT_CENTERPRINT = 5;
-float FONT_INFOBAR     = 6;
-float FONT_MENU        = 7;
-float FONT_USER        = 8; // add to this the index, like FONT_USER+3 = user3. At least 8 of them are supported.
-float drawfont;
-
-/* not supported at the moment
-///////////////////////////
-// os constants
-
-float OS_WINDOWS       = 0;
-float OS_LINUX         = 1;
-float OS_MAC           = 2;
-*/
-
-
-
-
-
-
-
-
-
-
-//////////////////////////////////////////////////
-// common cmd
-//////////////////////////////////////////////////
-// AK FIXME: Create perhaps a special builtin file for the common cmds
-
-void   checkextension(string ext)      = #1;
-
-// error cmds
-void   error(string err,...)           = #2;
-void   objerror(string err,...)        = #3;
-
-// print
-
-void   print(string text,...)                   = #4;
-void   bprint(string text,...)                  = #5;
-void   sprint(float clientnum, string text,...) = #6;
-void   centerprint(string text,...)             = #7;
-
-// vector stuff
-
-vector normalize(vector v)             = #8;
-float  vlen(vector v)                  = #9;
-float          vectoyaw(vector v)              = #10;
-vector         vectoangles(vector v)           = #11;
-
-float  random(void)  = #12;
-
-void   cmd(string command, ...) = #13;
-
-// cvar cmds
-
-float  cvar(string name)                       = #14;
-const string str_cvar(string name)             = #71;
-void   cvar_set(string name, string value)     = #15;
-
-void   dprint(string text,...) = #16;
-
-// conversion functions
-
-string ftos(float f)   = #17;
-float  fabs(float f)   = #18;
-string vtos(vector v)  = #19;
-string etos(entity e)  = #20;
-
-float  stof(string val,...)  = #21;
-
-entity spawn(void)             = #22;
-void   remove(entity e)        = #23;
-
-entity find(entity start, .string field, string match)         = #24;
-entity findfloat(entity start, .float field, float match)      = #25;
-entity findentity(entity start, .entity field, entity match)   = #25;
-
-entity findchainstring(.string field, string match)    = #26;
-entity findchainfloat(.float field, float match)       = #27;
-entity findchainentity(.entity field, entity match)    = #27;
-
-string precache_file(string file)      = #28;
-string precache_sound(string sample)   = #29;
-
-void   crash(void)     = #72;
-void   coredump(void)  = #30;
-void   stackdump(void) = #73;
-void   traceon(void)   = #31;
-void   traceoff(void)  = #32;
-
-void   eprint(entity e)        = #33;
-float  rint(float f)           = #34;
-float  floor(float f)          = #35;
-float  ceil(float f)           = #36;
-entity nextent(entity e)       = #37;
-float  sin(float f)            = #38;
-float  cos(float f)            = #39;
-float  sqrt(float f)           = #40;
-vector randomvec(void)         = #41;
-
-float  registercvar(string name, string value, float flags)  = #42; // returns 1 if success
-
-float  min(float f,...)  = #43;
-float  max(float f,...)  = #44;
-
-float  bound(float min,float value, float max)  = #45;
-float  pow(float a, float b)  = #46;
-
-void   copyentity(entity src, entity dst)  = #47;
-
-float  fopen(string filename, float mode)  = #48;
-void   fclose(float fhandle)  = #49;
-string fgets(float fhandle)  = #50;
-void   fputs(float fhandle, string s)  = #51;
-
-float  strlen(string s)  = #52;
-string strcat(string s1,string s2,...)  = #53;
-string substring(string s, float start, float length)  = #54;
-
-vector stov(string s)  = #55;
-
-string strzone(string s)  = #56;
-void   strunzone(string s) = #57;
-
-float  tokenize(string s)  = #58;
-string argv(float n)  = #59;
-
-float  isserver(void)  = #60;
-float  clientcount(void)  = #61;
-float  clientstate(void)  = #62;
-void   clientcommand(float client, string s)  = #63;
-void   changelevel(string map)  = #64;
-void   localsound(string sample)  = #65;
-vector getmousepos(void)       = #66;
-float  gettime(void)           = #67;
-void   loadfromdata(string data) = #68;
-void   loadfromfile(string file) = #69;
-
-float  mod(float val, float m) = #70;
-
-float  search_begin(string pattern, float caseinsensitive, float quiet) = #74;
-void   search_end(float handle) = #75;
-float  search_getsize(float handle) = #76;
-string search_getfilename(float handle, float num) = #77;
-
-string chr(float ascii) = #78;
-
-/////////////////////////////////////////////////
-// Write* Functions
-/////////////////////////////////////////////////
-void   WriteByte(float data, float dest, float desto)  = #401;
-void   WriteChar(float data, float dest, float desto)  = #402;
-void   WriteShort(float data, float dest, float desto) = #403;
-void   WriteLong(float data, float dest, float desto)  = #404;
-void   WriteAngle(float data, float dest, float desto) = #405;
-void   WriteCoord(float data, float dest, float desto) = #406;
-void   WriteString(string data, float dest, float desto)= #407;
-void   WriteEntity(entity data, float dest, float desto) = #408;
-
-//////////////////////////////////////////////////
-// Draw funtions
-//////////////////////////////////////////////////
-
-float  iscachedpic(string name)        = #451;
-string precache_pic(string name, ...)  = #452;
-void   freepic(string name)            = #453;
-
-float  drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
-
-float  drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
-
-float  drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag) = #467;
-
-vector drawcolorcodedstring2(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #467;
-
-float  drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
-
-float  drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
-
-void   drawsetcliparea(float x, float y, float width, float height) = #458;
-
-void   drawresetcliparea(void) = #459;
-
-vector  drawgetimagesize(string pic) = #460;
-
-////////////////////////////////////////////////
-// Menu functions
-////////////////////////////////////////////////
-
-void   setkeydest(float dest)  = #601;
-float  getkeydest(void)        = #602;
-
-void   setmousetarget(float trg) = #603;
-float  getmousetarget(void)      = #604;
-
-float  isfunction(string function_name) = #607;
-void   callfunction(...) = #605;
-void   writetofile(float fhandle, entity ent) = #606;
-vector getresolution(float number) = #608;
-string keynumtostring(float keynum) = #609;
-
-float  gethostcachevalue(float type) = #611;
-string gethostcachestring(float type, float hostnr) = #612;
-
-//DP_CSQC_BINDMAPS
-//idea: daemon, motorsep
-//darkplaces implementation: divVerent
-//builtin definitions:
-string(float key, float bindmap) getkeybind_bindmap = #342;
-float(float key, string bind, float bindmap) setkeybind_bindmap = #630;
-vector(void) getbindmaps = #631;
-float(vector bm) setbindmaps = #632;
-string(string command, float bindmap) findkeysforcommand = #610;
-float(string key) stringtokeynum = #341;
-//<also allowed builtin number to match EXT_CSQC> string(float keynum) keynumtostring = #340;
-//description: key bind setting/getting including support for switchable
-//bindmaps.
-
-//DP_CRYPTO
-//idea: divVerent
-//darkplaces implementation: divVerent
-//field definitions: (MENUQC)
-string(string serveraddress) crypto_getkeyfp = #633; // retrieves the cached host key's CA fingerprint of a server given by IP address
-string(string serveraddress) crypto_getidfp = #634; // retrieves the cached host key fingerprint of a server given by IP address
-string(string serveraddress) crypto_getencryptlevel = #635; // 0 if never encrypting, 1 supported, 2 requested, 3 required, appended by list of allowed methods in order of preference ("AES128"), preceded by a space each
-string(float i) crypto_getmykeyfp = #636; // retrieves the CA key fingerprint of a given CA slot, or "" if slot is unused but more to come, or string_null if end of list
-string(float i) crypto_getmyidfp = #637; // retrieves the ID fingerprint of a given CA slot, or "" if slot is unused but more to come, or string_null if end of list
-float CRYPTO_IDSTATUS_OUTOFRANGE = -1;
-float CRYPTO_IDSTATUS_EMPTY = 0;
-float CRYPTO_IDSTATUS_UNSIGNED = 1;
-float CRYPTO_IDSTATUS_SIGNED = 2;
-float(float i) crypto_getmyidstatus = #641; // retrieves the ID's status of a given CA slot, or 0 if slot is unused but more to come, or -1 if end of list
-float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513;
-//description:
-//use -1 as buffer handle to justs end delim as postdata
-
-//DP_GECKO_SUPPORT
-//idea: Res2k, BlackHC
-//darkplaces implementation: Res2k, BlackHC
-//constant definitions:
-float GECKO_BUTTON_DOWN         = 0;
-float GECKO_BUTTON_UP           = 1;
-// either use down and up or just press but not all of them!
-float GECKO_BUTTON_PRESS        = 2;
-// use this for mouse events if needed?
-float GECKO_BUTTON_DOUBLECLICK  = 3;
-//builtin definitions:
-float gecko_create( string name ) = #487;
-void gecko_destroy( string name ) = #488;
-void gecko_navigate( string name, string URI ) = #489;
-float gecko_keyevent( string name, float key, float eventtype ) = #490;
-void gecko_mousemove( string name, float x, float y ) = #491;
-void gecko_resize( string name, float w, float h ) = #492;
-vector gecko_get_texture_extent( string name ) = #493;
-//engine-called QC prototypes:
-//string(string name, string query) Qecko_Query;
-//description:
-//provides an interface to the offscreengecko library and allows for internet browsing in games
-
-//FTE_STRINGS
-//idea: many
-//darkplaces implementation: KrimZon
-//description:
-//various string manipulation functions
-float(string str, string sub, float startpos) strstrofs = #221;
-float(string str, float ofs) str2chr = #222;
-string(float c, ...) chr2str = #223;
-string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
-string(float chars, string s, ...) strpad = #225;
-string(string info, string key, string value, ...) infoadd = #226;
-string(string info, string key) infoget = #227;
-float(string s1, string s2) strcmp = #228;
-float(string s1, string s2, float len) strncmp = #228;
-float(string s1, string s2) strcasecmp = #229;
-float(string s1, string s2, float len) strncasecmp = #230;
-
-//DP_PRECACHE_PIC_FLAGS
-//idea: divVerent
-//darkplaces implementation: divVerent
-//constant definitions:
-float PRECACHE_PIC_FROMWAD = 1; // this one actually is part of EXT_CSQC
-float PRECACHE_PIC_NOTPERSISTENT = 2; // picture may get deallocated when unused
-float PRECACHE_PIC_MIPMAP = 8; // mipmap the texture for possibly better downscaling at memory expense
-//notes: these constants are given as optional second argument to precache_pic()
-
-//DP_QC_CRC16
-//idea: div0
-//darkplaces implementation: div0
-//Some hash function to build hash tables with. This has to be be the CRC-16-CCITT that is also required for the QuakeWorld download protocol.
-//When caseinsensitive is set, the CRC is calculated of the lower cased string.
-float(float caseinsensitive, string s, ...) crc16 = #494;
-
-//DP_QC_CVAR_TYPE
-float(string name) cvar_type = #495;
-float CVAR_TYPEFLAG_EXISTS = 1;
-float CVAR_TYPEFLAG_SAVED = 2;
-float CVAR_TYPEFLAG_PRIVATE = 4;
-float CVAR_TYPEFLAG_ENGINE = 8;
-float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
-float CVAR_TYPEFLAG_READONLY = 32;
-
-//DP_QC_STRINGBUFFERS
-//idea: ??
-//darkplaces implementation: LordHavoc
-//functions to manage string buffer objects - that is, arbitrary length string arrays that are handled by the engine
-float() buf_create = #440;
-void(float bufhandle) buf_del = #441;
-float(float bufhandle) buf_getsize = #442;
-void(float bufhandle_from, float bufhandle_to) buf_copy = #443;
-void(float bufhandle, float sortpower, float backward) buf_sort = #444;
-string(float bufhandle, string glue) buf_implode = #445;
-string(float bufhandle, float string_index) bufstr_get = #446;
-void(float bufhandle, float string_index, string str) bufstr_set = #447;
-float(float bufhandle, string str, float order) bufstr_add = #448;
-void(float bufhandle, float string_index) bufstr_free = #449;
-void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517;
-
-//DP_QC_STRING_CASE_FUNCTIONS
-//idea: Dresk
-//darkplaces implementation: LordHavoc / Dresk
-//builtin definitions:
-string(string s) strtolower = #480; // returns the passed in string in pure lowercase form
-string(string s) strtoupper = #481; // returns the passed in string in pure uppercase form
-//description:
-//provides simple string uppercase and lowercase functions
-
-//DP_QC_CVAR_DESCRIPTION
-//idea: divVerent
-//DarkPlaces implementation: divVerent
-//builtin definitions:
-string(string name) cvar_description = #518;
-//description:
-//returns the description of a cvar
-
-//DP_QC_DIGEST
-//idea: motorsep, Spike
-//DarkPlaces implementation: divVerent
-//builtin definitions:
-string(string digest, string data, ...) digest_hex = #639;
-//description:
-//returns a given hex digest of given data
-//the returned digest is always encoded in hexadecimal
-//only the "MD4" digest is always supported!
-//if the given digest is not supported, string_null is returned
-//the digest string is matched case sensitively, use "MD4", not "md4"!
-
-//DP_QC_URI_ESCAPE
-//idea: div0
-//darkplaces implementation: div0
-//URI::Escape's functionality
-string(string in) uri_escape = #510;
-string(string in) uri_unescape = #511;
-
-//DP_QC_URI_GET
-//idea: divVerent
-//darkplaces implementation: divVerent
-//loads text from an URL into a string
-//returns 1 on success of initiation, 0 if there are too many concurrent
-//connections already or if the URL is invalid
-//the following callback will receive the data and MUST exist!
-//  void(float id, float status, string data) URI_Get_Callback;
-//status is either
-//  negative for an internal error,
-//  0 for success, or
-//  the HTTP response code on server error (e.g. 404)
-//if 1 is returned by uri_get, the callback will be called in the future
-float(string url, float id) uri_get = #513;
-//DP_QC_URI_POST
-//idea: divVerent
-//darkplaces implementation: divVerent
-//loads text from an URL into a string after POSTing via HTTP
-//works like uri_get, but uri_post sends data with Content-Type: content_type to the server
-//and uri_post sends the string buffer buf, joined using the delimiter delim
-float(string url, float id, string content_type, string data) uri_post = #513;
-float(string url, float id, string content_type, string delim, float buf) uri_postbuf = #513;
-
-//DP_QC_ENTITYDATA
-//idea: KrimZon
-//darkplaces implementation: KrimZon
-//builtin definitions:
-float() numentityfields = #496;
-string(float fieldnum) entityfieldname = #497;
-float(float fieldnum) entityfieldtype = #498;
-string(float fieldnum, entity ent) getentityfieldstring = #499;
-float(float fieldnum, entity ent, string s) putentityfieldstring = #500;
-//constants:
-//Returned by entityfieldtype
-float FIELD_STRING   = 1;
-float FIELD_FLOAT    = 2;
-float FIELD_VECTOR   = 3;
-float FIELD_ENTITY   = 4;
-float FIELD_FUNCTION = 6;
-//description:
-//Versatile functions intended for storing data from specific entities between level changes, but can be customized for some kind of partial savegame.
-//WARNING: .entity fields cannot be saved and restored between map loads as they will leave dangling pointers.
-//numentityfields returns the number of entity fields. NOT offsets. Vectors comprise 4 fields: v, v_x, v_y and v_z.
-//entityfieldname returns the name as a string, eg. "origin" or "classname" or whatever.
-//entityfieldtype returns a value that the constants represent, but the field may be of another type in more exotic progs.dat formats or compilers.
-//getentityfieldstring returns data as would be written to a savegame, eg... "0.05" (float), "0 0 1" (vector), or "Hello World!" (string). Function names can also be returned.
-//putentityfieldstring puts the data returned by getentityfieldstring back into the entity.
-
-// assorted undocumented extensions
-string(string, float) netaddress_resolve = #625;
-string(string search, string replace, string subject) strreplace = #484;
-string(float uselocaltime, string format, ...) strftime = #478;
-float(string s) tokenize_console = #514;
-float(float i) argv_start_index = #515;
-float(float i) argv_end_index = #516;
-string(float, float) getgamedirinfo = #626;
-#define GETGAMEDIRINFO_NAME 0
-#define GETGAMEDIRINFO_DESCRIPTION 1
-float log(float f) = #532;
-string(string format, ...) sprintf = #627;
-string(string s) strdecolorize = #477;
-entity findflags(entity start, .float field, float match) = #87;
-entity findchainflags(.float field, float match) = #88;
-float(string s, string separator1, ...) tokenizebyseparator = #479;
-float  etof(entity ent) = #79;
-entity         ftoe(float num)  = #80;
-float   validstring(string str) = #81;
-float  altstr_count(string str) = #82;
-string  altstr_prepare(string str) = #83;
-string  altstr_get(string str, float num) = #84;
-string  altstr_set(string str, float num, string set) = #85;
-string         altstr_ins(string str, float num, string set) = #86;
-float  isdemo() = #349;
-float  drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #469;
-//vector       getresolution(float number, ...) = #608; // optional argument "isfullscreen"
-void   parseentitydata(entity ent, string data) = #613;
-void   resethostcachemasks(void) = #615;
-void   sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
-void   sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
-void   resorthostcache(void) = #618;
-float SLSF_DESCENDING = 1;
-float SLSF_FAVORITES = 2;
-float SLSF_CATEGORIES = 4;
-void   sethostcachesort(float fld, float slsf) = #619;
-void   refreshhostcache(...) = #620;  // optional boolean argument "clear_list"
-float  gethostcachenumber(float fld, float hostnr) = #621;
-float  gethostcacheindexforkey(string key) = #622;
-void   addwantedhostcachekey(string key) = #623;
-string getextresponse(void) = #624;
-const string cvar_string(string name) = #71;
-const string cvar_defstring(string name) = #89;
-float  stringwidth(string text, float handleColors, vector size) = #468;
diff --git a/qcsrc/dpdefs/menudefs.qh b/qcsrc/dpdefs/menudefs.qh
new file mode 100644 (file)
index 0000000..853fa25
--- /dev/null
@@ -0,0 +1,581 @@
+#ifndef MENUDEFS_H
+#define MENUDEFS_H
+
+#pragma noref 1
+
+//////////////////////////////////////////////////////////
+// sys globals
+
+entity self;
+
+/////////////////////////////////////////////////////////
+void           end_sys_globals;
+/////////////////////////////////////////////////////////
+// sys fields
+
+/////////////////////////////////////////////////////////
+void           end_sys_fields;
+/////////////////////////////////////////////////////////
+// sys functions
+
+void() m_init;
+void(float keynr, float ascii) m_keydown;
+void(float width, float height) m_draw;
+void(float mode) m_toggle;
+void() m_shutdown;
+// optional: float(float) m_gethostcachecategory;
+
+/////////////////////////////////////////////////////////
+// sys constants
+///////////////////////////
+// key dest constants
+
+float KEY_UNKNOWN      =       -1;
+float KEY_GAME                 =       0;
+float KEY_MENU         =       2;
+float KEY_MENU_GRABBED =       3;
+
+///////////////////////////
+// file constants
+
+float FILE_READ = 0;
+float FILE_APPEND = 1;
+float FILE_WRITE = 2;
+
+///////////////////////////
+// msg constants
+
+float MSG_BROADCAST            = 0;            // unreliable to all
+float MSG_ONE                  = 1;            // reliable to one (msg_entity)
+float MSG_ALL                  = 2;            // reliable to all
+float MSG_INIT                 = 3;            // write to the init string
+
+/////////////////////////////
+// mouse target constants
+
+float MT_MENU = 1;
+float MT_CLIENT = 2;
+
+/////////////////////////
+// client state constants
+
+float CS_DEDICATED             = 0;
+float CS_DISCONNECTED  = 1;
+float CS_CONNECTED             = 2;
+
+///////////////////////////
+// blend flags
+
+float DRAWFLAG_NORMAL          = 0;
+float DRAWFLAG_ADDITIVE        = 1;
+float DRAWFLAG_MODULATE        = 2;
+float DRAWFLAG_2XMODULATE   = 3;
+
+///////////////////////////
+// null entity (actually it is the same like the world entity)
+
+entity null_entity;
+
+///////////////////////////
+// error constants
+
+// file handling
+float ERR_CANNOTOPEN                   = -1; // fopen
+float ERR_NOTENOUGHFILEHANDLES         = -2; // fopen
+float ERR_INVALIDMODE                  = -3; // fopen
+float ERR_BADFILENAME                  = -4; // fopen
+
+// drawing functions
+
+float ERR_NULLSTRING                   = -1;
+float ERR_BADDRAWFLAG                  = -2;
+float ERR_BADSCALE                             = -3;
+float ERR_BADSIZE                              = -3; // same as ERR_BADSCALE
+float ERR_NOTCACHED                            = -4;
+
+// server list stuff
+float SLIST_HOSTCACHEVIEWCOUNT  = 0;
+float SLIST_HOSTCACHETOTALCOUNT = 1;
+float SLIST_MASTERQUERYCOUNT   = 2;
+float SLIST_MASTERREPLYCOUNT   = 3;
+float SLIST_SERVERQUERYCOUNT   = 4;
+float SLIST_SERVERREPLYCOUNT   = 5;
+float SLIST_SORTFIELD          = 6;
+float SLIST_SORTDESCENDING     = 7;
+float SLIST_LEGACY_LINE1       = 1024;
+float SLIST_LEGACY_LINE2       = 1025;
+float SLIST_TEST_CONTAINS      = 0;
+float SLIST_TEST_NOTCONTAIN    = 1;
+float SLIST_TEST_LESSEQUAL     = 2;
+float SLIST_TEST_LESS          = 3;
+float SLIST_TEST_EQUAL         = 4;
+float SLIST_TEST_GREATER       = 5;
+float SLIST_TEST_GREATEREQUAL  = 6;
+float SLIST_TEST_NOTEQUAL      = 7;
+float SLIST_TEST_STARTSWITH    = 8;
+float SLIST_TEST_NOTSTARTSWITH = 9;
+float SLIST_MASK_AND = 0;
+float SLIST_MASK_OR  = 512;
+
+// font stuff
+float FONT_DEFAULT     = 0;
+float FONT_CONSOLE     = 1;
+float FONT_SBAR        = 2;
+float FONT_NOTIFY      = 3;
+float FONT_CHAT        = 4;
+float FONT_CENTERPRINT = 5;
+float FONT_INFOBAR     = 6;
+float FONT_MENU        = 7;
+float FONT_USER        = 8; // add to this the index, like FONT_USER+3 = user3. At least 8 of them are supported.
+float drawfont;
+
+/* not supported at the moment
+///////////////////////////
+// os constants
+
+float OS_WINDOWS       = 0;
+float OS_LINUX         = 1;
+float OS_MAC           = 2;
+*/
+
+
+
+
+
+
+
+
+
+
+//////////////////////////////////////////////////
+// common cmd
+//////////////////////////////////////////////////
+// AK FIXME: Create perhaps a special builtin file for the common cmds
+
+void   checkextension(string ext)      = #1;
+
+// error cmds
+void   error(string err,...)           = #2;
+void   objerror(string err,...)        = #3;
+
+// print
+
+void   print(string text,...)                   = #4;
+void   bprint(string text,...)                  = #5;
+void   sprint(float clientnum, string text,...) = #6;
+void   centerprint(string text,...)             = #7;
+
+// vector stuff
+
+vector normalize(vector v)             = #8;
+float  vlen(vector v)                  = #9;
+float          vectoyaw(vector v)              = #10;
+vector         vectoangles(vector v)           = #11;
+
+float  random(void)  = #12;
+
+void   cmd(string command, ...) = #13;
+
+// cvar cmds
+
+float  cvar(string name)                       = #14;
+const string str_cvar(string name)             = #71;
+void   cvar_set(string name, string value)     = #15;
+
+void   dprint(string text,...) = #16;
+
+// conversion functions
+
+string ftos(float f)   = #17;
+float  fabs(float f)   = #18;
+string vtos(vector v)  = #19;
+string etos(entity e)  = #20;
+
+float  stof(string val,...)  = #21;
+
+entity spawn(void)             = #22;
+void   remove(entity e)        = #23;
+
+entity find(entity start, .string field, string match)         = #24;
+entity findfloat(entity start, .float field, float match)      = #25;
+entity findentity(entity start, .entity field, entity match)   = #25;
+
+entity findchainstring(.string field, string match)    = #26;
+entity findchainfloat(.float field, float match)       = #27;
+entity findchainentity(.entity field, entity match)    = #27;
+
+string precache_file(string file)      = #28;
+string precache_sound(string sample)   = #29;
+
+void   crash(void)     = #72;
+void   coredump(void)  = #30;
+void   stackdump(void) = #73;
+void   traceon(void)   = #31;
+void   traceoff(void)  = #32;
+
+void   eprint(entity e)        = #33;
+float  rint(float f)           = #34;
+float  floor(float f)          = #35;
+float  ceil(float f)           = #36;
+entity nextent(entity e)       = #37;
+float  sin(float f)            = #38;
+float  cos(float f)            = #39;
+float  sqrt(float f)           = #40;
+vector randomvec(void)         = #41;
+
+float  registercvar(string name, string value, float flags)  = #42; // returns 1 if success
+
+float  min(float f,...)  = #43;
+float  max(float f,...)  = #44;
+
+float  bound(float min,float value, float max)  = #45;
+float  pow(float a, float b)  = #46;
+
+void   copyentity(entity src, entity dst)  = #47;
+
+float  fopen(string filename, float mode)  = #48;
+void   fclose(float fhandle)  = #49;
+string fgets(float fhandle)  = #50;
+void   fputs(float fhandle, string s)  = #51;
+
+float  strlen(string s)  = #52;
+string strcat(string s1,string s2,...)  = #53;
+string substring(string s, float start, float length)  = #54;
+
+vector stov(string s)  = #55;
+
+string strzone(string s)  = #56;
+void   strunzone(string s) = #57;
+
+float  tokenize(string s)  = #58;
+string argv(float n)  = #59;
+
+float  isserver(void)  = #60;
+float  clientcount(void)  = #61;
+float  clientstate(void)  = #62;
+void   clientcommand(float client, string s)  = #63;
+void   changelevel(string map)  = #64;
+void   localsound(string sample)  = #65;
+vector getmousepos(void)       = #66;
+float  gettime(void)           = #67;
+void   loadfromdata(string data) = #68;
+void   loadfromfile(string file) = #69;
+
+float  mod(float val, float m) = #70;
+
+float  search_begin(string pattern, float caseinsensitive, float quiet) = #74;
+void   search_end(float handle) = #75;
+float  search_getsize(float handle) = #76;
+string search_getfilename(float handle, float num) = #77;
+
+string chr(float ascii) = #78;
+
+/////////////////////////////////////////////////
+// Write* Functions
+/////////////////////////////////////////////////
+void   WriteByte(float data, float dest, float desto)  = #401;
+void   WriteChar(float data, float dest, float desto)  = #402;
+void   WriteShort(float data, float dest, float desto) = #403;
+void   WriteLong(float data, float dest, float desto)  = #404;
+void   WriteAngle(float data, float dest, float desto) = #405;
+void   WriteCoord(float data, float dest, float desto) = #406;
+void   WriteString(string data, float dest, float desto)= #407;
+void   WriteEntity(entity data, float dest, float desto) = #408;
+
+//////////////////////////////////////////////////
+// Draw funtions
+//////////////////////////////////////////////////
+
+float  iscachedpic(string name)        = #451;
+string precache_pic(string name, ...)  = #452;
+void   freepic(string name)            = #453;
+
+float  drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
+
+float  drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
+
+float  drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag) = #467;
+
+vector drawcolorcodedstring2(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #467;
+float  drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
+
+float  drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
+
+void   drawsetcliparea(float x, float y, float width, float height) = #458;
+
+void   drawresetcliparea(void) = #459;
+
+vector  drawgetimagesize(string pic) = #460;
+
+////////////////////////////////////////////////
+// Menu functions
+////////////////////////////////////////////////
+
+void   setkeydest(float dest)  = #601;
+float  getkeydest(void)        = #602;
+
+void   setmousetarget(float trg) = #603;
+float  getmousetarget(void)      = #604;
+
+float  isfunction(string function_name) = #607;
+void   callfunction(...) = #605;
+void   writetofile(float fhandle, entity ent) = #606;
+vector getresolution(float number) = #608;
+string keynumtostring(float keynum) = #609;
+
+float  gethostcachevalue(float type) = #611;
+string gethostcachestring(float type, float hostnr) = #612;
+
+//DP_CSQC_BINDMAPS
+//idea: daemon, motorsep
+//darkplaces implementation: divVerent
+//builtin definitions:
+string(float key, float bindmap) getkeybind_bindmap = #342;
+float(float key, string bind, float bindmap) setkeybind_bindmap = #630;
+vector(void) getbindmaps = #631;
+float(vector bm) setbindmaps = #632;
+string(string command, float bindmap) findkeysforcommand = #610;
+float(string key) stringtokeynum = #341;
+//<also allowed builtin number to match EXT_CSQC> string(float keynum) keynumtostring = #340;
+//description: key bind setting/getting including support for switchable
+//bindmaps.
+
+//DP_CRYPTO
+//idea: divVerent
+//darkplaces implementation: divVerent
+//field definitions: (MENUQC)
+string(string serveraddress) crypto_getkeyfp = #633; // retrieves the cached host key's CA fingerprint of a server given by IP address
+string(string serveraddress) crypto_getidfp = #634; // retrieves the cached host key fingerprint of a server given by IP address
+float(string serveraddress) crypto_getidstatus = #643; // retrieves the cached host key's key status. See below for CRYPTO_IDSTATUS_ defines.
+string(string serveraddress) crypto_getencryptlevel = #635; // 0 if never encrypting, 1 supported, 2 requested, 3 required, appended by list of allowed methods in order of preference ("AES128"), preceded by a space each
+string(float i) crypto_getmykeyfp = #636; // retrieves the CA key fingerprint of a given CA slot, or "" if slot is unused but more to come, or string_null if end of list
+string(float i) crypto_getmyidfp = #637; // retrieves the ID fingerprint of a given CA slot, or "" if slot is unused but more to come, or string_null if end of list
+float CRYPTO_IDSTATUS_OUTOFRANGE = -1;
+float CRYPTO_IDSTATUS_EMPTY = 0;
+float CRYPTO_IDSTATUS_UNSIGNED = 1;
+float CRYPTO_IDSTATUS_SIGNED = 2;
+float(float i) crypto_getmyidstatus = #641; // retrieves the ID's status of a given CA slot, or 0 if slot is unused but more to come, or -1 if end of list
+float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513;
+//description:
+//use -1 as buffer handle to justs end delim as postdata
+
+//DP_GECKO_SUPPORT
+//idea: Res2k, BlackHC
+//darkplaces implementation: Res2k, BlackHC
+//constant definitions:
+float GECKO_BUTTON_DOWN         = 0;
+float GECKO_BUTTON_UP           = 1;
+// either use down and up or just press but not all of them!
+float GECKO_BUTTON_PRESS        = 2;
+// use this for mouse events if needed?
+float GECKO_BUTTON_DOUBLECLICK  = 3;
+//builtin definitions:
+float gecko_create( string name ) = #487;
+void gecko_destroy( string name ) = #488;
+void gecko_navigate( string name, string URI ) = #489;
+float gecko_keyevent( string name, float key, float eventtype ) = #490;
+void gecko_mousemove( string name, float x, float y ) = #491;
+void gecko_resize( string name, float w, float h ) = #492;
+vector gecko_get_texture_extent( string name ) = #493;
+//engine-called QC prototypes:
+//string(string name, string query) Qecko_Query;
+//description:
+//provides an interface to the offscreengecko library and allows for internet browsing in games
+
+//FTE_STRINGS
+//idea: many
+//darkplaces implementation: KrimZon
+//description:
+//various string manipulation functions
+int(string str, string sub, float startpos) strstrofs = #221;
+int(string str, float ofs) str2chr = #222;
+string(int c, ...) chr2str = #223;
+string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
+string(float chars, string s, ...) strpad = #225;
+string(string info, string key, string value, ...) infoadd = #226;
+string(string info, string key) infoget = #227;
+int(string s1, string s2) strcmp = #228;
+int(string s1, string s2, float len) strncmp = #228;
+int(string s1, string s2) strcasecmp = #229;
+int(string s1, string s2, float len) strncasecmp = #230;
+
+//DP_PRECACHE_PIC_FLAGS
+//idea: divVerent
+//darkplaces implementation: divVerent
+//constant definitions:
+float PRECACHE_PIC_FROMWAD = 1; // this one actually is part of EXT_CSQC
+float PRECACHE_PIC_NOTPERSISTENT = 2; // picture may get deallocated when unused
+float PRECACHE_PIC_MIPMAP = 8; // mipmap the texture for possibly better downscaling at memory expense
+//notes: these constants are given as optional second argument to precache_pic()
+
+//DP_QC_CRC16
+//idea: div0
+//darkplaces implementation: div0
+//Some hash function to build hash tables with. This has to be be the CRC-16-CCITT that is also required for the QuakeWorld download protocol.
+//When caseinsensitive is set, the CRC is calculated of the lower cased string.
+float(float caseinsensitive, string s, ...) crc16 = #494;
+
+//DP_QC_CVAR_TYPE
+float(string name) cvar_type = #495;
+float CVAR_TYPEFLAG_EXISTS = 1;
+float CVAR_TYPEFLAG_SAVED = 2;
+float CVAR_TYPEFLAG_PRIVATE = 4;
+float CVAR_TYPEFLAG_ENGINE = 8;
+float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
+float CVAR_TYPEFLAG_READONLY = 32;
+
+//DP_QC_STRINGBUFFERS
+//idea: ??
+//darkplaces implementation: LordHavoc
+//functions to manage string buffer objects - that is, arbitrary length string arrays that are handled by the engine
+int() buf_create = #440;
+void(float bufhandle) buf_del = #441;
+float(float bufhandle) buf_getsize = #442;
+void(float bufhandle_from, float bufhandle_to) buf_copy = #443;
+void(float bufhandle, float sortpower, float backward) buf_sort = #444;
+string(float bufhandle, string glue) buf_implode = #445;
+string(float bufhandle, float string_index) bufstr_get = #446;
+void(float bufhandle, float string_index, string str) bufstr_set = #447;
+float(float bufhandle, string str, float order) bufstr_add = #448;
+void(float bufhandle, float string_index) bufstr_free = #449;
+void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517;
+
+//DP_QC_STRING_CASE_FUNCTIONS
+//idea: Dresk
+//darkplaces implementation: LordHavoc / Dresk
+//builtin definitions:
+string(string s) strtolower = #480; // returns the passed in string in pure lowercase form
+string(string s) strtoupper = #481; // returns the passed in string in pure uppercase form
+//description:
+//provides simple string uppercase and lowercase functions
+
+//DP_QC_CVAR_DESCRIPTION
+//idea: divVerent
+//DarkPlaces implementation: divVerent
+//builtin definitions:
+string(string name) cvar_description = #518;
+//description:
+//returns the description of a cvar
+
+//DP_QC_DIGEST
+//idea: motorsep, Spike
+//DarkPlaces implementation: divVerent
+//builtin definitions:
+string(string digest, string data, ...) digest_hex = #639;
+//description:
+//returns a given hex digest of given data
+//the returned digest is always encoded in hexadecimal
+//only the "MD4" digest is always supported!
+//if the given digest is not supported, string_null is returned
+//the digest string is matched case sensitively, use "MD4", not "md4"!
+
+//DP_QC_URI_ESCAPE
+//idea: div0
+//darkplaces implementation: div0
+//URI::Escape's functionality
+string(string in) uri_escape = #510;
+string(string in) uri_unescape = #511;
+
+//DP_QC_URI_GET
+//idea: divVerent
+//darkplaces implementation: divVerent
+//loads text from an URL into a string
+//returns 1 on success of initiation, 0 if there are too many concurrent
+//connections already or if the URL is invalid
+//the following callback will receive the data and MUST exist!
+//  void(float id, float status, string data) URI_Get_Callback;
+//status is either
+//  negative for an internal error,
+//  0 for success, or
+//  the HTTP response code on server error (e.g. 404)
+//if 1 is returned by uri_get, the callback will be called in the future
+float(string url, float id) uri_get = #513;
+//DP_QC_URI_POST
+//idea: divVerent
+//darkplaces implementation: divVerent
+//loads text from an URL into a string after POSTing via HTTP
+//works like uri_get, but uri_post sends data with Content-Type: content_type to the server
+//and uri_post sends the string buffer buf, joined using the delimiter delim
+float(string url, float id, string content_type, string data) uri_post = #513;
+float(string url, float id, string content_type, string delim, float buf) uri_postbuf = #513;
+
+//DP_QC_ENTITYDATA
+//idea: KrimZon
+//darkplaces implementation: KrimZon
+//builtin definitions:
+float() numentityfields = #496;
+string(float fieldnum) entityfieldname = #497;
+float(float fieldnum) entityfieldtype = #498;
+string(float fieldnum, entity ent) getentityfieldstring = #499;
+float(float fieldnum, entity ent, string s) putentityfieldstring = #500;
+//constants:
+//Returned by entityfieldtype
+float FIELD_STRING   = 1;
+float FIELD_FLOAT    = 2;
+float FIELD_VECTOR   = 3;
+float FIELD_ENTITY   = 4;
+float FIELD_FUNCTION = 6;
+//description:
+//Versatile functions intended for storing data from specific entities between level changes, but can be customized for some kind of partial savegame.
+//WARNING: .entity fields cannot be saved and restored between map loads as they will leave dangling pointers.
+//numentityfields returns the number of entity fields. NOT offsets. Vectors comprise 4 fields: v, v_x, v_y and v_z.
+//entityfieldname returns the name as a string, eg. "origin" or "classname" or whatever.
+//entityfieldtype returns a value that the constants represent, but the field may be of another type in more exotic progs.dat formats or compilers.
+//getentityfieldstring returns data as would be written to a savegame, eg... "0.05" (float), "0 0 1" (vector), or "Hello World!" (string). Function names can also be returned.
+//putentityfieldstring puts the data returned by getentityfieldstring back into the entity.
+
+//DP_COVERAGE
+//idea: divVerent
+//darkplaces implementation: divVerent
+//function definitions:
+void coverage() = #642;  // Reports a coverage event. The engine counts for each of the calls to this builtin whether it has been called.
+
+// assorted undocumented extensions
+string(string, float) netaddress_resolve = #625;
+string(string search, string replace, string subject) strreplace = #484;
+string(float uselocaltime, string format, ...) strftime = #478;
+float(string s) tokenize_console = #514;
+float(float i) argv_start_index = #515;
+float(float i) argv_end_index = #516;
+string(float, float) getgamedirinfo = #626;
+const float GETGAMEDIRINFO_NAME = 0;
+const float GETGAMEDIRINFO_DESCRIPTION = 1;
+float log(float f) = #532;
+string(string format, ...) sprintf = #627;
+string(string s) strdecolorize = #477;
+entity findflags(entity start, .float field, float match) = #87;
+entity findchainflags(.float field, float match) = #88;
+float(string s, string separator1, ...) tokenizebyseparator = #479;
+float  etof(entity ent) = #79;
+entity         ftoe(float num)  = #80;
+float   validstring(string str) = #81;
+float  altstr_count(string str) = #82;
+string  altstr_prepare(string str) = #83;
+string  altstr_get(string str, float num) = #84;
+string  altstr_set(string str, float num, string set) = #85;
+string         altstr_ins(string str, float num, string set) = #86;
+float  isdemo() = #349;
+float  drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #469;
+//vector       getresolution(float number, ...) = #608; // optional argument "isfullscreen"
+void   parseentitydata(entity ent, string data) = #613;
+void   resethostcachemasks(void) = #615;
+void   sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
+void   sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
+void   resorthostcache(void) = #618;
+float SLSF_DESCENDING = 1;
+float SLSF_FAVORITES = 2;
+float SLSF_CATEGORIES = 4;
+void   sethostcachesort(float fld, float slsf) = #619;
+void   refreshhostcache(...) = #620;  // optional boolean argument "clear_list"
+float  gethostcachenumber(float fld, float hostnr) = #621;
+float  gethostcacheindexforkey(string key) = #622;
+void   addwantedhostcachekey(string key) = #623;
+string getextresponse(void) = #624;
+const string cvar_string(string name) = #71;
+const string cvar_defstring(string name) = #89;
+float  stringwidth(string text, float handleColors, vector size) = #468;
+
+#pragma noref 0
+
+#endif
diff --git a/qcsrc/dpdefs/progsdefs.qc b/qcsrc/dpdefs/progsdefs.qc
deleted file mode 100644 (file)
index 2ccd843..0000000
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
-==============================================================================
-
-                       SOURCE FOR GLOBALVARS_T C STRUCTURE
-                       MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
-
-==============================================================================
-*/
-
-//
-// system globals
-//
-entity         self;
-entity         other;
-entity         world;
-float          time;
-float          frametime;
-
-float          force_retouch;          // force all entities to touch triggers
-                                                               // next frame.  this is needed because
-                                                               // non-moving things don't normally scan
-                                                               // for triggers, and when a trigger is
-                                                               // created (like a teleport trigger), it
-                                                               // needs to catch everything.
-                                                               // decremented each frame, so set to 2
-                                                               // to guarantee everything is touched
-string         mapname;
-
-float          deathmatch;
-float          coop;
-float          teamplay;
-
-float          serverflags;            // propagated from level to level, used to
-                                                               // keep track of completed episodes
-
-float          total_secrets;
-float          total_monsters;
-
-float          found_secrets;          // number of secrets found
-float          killed_monsters;        // number of monsters killed
-
-
-// spawnparms are used to encode information about clients across server
-// level changes
-float          parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
-
-//
-// global variables set by built in functions
-//
-vector         v_forward, v_up, v_right;       // set by makevectors()
-
-// set by traceline / tracebox
-float          trace_allsolid;
-float          trace_startsolid;
-float          trace_fraction;
-vector         trace_endpos;
-vector         trace_plane_normal;
-float          trace_plane_dist;
-entity         trace_ent;
-float          trace_inopen;
-float          trace_inwater;
-
-entity         msg_entity;                             // destination of single entity writes
-
-//
-// required prog functions
-//
-void()                 main;                                           // only for testing
-
-void()         StartFrame;
-
-void()                 PlayerPreThink;
-void()                 PlayerPostThink;
-
-void()         ClientKill;
-void()         ClientConnect;
-void()                 PutClientInServer;              // call after setting the parm1... parms
-void()         ClientDisconnect;
-
-void()         SetNewParms;                    // called when a client first connects to
-                                                                       // a server. sets parms so they can be
-                                                                       // saved off for restarts
-
-void()         SetChangeParms;                 // call to set parms for self so they can
-                                                                       // be saved for a level transition
-
-
-//================================================
-void           end_sys_globals;                // flag for structure dumping
-//================================================
-
-/*
-==============================================================================
-
-                       SOURCE FOR ENTVARS_T C STRUCTURE
-                       MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
-
-==============================================================================
-*/
-
-//
-// system fields (*** = do not set in prog code, maintained by C code)
-//
-.float         modelindex;             // *** model index in the precached list
-.vector                absmin, absmax; // *** origin + mins / maxs
-
-.float         ltime;                  // local time for entity
-.float         movetype;
-.float         solid;
-
-.vector                origin;                 // ***
-.vector                oldorigin;              // ***
-.vector                velocity;
-.vector                angles;
-.vector                avelocity;
-
-.vector                punchangle;             // temp angle adjust from damage or recoil
-
-.string                classname;              // spawn function
-.string                model;
-.float         frame;
-.float         skin;
-.float         effects;
-
-.vector                mins, maxs;             // bounding box extents reletive to origin
-.vector                size;                   // maxs - mins
-
-.void()                touch;
-.void()                use;
-.void()                think;
-.void()                blocked;                // for doors or plats, called when can't push other
-
-.float         nextthink;
-.entity                groundentity;
-
-// stats
-.float         health;
-.float         frags;
-.float         weapon;                 // one of the IT_SHOTGUN, etc flags
-.string                weaponmodel;
-.float         weaponframe;
-.float         currentammo;
-.float         ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
-
-.float         items;                  // bit flags
-
-.float         takedamage;
-.entity                chain;
-.float         deadflag;
-
-.vector                view_ofs;                       // add to origin to get eye point
-
-
-.float         button0;                // fire
-.float         button1;                // use
-.float         button2;                // jump
-
-.float         impulse;                // weapon changes
-
-.float         fixangle;
-.vector                v_angle;                // view / targeting angle for players
-.float         idealpitch;             // calculated pitch angle for lookup up slopes
-
-
-.string                netname;
-
-.entity        enemy;
-
-.float         flags;
-
-.float         colormap;
-.float         team;
-
-.float         max_health;             // players maximum health is stored here
-
-.float         teleport_time;  // don't back up
-
-.float         armortype;              // save this fraction of incoming damage
-.float         armorvalue;
-
-.float         waterlevel;             // 0 = not in, 1 = feet, 2 = wast, 3 = eyes
-.float         watertype;              // a contents value
-
-.float         ideal_yaw;
-.float         yaw_speed;
-
-.entity                aiment;
-
-.entity        goalentity;             // a movetarget or an enemy
-
-.float         spawnflags;
-
-.string                target;
-.string                targetname;
-
-// damage is accumulated through a frame. and sent as one single
-// message, so the super shotgun doesn't generate huge messages
-.float         dmg_take;
-.float         dmg_save;
-.entity                dmg_inflictor;
-
-.entity                owner;          // who launched a missile
-.vector                movedir;        // mostly for doors, but also used for waterjump
-
-.string                message;                // trigger messages
-
-.float         sounds;         // either a cd track number or sound number
-
-.string                noise, noise1, noise2, noise3;  // contains names of wavs to play
-
-//================================================
-void           end_sys_fields;                 // flag for structure dumping
-//================================================
-
-/*
-==============================================================================
-
-                               CONSTANT DEFINITIONS
-
-==============================================================================
-*/
-
-
-//
-// constants
-//
-
-float  FALSE                                   = 0;
-float  TRUE                                    = 1;
-
-// edict.flags
-float  FL_FLY                                  = 1;
-float  FL_SWIM                                 = 2;
-float  FL_CLIENT                               = 8;    // set for all client edicts
-float  FL_INWATER                              = 16;   // for enter / leave water splash
-float  FL_MONSTER                              = 32;
-float  FL_GODMODE                              = 64;   // player cheat
-float  FL_NOTARGET                             = 128;  // player cheat
-float  FL_ITEM                                 = 256;  // extra wide size for bonus items
-float  FL_ONGROUND                             = 512;  // standing on something
-float  FL_PARTIALGROUND                = 1024; // not all corners are valid
-float  FL_WATERJUMP                    = 2048; // player jumping out of water
-float  FL_JUMPRELEASED                 = 4096; // for jump debouncing
-
-// edict.movetype values
-float  MOVETYPE_NONE                   = 0;    // never moves
-//float        MOVETYPE_ANGLENOCLIP    = 1;
-//float        MOVETYPE_ANGLECLIP              = 2;
-float  MOVETYPE_WALK                   = 3;    // players only
-float  MOVETYPE_STEP                   = 4;    // discrete, not real time unless fall
-float  MOVETYPE_FLY                    = 5;
-float  MOVETYPE_TOSS                   = 6;    // gravity
-float  MOVETYPE_PUSH                   = 7;    // no clip to world, push and crush
-float  MOVETYPE_NOCLIP                 = 8;
-float  MOVETYPE_FLYMISSILE             = 9;    // fly with extra size against monsters
-float  MOVETYPE_BOUNCE                 = 10;
-float  MOVETYPE_BOUNCEMISSILE  = 11;   // bounce with extra size
-
-// edict.solid values
-float  SOLID_NOT                               = 0;    // no interaction with other objects
-float  SOLID_TRIGGER                   = 1;    // touch on edge, but not blocking
-float  SOLID_BBOX                              = 2;    // touch on edge, block
-float  SOLID_SLIDEBOX                  = 3;    // touch on edge, but not an onground
-float  SOLID_BSP                               = 4;    // bsp clip, touch on edge, block
-
-// range values
-float  RANGE_MELEE                             = 0;
-float  RANGE_NEAR                              = 1;
-float  RANGE_MID                               = 2;
-float  RANGE_FAR                               = 3;
-
-// deadflag values
-
-float  DEAD_NO                                 = 0;
-float  DEAD_DYING                              = 1;
-float  DEAD_DEAD                               = 2;
-float  DEAD_RESPAWNABLE                = 3;
-float  DEAD_RESPAWNING                 = 4; // dead, waiting for buttons to be released
-
-// takedamage values
-
-float  DAMAGE_NO                               = 0;
-float  DAMAGE_YES                              = 1;
-float  DAMAGE_AIM                              = 2;
-
-// items
-float  IT_AXE                                  = 4096;
-float  IT_SHOTGUN                              = 1;
-float  IT_SUPER_SHOTGUN                = 2;
-float  IT_NAILGUN                              = 4;
-float  IT_SUPER_NAILGUN                = 8;
-float  IT_GRENADE_LAUNCHER             = 16;
-float  IT_ROCKET_LAUNCHER              = 32;
-float  IT_LIGHTNING                    = 64;
-float  IT_EXTRA_WEAPON                 = 128;
-
-float  IT_SHELLS                               = 256;
-float  IT_NAILS                                = 512;
-float  IT_ROCKETS                              = 1024;
-float  IT_CELLS                                = 2048;
-
-float  IT_ARMOR1                               = 8192;
-float  IT_ARMOR2                               = 16384;
-float  IT_ARMOR3                               = 32768;
-float  IT_SUPERHEALTH                  = 65536;
-
-float  IT_KEY1                                 = 131072;
-float  IT_KEY2                                 = 262144;
-
-float  IT_INVISIBILITY                 = 524288;
-float  IT_INVULNERABILITY              = 1048576;
-float  IT_SUIT                                 = 2097152;
-float  IT_QUAD                                 = 4194304;
-
-// point content values
-
-float  CONTENT_EMPTY                   = -1;
-float  CONTENT_SOLID                   = -2;
-float  CONTENT_WATER                   = -3;
-float  CONTENT_SLIME                   = -4;
-float  CONTENT_LAVA                    = -5;
-float  CONTENT_SKY                             = -6;
-
-float  STATE_TOP               = 0;
-float  STATE_BOTTOM    = 1;
-float  STATE_UP                = 2;
-float  STATE_DOWN              = 3;
-
-vector VEC_ORIGIN = '0 0 0';
-vector VEC_HULL_MIN = '-16 -16 -24';
-vector VEC_HULL_MAX = '16 16 32';
-
-vector VEC_HULL2_MIN = '-32 -32 -24';
-vector VEC_HULL2_MAX = '32 32 64';
-
-// protocol bytes
-float  SVC_TEMPENTITY          = 23;
-float  SVC_KILLEDMONSTER       = 27;
-float  SVC_FOUNDSECRET         = 28;
-float  SVC_INTERMISSION        = 30;
-float  SVC_FINALE                      = 31;
-float  SVC_CDTRACK                     = 32;
-float  SVC_SELLSCREEN          = 33;
-
-
-float  TE_SPIKE                = 0;
-float  TE_SUPERSPIKE   = 1;
-float  TE_GUNSHOT              = 2;
-float  TE_EXPLOSION    = 3;
-float  TE_TAREXPLOSION = 4;
-float  TE_LIGHTNING1   = 5;
-float  TE_LIGHTNING2   = 6;
-float  TE_WIZSPIKE             = 7;
-float  TE_KNIGHTSPIKE  = 8;
-float  TE_LIGHTNING3   = 9;
-float  TE_LAVASPLASH   = 10;
-float  TE_TELEPORT             = 11;
-
-// sound channels
-// channel 0 never willingly overrides
-// other channels (1-7) allways override a playing sound on that channel
-float  CHAN_AUTO               = 0;
-float  CHAN_WEAPON             = 1;
-float  CHAN_VOICE              = 2;
-float  CHAN_ITEM               = 3;
-float  CHAN_BODY               = 4;
-
-float  ATTN_NONE               = 0;
-float  ATTN_NORM               = 1;
-float  ATTN_IDLE               = 2;
-float  ATTN_STATIC             = 3;
-
-// update types
-
-float  UPDATE_GENERAL  = 0;
-float  UPDATE_STATIC   = 1;
-float  UPDATE_BINARY   = 2;
-float  UPDATE_TEMP             = 3;
-
-// entity effects
-
-float  EF_BRIGHTFIELD  = 1;
-float  EF_MUZZLEFLASH  = 2;
-float  EF_BRIGHTLIGHT  = 4;
-float  EF_DIMLIGHT     = 8;
-
-
-// messages
-float  MSG_BROADCAST   = 0;            // unreliable to all
-float  MSG_ONE                 = 1;            // reliable to one (msg_entity)
-float  MSG_ALL                 = 2;            // reliable to all
-float  MSG_INIT                = 3;            // write to the init string
-
-//===========================================================================
-
-//
-// builtin functions
-//
-
-void(vector ang)       makevectors             = #1;           // sets v_forward, etc globals
-void(entity e, vector o) setorigin     = #2;
-void(entity e, string m) setmodel      = #3;           // set movetype and solid first
-void(entity e, vector min, vector max) setsize = #4;
-// #5 was removed
-void() break_to_debugger                                               = #6;
-float() random                                         = #7;           // returns 0 - 1
-void(entity e, float chan, string samp, float vol, float atten) sound = #8;
-vector(vector v) normalize                     = #9;
-void(string e, ...) error                              = #10;
-void(string e, ...) objerror                           = #11;
-float(vector v) vlen                           = #12;
-float(vector v) vectoyaw                       = #13;
-entity() spawn                                         = #14;
-void(entity e) remove                          = #15;
-
-// sets trace_* globals
-// nomonsters can be:
-// An entity will also be ignored for testing if forent == test,
-// forent->owner == test, or test->owner == forent
-// a forent of world is ignored
-void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
-
-entity() checkclient                           = #17;  // returns a client to look for
-entity(entity start, .string fld, string match) find = #18;
-string(string s) precache_sound                = #19;
-string(string s) precache_model                = #20;
-void(entity client, string s, ...)stuffcmd = #21;
-entity(vector org, float rad) findradius = #22;
-void(string s, ...) bprint                             = #23;
-void(entity client, string s, ...) sprint = #24;
-void(string s, ...) dprint                             = #25;
-string(float f) ftos                           = #26;
-string(vector v) vtos                          = #27;
-void() coredump                                                = #28;          // prints all edicts
-void() traceon                                         = #29;          // turns statment trace on
-void() traceoff                                                = #30;
-void(entity e) eprint                          = #31;          // prints an entire edict
-float(float yaw, float dist) walkmove  = #32;  // returns TRUE or FALSE
-// #33 was removed
-float() droptofloor= #34;      // TRUE if landed on floor
-void(float style, string value) lightstyle = #35;
-float(float v) rint                                    = #36;          // round to nearest int
-float(float v) floor                           = #37;          // largest integer <= v
-float(float v) ceil                                    = #38;          // smallest integer >= v
-// #39 was removed
-float(entity e) checkbottom                    = #40;          // true if self is on ground
-float(vector v) pointcontents          = #41;          // returns a CONTENT_*
-// #42 was removed
-float(float f) fabs = #43;
-vector(entity e, float speed) aim = #44;               // returns the shooting vector
-float(string s) cvar = #45;                                            // return cvar.value
-void(string s, ...) localcmd = #46;                                    // put string into local que
-entity(entity e) nextent = #47;                                        // for looping through all ents
-void(vector o, vector d, float color, float count) particle = #48;// start a particle effect
-void() ChangeYaw = #49;                                                // turn towards self.ideal_yaw
-                                                                                       // at self.yaw_speed
-// #50 was removed
-vector(vector v) vectoangles                   = #51;
-
-//
-// direct client message generation
-//
-void(float to, float f) WriteByte              = #52;
-void(float to, float f) WriteChar              = #53;
-void(float to, float f) WriteShort             = #54;
-void(float to, float f) WriteLong              = #55;
-void(float to, float f) WriteCoord             = #56;
-void(float to, float f) WriteAngle             = #57;
-void(float to, string s, ...) WriteString      = #58;
-void(float to, entity s) WriteEntity   = #59;
-
-//
-// broadcast client message generation
-//
-
-// void(float f) bWriteByte            = #59;
-// void(float f) bWriteChar            = #60;
-// void(float f) bWriteShort           = #61;
-// void(float f) bWriteLong            = #62;
-// void(float f) bWriteCoord           = #63;
-// void(float f) bWriteAngle           = #64;
-// void(string s) bWriteString = #65;
-// void(entity e) bWriteEntity = #66;
-
-void(float step) movetogoal                            = #67;
-
-string(string s) precache_file         = #68;  // no effect except for -copy
-void(entity e) makestatic              = #69;
-void(string s) changelevel = #70;
-
-//#71 was removed
-
-void(string var, string val) cvar_set = #72;   // sets cvar.value
-
-void(entity client, string s, ...) centerprint = #73;  // sprint, but in middle
-
-void(vector pos, string samp, float vol, float atten) ambientsound = #74;
-
-string(string s) precache_model2       = #75;          // registered version only
-string(string s) precache_sound2       = #76;          // registered version only
-string(string s) precache_file2                = #77;          // registered version only
-
-void(entity e) setspawnparms           = #78;          // set parm1... to the
-                                                                                               // values at level start
-                                                                                               // for coop respawn
-
-//============================================================================
diff --git a/qcsrc/dpdefs/progsdefs.qh b/qcsrc/dpdefs/progsdefs.qh
new file mode 100644 (file)
index 0000000..fe632ce
--- /dev/null
@@ -0,0 +1,511 @@
+#ifndef PROGSDEFS_H
+#define PROGSDEFS_H
+
+/*
+==============================================================================
+
+                       SOURCE FOR GLOBALVARS_T C STRUCTURE
+                       MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
+
+==============================================================================
+*/
+
+//
+// system globals
+//
+entity         self;
+entity         other;
+entity         world;
+float          time;
+float          frametime;
+
+float          force_retouch;          // force all entities to touch triggers
+                                                               // next frame.  this is needed because
+                                                               // non-moving things don't normally scan
+                                                               // for triggers, and when a trigger is
+                                                               // created (like a teleport trigger), it
+                                                               // needs to catch everything.
+                                                               // decremented each frame, so set to 2
+                                                               // to guarantee everything is touched
+string         mapname;
+
+float          deathmatch;
+float          coop;
+float          teamplay;
+
+int                    serverflags;            // propagated from level to level, used to
+                                                               // keep track of completed episodes
+
+float          total_secrets;
+float          total_monsters;
+
+float          found_secrets;          // number of secrets found
+float          killed_monsters;        // number of monsters killed
+
+
+// spawnparms are used to encode information about clients across server
+// level changes
+float          parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
+
+//
+// global variables set by built in functions
+//
+vector         v_forward, v_up, v_right;       // set by makevectors()
+
+// set by traceline / tracebox
+float          trace_allsolid;
+float          trace_startsolid;
+float          trace_fraction;
+vector         trace_endpos;
+vector         trace_plane_normal;
+float          trace_plane_dist;
+entity         trace_ent;
+float          trace_inopen;
+float          trace_inwater;
+
+entity         msg_entity;                             // destination of single entity writes
+
+//
+// required prog functions
+//
+void()                 main;                                           // only for testing
+
+void()         StartFrame;
+
+void()                 PlayerPreThink;
+void()                 PlayerPostThink;
+
+void()         ClientKill;
+#ifdef DP_EXT_PRECONNECT
+void()         ClientPreConnect;
+#endif
+void()         ClientConnect;
+void()                 PutClientInServer;              // call after setting the parm1... parms
+void()         ClientDisconnect;
+
+void()         SetNewParms;                    // called when a client first connects to
+                                                                       // a server. sets parms so they can be
+                                                                       // saved off for restarts
+
+void()         SetChangeParms;                 // call to set parms for self so they can
+                                                                       // be saved for a level transition
+
+
+//================================================
+void           end_sys_globals;                // flag for structure dumping
+//================================================
+
+/*
+==============================================================================
+
+                       SOURCE FOR ENTVARS_T C STRUCTURE
+                       MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
+
+==============================================================================
+*/
+
+//
+// system fields (*** = do not set in prog code, maintained by C code)
+//
+.int           modelindex;             // *** model index in the precached list
+.vector                absmin, absmax; // *** origin + mins / maxs
+
+.float         ltime;                  // local time for entity
+.float         movetype;
+.float         solid;
+
+.vector                origin;                 // ***
+.vector                oldorigin;              // ***
+.vector                velocity;
+.vector                angles;
+.vector                avelocity;
+
+.vector                punchangle;             // temp angle adjust from damage or recoil
+
+.string                classname;              // spawn function
+.string                model;
+.int           frame;
+.int           skin;
+.int           effects;
+
+.vector                mins, maxs;             // bounding box extents reletive to origin
+.vector                size;                   // maxs - mins
+
+.void()                touch;
+.void()                use;
+.void()                think;
+.void()                blocked;                // for doors or plats, called when can't push other
+
+.float         nextthink;
+.entity                groundentity;
+
+// stats
+.float         health;
+.float         frags;
+.int           weapon;                 // one of the IT_SHOTGUN, etc flags
+.string                weaponmodel;
+.float         weaponframe;
+.float         currentammo;
+.float         ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
+
+.int           items;                  // bit flags
+
+.float         takedamage;
+.entity                chain;
+.float         deadflag;
+
+.vector                view_ofs;                       // add to origin to get eye point
+
+
+.float         button0;                // fire
+.float         button1;                // use
+.float         button2;                // jump
+
+.float         impulse;                // weapon changes
+
+.float         fixangle;
+.vector                v_angle;                // view / targeting angle for players
+.float         idealpitch;             // calculated pitch angle for lookup up slopes
+
+
+.string                netname;
+
+.entity        enemy;
+
+.int           flags;
+
+.int           colormap;
+.float         team;
+
+.float         max_health;             // players maximum health is stored here
+
+.float         teleport_time;  // don't back up
+
+.float         armortype;              // save this fraction of incoming damage
+.float         armorvalue;
+
+.float         waterlevel;             // 0 = not in, 1 = feet, 2 = wast, 3 = eyes
+.float         watertype;              // a contents value
+
+.float         ideal_yaw;
+.float         yaw_speed;
+
+.entity                aiment;
+
+.entity        goalentity;             // a movetarget or an enemy
+
+.int           spawnflags;
+
+.string                target;
+.string                targetname;
+
+// damage is accumulated through a frame. and sent as one single
+// message, so the super shotgun doesn't generate huge messages
+.float         dmg_take;
+.float         dmg_save;
+.entity                dmg_inflictor;
+
+.entity                owner;          // who launched a missile
+.vector                movedir;        // mostly for doors, but also used for waterjump
+
+.string                message;                // trigger messages
+
+.float         sounds;         // either a cd track number or sound number
+
+.string                noise, noise1, noise2, noise3;  // contains names of wavs to play
+
+//================================================
+void           end_sys_fields;                 // flag for structure dumping
+//================================================
+
+/*
+==============================================================================
+
+                               CONSTANT DEFINITIONS
+
+==============================================================================
+*/
+
+
+//
+// constants
+//
+
+// edict.flags
+const int FL_FLY                               = 1;
+const int FL_SWIM                              = 2;
+const int FL_CLIENT                            = 8;    // set for all client edicts
+const int FL_INWATER                   = 16;   // for enter / leave water splash
+const int FL_MONSTER                   = 32;
+const int FL_GODMODE                   = 64;   // player cheat
+const int FL_NOTARGET                  = 128;  // player cheat
+const int FL_ITEM                              = 256;  // extra wide size for bonus items
+const int FL_ONGROUND                  = 512;  // standing on something
+const int FL_PARTIALGROUND             = 1024; // not all corners are valid
+const int FL_WATERJUMP                 = 2048; // player jumping out of water
+const int FL_JUMPRELEASED              = 4096; // for jump debouncing
+
+// edict.movetype values
+const int MOVETYPE_NONE                        = 0;    // never moves
+//const int    MOVETYPE_ANGLENOCLIP= 1;
+//const int    MOVETYPE_ANGLECLIP      = 2;
+const int MOVETYPE_WALK                        = 3;    // players only
+const int MOVETYPE_STEP                        = 4;    // discrete, not real time unless fall
+const int MOVETYPE_FLY                 = 5;
+const int MOVETYPE_TOSS                        = 6;    // gravity
+const int MOVETYPE_PUSH                        = 7;    // no clip to world, push and crush
+const int MOVETYPE_NOCLIP              = 8;
+const int MOVETYPE_FLYMISSILE  = 9;    // fly with extra size against monsters
+const int MOVETYPE_BOUNCE              = 10;
+const int MOVETYPE_BOUNCEMISSILE= 11;  // bounce with extra size
+
+// edict.solid values
+const int SOLID_NOT                            = 0;    // no interaction with other objects
+const int SOLID_TRIGGER                        = 1;    // touch on edge, but not blocking
+const int SOLID_BBOX                   = 2;    // touch on edge, block
+const int SOLID_SLIDEBOX               = 3;    // touch on edge, but not an onground
+const int SOLID_BSP                            = 4;    // bsp clip, touch on edge, block
+
+// range values
+const int RANGE_MELEE                  = 0;
+const int RANGE_NEAR                   = 1;
+const int RANGE_MID                            = 2;
+const int RANGE_FAR                            = 3;
+
+// deadflag values
+
+const int DEAD_NO                              = 0;
+const int DEAD_DYING                   = 1;
+const int DEAD_DEAD                            = 2;
+const int DEAD_RESPAWNABLE             = 3;
+const int DEAD_RESPAWNING              = 4; // dead, waiting for buttons to be released
+
+// takedamage values
+
+const int DAMAGE_NO                            = 0;
+const int DAMAGE_YES                   = 1;
+const int DAMAGE_AIM                   = 2;
+
+// items
+const int IT_AXE                               = 4096;
+const int IT_SHOTGUN                   = 1;
+const int IT_SUPER_SHOTGUN             = 2;
+const int IT_NAILGUN                   = 4;
+const int IT_SUPER_NAILGUN             = 8;
+const int IT_GRENADE_LAUNCHER  = 16;
+const int IT_ROCKET_LAUNCHER   = 32;
+const int IT_LIGHTNING                 = 64;
+const int IT_EXTRA_WEAPON              = 128;
+
+//const int IT_SHELLS                  = 256;
+//const int IT_NAILS                   = 512;
+//const int IT_ROCKETS                 = 1024;
+//const int IT_CELLS                   = 2048;
+
+const int IT_ARMOR1                            = 8192;
+const int IT_ARMOR2                            = 16384;
+const int IT_ARMOR3                            = 32768;
+const int IT_SUPERHEALTH               = 65536;
+
+//const int IT_KEY1                            = 131072;
+//const int IT_KEY2                            = 262144;
+
+const int IT_INVISIBILITY              = 524288;
+const int IT_INVULNERABILITY   = 1048576;
+const int IT_SUIT                              = 2097152;
+const int IT_QUAD                              = 4194304;
+
+// point content values
+
+const int CONTENT_EMPTY                        = -1;
+const int CONTENT_SOLID                        = -2;
+const int CONTENT_WATER                        = -3;
+const int CONTENT_SLIME                        = -4;
+const int CONTENT_LAVA                 = -5;
+const int CONTENT_SKY                  = -6;
+
+const int STATE_TOP                            = 0;
+const int STATE_BOTTOM                 = 1;
+const int STATE_UP                             = 2;
+const int STATE_DOWN                   = 3;
+
+const vector VEC_ORIGIN                = '0 0 0';
+const vector VEC_HULL_MIN              = '-16 -16 -24';
+const vector VEC_HULL_MAX              = '16 16 32';
+
+const vector VEC_HULL2_MIN             = '-32 -32 -24';
+const vector VEC_HULL2_MAX             = '32 32 64';
+
+// protocol bytes
+const int SVC_TEMPENTITY               = 23;
+const int SVC_KILLEDMONSTER            = 27;
+const int SVC_FOUNDSECRET              = 28;
+const int SVC_INTERMISSION             = 30;
+const int SVC_FINALE                   = 31;
+const int SVC_CDTRACK                  = 32;
+const int SVC_SELLSCREEN               = 33;
+
+
+const int TE_SPIKE                             = 0;
+const int TE_SUPERSPIKE                        = 1;
+const int TE_GUNSHOT                   = 2;
+const int TE_EXPLOSION                 = 3;
+const int TE_TAREXPLOSION              = 4;
+const int TE_LIGHTNING1                        = 5;
+const int TE_LIGHTNING2                        = 6;
+const int TE_WIZSPIKE                  = 7;
+const int TE_KNIGHTSPIKE               = 8;
+const int TE_LIGHTNING3                        = 9;
+const int TE_LAVASPLASH                        = 10;
+const int TE_TELEPORT                  = 11;
+
+// sound channels
+// channel 0 never willingly overrides
+// other channels (1-7) allways override a playing sound on that channel
+const int CHAN_AUTO                            = 0;
+const int CHAN_WEAPON                  = 1;
+const int CHAN_VOICE                   = 2;
+const int CHAN_ITEM                            = 3;
+const int CHAN_BODY                            = 4;
+
+const int ATTN_NONE                            = 0;
+const int ATTN_NORM                            = 1;
+const int ATTN_IDLE                            = 2;
+const int ATTN_STATIC                  = 3;
+
+// update types
+
+const int UPDATE_GENERAL               = 0;
+const int UPDATE_STATIC                        = 1;
+const int UPDATE_BINARY                        = 2;
+const int UPDATE_TEMP                  = 3;
+
+// entity effects
+
+const int EF_BRIGHTFIELD               = 1;
+const int EF_MUZZLEFLASH               = 2;
+const int EF_BRIGHTLIGHT               = 4;
+const int EF_DIMLIGHT                  = 8;
+
+
+// messages
+const int MSG_BROADCAST                        = 0;            // unreliable to all
+const int MSG_ONE                              = 1;            // reliable to one (msg_entity)
+const int MSG_ALL                              = 2;            // reliable to all
+const int MSG_INIT                             = 3;            // write to the init string
+
+//===========================================================================
+
+//
+// builtin functions
+//
+
+void(vector ang)       makevectors             = #1;           // sets v_forward, etc globals
+void(entity e, vector o) setorigin     = #2;
+void(entity e, string m) setmodel      = #3;           // set movetype and solid first
+void(entity e, vector min, vector max) setsize = #4;
+// #5 was removed
+void() break_to_debugger                                               = #6;
+float() random                                         = #7;           // returns 0 - 1
+void(entity e, float chan, string samp, float vol, float atten) sound = #8;
+vector(vector v) normalize                     = #9;
+void(string e, ...) error                              = #10;
+void(string e, ...) objerror                           = #11;
+float(vector v) vlen                           = #12;
+float(vector v) vectoyaw                       = #13;
+entity() spawn                                         = #14;
+void(entity e) remove                          = #15;
+
+// sets trace_* globals
+// nomonsters can be:
+// An entity will also be ignored for testing if forent == test,
+// forent->owner == test, or test->owner == forent
+// a forent of world is ignored
+void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
+
+entity() checkclient                           = #17;  // returns a client to look for
+entity(entity start, .string fld, string match) find = #18;
+string(string s) precache_sound                = #19;
+string(string s) precache_model                = #20;
+void(entity client, string s, ...)stuffcmd = #21;
+entity(vector org, float rad) findradius = #22;
+void(string s, ...) bprint                             = #23;
+void(entity client, string s, ...) sprint = #24;
+void(string s, ...) dprint                             = #25;
+string(float f) ftos                           = #26;
+string(vector v) vtos                          = #27;
+void() coredump                                                = #28;          // prints all edicts
+void() traceon                                         = #29;          // turns statment trace on
+void() traceoff                                                = #30;
+void(entity e) eprint                          = #31;          // prints an entire edict
+float(float yaw, float dist) walkmove  = #32;  // returns true or false
+// #33 was removed
+float() droptofloor= #34;      // true if landed on floor
+void(float style, string value) lightstyle = #35;
+float(float v) rint                                    = #36;          // round to nearest int
+float(float v) floor                           = #37;          // largest integer <= v
+float(float v) ceil                                    = #38;          // smallest integer >= v
+// #39 was removed
+float(entity e) checkbottom                    = #40;          // true if self is on ground
+float(vector v) pointcontents          = #41;          // returns a CONTENT_*
+// #42 was removed
+float(float f) fabs = #43;
+vector(entity e, float speed) aim = #44;               // returns the shooting vector
+float(string s) cvar = #45;                                            // return cvar.value
+void(string s, ...) localcmd = #46;                                    // put string into local que
+entity(entity e) nextent = #47;                                        // for looping through all ents
+void(vector o, vector d, float color, float count) particle = #48;// start a particle effect
+void() ChangeYaw = #49;                                                // turn towards self.ideal_yaw
+                                                                                       // at self.yaw_speed
+// #50 was removed
+vector(vector v) vectoangles                   = #51;
+
+//
+// direct client message generation
+//
+void(float to, float f) WriteByte              = #52;
+void(float to, float f) WriteChar              = #53;
+void(float to, float f) WriteShort             = #54;
+void(float to, float f) WriteLong              = #55;
+void(float to, float f) WriteCoord             = #56;
+void(float to, float f) WriteAngle             = #57;
+void(float to, string s, ...) WriteString      = #58;
+void(float to, entity s) WriteEntity   = #59;
+
+//
+// broadcast client message generation
+//
+
+// void(float f) bWriteByte            = #59;
+// void(float f) bWriteChar            = #60;
+// void(float f) bWriteShort           = #61;
+// void(float f) bWriteLong            = #62;
+// void(float f) bWriteCoord           = #63;
+// void(float f) bWriteAngle           = #64;
+// void(string s) bWriteString = #65;
+// void(entity e) bWriteEntity = #66;
+
+void(float step) movetogoal                            = #67;
+
+string(string s) precache_file         = #68;  // no effect except for -copy
+void(entity e) makestatic              = #69;
+void(string s) changelevel = #70;
+
+//#71 was removed
+
+void(string name, string value) cvar_set = #72;        // sets cvar.value
+
+void(entity client, string s, ...) centerprint = #73;  // sprint, but in middle
+
+void(vector pos, string samp, float vol, float atten) ambientsound = #74;
+
+string(string s) precache_model2       = #75;          // registered version only
+string(string s) precache_sound2       = #76;          // registered version only
+string(string s) precache_file2                = #77;          // registered version only
+
+void(entity e) setspawnparms           = #78;          // set parm1... to the
+                                                                                               // values at level start
+                                                                                               // for coop respawn
+
+//============================================================================
+#endif
diff --git a/qcsrc/menu/anim/animation.c b/qcsrc/menu/anim/animation.c
deleted file mode 100644 (file)
index 99ccc78..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-#ifdef INTERFACE
-CLASS(Animation) EXTENDS(Object)
-       METHOD(Animation, configureAnimation, void(entity, entity, void(entity, float), float, float, float, float))
-       METHOD(Animation, setTimeStartEnd, void(entity, float, float))
-       METHOD(Animation, setTimeStartDuration, void(entity, float, float))
-       METHOD(Animation, setValueStartEnd, void(entity, float, float))
-       METHOD(Animation, setValueStartDelta, void(entity, float, float))
-       METHOD(Animation, setObjectSetter, void(entity, entity, void(entity, float)))
-       METHOD(Animation, tick, void(entity, float))
-       METHOD(Animation, calcValue, float(entity, float, float, float, float))
-       METHOD(Animation, isStopped, float(entity))
-       METHOD(Animation, stopAnim, void(entity))
-       METHOD(Animation, resumeAnim, void(entity))
-       METHOD(Animation, isFinished, float(entity))
-       METHOD(Animation, finishAnim, void(entity))
-       ATTRIB(Animation, object, entity, NULL)
-       ATTRIB(Animation, setter, void(entity, float), setterDummy)
-       ATTRIB(Animation, value, float, 0)
-       ATTRIB(Animation, startTime, float, 0)
-       ATTRIB(Animation, duration, float, 0)
-       ATTRIB(Animation, startValue, float, 0)
-       ATTRIB(Animation, delta, float, 0)
-       ATTRIB(Animation, stopped, float, FALSE)
-       ATTRIB(Animation, finished, float, FALSE)
-ENDCLASS(Animation)
-void setterDummy(entity, float);
-#endif
-
-#ifdef IMPLEMENTATION
-void Animation_configureAnimation(entity me, entity obj, void(entity, float) objSetter, float animStartTime, float animDuration, float animStartValue, float animEndValue)
-{
-       me.setObjectSetter(me, obj, objSetter);
-       me.setTimeStartDuration(me, animStartTime, animDuration);
-       me.setValueStartEnd(me, animStartValue, animEndValue);
-}
-
-void Animation_setTimeStartEnd(entity me, float s, float e)
-{
-       me.startTime = s;
-       me.duration = e - s;
-}
-
-void Animation_setTimeStartDuration(entity me, float s, float d)
-{
-       me.startTime = s;
-       me.duration = d;
-}
-
-void Animation_setValueStartEnd(entity me, float s, float e)
-{
-       me.startValue = s;
-       me.delta = e - s;
-}
-
-void Animation_setValueStartDelta(entity me, float s, float d)
-{
-       me.startValue = s;
-       me.delta = d;
-}
-
-void Animation_setObjectSetter(entity me, entity o, void(entity, float) s)
-{
-       me.object = o;
-       me.setter = s;
-}
-
-void Animation_tick(entity me, float tickTime)
-{
-       if (me.isStopped(me) || me.isFinished(me) || (tickTime < me.startTime))
-               return;
-
-       if (tickTime >= (me.startTime + me.duration))
-               me.finishAnim(me);
-       else
-               me.value = me.calcValue(me, (tickTime - me.startTime), me.duration, me.startValue, me.delta);
-
-       me.setter(me.object, me.value);
-}
-
-float Animation_calcValue(entity me, float tickTime, float animDuration, float animStartValue, float animDelta)
-{
-       return animStartValue;
-}
-
-float Animation_isStopped(entity me)
-{
-       return me.stopped;
-}
-
-void Animation_stopAnim(entity me)
-{
-       me.stopped = TRUE;
-}
-
-void Animation_resumeAnim(entity me)
-{
-       me.stopped = FALSE;
-}
-
-float Animation_isFinished(entity me)
-{
-       return me.finished;
-}
-
-void Animation_finishAnim(entity me)
-{
-       me.value = me.delta + me.startValue;
-       me.finished = TRUE;
-       me.setter(me.object, me.value);
-}
-
-void setterDummy(entity obj, float objValue)
-{
-}
-
-#endif
diff --git a/qcsrc/menu/anim/animation.qc b/qcsrc/menu/anim/animation.qc
new file mode 100644 (file)
index 0000000..26b01d7
--- /dev/null
@@ -0,0 +1,116 @@
+#ifdef INTERFACE
+CLASS(Animation) EXTENDS(Object)
+       METHOD(Animation, configureAnimation, void(entity, entity, void(entity, float), float, float, float, float))
+       METHOD(Animation, setTimeStartEnd, void(entity, float, float))
+       METHOD(Animation, setTimeStartDuration, void(entity, float, float))
+       METHOD(Animation, setValueStartEnd, void(entity, float, float))
+       METHOD(Animation, setValueStartDelta, void(entity, float, float))
+       METHOD(Animation, setObjectSetter, void(entity, entity, void(entity, float)))
+       METHOD(Animation, tick, void(entity, float))
+       METHOD(Animation, calcValue, float(entity, float, float, float, float))
+       METHOD(Animation, isStopped, float(entity))
+       METHOD(Animation, stopAnim, void(entity))
+       METHOD(Animation, resumeAnim, void(entity))
+       METHOD(Animation, isFinished, float(entity))
+       METHOD(Animation, finishAnim, void(entity))
+       ATTRIB(Animation, object, entity, NULL)
+       ATTRIB(Animation, setter, void(entity, float), setterDummy)
+       ATTRIB(Animation, value, float, 0)
+       ATTRIB(Animation, startTime, float, 0)
+       ATTRIB(Animation, duration, float, 0)
+       ATTRIB(Animation, startValue, float, 0)
+       ATTRIB(Animation, delta, float, 0)
+       ATTRIB(Animation, stopped, float, false)
+       ATTRIB(Animation, finished, float, false)
+ENDCLASS(Animation)
+void setterDummy(entity, float);
+#endif
+
+#ifdef IMPLEMENTATION
+void Animation_configureAnimation(entity me, entity obj, void(entity, float) objSetter, float animStartTime, float animDuration, float animStartValue, float animEndValue)
+{
+       me.setObjectSetter(me, obj, objSetter);
+       me.setTimeStartDuration(me, animStartTime, animDuration);
+       me.setValueStartEnd(me, animStartValue, animEndValue);
+}
+
+void Animation_setTimeStartEnd(entity me, float s, float e)
+{
+       me.startTime = s;
+       me.duration = e - s;
+}
+
+void Animation_setTimeStartDuration(entity me, float s, float d)
+{
+       me.startTime = s;
+       me.duration = d;
+}
+
+void Animation_setValueStartEnd(entity me, float s, float e)
+{
+       me.startValue = s;
+       me.delta = e - s;
+}
+
+void Animation_setValueStartDelta(entity me, float s, float d)
+{
+       me.startValue = s;
+       me.delta = d;
+}
+
+void Animation_setObjectSetter(entity me, entity o, void(entity, float) s)
+{
+       me.object = o;
+       me.setter = s;
+}
+
+void Animation_tick(entity me, float tickTime)
+{
+       if (me.isStopped(me) || me.isFinished(me) || (tickTime < me.startTime))
+               return;
+
+       if (tickTime >= (me.startTime + me.duration))
+               me.finishAnim(me);
+       else
+               me.value = me.calcValue(me, (tickTime - me.startTime), me.duration, me.startValue, me.delta);
+
+       me.setter(me.object, me.value);
+}
+
+float Animation_calcValue(entity me, float tickTime, float animDuration, float animStartValue, float animDelta)
+{
+       return animStartValue;
+}
+
+float Animation_isStopped(entity me)
+{
+       return me.stopped;
+}
+
+void Animation_stopAnim(entity me)
+{
+       me.stopped = true;
+}
+
+void Animation_resumeAnim(entity me)
+{
+       me.stopped = false;
+}
+
+float Animation_isFinished(entity me)
+{
+       return me.finished;
+}
+
+void Animation_finishAnim(entity me)
+{
+       me.value = me.delta + me.startValue;
+       me.finished = true;
+       me.setter(me.object, me.value);
+}
+
+void setterDummy(entity obj, float objValue)
+{
+}
+
+#endif
diff --git a/qcsrc/menu/anim/animhost.c b/qcsrc/menu/anim/animhost.c
deleted file mode 100644 (file)
index ae84e09..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-#ifdef INTERFACE
-CLASS(AnimHost) EXTENDS(Object)
-       METHOD(AnimHost, addAnim, void(entity, entity))
-       METHOD(AnimHost, removeAnim, void(entity, entity))
-       METHOD(AnimHost, removeAllAnim, void(entity))
-       METHOD(AnimHost, removeObjAnim, void(entity, entity))
-       METHOD(AnimHost, stopAllAnim, void(entity))
-       METHOD(AnimHost, stopObjAnim, void(entity, entity))
-       METHOD(AnimHost, resumeAllAnim, void(entity))
-       METHOD(AnimHost, resumeObjAnim, void(entity, entity))
-       METHOD(AnimHost, finishAllAnim, void(entity))
-       METHOD(AnimHost, finishObjAnim, void(entity, entity))
-       METHOD(AnimHost, tickAll, void(entity))
-       ATTRIB(AnimHost, firstChild, entity, NULL)
-       ATTRIB(AnimHost, lastChild, entity, NULL)
-ENDCLASS(AnimHost)
-.entity nextSibling;
-.entity prevSibling;
-#endif
-
-#ifdef IMPLEMENTATION
-void AnimHost_addAnim(entity me, entity other)
-{
-       if(other.parent)
-               error("Can't add already added anim!");
-
-       if(other.isFinished(other))
-               error("Can't add finished anim!");
-
-       other.parent = me;
-
-       entity l;
-       l = me.lastChild;
-
-       if(l)
-               l.nextSibling = other;
-       else
-               me.firstChild = other;
-
-       other.prevSibling = l;
-       other.nextSibling = NULL;
-       me.lastChild = other;
-}
-
-void AnimHost_removeAnim(entity me, entity other)
-{
-       if(other.parent != me)
-               error("Can't remove from wrong AnimHost!");
-
-       other.parent = NULL;
-
-       entity n, p;
-       n = other.nextSibling;
-       p = other.prevSibling;
-
-       if(p)
-               p.nextSibling = n;
-       else
-               me.firstChild = n;
-
-       if(n)
-               n.prevSibling = p;
-       else
-               me.lastChild = p;
-       remove(other);
-}
-
-void AnimHost_removeAllAnim(entity me)
-{
-       entity e, tmp;
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               tmp = e;
-               e = tmp.prevSibling;
-               me.removeAnim(me, tmp);
-       }
-}
-
-void AnimHost_removeObjAnim(entity me, entity obj)
-{
-       entity e, tmp;
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               if (e.object == obj)
-               {
-                       tmp = e;
-                       e = tmp.prevSibling;
-                       me.removeAnim(me, tmp);
-               }
-       }
-}
-
-void AnimHost_stopAllAnim(entity me)
-{
-       entity e;
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               e.stopAnim(e);
-       }
-}
-
-void AnimHost_stopObjAnim(entity me, entity obj)
-{
-       entity e;
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               if (e.object == obj)
-               {
-                       e.stopAnim(e);
-               }
-       }
-}
-
-void AnimHost_resumeAllAnim(entity me)
-{
-       entity e;
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               e.resumeAnim(e);
-       }
-}
-
-void AnimHost_resumeObjAnim(entity me, entity obj)
-{
-       entity e;
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               if (e.object == obj)
-               {
-                       e.resumeAnim(e);
-               }
-       }
-}
-
-void AnimHost_finishAllAnim(entity me)
-{
-       entity e, tmp;
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               tmp = e;
-               e = tmp.prevSibling;
-               tmp.finishAnim(tmp);
-       }
-}
-
-void AnimHost_finishObjAnim(entity me, entity obj)
-{
-       entity e, tmp;
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               if (e.object == obj)
-               {
-                       tmp = e;
-                       e = tmp.prevSibling;
-                       tmp.finishAnim(tmp);
-               }
-       }
-}
-
-void AnimHost_tickAll(entity me)
-{
-       entity e, tmp;
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               e.tick(e, time);
-               if (e.isFinished(e))
-               {
-                       tmp = e;
-                       e = tmp.prevSibling;
-                       me.removeAnim(me, tmp);
-               }
-       }
-}
-#endif
diff --git a/qcsrc/menu/anim/animhost.qc b/qcsrc/menu/anim/animhost.qc
new file mode 100644 (file)
index 0000000..c46334d
--- /dev/null
@@ -0,0 +1,176 @@
+#include "../menu.qh"
+
+#ifdef INTERFACE
+CLASS(AnimHost) EXTENDS(Object)
+       METHOD(AnimHost, addAnim, void(entity, entity))
+       METHOD(AnimHost, removeAnim, void(entity, entity))
+       METHOD(AnimHost, removeAllAnim, void(entity))
+       METHOD(AnimHost, removeObjAnim, void(entity, entity))
+       METHOD(AnimHost, stopAllAnim, void(entity))
+       METHOD(AnimHost, stopObjAnim, void(entity, entity))
+       METHOD(AnimHost, resumeAllAnim, void(entity))
+       METHOD(AnimHost, resumeObjAnim, void(entity, entity))
+       METHOD(AnimHost, finishAllAnim, void(entity))
+       METHOD(AnimHost, finishObjAnim, void(entity, entity))
+       METHOD(AnimHost, tickAll, void(entity))
+       ATTRIB(AnimHost, firstChild, entity, NULL)
+       ATTRIB(AnimHost, lastChild, entity, NULL)
+ENDCLASS(AnimHost)
+.entity nextSibling;
+.entity prevSibling;
+#endif
+
+#ifdef IMPLEMENTATION
+void AnimHost_addAnim(entity me, entity other)
+{
+       if(other.parent)
+               error("Can't add already added anim!");
+
+       if(other.isFinished(other))
+               error("Can't add finished anim!");
+
+       other.parent = me;
+
+       entity l;
+       l = me.lastChild;
+
+       if(l)
+               l.nextSibling = other;
+       else
+               me.firstChild = other;
+
+       other.prevSibling = l;
+       other.nextSibling = NULL;
+       me.lastChild = other;
+}
+
+void AnimHost_removeAnim(entity me, entity other)
+{
+       if(other.parent != me)
+               error("Can't remove from wrong AnimHost!");
+
+       other.parent = NULL;
+
+       entity n, p;
+       n = other.nextSibling;
+       p = other.prevSibling;
+
+       if(p)
+               p.nextSibling = n;
+       else
+               me.firstChild = n;
+
+       if(n)
+               n.prevSibling = p;
+       else
+               me.lastChild = p;
+       remove(other);
+}
+
+void AnimHost_removeAllAnim(entity me)
+{
+       entity e, tmp;
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               tmp = e;
+               e = tmp.prevSibling;
+               me.removeAnim(me, tmp);
+       }
+}
+
+void AnimHost_removeObjAnim(entity me, entity obj)
+{
+       entity e, tmp;
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               if (e.object == obj)
+               {
+                       tmp = e;
+                       e = tmp.prevSibling;
+                       me.removeAnim(me, tmp);
+               }
+       }
+}
+
+void AnimHost_stopAllAnim(entity me)
+{
+       entity e;
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               e.stopAnim(e);
+       }
+}
+
+void AnimHost_stopObjAnim(entity me, entity obj)
+{
+       entity e;
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               if (e.object == obj)
+               {
+                       e.stopAnim(e);
+               }
+       }
+}
+
+void AnimHost_resumeAllAnim(entity me)
+{
+       entity e;
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               e.resumeAnim(e);
+       }
+}
+
+void AnimHost_resumeObjAnim(entity me, entity obj)
+{
+       entity e;
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               if (e.object == obj)
+               {
+                       e.resumeAnim(e);
+               }
+       }
+}
+
+void AnimHost_finishAllAnim(entity me)
+{
+       entity e, tmp;
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               tmp = e;
+               e = tmp.prevSibling;
+               tmp.finishAnim(tmp);
+       }
+}
+
+void AnimHost_finishObjAnim(entity me, entity obj)
+{
+       entity e, tmp;
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               if (e.object == obj)
+               {
+                       tmp = e;
+                       e = tmp.prevSibling;
+                       tmp.finishAnim(tmp);
+               }
+       }
+}
+
+void AnimHost_tickAll(entity me)
+{
+       entity e, tmp;
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               e.tick(e, time);
+               if (e.isFinished(e))
+               {
+                       tmp = e;
+                       e = tmp.prevSibling;
+                       me.removeAnim(me, tmp);
+               }
+       }
+}
+#endif
diff --git a/qcsrc/menu/anim/easing.c b/qcsrc/menu/anim/easing.c
deleted file mode 100644 (file)
index 94ea9cf..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifdef INTERFACE
-CLASS(Easing) EXTENDS(Animation)
-       METHOD(Easing, calcValue, float(entity, float, float, float, float))
-       METHOD(Easing, setMath, void(entity, float(float, float, float, float)))
-       ATTRIB(Easing, math, float(float, float, float, float), easingLinear)
-ENDCLASS(Easing)
-entity makeHostedEasing(entity, void(entity, float), float(float, float, float, float), float, float, float);
-entity makeEasing(entity, void(entity, float), float(float, float, float, float), float, float, float, float);
-float easingLinear(float, float, float, float);
-float easingQuadIn(float, float, float, float);
-float easingQuadOut(float, float, float, float);
-float easingQuadInOut(float, float, float, float);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeHostedEasing(entity obj, void(entity, float) objSetter, float(float, float, float, float) func, float animDuration, float animStartValue, float animEnd)
-{
-       entity me;
-       me = makeEasing(obj, objSetter, func, time, animDuration, animStartValue, animEnd);
-       anim.addAnim(anim, me);
-       return me;
-}
-
-entity makeEasing(entity obj, void(entity, float) objSetter, float(float, float, float, float) func, float animStartTime, float animDuration, float animStartValue, float animEnd)
-{
-       entity me;
-       me = spawnEasing();
-       me.configureAnimation(me, obj, objSetter, animStartTime, animDuration, animStartValue, animEnd);
-       me.setMath(me, func);
-       return me;
-}
-
-float Easing_calcValue(entity me, float tickTime, float animDuration, float animStart, float animDelta)
-{
-       return me.math(tickTime, animDuration, animStart, animDelta);
-}
-
-void Easing_setMath(entity me, float(float, float, float, float) func)
-{
-       me.math = func;
-}
-
-float easingLinear(float tickTime, float animDuration, float animStart, float animDelta)
-{
-       return (animDelta * (tickTime / animDuration)) + animStart;
-}
-
-float easingQuadIn(float tickTime, float animDuration, float animStart, float animDelta)
-{
-       float frac = tickTime / animDuration;
-       return (animDelta * frac * frac) + animStart;
-}
-
-float easingQuadOut(float tickTime, float animDuration, float animStart, float animDelta)
-{
-       float frac = tickTime / animDuration;
-       return (-animDelta * frac * (frac - 2)) + animStart;
-}
-
-float easingQuadInOut(float tickTime, float animDuration, float animStart, float animDelta)
-{
-       if (tickTime < (animDuration / 2))
-       {
-               return easingQuadIn(tickTime, (animDuration / 2), animStart, (animDelta / 2));
-       }
-       else
-       {
-               return easingQuadOut((tickTime - (animDuration / 2)), (animDuration / 2), (animStart + (animDelta / 2)), (animDelta / 2));
-       }
-}
-
-#endif
diff --git a/qcsrc/menu/anim/easing.qc b/qcsrc/menu/anim/easing.qc
new file mode 100644 (file)
index 0000000..94ea9cf
--- /dev/null
@@ -0,0 +1,72 @@
+#ifdef INTERFACE
+CLASS(Easing) EXTENDS(Animation)
+       METHOD(Easing, calcValue, float(entity, float, float, float, float))
+       METHOD(Easing, setMath, void(entity, float(float, float, float, float)))
+       ATTRIB(Easing, math, float(float, float, float, float), easingLinear)
+ENDCLASS(Easing)
+entity makeHostedEasing(entity, void(entity, float), float(float, float, float, float), float, float, float);
+entity makeEasing(entity, void(entity, float), float(float, float, float, float), float, float, float, float);
+float easingLinear(float, float, float, float);
+float easingQuadIn(float, float, float, float);
+float easingQuadOut(float, float, float, float);
+float easingQuadInOut(float, float, float, float);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeHostedEasing(entity obj, void(entity, float) objSetter, float(float, float, float, float) func, float animDuration, float animStartValue, float animEnd)
+{
+       entity me;
+       me = makeEasing(obj, objSetter, func, time, animDuration, animStartValue, animEnd);
+       anim.addAnim(anim, me);
+       return me;
+}
+
+entity makeEasing(entity obj, void(entity, float) objSetter, float(float, float, float, float) func, float animStartTime, float animDuration, float animStartValue, float animEnd)
+{
+       entity me;
+       me = spawnEasing();
+       me.configureAnimation(me, obj, objSetter, animStartTime, animDuration, animStartValue, animEnd);
+       me.setMath(me, func);
+       return me;
+}
+
+float Easing_calcValue(entity me, float tickTime, float animDuration, float animStart, float animDelta)
+{
+       return me.math(tickTime, animDuration, animStart, animDelta);
+}
+
+void Easing_setMath(entity me, float(float, float, float, float) func)
+{
+       me.math = func;
+}
+
+float easingLinear(float tickTime, float animDuration, float animStart, float animDelta)
+{
+       return (animDelta * (tickTime / animDuration)) + animStart;
+}
+
+float easingQuadIn(float tickTime, float animDuration, float animStart, float animDelta)
+{
+       float frac = tickTime / animDuration;
+       return (animDelta * frac * frac) + animStart;
+}
+
+float easingQuadOut(float tickTime, float animDuration, float animStart, float animDelta)
+{
+       float frac = tickTime / animDuration;
+       return (-animDelta * frac * (frac - 2)) + animStart;
+}
+
+float easingQuadInOut(float tickTime, float animDuration, float animStart, float animDelta)
+{
+       if (tickTime < (animDuration / 2))
+       {
+               return easingQuadIn(tickTime, (animDuration / 2), animStart, (animDelta / 2));
+       }
+       else
+       {
+               return easingQuadOut((tickTime - (animDuration / 2)), (animDuration / 2), (animStart + (animDelta / 2)), (animDelta / 2));
+       }
+}
+
+#endif
diff --git a/qcsrc/menu/anim/keyframe.c b/qcsrc/menu/anim/keyframe.c
deleted file mode 100644 (file)
index 3bcda94..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-#ifdef INTERFACE
-CLASS(Keyframe) EXTENDS(Animation)
-       METHOD(Keyframe, addEasing, entity(entity, float, float, float(float, float, float, float)))
-       METHOD(Keyframe, addAnim, void(entity, entity))
-       METHOD(Keyframe, calcValue, float(entity, float, float, float, float))
-       ATTRIB(Keyframe, currentChild, entity, NULL)
-       ATTRIB(Keyframe, firstChild, entity, NULL)
-       ATTRIB(Keyframe, lastChild, entity, NULL)
-ENDCLASS(Keyframe)
-entity makeHostedKeyframe(entity, void(entity, float), float, float, float);
-entity makeKeyframe(entity, void(entity, float), float, float, float);
-float getNewChildStart(entity);
-float getNewChildDuration(entity, float);
-float getNewChildValue(entity);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeHostedKeyframe(entity obj, void(entity, float) objSetter, float animDuration, float animStart, float animEnd)
-{
-       entity me;
-       me = makeKeyframe(obj, objSetter, animDuration, animStart, animEnd);
-       anim.addAnim(anim, me);
-       return me;
-}
-
-entity makeKeyframe(entity obj, void(entity, float) objSetter, float animDuration, float animStart, float animEnd)
-{
-       entity me;
-       me = spawnKeyframe();
-       me.configureAnimation(me, obj, objSetter, time, animDuration, animStart, animEnd);
-       return me;
-}
-
-entity Keyframe_addEasing(entity me, float animDurationTime, float animEnd, float(float, float, float, float) func)
-{
-       entity other;
-       other = makeEasing(me.object, me.setter, func, getNewChildStart(me), getNewChildDuration(me, animDurationTime), getNewChildValue(me), animEnd);
-       me.addAnim(me, other);
-       return other;
-}
-
-float getNewChildStart(entity me)
-{
-       if (me.lastChild)
-               return (me.lastChild.startTime + me.lastChild.duration);
-       else
-               return 0;
-}
-
-float getNewChildDuration(entity me, float durationTime)
-{
-       float dura, maxDura;
-       maxDura = me.duration;
-       if (me.lastChild) maxDura = maxDura - (me.lastChild.startTime + me.lastChild.duration);
-       dura = durationTime;
-       if (0 >= dura || dura > maxDura) dura = maxDura;
-       return dura;
-}
-
-float getNewChildValue(entity me)
-{
-       if (me.lastChild)
-               return (me.lastChild.startValue + me.lastChild.delta);
-       else
-               return me.startValue;
-}
-
-void Keyframe_addAnim(entity me, entity other)
-{
-       if(other.parent)
-               error("Can't add already added anim!");
-
-       if(other.isFinished(other))
-               error("Can't add finished anim!");
-
-       other.parent = me;
-
-       entity l;
-       l = me.lastChild;
-
-       if(l)
-               l.nextSibling = other;
-       else
-       {
-               me.currentChild = other;
-               me.firstChild = other;
-       }
-
-       other.prevSibling = l;
-       other.nextSibling = NULL;
-       me.lastChild = other;
-}
-
-float Keyframe_calcValue(entity me, float tickTime, float animDuration, float animStartValue, float animDelta)
-{
-       if (me.currentChild)
-               if (me.currentChild.isFinished(me.currentChild))
-                       me.currentChild = me.currentChild.nextSibling;
-
-       if (me.currentChild)
-       {
-               me.currentChild.tick(me.currentChild, tickTime);
-               return me.currentChild.value;
-       }
-
-       return animStartValue + animDelta;
-}
-#endif
diff --git a/qcsrc/menu/anim/keyframe.qc b/qcsrc/menu/anim/keyframe.qc
new file mode 100644 (file)
index 0000000..3bcda94
--- /dev/null
@@ -0,0 +1,108 @@
+#ifdef INTERFACE
+CLASS(Keyframe) EXTENDS(Animation)
+       METHOD(Keyframe, addEasing, entity(entity, float, float, float(float, float, float, float)))
+       METHOD(Keyframe, addAnim, void(entity, entity))
+       METHOD(Keyframe, calcValue, float(entity, float, float, float, float))
+       ATTRIB(Keyframe, currentChild, entity, NULL)
+       ATTRIB(Keyframe, firstChild, entity, NULL)
+       ATTRIB(Keyframe, lastChild, entity, NULL)
+ENDCLASS(Keyframe)
+entity makeHostedKeyframe(entity, void(entity, float), float, float, float);
+entity makeKeyframe(entity, void(entity, float), float, float, float);
+float getNewChildStart(entity);
+float getNewChildDuration(entity, float);
+float getNewChildValue(entity);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeHostedKeyframe(entity obj, void(entity, float) objSetter, float animDuration, float animStart, float animEnd)
+{
+       entity me;
+       me = makeKeyframe(obj, objSetter, animDuration, animStart, animEnd);
+       anim.addAnim(anim, me);
+       return me;
+}
+
+entity makeKeyframe(entity obj, void(entity, float) objSetter, float animDuration, float animStart, float animEnd)
+{
+       entity me;
+       me = spawnKeyframe();
+       me.configureAnimation(me, obj, objSetter, time, animDuration, animStart, animEnd);
+       return me;
+}
+
+entity Keyframe_addEasing(entity me, float animDurationTime, float animEnd, float(float, float, float, float) func)
+{
+       entity other;
+       other = makeEasing(me.object, me.setter, func, getNewChildStart(me), getNewChildDuration(me, animDurationTime), getNewChildValue(me), animEnd);
+       me.addAnim(me, other);
+       return other;
+}
+
+float getNewChildStart(entity me)
+{
+       if (me.lastChild)
+               return (me.lastChild.startTime + me.lastChild.duration);
+       else
+               return 0;
+}
+
+float getNewChildDuration(entity me, float durationTime)
+{
+       float dura, maxDura;
+       maxDura = me.duration;
+       if (me.lastChild) maxDura = maxDura - (me.lastChild.startTime + me.lastChild.duration);
+       dura = durationTime;
+       if (0 >= dura || dura > maxDura) dura = maxDura;
+       return dura;
+}
+
+float getNewChildValue(entity me)
+{
+       if (me.lastChild)
+               return (me.lastChild.startValue + me.lastChild.delta);
+       else
+               return me.startValue;
+}
+
+void Keyframe_addAnim(entity me, entity other)
+{
+       if(other.parent)
+               error("Can't add already added anim!");
+
+       if(other.isFinished(other))
+               error("Can't add finished anim!");
+
+       other.parent = me;
+
+       entity l;
+       l = me.lastChild;
+
+       if(l)
+               l.nextSibling = other;
+       else
+       {
+               me.currentChild = other;
+               me.firstChild = other;
+       }
+
+       other.prevSibling = l;
+       other.nextSibling = NULL;
+       me.lastChild = other;
+}
+
+float Keyframe_calcValue(entity me, float tickTime, float animDuration, float animStartValue, float animDelta)
+{
+       if (me.currentChild)
+               if (me.currentChild.isFinished(me.currentChild))
+                       me.currentChild = me.currentChild.nextSibling;
+
+       if (me.currentChild)
+       {
+               me.currentChild.tick(me.currentChild, tickTime);
+               return me.currentChild.value;
+       }
+
+       return animStartValue + animDelta;
+}
+#endif
diff --git a/qcsrc/menu/classes.c b/qcsrc/menu/classes.c
deleted file mode 100644 (file)
index 9f01ee3..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-#include "anim/animhost.c"
-#include "anim/animation.c"
-#include "anim/easing.c"
-#include "anim/keyframe.c"
-#include "item.c"
-#include "item/container.c"
-#include "item/inputcontainer.c"
-#include "item/nexposee.c"
-#include "item/modalcontroller.c"
-#include "item/image.c"
-#include "item/label.c"
-#include "item/button.c"
-#include "item/checkbox.c"
-#include "item/radiobutton.c"
-#include "item/borderimage.c"
-#include "item/slider.c"
-#include "item/dialog.c"
-#include "item/tab.c"
-#include "item/textslider.c"
-#include "item/listbox.c"
-#include "item/inputbox.c"
-#include "xonotic/dialog.c"
-#include "xonotic/tab.c"
-#include "xonotic/mainwindow.c"
-#include "xonotic/button.c"
-#include "xonotic/bigbutton.c"
-#include "xonotic/commandbutton.c"
-#include "xonotic/bigcommandbutton.c"
-#include "xonotic/textlabel.c"
-#include "xonotic/dialog_firstrun.c"
-#include "xonotic/dialog_teamselect.c"
-#include "xonotic/dialog_sandboxtools.c"
-#include "xonotic/dialog_monstertools.c"
-#include "xonotic/dialog_settings.c"
-#include "xonotic/dialog_settings_video.c"
-#include "xonotic/dialog_settings_effects.c"
-#include "xonotic/dialog_settings_audio.c"
-#include "xonotic/dialog_settings_game.c"
-#include "xonotic/dialog_settings_user.c"
-#include "xonotic/dialog_settings_user_languagewarning.c"
-#include "xonotic/dialog_settings_misc.c"
-#include "xonotic/dialog_multiplayer.c"
-#include "xonotic/dialog_multiplayer_profile.c"
-#include "xonotic/tabcontroller.c"
-#include "xonotic/slider.c"
-#include "xonotic/slider_resolution.c"
-#include "xonotic/checkbox.c"
-#include "xonotic/checkbox_string.c"
-#include "xonotic/weaponarenacheckbox.c"
-#include "xonotic/radiobutton.c"
-#include "xonotic/nexposee.c"
-#include "xonotic/rootdialog.c"
-#include "xonotic/textslider.c"
-#include "xonotic/colorbutton.c"
-#include "xonotic/dialog_multiplayer_join.c"
-#include "xonotic/dialog_multiplayer_join_serverinfo.c"
-#include "xonotic/playerlist.c"
-#include "xonotic/listbox.c"
-#include "xonotic/serverlist.c"
-#include "xonotic/inputbox.c"
-#include "xonotic/dialog_quit.c"
-#include "xonotic/dialog_multiplayer_create.c"
-#include "xonotic/dialog_multiplayer_create_mutators.c"
-#include "xonotic/dialog_multiplayer_create_mapinfo.c"
-#include "xonotic/gametypelist.c"
-#include "xonotic/maplist.c"
-#include "xonotic/skinlist.c"
-#include "xonotic/languagelist.c"
-#include "xonotic/image.c"
-#include "xonotic/crosshairbutton.c"
-#include "xonotic/playermodel.c"
-#include "xonotic/checkbox_slider_invalid.c"
-#include "xonotic/charmap.c"
-#include "xonotic/keybinder.c"
-#include "xonotic/dialog_settings_input.c"
-#include "xonotic/dialog_settings_input_userbind.c"
-#include "xonotic/slider_decibels.c"
-#include "xonotic/dialog_singleplayer.c"
-#include "xonotic/campaign.c"
-#include "xonotic/dialog_singleplayer_winner.c"
-#include "xonotic/dialog_credits.c"
-#include "xonotic/credits.c"
-#include "xonotic/dialog_settings_game_crosshair.c"
-#include "xonotic/dialog_settings_game_hud.c"
-#include "xonotic/dialog_settings_game_hudconfirm.c"
-#include "xonotic/dialog_settings_game_model.c"
-#include "xonotic/dialog_settings_game_messages.c"
-#include "xonotic/dialog_settings_game_view.c"
-#include "xonotic/dialog_settings_game_weapons.c"
-#include "xonotic/weaponslist.c"
-#include "xonotic/dialog_multiplayer_media.c"
-#include "xonotic/dialog_multiplayer_media_demo.c"
-#include "xonotic/dialog_multiplayer_media_demo_startconfirm.c"
-#include "xonotic/dialog_multiplayer_media_demo_timeconfirm.c"
-#include "xonotic/demolist.c"
-#include "xonotic/screenshotimage.c"
-#include "xonotic/dialog_multiplayer_media_screenshot.c"
-#include "xonotic/dialog_multiplayer_media_screenshot_viewer.c"
-#include "xonotic/screenshotlist.c"
-#include "xonotic/statslist.c"
-#include "xonotic/dialog_multiplayer_media_musicplayer.c"
-#include "xonotic/soundlist.c"
-#include "xonotic/playlist.c"
-#include "xonotic/colorpicker.c"
-#include "xonotic/colorpicker_string.c"
-#include "xonotic/cvarlist.c"
-#include "xonotic/dialog_settings_misc_cvars.c"
-#include "xonotic/dialog_hudsetup_exit.c"
-#include "xonotic/dialog_hudpanel_notification.c"
-#include "xonotic/dialog_hudpanel_ammo.c"
-#include "xonotic/dialog_hudpanel_healtharmor.c"
-#include "xonotic/dialog_hudpanel_powerups.c"
-#include "xonotic/dialog_hudpanel_racetimer.c"
-#include "xonotic/dialog_hudpanel_pressedkeys.c"
-#include "xonotic/dialog_hudpanel_radar.c"
-#include "xonotic/dialog_hudpanel_score.c"
-#include "xonotic/dialog_hudpanel_timer.c"
-#include "xonotic/dialog_hudpanel_vote.c"
-#include "xonotic/dialog_hudpanel_modicons.c"
-#include "xonotic/dialog_hudpanel_chat.c"
-#include "xonotic/dialog_hudpanel_engineinfo.c"
-#include "xonotic/dialog_hudpanel_infomessages.c"
-#include "xonotic/dialog_hudpanel_weapons.c"
-#include "xonotic/dialog_hudpanel_physics.c"
-#include "xonotic/dialog_hudpanel_centerprint.c"
-#include "xonotic/dialog_hudpanel_buffs.c"
-#include "xonotic/slider_picmip.c"
-#include "xonotic/slider_particles.c"
-#include "xonotic/slider_sbfadetime.c"
-#include "xonotic/dialog_settings_misc_reset.c"
diff --git a/qcsrc/menu/classes.qc b/qcsrc/menu/classes.qc
new file mode 100644 (file)
index 0000000..9b4bb4d
--- /dev/null
@@ -0,0 +1,130 @@
+#include "anim/animhost.qc"
+#include "anim/animation.qc"
+#include "anim/easing.qc"
+#include "anim/keyframe.qc"
+#include "item.qc"
+#include "item/container.qc"
+#include "item/inputcontainer.qc"
+#include "item/nexposee.qc"
+#include "item/modalcontroller.qc"
+#include "item/image.qc"
+#include "item/label.qc"
+#include "item/button.qc"
+#include "item/checkbox.qc"
+#include "item/radiobutton.qc"
+#include "item/borderimage.qc"
+#include "item/slider.qc"
+#include "item/dialog.qc"
+#include "item/tab.qc"
+#include "item/textslider.qc"
+#include "item/listbox.qc"
+#include "item/inputbox.qc"
+#include "xonotic/dialog.qc"
+#include "xonotic/tab.qc"
+#include "xonotic/mainwindow.qc"
+#include "xonotic/button.qc"
+#include "xonotic/bigbutton.qc"
+#include "xonotic/commandbutton.qc"
+#include "xonotic/bigcommandbutton.qc"
+#include "xonotic/textlabel.qc"
+#include "xonotic/dialog_firstrun.qc"
+#include "xonotic/dialog_teamselect.qc"
+#include "xonotic/dialog_sandboxtools.qc"
+#include "xonotic/dialog_monstertools.qc"
+#include "xonotic/dialog_settings.qc"
+#include "xonotic/dialog_settings_video.qc"
+#include "xonotic/dialog_settings_effects.qc"
+#include "xonotic/dialog_settings_audio.qc"
+#include "xonotic/dialog_settings_game.qc"
+#include "xonotic/dialog_settings_user.qc"
+#include "xonotic/dialog_settings_user_languagewarning.qc"
+#include "xonotic/dialog_settings_misc.qc"
+#include "xonotic/dialog_multiplayer.qc"
+#include "xonotic/dialog_multiplayer_profile.qc"
+#include "xonotic/tabcontroller.qc"
+#include "xonotic/slider.qc"
+#include "xonotic/slider_resolution.qc"
+#include "xonotic/checkbox.qc"
+#include "xonotic/checkbox_string.qc"
+#include "xonotic/weaponarenacheckbox.qc"
+#include "xonotic/radiobutton.qc"
+#include "xonotic/nexposee.qc"
+#include "xonotic/rootdialog.qc"
+#include "xonotic/textslider.qc"
+#include "xonotic/colorbutton.qc"
+#include "xonotic/dialog_multiplayer_join.qc"
+#include "xonotic/dialog_multiplayer_join_serverinfo.qc"
+#include "xonotic/playerlist.qc"
+#include "xonotic/listbox.qc"
+#include "xonotic/serverlist.qc"
+#include "xonotic/inputbox.qc"
+#include "xonotic/dialog_quit.qc"
+#include "xonotic/dialog_multiplayer_create.qc"
+#include "xonotic/dialog_multiplayer_create_mutators.qc"
+#include "xonotic/dialog_multiplayer_create_mapinfo.qc"
+#include "xonotic/gametypelist.qc"
+#include "xonotic/maplist.qc"
+#include "xonotic/skinlist.qc"
+#include "xonotic/languagelist.qc"
+#include "xonotic/image.qc"
+#include "xonotic/crosshairbutton.qc"
+#include "xonotic/playermodel.qc"
+#include "xonotic/checkbox_slider_invalid.qc"
+#include "xonotic/charmap.qc"
+#include "xonotic/keybinder.qc"
+#include "xonotic/dialog_settings_input.qc"
+#include "xonotic/dialog_settings_input_userbind.qc"
+#include "xonotic/slider_decibels.qc"
+#include "xonotic/dialog_singleplayer.qc"
+#include "xonotic/campaign.qc"
+#include "xonotic/dialog_singleplayer_winner.qc"
+#include "xonotic/dialog_credits.qc"
+#include "xonotic/credits.qc"
+#include "xonotic/dialog_settings_game_crosshair.qc"
+#include "xonotic/dialog_settings_game_hud.qc"
+#include "xonotic/dialog_settings_game_hudconfirm.qc"
+#include "xonotic/dialog_settings_game_model.qc"
+#include "xonotic/dialog_settings_game_messages.qc"
+#include "xonotic/dialog_settings_game_view.qc"
+#include "xonotic/dialog_settings_game_weapons.qc"
+#include "xonotic/weaponslist.qc"
+#include "xonotic/dialog_multiplayer_media.qc"
+#include "xonotic/dialog_multiplayer_media_demo.qc"
+#include "xonotic/dialog_multiplayer_media_demo_startconfirm.qc"
+#include "xonotic/dialog_multiplayer_media_demo_timeconfirm.qc"
+#include "xonotic/demolist.qc"
+#include "xonotic/screenshotimage.qc"
+#include "xonotic/dialog_multiplayer_media_screenshot.qc"
+#include "xonotic/dialog_multiplayer_media_screenshot_viewer.qc"
+#include "xonotic/screenshotlist.qc"
+#include "xonotic/statslist.qc"
+#include "xonotic/dialog_multiplayer_media_musicplayer.qc"
+#include "xonotic/soundlist.qc"
+#include "xonotic/playlist.qc"
+#include "xonotic/colorpicker.qc"
+#include "xonotic/colorpicker_string.qc"
+#include "xonotic/cvarlist.qc"
+#include "xonotic/dialog_settings_misc_cvars.qc"
+#include "xonotic/dialog_hudsetup_exit.qc"
+#include "xonotic/dialog_hudpanel_notification.qc"
+#include "xonotic/dialog_hudpanel_ammo.qc"
+#include "xonotic/dialog_hudpanel_healtharmor.qc"
+#include "xonotic/dialog_hudpanel_powerups.qc"
+#include "xonotic/dialog_hudpanel_racetimer.qc"
+#include "xonotic/dialog_hudpanel_pressedkeys.qc"
+#include "xonotic/dialog_hudpanel_radar.qc"
+#include "xonotic/dialog_hudpanel_score.qc"
+#include "xonotic/dialog_hudpanel_timer.qc"
+#include "xonotic/dialog_hudpanel_vote.qc"
+#include "xonotic/dialog_hudpanel_modicons.qc"
+#include "xonotic/dialog_hudpanel_chat.qc"
+#include "xonotic/dialog_hudpanel_engineinfo.qc"
+#include "xonotic/dialog_hudpanel_infomessages.qc"
+#include "xonotic/dialog_hudpanel_weapons.qc"
+#include "xonotic/dialog_hudpanel_physics.qc"
+#include "xonotic/dialog_hudpanel_centerprint.qc"
+#include "xonotic/dialog_hudpanel_buffs.qc"
+#include "xonotic/slider_picmip.qc"
+#include "xonotic/slider_particles.qc"
+#include "xonotic/slider_sbfadetime.qc"
+#include "xonotic/dialog_settings_misc_reset.qc"
index c7499e58e40a8a94ba1f31f2c504f0310bb465a3..93825cd56098d73e2ebe53aa0aee97041fcaf03c 100644 (file)
@@ -1,3 +1,7 @@
+#include "menu_cmd.qh"
+
+#include "../../common/command/generic.qh"
+
 string _dumptree_space;
 void _dumptree_open(entity pass, entity me)
 {
@@ -85,7 +89,10 @@ void GameCommand(string theCommand)
                                }
                }
                else if(argc == 2 && !isdemo()) // don't allow this command in demos
+               {
+                       m_play_click_sound(MENU_SOUND_OPEN);
                        m_goto(strcat(filter, argv(1))); // switch to a menu item
+               }
                if(filter)
                        strunzone(filter);
                return;
index 7a18fe2def40683da35241f8b6bf53a04429d68d..364b13690a08e1336733b5669c24856ca9b7ca96 100644 (file)
@@ -1 +1,5 @@
+#ifndef MENU_CMD_H
+#define MENU_CMD_H
+
 void GameCommand(string command);
+#endif
diff --git a/qcsrc/menu/config.qh b/qcsrc/menu/config.qh
deleted file mode 100644 (file)
index ceb266a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// build config file
-#define MENUQC // so common/*.qc can check for menu QC or game QC
-
index 19d18223aa852c8362126dc66f14004eb2baffa9..05e7af227adccb9040870bc7e690e405a7b1d400 100644 (file)
@@ -1,3 +1,8 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
 string draw_mousepointer;
 vector draw_mousepointer_offset;
 vector draw_mousepointer_size;
@@ -6,7 +11,7 @@ void draw_setMousePointer(string pic, vector theSize, vector theOffset)
 {
        draw_mousepointer = strzone(draw_UseSkinFor(pic));
        draw_mousepointer_size = theSize;
-       draw_mousepointer_offset = eX * (theOffset_x * theSize_x) + eY * (theOffset_y * theSize_y);
+       draw_mousepointer_offset = eX * (theOffset.x * theSize.x) + eY * (theOffset.y * theSize.y);
 }
 
 void draw_drawMousePointer(vector where)
@@ -36,30 +41,30 @@ void draw_endBoldFont()
 vector globalToBox(vector v, vector theOrigin, vector theScale)
 {
        v -= theOrigin;
-       v_x /= theScale_x;
-       v_y /= theScale_y;
+       v.x /= theScale.x;
+       v.y /= theScale.y;
        return v;
 }
 
 vector globalToBoxSize(vector v, vector theScale)
 {
-       v_x /= theScale_x;
-       v_y /= theScale_y;
+       v.x /= theScale.x;
+       v.y /= theScale.y;
        return v;
 }
 
 vector boxToGlobal(vector v, vector theOrigin, vector theScale)
 {
-       v_x *= theScale_x;
-       v_y *= theScale_y;
+       v.x *= theScale.x;
+       v.y *= theScale.y;
        v += theOrigin;
        return v;
 }
 
 vector boxToGlobalSize(vector v, vector theScale)
 {
-       v_x *= theScale_x;
-       v_y *= theScale_y;
+       v.x *= theScale.x;
+       v.y *= theScale.y;
        return v;
 }
 
@@ -77,7 +82,7 @@ string draw_PreloadPictureWithFlags(string pic, float f)
 
 void draw_Picture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha)
 {
-       if(theSize_x == 0 || theSize_y <= 0) // no default sizing please
+       if(theSize.x == 0 || theSize.y <= 0) // no default sizing please
                return;
        pic = draw_UseSkinFor(pic);
        drawpic(boxToGlobal(theOrigin, draw_shift, draw_scale), pic, boxToGlobalSize(theSize, draw_scale), theColor, theAlpha * draw_alpha, 0);
@@ -109,20 +114,20 @@ void draw_ButtonPicture(vector theOrigin, string pic, vector theSize, vector the
        theOrigin = boxToGlobal(theOrigin, draw_shift, draw_scale);
        theSize = boxToGlobalSize(theSize, draw_scale);
        theAlpha *= draw_alpha;
-       width = eX * theSize_x;
-       height = eY * theSize_y;
-       if(theSize_x <= theSize_y * 2)
+       width = eX * theSize.x;
+       height = eY * theSize.y;
+       if(theSize.x <= theSize.y * 2)
        {
                // button not wide enough
                // draw just left and right part then
-               square = eX * theSize_x * 0.5;
-               bW = eX * (0.25 * theSize_x / (theSize_y * 2));
+               square = eX * theSize.x * 0.5;
+               bW = eX * (0.25 * theSize.x / (theSize.y * 2));
                drawsubpic(theOrigin,          square + height, pic, '0 0 0', eY + bW, theColor, theAlpha, 0);
                drawsubpic(theOrigin + square, square + height, pic, eX - bW, eY + bW, theColor, theAlpha, 0);
        }
        else
        {
-               square = eX * theSize_y;
+               square = eX * theSize.y;
                drawsubpic(theOrigin,                  height  +     square, pic, '0    0 0', '0.25 1 0', theColor, theAlpha, 0);
                drawsubpic(theOrigin +         square, theSize - 2 * square, pic, '0.25 0 0', '0.5  1 0', theColor, theAlpha, 0);
                drawsubpic(theOrigin + width - square, height  +     square, pic, '0.75 0 0', '0.25 1 0', theColor, theAlpha, 0);
@@ -144,20 +149,20 @@ void draw_VertButtonPicture(vector theOrigin, string pic, vector theSize, vector
        theOrigin = boxToGlobal(theOrigin, draw_shift, draw_scale);
        theSize = boxToGlobalSize(theSize, draw_scale);
        theAlpha *= draw_alpha;
-       width = eX * theSize_x;
-       height = eY * theSize_y;
-       if(theSize_y <= theSize_x * 2)
+       width = eX * theSize.x;
+       height = eY * theSize.y;
+       if(theSize.y <= theSize.x * 2)
        {
                // button not high enough
                // draw just upper and lower part then
-               square = eY * theSize_y * 0.5;
-               bH = eY * (0.25 * theSize_y / (theSize_x * 2));
+               square = eY * theSize.y * 0.5;
+               bH = eY * (0.25 * theSize.y / (theSize.x * 2));
                drawsubpic(theOrigin,          square + width, pic, '0 0 0', eX + bH, theColor, theAlpha, 0);
                drawsubpic(theOrigin + square, square + width, pic, eY - bH, eX + bH, theColor, theAlpha, 0);
        }
        else
        {
-               square = eY * theSize_x;
+               square = eY * theSize.x;
                drawsubpic(theOrigin,                   width   +     square, pic, '0 0    0', '1 0.25 0', theColor, theAlpha, 0);
                drawsubpic(theOrigin +          square, theSize - 2 * square, pic, '0 0.25 0', '1 0.5  0', theColor, theAlpha, 0);
                drawsubpic(theOrigin + height - square, width   +     square, pic, '0 0.75 0', '1 0.25 0', theColor, theAlpha, 0);
@@ -182,45 +187,45 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
        theSize = boxToGlobalSize(theSize, draw_scale);
        theBorderSize = boxToGlobalSize(theBorderSize, draw_scale);
        theAlpha *= draw_alpha;
-       width = eX * theSize_x;
-       height = eY * theSize_y;
+       width = eX * theSize.x;
+       height = eY * theSize.y;
        // zero size? bail out, we cannot handle this
-       if(theSize_x <= 0 || theSize_y <= 0)
+       if(theSize.x <= 0 || theSize.y <= 0)
                return;
-       if(theBorderSize_x <= 0) // no x border
+       if(theBorderSize.x <= 0) // no x border
        {
-               if(theBorderSize_y <= 0)
+               if(theBorderSize.y <= 0)
                {
                        drawsubpic(theOrigin,                            width          + height,          pic, '0.25 0.25 0', '0.5  0.5  0', theColor, theAlpha, 0);
                }
-               else if(theSize_y <= theBorderSize_y * 2)
+               else if(theSize.y <= theBorderSize.y * 2)
                {
                        // not high enough... draw just top and bottom then
-                       bH = eY * (0.25 * theSize_y / (theBorderSize_y * 2));
+                       bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
                        drawsubpic(theOrigin,                             width          + height * 0.5, pic, '0.25 0 0',           '0.5  0 0' + bH, theColor, theAlpha, 0);
                        drawsubpic(theOrigin              + height * 0.5, width          + height * 0.5, pic, '0.25 0 0' + eY - bH, '0.5  0 0' + bH, theColor, theAlpha, 0);
                }
                else
                {
-                       dY = theBorderSize_y * eY;
+                       dY = theBorderSize.y * eY;
                        drawsubpic(theOrigin,                            width                   +     dY, pic, '0.25 0    0', '0.5  0.25 0', theColor, theAlpha, 0);
                        drawsubpic(theOrigin          + dY,              width          + height - 2 * dY, pic, '0.25 0.25 0', '0.5  0.5  0', theColor, theAlpha, 0);
                        drawsubpic(theOrigin + height - dY,              width                   +     dY, pic, '0.25 0.75 0', '0.5  0.25 0', theColor, theAlpha, 0);
                }
        }
-       else if(theSize_x <= theBorderSize_x * 2)
+       else if(theSize.x <= theBorderSize.x * 2)
        {
                // not wide enough... draw just left and right then
-               bW = eX * (0.25 * theSize_x / (theBorderSize_x * 2));
-               if(theBorderSize_y <= 0)
+               bW = eX * (0.25 * theSize.x / (theBorderSize.x * 2));
+               if(theBorderSize.y <= 0)
                {
                        drawsubpic(theOrigin,                             width * 0.5 + height,          pic, '0 0.25 0',           '0 0.5  0' + bW, theColor, theAlpha, 0);
                        drawsubpic(theOrigin + width * 0.5,               width * 0.5 + height,          pic, '0 0.25 0' + eX - bW, '0 0.5  0' + bW, theColor, theAlpha, 0);
                }
-               else if(theSize_y <= theBorderSize_y * 2)
+               else if(theSize.y <= theBorderSize.y * 2)
                {
                        // not high enough... draw just corners
-                       bH = eY * (0.25 * theSize_y / (theBorderSize_y * 2));
+                       bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
                        drawsubpic(theOrigin,                 width * 0.5 + height * 0.5, pic, '0 0 0',           bW + bH, theColor, theAlpha, 0);
                        drawsubpic(theOrigin + width   * 0.5, width * 0.5 + height * 0.5, pic, eX - bW,           bW + bH, theColor, theAlpha, 0);
                        drawsubpic(theOrigin + height  * 0.5, width * 0.5 + height * 0.5, pic, eY - bH,           bW + bH, theColor, theAlpha, 0);
@@ -228,7 +233,7 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
                }
                else
                {
-                       dY = theBorderSize_y * eY;
+                       dY = theBorderSize.y * eY;
                        drawsubpic(theOrigin,                             width * 0.5          +     dY, pic, '0 0    0',           '0 0.25 0' + bW, theColor, theAlpha, 0);
                        drawsubpic(theOrigin + width * 0.5,               width * 0.5          +     dY, pic, '0 0    0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
                        drawsubpic(theOrigin                        + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0',           '0 0.5  0' + bW, theColor, theAlpha, 0);
@@ -239,18 +244,18 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
        }
        else
        {
-               if(theBorderSize_y <= 0)
+               if(theBorderSize.y <= 0)
                {
-                       dX = theBorderSize_x * eX;
+                       dX = theBorderSize.x * eX;
                        drawsubpic(theOrigin,                                        dX + height,          pic, '0    0.25 0', '0.25 0.5  0', theColor, theAlpha, 0);
                        drawsubpic(theOrigin                       + dX, width - 2 * dX + height,          pic, '0.25 0.25 0', '0.5  0.5  0', theColor, theAlpha, 0);
                        drawsubpic(theOrigin               + width - dX,             dX + height,          pic, '0.75 0.25 0', '0.25 0.5  0', theColor, theAlpha, 0);
                }
-               else if(theSize_y <= theBorderSize_y * 2)
+               else if(theSize.y <= theBorderSize.y * 2)
                {
                        // not high enough... draw just top and bottom then
-                       bH = eY * (0.25 * theSize_y / (theBorderSize_y * 2));
-                       dX = theBorderSize_x * eX;
+                       bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
+                       dX = theBorderSize.x * eX;
                        drawsubpic(theOrigin,                                         dX + height * 0.5, pic, '0    0 0',           '0.25 0 0' + bH, theColor, theAlpha, 0);
                        drawsubpic(theOrigin + dX,                        width - 2 * dX + height * 0.5, pic, '0.25 0 0',           '0.5  0 0' + bH, theColor, theAlpha, 0);
                        drawsubpic(theOrigin + width - dX,                            dX + height * 0.5, pic, '0.75 0 0',           '0.25 0 0' + bH, theColor, theAlpha, 0);
@@ -260,8 +265,8 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
                }
                else
                {
-                       dX = theBorderSize_x * eX;
-                       dY = theBorderSize_y * eY;
+                       dX = theBorderSize.x * eX;
+                       dY = theBorderSize.y * eY;
                        drawsubpic(theOrigin,                                        dX          +     dY, pic, '0    0    0', '0.25 0.25 0', theColor, theAlpha, 0);
                        drawsubpic(theOrigin                  + dX,      width - 2 * dX          +     dY, pic, '0.25 0    0', '0.5  0.25 0', theColor, theAlpha, 0);
                        drawsubpic(theOrigin          + width - dX,                  dX          +     dY, pic, '0.75 0    0', '0.25 0.25 0', theColor, theAlpha, 0);
@@ -276,7 +281,7 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
 }
 void draw_Text(vector theOrigin, string theText, vector theSize, vector theColor, float theAlpha, float ICanHasKallerz)
 {
-       if(theSize_x <= 0 || theSize_y <= 0) {
+       if(theSize.x <= 0 || theSize.y <= 0) {
                dprint("Drawing zero size text?\n");
                return;
        }
@@ -303,9 +308,9 @@ float draw_TextWidth(string theText, float ICanHasKallerz, vector SizeThxBye)
        vector v;
        v = '0 0 0';
        //float r;
-       v_x = stringwidth(theText, ICanHasKallerz, globalToBoxSize(boxToGlobalSize(SizeThxBye, draw_scale), draw_fontscale));
+       v.x = stringwidth(theText, ICanHasKallerz, globalToBoxSize(boxToGlobalSize(SizeThxBye, draw_scale), draw_fontscale));
        v = globalToBoxSize(v, draw_scale);
-       return v_x;
+       return v.x;
 }
 
 float draw_CondensedFontFactor(string theText, float ICanHasKallerz, vector SizeThxBye, float maxWidth)
@@ -323,7 +328,7 @@ void draw_SetClip()
 {
        if(draw_clipSet)
                error("Already clipping, no stack implemented here, sorry");
-       drawsetcliparea(draw_shift_x, draw_shift_y, draw_scale_x, draw_scale_y);
+       drawsetcliparea(draw_shift.x, draw_shift.y, draw_scale.x, draw_scale.y);
        draw_clipSet = 1;
 }
 
@@ -334,7 +339,7 @@ void draw_SetClipRect(vector theOrigin, vector theScale)
                error("Already clipping, no stack implemented here, sorry");
        o = boxToGlobal(theOrigin, draw_shift, draw_scale);
        s = boxToGlobalSize(theScale, draw_scale);
-       drawsetcliparea(o_x, o_y, s_x, s_y);
+       drawsetcliparea(o.x, o.y, s.x, s.y);
        draw_clipSet = 1;
 }
 
@@ -362,12 +367,12 @@ string draw_TextShortenToWidth(string theText, float maxWidth, float ICanHasKall
 
 float draw_TextWidth_WithColors(string s, vector theFontSize)
 {
-       return draw_TextWidth(s, TRUE, theFontSize);
+       return draw_TextWidth(s, true, theFontSize);
 }
 
 float draw_TextWidth_WithoutColors(string s, vector theFontSize)
 {
-       return draw_TextWidth(s, FALSE, theFontSize);
+       return draw_TextWidth(s, false, theFontSize);
 }
 
 float draw_TextLengthUpToWidth(string theText, float maxWidth, float allowColorCodes, vector theFontSize)
index 9632c8fea6d27dab04b889d70be33c53747dd57b..873ccb6df31e3695760db9b33002da2fe1a23665 100644 (file)
@@ -1,9 +1,9 @@
+#ifndef DRAW_H
+#define DRAW_H
+
 // from the engine
 vector drawfontscale;
 #define draw_fontscale drawfontscale
-#define draw_fontscale_x drawfontscale_x
-#define draw_fontscale_y drawfontscale_y
-#define draw_fontscale_z drawfontscale_z
 
 vector draw_shift;
 vector draw_scale;
@@ -41,3 +41,4 @@ vector globalToBoxSize(vector v, vector scale);
 
 float draw_TextWidth_WithColors(string s, vector size);
 float draw_TextWidth_WithoutColors(string s, vector size);
+#endif
diff --git a/qcsrc/menu/item.c b/qcsrc/menu/item.c
deleted file mode 100644 (file)
index d055b1a..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-#ifdef INTERFACE
-CLASS(Item) EXTENDS(Object)
-       METHOD(Item, draw, void(entity))
-       METHOD(Item, keyDown, float(entity, float, float, float))
-       METHOD(Item, keyUp, float(entity, float, float, float))
-       METHOD(Item, mouseMove, float(entity, vector))
-       METHOD(Item, mousePress, float(entity, vector))
-       METHOD(Item, mouseDrag, float(entity, vector))
-       METHOD(Item, mouseRelease, float(entity, vector))
-       METHOD(Item, focusEnter, void(entity))
-       METHOD(Item, focusLeave, void(entity))
-       METHOD(Item, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(Item, relinquishFocus, void(entity))
-       METHOD(Item, showNotify, void(entity))
-       METHOD(Item, hideNotify, void(entity))
-       METHOD(Item, toString, string(entity))
-       METHOD(Item, destroy, void(entity))
-       ATTRIB(Item, focused, float, 0)
-       ATTRIB(Item, focusable, float, 0)
-       ATTRIB(Item, parent, entity, NULL)
-       ATTRIB(Item, preferredFocusPriority, float, 0)
-       ATTRIB(Item, origin, vector, '0 0 0')
-       ATTRIB(Item, size, vector, '0 0 0')
-       ATTRIB(Item, tooltip, string, string_null)
-ENDCLASS(Item)
-#endif
-
-#ifdef IMPLEMENTATION
-void Item_destroy(entity me)
-{
-       // free memory associated with me
-}
-
-void Item_relinquishFocus(entity me)
-{
-       if(me.parent)
-               if(me.parent.instanceOfContainer)
-                       me.parent.setFocus(me.parent, NULL);
-}
-
-void Item_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.origin = absOrigin;
-       me.size = absSize;
-}
-
-float autocvar_menu_showboxes;
-void Item_draw(entity me)
-{
-       if(autocvar_menu_showboxes)
-       {
-               vector rgb = '1 0 1';
-               float a = fabs(autocvar_menu_showboxes);
-
-               // don't draw containers and border images
-               if(me.instanceOfContainer || me.instanceOfBorderImage)
-               {
-                       rgb = '0 0 0';
-                       a = 0;
-               }
-
-#if 0
-               // hack to detect multi drawing
-               float r = random() * 3;
-               if(r >= 2)
-                       rgb = '1 0 0';
-               else if(r >= 1)
-                       rgb = '0 1 0';
-               else
-                       rgb = '0 0 1';
-#endif
-               if(autocvar_menu_showboxes < 0)
-               {
-                       draw_Fill('0 0 0', '0.5 0.5 0', rgb, a);
-                       draw_Fill('0.5 0.5 0', '0.5 0.5 0', rgb, a);
-               }
-               if(autocvar_menu_showboxes > 0)
-               {
-                       draw_Fill('0 0 0', '1 1 0', rgb, a);
-               }
-       }
-}
-
-void Item_showNotify(entity me)
-{
-}
-
-void Item_hideNotify(entity me)
-{
-}
-
-float Item_keyDown(entity me, float scan, float ascii, float shift)
-{
-       return 0; // unhandled
-}
-
-float Item_keyUp(entity me, float scan, float ascii, float shift)
-{
-       return 0; // unhandled
-}
-
-float Item_mouseMove(entity me, vector pos)
-{
-       return 0; // unhandled
-}
-
-float Item_mousePress(entity me, vector pos)
-{
-       return 0; // unhandled
-}
-
-float Item_mouseDrag(entity me, vector pos)
-{
-       return 0; // unhandled
-}
-
-float Item_mouseRelease(entity me, vector pos)
-{
-       return 0; // unhandled
-}
-
-void Item_focusEnter(entity me)
-{
-}
-
-void Item_focusLeave(entity me)
-{
-}
-
-string Item_toString(entity me)
-{
-       return string_null;
-}
-#endif
diff --git a/qcsrc/menu/item.qc b/qcsrc/menu/item.qc
new file mode 100644 (file)
index 0000000..d0bd40b
--- /dev/null
@@ -0,0 +1,137 @@
+#ifdef INTERFACE
+CLASS(Item) EXTENDS(Object)
+       METHOD(Item, draw, void(entity))
+       METHOD(Item, keyDown, float(entity, float, float, float))
+       METHOD(Item, keyUp, float(entity, float, float, float))
+       METHOD(Item, mouseMove, float(entity, vector))
+       METHOD(Item, mousePress, float(entity, vector))
+       METHOD(Item, mouseDrag, float(entity, vector))
+       METHOD(Item, mouseRelease, float(entity, vector))
+       METHOD(Item, focusEnter, void(entity))
+       METHOD(Item, focusLeave, void(entity))
+       METHOD(Item, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(Item, relinquishFocus, void(entity))
+       METHOD(Item, showNotify, void(entity))
+       METHOD(Item, hideNotify, void(entity))
+       METHOD(Item, toString, string(entity))
+       METHOD(Item, destroy, void(entity))
+       ATTRIB(Item, focused, float, 0)
+       ATTRIB(Item, focusable, float, 0)
+       ATTRIB(Item, allowFocusSound, float, 0)
+       ATTRIB(Item, parent, entity, NULL)
+       ATTRIB(Item, preferredFocusPriority, float, 0)
+       ATTRIB(Item, origin, vector, '0 0 0')
+       ATTRIB(Item, size, vector, '0 0 0')
+       ATTRIB(Item, tooltip, string, string_null)
+ENDCLASS(Item)
+#endif
+
+#ifdef IMPLEMENTATION
+void Item_destroy(entity me)
+{
+       // free memory associated with me
+}
+
+void Item_relinquishFocus(entity me)
+{
+       if(me.parent)
+               if(me.parent.instanceOfContainer)
+                       me.parent.setFocus(me.parent, NULL);
+}
+
+void Item_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.origin = absOrigin;
+       me.size = absSize;
+}
+
+float autocvar_menu_showboxes;
+void Item_draw(entity me)
+{
+       if(autocvar_menu_showboxes)
+       {
+               vector rgb = '1 0 1';
+               float a = fabs(autocvar_menu_showboxes);
+
+               // don't draw containers and border images
+               if(me.instanceOfContainer || me.instanceOfBorderImage)
+               {
+                       rgb = '0 0 0';
+                       a = 0;
+               }
+
+#if 0
+               // hack to detect multi drawing
+               float r = random() * 3;
+               if(r >= 2)
+                       rgb = '1 0 0';
+               else if(r >= 1)
+                       rgb = '0 1 0';
+               else
+                       rgb = '0 0 1';
+#endif
+               if(autocvar_menu_showboxes < 0)
+               {
+                       draw_Fill('0 0 0', '0.5 0.5 0', rgb, a);
+                       draw_Fill('0.5 0.5 0', '0.5 0.5 0', rgb, a);
+               }
+               if(autocvar_menu_showboxes > 0)
+               {
+                       draw_Fill('0 0 0', '1 1 0', rgb, a);
+               }
+       }
+}
+
+void Item_showNotify(entity me)
+{
+}
+
+void Item_hideNotify(entity me)
+{
+}
+
+float Item_keyDown(entity me, float scan, float ascii, float shift)
+{
+       return 0; // unhandled
+}
+
+float Item_keyUp(entity me, float scan, float ascii, float shift)
+{
+       return 0; // unhandled
+}
+
+float Item_mouseMove(entity me, vector pos)
+{
+       return 0; // unhandled
+}
+
+float Item_mousePress(entity me, vector pos)
+{
+       return 0; // unhandled
+}
+
+float Item_mouseDrag(entity me, vector pos)
+{
+       return 0; // unhandled
+}
+
+float Item_mouseRelease(entity me, vector pos)
+{
+       return 0; // unhandled
+}
+
+void Item_focusEnter(entity me)
+{
+       if(me.allowFocusSound)
+               m_play_focus_sound();
+}
+
+void Item_focusLeave(entity me)
+{
+}
+
+string Item_toString(entity me)
+{
+       return string_null;
+}
+#endif
diff --git a/qcsrc/menu/item/borderimage.c b/qcsrc/menu/item/borderimage.c
deleted file mode 100644 (file)
index 3a345a4..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-#ifdef INTERFACE
-CLASS(BorderImage) EXTENDS(Label)
-       METHOD(BorderImage, configureBorderImage, void(entity, string, float, vector, string, float))
-       METHOD(BorderImage, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(BorderImage, recalcPositionWithText, void(entity, string))
-       ATTRIB(BorderImage, isBold, float, 1)
-       METHOD(BorderImage, draw, void(entity))
-       ATTRIB(BorderImage, src, string, string_null)
-       ATTRIB(BorderImage, borderHeight, float, 0)
-       ATTRIB(BorderImage, borderVec, vector, '0 0 0')
-       ATTRIB(BorderImage, color, vector, '1 1 1')
-       ATTRIB(BorderImage, closeButton, entity, NULL)
-       ATTRIB(BorderImage, realFontSize_Nexposeed, vector, '0 0 0')
-       ATTRIB(BorderImage, realOrigin_Nexposeed, vector, '0 0 0')
-       ATTRIB(BorderImage, isNexposeeTitleBar, float, 0)
-       ATTRIB(BorderImage, zoomedOutTitleBarPosition, float, 0)
-       ATTRIB(BorderImage, zoomedOutTitleBar, float, 0)
-       ATTRIB(BorderImage, overrideRealOrigin, vector, '0 1 0')
-       ATTRIB(BorderImage, saveRelOrigin, vector, '0 0 0')
-       ATTRIB(BorderImage, saveRelSize, vector, '0 0 0')
-ENDCLASS(BorderImage)
-#endif
-
-#ifdef IMPLEMENTATION
-void BorderImage_recalcPositionWithText(entity me, string t)
-{
-       if(me.isNexposeeTitleBar)
-       {
-               vector scrs;
-               scrs = eX * conwidth + eY * conheight;
-               me.resizeNotify(me, me.saveRelOrigin, me.saveRelSize, boxToGlobal(me.parent.Nexposee_smallOrigin, '0 0 0', scrs), boxToGlobalSize(me.parent.Nexposee_smallSize, scrs));
-               SUPER(BorderImage).recalcPositionWithText(me, t);
-               me.realOrigin_y = me.realFontSize_y * me.zoomedOutTitleBarPosition;
-               me.realOrigin_Nexposeed = me.realOrigin;
-               me.realFontSize_Nexposeed = me.realFontSize;
-               me.resizeNotify(me, me.saveRelOrigin, me.saveRelSize, boxToGlobal(me.parent.Nexposee_initialOrigin, '0 0 0', scrs), boxToGlobalSize(me.parent.Nexposee_initialSize, scrs));
-       }
-       SUPER(BorderImage).recalcPositionWithText(me, t);
-}
-void BorderImage_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.isNexposeeTitleBar = 0;
-       if(me.zoomedOutTitleBar)
-               if(me.parent.parent.instanceOfNexposee)
-                       if(me.parent.instanceOfDialog)
-                               if(me == me.parent.frame)
-                                       me.isNexposeeTitleBar = 1;
-       me.saveRelOrigin = relOrigin;
-       me.saveRelSize = relSize;
-       SUPER(BorderImage).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-       me.borderVec_x = me.borderHeight / absSize_x;
-       me.borderVec_y = me.borderHeight / absSize_y;
-       me.realOrigin_y = 0.5 * (me.borderVec_y - me.realFontSize_y);
-       if(me.closeButton)
-       {
-               // move the close button to the right place
-               me.closeButton.Container_origin = '1 0 0' * (1 - me.borderVec_x);
-               me.closeButton.Container_size = me.borderVec;
-               me.closeButton.color = me.color;
-               me.closeButton.colorC = me.color;
-               me.closeButton.colorF = me.color;
-       }
-}
-void BorderImage_configureBorderImage(entity me, string theTitle, float sz, vector theColor, string path, float theBorderHeight)
-{
-       me.configureLabel(me, theTitle, sz, 0.5);
-       me.src = path;
-       me.color = theColor;
-       me.borderHeight = theBorderHeight;
-}
-void BorderImage_draw(entity me)
-{
-       if(me.src)
-               draw_BorderPicture('0 0 0', me.src, '1 1 0', me.color, 1, me.borderVec);
-
-       if(me.fontSize > 0)
-       {
-               if(me.recalcPos)
-                       me.recalcPositionWithText(me, me.text);
-
-               if(me.isNexposeeTitleBar)
-               {
-                       vector ro, rf, df;
-
-                       // me.parent.Nexposee_animationFactor 0 (small) or 1 (full)
-                       // default values are for 1
-                       ro = me.realOrigin;
-                       rf = me.realFontSize;
-                       df = draw_fontscale;
-                       me.realOrigin = ro * me.parent.Nexposee_animationFactor + me.realOrigin_Nexposeed * (1 - me.parent.Nexposee_animationFactor);
-                       me.realFontSize = rf * me.parent.Nexposee_animationFactor + me.realFontSize_Nexposeed * (1 - me.parent.Nexposee_animationFactor);
-                       draw_fontscale = globalToBoxSize(boxToGlobalSize(df, me.realFontSize), rf);
-
-                       SUPER(BorderImage).draw(me);
-
-                       // me.Nexposee_animationState 0 (small) or 1 (full)
-                       // default values are for 1
-                       me.realOrigin = ro;
-                       me.realFontSize = rf;
-                       draw_fontscale = df;
-               }
-               else
-                       SUPER(BorderImage).draw(me);
-       }
-       else
-       {
-               SUPER(BorderImage).draw(me);
-       }
-}
-#endif
diff --git a/qcsrc/menu/item/borderimage.qc b/qcsrc/menu/item/borderimage.qc
new file mode 100644 (file)
index 0000000..e6affc1
--- /dev/null
@@ -0,0 +1,110 @@
+#ifdef INTERFACE
+CLASS(BorderImage) EXTENDS(Label)
+       METHOD(BorderImage, configureBorderImage, void(entity, string, float, vector, string, float))
+       METHOD(BorderImage, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(BorderImage, recalcPositionWithText, void(entity, string))
+       ATTRIB(BorderImage, isBold, float, 1)
+       METHOD(BorderImage, draw, void(entity))
+       ATTRIB(BorderImage, src, string, string_null)
+       ATTRIB(BorderImage, borderHeight, float, 0)
+       ATTRIB(BorderImage, borderVec, vector, '0 0 0')
+       ATTRIB(BorderImage, color, vector, '1 1 1')
+       ATTRIB(BorderImage, closeButton, entity, NULL)
+       ATTRIB(BorderImage, realFontSize_Nexposeed, vector, '0 0 0')
+       ATTRIB(BorderImage, realOrigin_Nexposeed, vector, '0 0 0')
+       ATTRIB(BorderImage, isNexposeeTitleBar, float, 0)
+       ATTRIB(BorderImage, zoomedOutTitleBarPosition, float, 0)
+       ATTRIB(BorderImage, zoomedOutTitleBar, float, 0)
+       ATTRIB(BorderImage, overrideRealOrigin, vector, '0 1 0')
+       ATTRIB(BorderImage, saveRelOrigin, vector, '0 0 0')
+       ATTRIB(BorderImage, saveRelSize, vector, '0 0 0')
+ENDCLASS(BorderImage)
+#endif
+
+#ifdef IMPLEMENTATION
+void BorderImage_recalcPositionWithText(entity me, string t)
+{
+       if(me.isNexposeeTitleBar)
+       {
+               vector scrs;
+               scrs = eX * conwidth + eY * conheight;
+               me.resizeNotify(me, me.saveRelOrigin, me.saveRelSize, boxToGlobal(me.parent.Nexposee_smallOrigin, '0 0 0', scrs), boxToGlobalSize(me.parent.Nexposee_smallSize, scrs));
+               SUPER(BorderImage).recalcPositionWithText(me, t);
+               me.realOrigin_y = me.realFontSize.y * me.zoomedOutTitleBarPosition;
+               me.realOrigin_Nexposeed = me.realOrigin;
+               me.realFontSize_Nexposeed = me.realFontSize;
+               me.resizeNotify(me, me.saveRelOrigin, me.saveRelSize, boxToGlobal(me.parent.Nexposee_initialOrigin, '0 0 0', scrs), boxToGlobalSize(me.parent.Nexposee_initialSize, scrs));
+       }
+       SUPER(BorderImage).recalcPositionWithText(me, t);
+}
+void BorderImage_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.isNexposeeTitleBar = 0;
+       if(me.zoomedOutTitleBar)
+               if(me.parent.parent.instanceOfNexposee)
+                       if(me.parent.instanceOfDialog)
+                               if(me == me.parent.frame)
+                                       me.isNexposeeTitleBar = 1;
+       me.saveRelOrigin = relOrigin;
+       me.saveRelSize = relSize;
+       SUPER(BorderImage).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+       me.borderVec_x = me.borderHeight / absSize.x;
+       me.borderVec_y = me.borderHeight / absSize.y;
+       me.realOrigin_y = 0.5 * (me.borderVec.y - me.realFontSize.y);
+       if(me.closeButton)
+       {
+               // move the close button to the right place
+               me.closeButton.Container_origin = '1 0 0' * (1 - me.borderVec.x);
+               me.closeButton.Container_size = me.borderVec;
+               me.closeButton.color = me.color;
+               me.closeButton.colorC = me.color;
+               me.closeButton.colorF = me.color;
+       }
+}
+void BorderImage_configureBorderImage(entity me, string theTitle, float sz, vector theColor, string path, float theBorderHeight)
+{
+       me.configureLabel(me, theTitle, sz, 0.5);
+       me.src = path;
+       me.color = theColor;
+       me.borderHeight = theBorderHeight;
+}
+void BorderImage_draw(entity me)
+{
+       if(me.src)
+               draw_BorderPicture('0 0 0', me.src, '1 1 0', me.color, 1, me.borderVec);
+
+       if(me.fontSize > 0)
+       {
+               if(me.recalcPos)
+                       me.recalcPositionWithText(me, me.text);
+
+               if(me.isNexposeeTitleBar)
+               {
+                       vector ro, rf, df;
+
+                       // me.parent.Nexposee_animationFactor 0 (small) or 1 (full)
+                       // default values are for 1
+                       ro = me.realOrigin;
+                       rf = me.realFontSize;
+                       df = draw_fontscale;
+                       me.realOrigin = ro * me.parent.Nexposee_animationFactor + me.realOrigin_Nexposeed * (1 - me.parent.Nexposee_animationFactor);
+                       me.realFontSize = rf * me.parent.Nexposee_animationFactor + me.realFontSize_Nexposeed * (1 - me.parent.Nexposee_animationFactor);
+                       draw_fontscale = globalToBoxSize(boxToGlobalSize(df, me.realFontSize), rf);
+
+                       SUPER(BorderImage).draw(me);
+
+                       // me.Nexposee_animationState 0 (small) or 1 (full)
+                       // default values are for 1
+                       me.realOrigin = ro;
+                       me.realFontSize = rf;
+                       draw_fontscale = df;
+               }
+               else
+                       SUPER(BorderImage).draw(me);
+       }
+       else
+       {
+               SUPER(BorderImage).draw(me);
+       }
+}
+#endif
diff --git a/qcsrc/menu/item/button.c b/qcsrc/menu/item/button.c
deleted file mode 100644 (file)
index 8bbdfa7..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-#ifdef INTERFACE
-CLASS(Button) EXTENDS(Label)
-       METHOD(Button, configureButton, void(entity, string, float, string))
-       METHOD(Button, draw, void(entity))
-       METHOD(Button, showNotify, void(entity))
-       METHOD(Button, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(Button, keyDown, float(entity, float, float, float))
-       METHOD(Button, mousePress, float(entity, vector))
-       METHOD(Button, mouseDrag, float(entity, vector))
-       METHOD(Button, mouseRelease, float(entity, vector))
-       METHOD(Button, focusEnter, void(entity))
-       ATTRIB(Button, onClick, void(entity, entity), func_null)
-       ATTRIB(Button, onClickEntity, entity, NULL)
-       ATTRIB(Button, src, string, string_null)
-       ATTRIB(Button, srcSuffix, string, string_null)
-       ATTRIB(Button, src2, string, string_null) // is centered, same aspect, and stretched to label size
-       ATTRIB(Button, src2scale, float, 1)
-       ATTRIB(Button, srcMulti, float, 1) // 0: button square left, text right; 1: button stretched, text over it
-       ATTRIB(Button, buttonLeftOfText, float, 0)
-       ATTRIB(Button, focusable, float, 1)
-       ATTRIB(Button, pressed, float, 0)
-       ATTRIB(Button, clickTime, float, 0)
-       ATTRIB(Button, disabled, float, 0)
-       ATTRIB(Button, disabledAlpha, float, 0.3)
-       ATTRIB(Button, forcePressed, float, 0)
-       ATTRIB(Button, color, vector, '1 1 1')
-       ATTRIB(Button, colorC, vector, '1 1 1')
-       ATTRIB(Button, colorF, vector, '1 1 1')
-       ATTRIB(Button, colorD, vector, '1 1 1')
-       ATTRIB(Button, color2, vector, '1 1 1')
-       ATTRIB(Button, alpha2, float, 1)
-
-       ATTRIB(Button, origin, vector, '0 0 0')
-       ATTRIB(Button, size, vector, '0 0 0')
-ENDCLASS(Button)
-#endif
-
-#ifdef IMPLEMENTATION
-void Button_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       if(me.srcMulti)
-               me.keepspaceLeft = 0;
-       else
-               me.keepspaceLeft = min(0.8, absSize_y / absSize_x);
-       SUPER(Button).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-}
-void Button_configureButton(entity me, string txt, float sz, string gfx)
-{
-       SUPER(Button).configureLabel(me, txt, sz, me.srcMulti ? 0.5 : 0);
-       me.src = gfx;
-}
-float Button_keyDown(entity me, float key, float ascii, float shift)
-{
-       if(key == K_ENTER || key == K_SPACE || key == K_KP_ENTER)
-       {
-               me.clickTime = 0.1; // delayed for effect
-               return 1;
-       }
-       return 0;
-}
-float Button_mouseDrag(entity me, vector pos)
-{
-       me.pressed = 1;
-       if(pos_x < 0) me.pressed = 0;
-       if(pos_y < 0) me.pressed = 0;
-       if(pos_x >= 1) me.pressed = 0;
-       if(pos_y >= 1) me.pressed = 0;
-       return 1;
-}
-float Button_mousePress(entity me, vector pos)
-{
-       me.mouseDrag(me, pos); // verify coordinates
-       return 1;
-}
-float Button_mouseRelease(entity me, vector pos)
-{
-       me.mouseDrag(me, pos); // verify coordinates
-       if(me.pressed)
-       {
-               if (!me.disabled)
-               {
-                       if(cvar("menu_sounds"))
-                               localsound("sound/misc/menu2.wav");
-                       if(me.onClick)
-                               me.onClick(me, me.onClickEntity);
-               }
-               me.pressed = 0;
-       }
-       return 1;
-}
-void Button_showNotify(entity me)
-{
-       me.focusable = !me.disabled;
-}
-void Button_focusEnter(entity me)
-{
-       if(cvar("menu_sounds") > 1)
-               localsound("sound/misc/menu1.wav");
-       SUPER(Button).focusEnter(me);
-}
-void Button_draw(entity me)
-{
-       vector bOrigin, bSize;
-       float save;
-
-       me.focusable = !me.disabled;
-
-       save = draw_alpha;
-       if(me.disabled)
-               draw_alpha *= me.disabledAlpha;
-
-       if(me.src)
-       {
-               if(me.srcMulti)
-               {
-                       bOrigin = '0 0 0';
-                       bSize = '1 1 0';
-                       if(me.disabled)
-                               draw_ButtonPicture(bOrigin, strcat(me.src, "_d", me.srcSuffix), bSize, me.colorD, 1);
-                       else if(me.forcePressed || me.pressed || me.clickTime > 0)
-                               draw_ButtonPicture(bOrigin, strcat(me.src, "_c", me.srcSuffix), bSize, me.colorC, 1);
-                       else if(me.focused)
-                               draw_ButtonPicture(bOrigin, strcat(me.src, "_f", me.srcSuffix), bSize, me.colorF, 1);
-                       else
-                               draw_ButtonPicture(bOrigin, strcat(me.src, "_n", me.srcSuffix), bSize, me.color, 1);
-               }
-               else
-               {
-                       if(me.realFontSize_y == 0)
-                       {
-                               bOrigin = '0 0 0';
-                               bSize = '1 1 0';
-                       }
-                       else
-                       {
-                               bOrigin = eY * (0.5 * (1 - me.realFontSize_y)) + eX * (0.5 * (me.keepspaceLeft - me.realFontSize_x));
-                               bSize = me.realFontSize;
-                       }
-                       if(me.disabled)
-                               draw_Picture(bOrigin, strcat(me.src, "_d", me.srcSuffix), bSize, me.colorD, 1);
-                       else if(me.forcePressed || me.pressed || me.clickTime > 0)
-                               draw_Picture(bOrigin, strcat(me.src, "_c", me.srcSuffix), bSize, me.colorC, 1);
-                       else if(me.focused)
-                               draw_Picture(bOrigin, strcat(me.src, "_f", me.srcSuffix), bSize, me.colorF, 1);
-                       else
-                               draw_Picture(bOrigin, strcat(me.src, "_n", me.srcSuffix), bSize, me.color, 1);
-               }
-       }
-       if(me.src2)
-       {
-               bOrigin = me.keepspaceLeft * eX;
-               bSize = eY + eX * (1 - me.keepspaceLeft);
-
-               bOrigin += bSize * (0.5 - 0.5 * me.src2scale);
-               bSize = bSize * me.src2scale;
-
-               draw_Picture(bOrigin, me.src2, bSize, me.color2, me.alpha2);
-       }
-
-       draw_alpha = save;
-
-       if(me.clickTime > 0 && me.clickTime <= frametime)
-       {
-               // keyboard click timer expired? Fire the event then.
-               if (!me.disabled)
-                       if(me.onClick)
-                               me.onClick(me, me.onClickEntity);
-       }
-       me.clickTime -= frametime;
-
-       SUPER(Button).draw(me);
-}
-#endif
diff --git a/qcsrc/menu/item/button.qc b/qcsrc/menu/item/button.qc
new file mode 100644 (file)
index 0000000..52e5823
--- /dev/null
@@ -0,0 +1,178 @@
+#ifdef INTERFACE
+CLASS(Button) EXTENDS(Label)
+       METHOD(Button, configureButton, void(entity, string, float, string))
+       METHOD(Button, draw, void(entity))
+       METHOD(Button, showNotify, void(entity))
+       METHOD(Button, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(Button, keyDown, float(entity, float, float, float))
+       METHOD(Button, mousePress, float(entity, vector))
+       METHOD(Button, mouseDrag, float(entity, vector))
+       METHOD(Button, mouseRelease, float(entity, vector))
+       METHOD(Button, playClickSound, void(entity))
+       ATTRIB(Button, onClick, void(entity, entity), func_null)
+       ATTRIB(Button, onClickEntity, entity, NULL)
+       ATTRIB(Button, src, string, string_null)
+       ATTRIB(Button, srcSuffix, string, string_null)
+       ATTRIB(Button, src2, string, string_null) // is centered, same aspect, and stretched to label size
+       ATTRIB(Button, src2scale, float, 1)
+       ATTRIB(Button, srcMulti, float, 1) // 0: button square left, text right; 1: button stretched, text over it
+       ATTRIB(Button, buttonLeftOfText, float, 0)
+       ATTRIB(Button, focusable, float, 1)
+       ATTRIB(Button, allowFocusSound, float, 1)
+       ATTRIB(Button, pressed, float, 0)
+       ATTRIB(Button, clickTime, float, 0)
+       ATTRIB(Button, disabled, float, 0)
+       ATTRIB(Button, disabledAlpha, float, 0.3)
+       ATTRIB(Button, forcePressed, float, 0)
+       ATTRIB(Button, color, vector, '1 1 1')
+       ATTRIB(Button, colorC, vector, '1 1 1')
+       ATTRIB(Button, colorF, vector, '1 1 1')
+       ATTRIB(Button, colorD, vector, '1 1 1')
+       ATTRIB(Button, color2, vector, '1 1 1')
+       ATTRIB(Button, alpha2, float, 1)
+
+       ATTRIB(Button, origin, vector, '0 0 0')
+       ATTRIB(Button, size, vector, '0 0 0')
+ENDCLASS(Button)
+#endif
+
+#ifdef IMPLEMENTATION
+void Button_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       if(me.srcMulti)
+               me.keepspaceLeft = 0;
+       else
+               me.keepspaceLeft = min(0.8, absSize.y / absSize.x);
+       SUPER(Button).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+}
+void Button_configureButton(entity me, string txt, float sz, string gfx)
+{
+       SUPER(Button).configureLabel(me, txt, sz, me.srcMulti ? 0.5 : 0);
+       me.src = gfx;
+}
+float Button_keyDown(entity me, float key, float ascii, float shift)
+{
+       if(key == K_ENTER || key == K_SPACE || key == K_KP_ENTER)
+       {
+               me.playClickSound(me);
+               me.clickTime = 0.1; // delayed for effect
+               return 1;
+       }
+       return 0;
+}
+float Button_mouseDrag(entity me, vector pos)
+{
+       me.pressed = 1;
+       if(pos.x < 0) me.pressed = 0;
+       if(pos.y < 0) me.pressed = 0;
+       if(pos.x >= 1) me.pressed = 0;
+       if(pos.y >= 1) me.pressed = 0;
+       return 1;
+}
+float Button_mousePress(entity me, vector pos)
+{
+       me.mouseDrag(me, pos); // verify coordinates
+       return 1;
+}
+float Button_mouseRelease(entity me, vector pos)
+{
+       me.mouseDrag(me, pos); // verify coordinates
+       if(me.pressed)
+       {
+               if (!me.disabled)
+               {
+                       me.playClickSound(me);
+                       if(me.onClick)
+                               me.onClick(me, me.onClickEntity);
+               }
+               me.pressed = 0;
+       }
+       return 1;
+}
+void Button_showNotify(entity me)
+{
+       me.focusable = !me.disabled;
+}
+void Button_draw(entity me)
+{
+       vector bOrigin, bSize;
+       float save;
+
+       me.focusable = !me.disabled;
+
+       save = draw_alpha;
+       if(me.disabled)
+               draw_alpha *= me.disabledAlpha;
+
+       if(me.src)
+       {
+               if(me.srcMulti)
+               {
+                       bOrigin = '0 0 0';
+                       bSize = '1 1 0';
+                       if(me.disabled)
+                               draw_ButtonPicture(bOrigin, strcat(me.src, "_d", me.srcSuffix), bSize, me.colorD, 1);
+                       else if(me.forcePressed || me.pressed || me.clickTime > 0)
+                               draw_ButtonPicture(bOrigin, strcat(me.src, "_c", me.srcSuffix), bSize, me.colorC, 1);
+                       else if(me.focused)
+                               draw_ButtonPicture(bOrigin, strcat(me.src, "_f", me.srcSuffix), bSize, me.colorF, 1);
+                       else
+                               draw_ButtonPicture(bOrigin, strcat(me.src, "_n", me.srcSuffix), bSize, me.color, 1);
+               }
+               else
+               {
+                       if(me.realFontSize_y == 0)
+                       {
+                               bOrigin = '0 0 0';
+                               bSize = '1 1 0';
+                       }
+                       else
+                       {
+                               bOrigin = eY * (0.5 * (1 - me.realFontSize.y)) + eX * (0.5 * (me.keepspaceLeft - me.realFontSize.x));
+                               bSize = me.realFontSize;
+                       }
+                       if(me.disabled)
+                               draw_Picture(bOrigin, strcat(me.src, "_d", me.srcSuffix), bSize, me.colorD, 1);
+                       else if(me.forcePressed || me.pressed || me.clickTime > 0)
+                               draw_Picture(bOrigin, strcat(me.src, "_c", me.srcSuffix), bSize, me.colorC, 1);
+                       else if(me.focused)
+                               draw_Picture(bOrigin, strcat(me.src, "_f", me.srcSuffix), bSize, me.colorF, 1);
+                       else
+                               draw_Picture(bOrigin, strcat(me.src, "_n", me.srcSuffix), bSize, me.color, 1);
+               }
+       }
+       if(me.src2)
+       {
+               bOrigin = me.keepspaceLeft * eX;
+               bSize = eY + eX * (1 - me.keepspaceLeft);
+
+               bOrigin += bSize * (0.5 - 0.5 * me.src2scale);
+               bSize = bSize * me.src2scale;
+
+               draw_Picture(bOrigin, me.src2, bSize, me.color2, me.alpha2);
+       }
+
+       draw_alpha = save;
+
+       if(me.clickTime > 0 && me.clickTime <= frametime)
+       {
+               // keyboard click timer expired? Fire the event then.
+               if (!me.disabled)
+                       if(me.onClick)
+                               me.onClick(me, me.onClickEntity);
+       }
+       me.clickTime -= frametime;
+
+       SUPER(Button).draw(me);
+}
+void Dialog_Close(entity button, entity me);
+void Button_playClickSound(entity me)
+{
+       if(me.onClick == DialogOpenButton_Click)
+               m_play_click_sound(MENU_SOUND_OPEN);
+       else if(me.onClick == Dialog_Close)
+               m_play_click_sound(MENU_SOUND_CLOSE);
+       else
+               m_play_click_sound(MENU_SOUND_EXECUTE);
+}
+#endif
diff --git a/qcsrc/menu/item/checkbox.c b/qcsrc/menu/item/checkbox.c
deleted file mode 100644 (file)
index 94f67ba..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifdef INTERFACE
-void CheckBox_Click(entity me, entity other);
-CLASS(CheckBox) EXTENDS(Button)
-       METHOD(CheckBox, configureCheckBox, void(entity, string, float, string))
-       METHOD(CheckBox, draw, void(entity))
-       METHOD(CheckBox, toString, string(entity))
-       METHOD(CheckBox, setChecked, void(entity, float))
-       ATTRIB(CheckBox, useDownAsChecked, float, 0)
-       ATTRIB(CheckBox, checked, float, 0)
-       ATTRIB(CheckBox, onClick, void(entity, entity), CheckBox_Click)
-       ATTRIB(CheckBox, srcMulti, float, 0)
-       ATTRIB(CheckBox, disabled, float, 0)
-ENDCLASS(CheckBox)
-#endif
-
-#ifdef IMPLEMENTATION
-void CheckBox_setChecked(entity me, float val)
-{
-       me.checked = val;
-}
-void CheckBox_Click(entity me, entity other)
-{
-       me.setChecked(me, !me.checked);
-}
-string CheckBox_toString(entity me)
-{
-       return strcat(SUPER(CheckBox).toString(me), ", ", me.checked ? "checked" : "unchecked");
-}
-void CheckBox_configureCheckBox(entity me, string txt, float sz, string gfx)
-{
-       me.configureButton(me, txt, sz, gfx);
-       me.align = 0;
-}
-void CheckBox_draw(entity me)
-{
-       float s;
-       s = me.pressed;
-       if(me.useDownAsChecked)
-       {
-               me.srcSuffix = string_null;
-               me.forcePressed = me.checked;
-       }
-       else
-               me.srcSuffix = (me.checked ? "1" : "0");
-       me.pressed = s;
-       SUPER(CheckBox).draw(me);
-}
-#endif
diff --git a/qcsrc/menu/item/checkbox.qc b/qcsrc/menu/item/checkbox.qc
new file mode 100644 (file)
index 0000000..2540cc8
--- /dev/null
@@ -0,0 +1,53 @@
+#ifdef INTERFACE
+void CheckBox_Click(entity me, entity other);
+CLASS(CheckBox) EXTENDS(Button)
+       METHOD(CheckBox, configureCheckBox, void(entity, string, float, string))
+       METHOD(CheckBox, draw, void(entity))
+       METHOD(CheckBox, playClickSound, void(entity))
+       METHOD(CheckBox, toString, string(entity))
+       METHOD(CheckBox, setChecked, void(entity, float))
+       ATTRIB(CheckBox, useDownAsChecked, float, 0)
+       ATTRIB(CheckBox, checked, float, 0)
+       ATTRIB(CheckBox, onClick, void(entity, entity), CheckBox_Click)
+       ATTRIB(CheckBox, srcMulti, float, 0)
+       ATTRIB(CheckBox, disabled, float, 0)
+ENDCLASS(CheckBox)
+#endif
+
+#ifdef IMPLEMENTATION
+void CheckBox_setChecked(entity me, float val)
+{
+       me.checked = val;
+}
+void CheckBox_Click(entity me, entity other)
+{
+       me.setChecked(me, !me.checked);
+}
+string CheckBox_toString(entity me)
+{
+       return strcat(SUPER(CheckBox).toString(me), ", ", me.checked ? "checked" : "unchecked");
+}
+void CheckBox_configureCheckBox(entity me, string txt, float sz, string gfx)
+{
+       me.configureButton(me, txt, sz, gfx);
+       me.align = 0;
+}
+void CheckBox_draw(entity me)
+{
+       float s;
+       s = me.pressed;
+       if(me.useDownAsChecked)
+       {
+               me.srcSuffix = string_null;
+               me.forcePressed = me.checked;
+       }
+       else
+               me.srcSuffix = (me.checked ? "1" : "0");
+       me.pressed = s;
+       SUPER(CheckBox).draw(me);
+}
+void CheckBox_playClickSound(entity me)
+{
+       m_play_click_sound(MENU_SOUND_SELECT);
+}
+#endif
diff --git a/qcsrc/menu/item/container.c b/qcsrc/menu/item/container.c
deleted file mode 100644 (file)
index 8bc925f..0000000
+++ /dev/null
@@ -1,453 +0,0 @@
-#ifdef INTERFACE
-CLASS(Container) EXTENDS(Item)
-       METHOD(Container, draw, void(entity))
-       METHOD(Container, keyUp, float(entity, float, float, float))
-       METHOD(Container, keyDown, float(entity, float, float, float))
-       METHOD(Container, mouseMove, float(entity, vector))
-       METHOD(Container, mousePress, float(entity, vector))
-       METHOD(Container, mouseDrag, float(entity, vector))
-       METHOD(Container, mouseRelease, float(entity, vector))
-       METHOD(Container, focusLeave, void(entity))
-       METHOD(Container, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(Container, resizeNotifyLie, void(entity, vector, vector, vector, vector, .vector, .vector, .vector))
-       METHOD(Container, addItem, void(entity, entity, vector, vector, float))
-       METHOD(Container, addItemCentered, void(entity, entity, vector, float))
-       METHOD(Container, moveItemAfter, void(entity, entity, entity))
-       METHOD(Container, removeItem, void(entity, entity))
-       METHOD(Container, setFocus, void(entity, entity))
-       METHOD(Container, saveFocus, void(entity))
-       METHOD(Container, setAlphaOf, void(entity, entity, float))
-       METHOD(Container, itemFromPoint, entity(entity, vector))
-       METHOD(Container, showNotify, void(entity))
-       METHOD(Container, hideNotify, void(entity))
-       METHOD(Container, preferredFocusedGrandChild, entity(entity))
-       ATTRIB(Container, focusable, float, 0)
-       ATTRIB(Container, firstChild, entity, NULL)
-       ATTRIB(Container, lastChild, entity, NULL)
-       ATTRIB(Container, focusedChild, entity, NULL)
-       ATTRIB(Container, savedFocus, entity, NULL)
-       ATTRIB(Container, shown, float, 0)
-
-       METHOD(Container, enterSubitem, void(entity, entity))
-       METHOD(Container, enterLieSubitem, void(entity, vector, vector, vector, float))
-       METHOD(Container, leaveSubitem, void(entity))
-ENDCLASS(Container)
-.entity nextSibling;
-.entity prevSibling;
-.float resized;
-.vector Container_origin;
-.vector Container_size;
-.vector Container_fontscale;
-.float Container_alpha;
-.vector Container_save_shift;
-.vector Container_save_scale;
-.vector Container_save_fontscale;
-.float Container_save_alpha;
-#endif
-
-#ifdef IMPLEMENTATION
-void Container_enterSubitem(entity me, entity sub)
-{
-       me.enterLieSubitem(me, sub.Container_origin, sub.Container_size, sub.Container_fontscale, sub.Container_alpha);
-}
-
-void Container_enterLieSubitem(entity me, vector o, vector s, vector f, float a)
-{
-       me.Container_save_shift = draw_shift;
-       me.Container_save_scale = draw_scale;
-       me.Container_save_alpha = draw_alpha;
-       me.Container_save_fontscale = draw_fontscale;
-
-       draw_shift = boxToGlobal(o, draw_shift, draw_scale);
-       draw_scale = boxToGlobalSize(s, draw_scale);
-       if(f != '0 0 0')
-               draw_fontscale = boxToGlobalSize(f, draw_fontscale);
-       draw_alpha *= a;
-}
-
-void Container_leaveSubitem(entity me)
-{
-       draw_shift = me.Container_save_shift;
-       draw_scale = me.Container_save_scale;
-       draw_alpha = me.Container_save_alpha;
-       draw_fontscale = me.Container_save_fontscale;
-}
-
-void Container_showNotify(entity me)
-{
-       entity e;
-       if(me.shown)
-               return;
-       me.shown = 1;
-       for(e = me.firstChild; e; e = e.nextSibling)
-               if(e.Container_alpha > 0)
-                       e.showNotify(e);
-}
-
-void Container_hideNotify(entity me)
-{
-       entity e;
-       if (!me.shown)
-               return;
-       me.shown = 0;
-       for(e = me.firstChild; e; e = e.nextSibling)
-               if(e.Container_alpha > 0)
-                       e.hideNotify(e);
-}
-
-void Container_setAlphaOf(entity me, entity other, float theAlpha)
-{
-       if(theAlpha <= 0)
-       {
-               if(other.Container_alpha > 0)
-                       other.hideNotify(other);
-       }
-       else // value > 0
-       {
-               if(other.Container_alpha <= 0)
-                       other.showNotify(other);
-       }
-       other.Container_alpha = theAlpha;
-}
-
-void Container_resizeNotifyLie(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize, .vector originField, .vector sizeField, .vector fontScaleField)
-{
-       entity e;
-       vector o, s;
-       float d;
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               o = e.originField;
-               s = e.sizeField;
-               me.enterLieSubitem(me, o, s, e.fontScaleField, e.Container_alpha);
-               e.resizeNotify(e, o, s, boxToGlobal(o, absOrigin, absSize), boxToGlobalSize(s, absSize));
-               me.leaveSubitem(me);
-       }
-       do
-       {
-               d = 0;
-               for(e = me.firstChild; e; e = e.nextSibling)
-                       if(e.resized)
-                       {
-                               e.resized = 0;
-                               d = 1;
-                               o = e.originField;
-                               s = e.sizeField;
-                               me.enterLieSubitem(me, o, s, e.fontScaleField, e.Container_alpha);
-                               e.resizeNotify(e, o, s, boxToGlobal(o, absOrigin, absSize), boxToGlobalSize(s, absSize));
-                               me.leaveSubitem(me);
-                       }
-       }
-       while(d);
-       SUPER(Container).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-}
-
-void Container_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.resizeNotifyLie(me, relOrigin, relSize, absOrigin, absSize, Container_origin, Container_size, Container_fontscale);
-}
-
-entity Container_itemFromPoint(entity me, vector pos)
-{
-       entity e;
-       vector o, s;
-       for(e = me.lastChild; e; e = e.prevSibling)
-       {
-               o = e.Container_origin;
-               s = e.Container_size;
-               if(pos_x < o_x) continue;
-               if(pos_y < o_y) continue;
-               if(pos_x >= o_x + s_x) continue;
-               if(pos_y >= o_y + s_y) continue;
-               return e;
-       }
-       return NULL;
-}
-
-void Container_draw(entity me)
-{
-       entity e;
-
-       me.focusable = 0;
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               if(e.focusable)
-                       me.focusable += 1;
-               if(e.Container_alpha < 0.003) // can't change color values anyway
-                       continue;
-               me.enterSubitem(me, e);
-               e.draw(e);
-               me.leaveSubitem(me);
-       }
-
-       SUPER(Container).draw(me);
-}
-
-void Container_focusLeave(entity me)
-{
-       me.setFocus(me, NULL);
-}
-
-float Container_keyUp(entity me, float scan, float ascii, float shift)
-{
-       entity f;
-       float r;
-       f = me.focusedChild;
-       if(f)
-       {
-               me.enterSubitem(me, f);
-               r = f.keyUp(f, scan, ascii, shift);
-               me.leaveSubitem(me);
-               return r;
-       }
-       return 0;
-}
-
-float Container_keyDown(entity me, float scan, float ascii, float shift)
-{
-       entity f;
-       float r;
-       f = me.focusedChild;
-       if(f)
-       {
-               me.enterSubitem(me, f);
-               r = f.keyDown(f, scan, ascii, shift);
-               me.leaveSubitem(me);
-               return r;
-       }
-       return 0;
-}
-
-float Container_mouseMove(entity me, vector pos)
-{
-       entity f;
-       float r;
-       f = me.focusedChild;
-       if(f)
-       {
-               me.enterSubitem(me, f);
-               r = f.mouseMove(f, globalToBox(pos, f.Container_origin, f.Container_size));
-               me.leaveSubitem(me);
-               return r;
-       }
-       return 0;
-}
-float Container_mousePress(entity me, vector pos)
-{
-       entity f;
-       float r;
-       f = me.focusedChild;
-       if(f)
-       {
-               me.enterSubitem(me, f);
-               r = f.mousePress(f, globalToBox(pos, f.Container_origin, f.Container_size));
-               me.leaveSubitem(me);
-               return r;
-       }
-       return 0;
-}
-float Container_mouseDrag(entity me, vector pos)
-{
-       entity f;
-       float r;
-       f = me.focusedChild;
-       if(f)
-       {
-               me.enterSubitem(me, f);
-               r = f.mouseDrag(f, globalToBox(pos, f.Container_origin, f.Container_size));
-               me.leaveSubitem(me);
-               return r;
-       }
-       return 0;
-}
-float Container_mouseRelease(entity me, vector pos)
-{
-       entity f;
-       float r;
-       f = me.focusedChild;
-       if(f)
-       {
-               me.enterSubitem(me, f);
-               r = f.mouseRelease(f, globalToBox(pos, f.Container_origin, f.Container_size));
-               me.leaveSubitem(me);
-               return r;
-       }
-       return 0;
-}
-
-void Container_addItemCentered(entity me, entity other, vector theSize, float theAlpha)
-{
-       me.addItem(me, other, '0.5 0.5 0' - 0.5 * theSize, theSize, theAlpha);
-}
-
-void Container_addItem(entity me, entity other, vector theOrigin, vector theSize, float theAlpha)
-{
-       if(other.parent)
-               error("Can't add already added item!");
-
-       if(other.focusable)
-               me.focusable += 1;
-
-       if(theSize_x > 1)
-       {
-               theOrigin_x -= 0.5 * (theSize_x - 1);
-               theSize_x = 1;
-       }
-       if(theSize_y > 1)
-       {
-               theOrigin_y -= 0.5 * (theSize_y - 1);
-               theSize_y = 1;
-       }
-       theOrigin_x = bound(0, theOrigin_x, 1 - theSize_x);
-       theOrigin_y = bound(0, theOrigin_y, 1 - theSize_y);
-
-       other.parent = me;
-       other.Container_origin = theOrigin;
-       other.Container_size = theSize;
-       me.setAlphaOf(me, other, theAlpha);
-
-       entity l;
-       l = me.lastChild;
-
-       if(l)
-               l.nextSibling = other;
-       else
-               me.firstChild = other;
-
-       other.prevSibling = l;
-       other.nextSibling = NULL;
-       me.lastChild = other;
-}
-
-void Container_removeItem(entity me, entity other)
-{
-       if(other.parent != me)
-               error("Can't remove from wrong container!");
-
-       if(other.focusable)
-               me.focusable -= 1;
-
-       other.parent = NULL;
-
-       entity n, p;
-       n = other.nextSibling;
-       p = other.prevSibling;
-
-       if(p)
-               p.nextSibling = n;
-       else
-               me.firstChild = n;
-
-       if(n)
-               n.prevSibling = p;
-       else
-               me.lastChild = p;
-}
-
-void Container_setFocus(entity me, entity other)
-{
-       if(me.focusedChild == other)
-               return;
-
-       if(me.focusedChild)
-       {
-               me.focusedChild.focused = 0;
-               me.focusedChild.focusLeave(me.focusedChild);
-               me.focusedChild = NULL;
-       }
-
-       if(other)
-       {
-               if(!me.focused)
-                       error("Trying to set focus in a non-focused control!");
-
-               if(me.savedFocus)
-               {
-                       me.focusedChild = me.savedFocus;
-                       me.savedFocus = NULL;
-                       me.focusedChild.focused = 1;
-                       me.focusedChild.focusEnter(me.focusedChild);
-
-                       if(me.focusedChild.instanceOfContainer)
-                               me.focusedChild.setFocus(me.focusedChild, me.focusedChild.savedFocus);
-               }
-               else
-               {
-                       me.focusedChild = other;
-                       me.focusedChild.focused = 1;
-                       me.focusedChild.focusEnter(me.focusedChild);
-               }
-       }
-}
-
-void Container_saveFocus(entity me)
-{
-       me.savedFocus = me.focusedChild;
-
-       if(me.focusedChild.instanceOfContainer)
-               me.focusedChild.saveFocus(me.focusedChild);
-}
-
-void Container_moveItemAfter(entity me, entity other, entity dest)
-{
-       // first: remove other from the chain
-       entity n, p;
-
-       if(other.parent != me)
-               error("Can't move in wrong container!");
-
-       n = other.nextSibling;
-       p = other.prevSibling;
-
-       if(p)
-               p.nextSibling = n;
-       else
-               me.firstChild = n;
-
-       if(n)
-               n.prevSibling = p;
-       else
-               me.lastChild = p;
-
-       // now other got removed. Insert it behind dest now.
-       other.prevSibling = dest;
-       if(dest)
-               other.nextSibling = dest.nextSibling;
-       else
-               other.nextSibling = me.firstChild;
-
-       if(dest)
-               dest.nextSibling = other;
-       else
-               me.firstChild = other;
-
-       if(other.nextSibling)
-               other.nextSibling.prevSibling = other;
-       else
-               me.lastChild = other;
-}
-
-entity Container_preferredFocusedGrandChild(entity me)
-{
-       entity e, e2;
-       entity best;
-
-       best = NULL;
-
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               if(e.instanceOfContainer)
-               {
-                       e2 = e.preferredFocusedGrandChild(e);
-                       if(e2)
-                               if(!best || best.preferredFocusPriority < e2.preferredFocusPriority)
-                                       best = e2;
-               }
-               if(e)
-                       if(!best || best.preferredFocusPriority < e.preferredFocusPriority)
-                               best = e;
-       }
-
-       return best;
-}
-#endif
diff --git a/qcsrc/menu/item/container.qc b/qcsrc/menu/item/container.qc
new file mode 100644 (file)
index 0000000..dc36986
--- /dev/null
@@ -0,0 +1,453 @@
+#ifdef INTERFACE
+CLASS(Container) EXTENDS(Item)
+       METHOD(Container, draw, void(entity))
+       METHOD(Container, keyUp, float(entity, float, float, float))
+       METHOD(Container, keyDown, float(entity, float, float, float))
+       METHOD(Container, mouseMove, float(entity, vector))
+       METHOD(Container, mousePress, float(entity, vector))
+       METHOD(Container, mouseDrag, float(entity, vector))
+       METHOD(Container, mouseRelease, float(entity, vector))
+       METHOD(Container, focusLeave, void(entity))
+       METHOD(Container, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(Container, resizeNotifyLie, void(entity, vector, vector, vector, vector, .vector, .vector, .vector))
+       METHOD(Container, addItem, void(entity, entity, vector, vector, float))
+       METHOD(Container, addItemCentered, void(entity, entity, vector, float))
+       METHOD(Container, moveItemAfter, void(entity, entity, entity))
+       METHOD(Container, removeItem, void(entity, entity))
+       METHOD(Container, setFocus, void(entity, entity))
+       METHOD(Container, saveFocus, void(entity))
+       METHOD(Container, setAlphaOf, void(entity, entity, float))
+       METHOD(Container, itemFromPoint, entity(entity, vector))
+       METHOD(Container, showNotify, void(entity))
+       METHOD(Container, hideNotify, void(entity))
+       METHOD(Container, preferredFocusedGrandChild, entity(entity))
+       ATTRIB(Container, focusable, float, 0)
+       ATTRIB(Container, firstChild, entity, NULL)
+       ATTRIB(Container, lastChild, entity, NULL)
+       ATTRIB(Container, focusedChild, entity, NULL)
+       ATTRIB(Container, savedFocus, entity, NULL)
+       ATTRIB(Container, shown, float, 0)
+
+       METHOD(Container, enterSubitem, void(entity, entity))
+       METHOD(Container, enterLieSubitem, void(entity, vector, vector, vector, float))
+       METHOD(Container, leaveSubitem, void(entity))
+ENDCLASS(Container)
+.entity nextSibling;
+.entity prevSibling;
+.float resized;
+.vector Container_origin;
+.vector Container_size;
+.vector Container_fontscale;
+.float Container_alpha;
+.vector Container_save_shift;
+.vector Container_save_scale;
+.vector Container_save_fontscale;
+.float Container_save_alpha;
+#endif
+
+#ifdef IMPLEMENTATION
+void Container_enterSubitem(entity me, entity sub)
+{
+       me.enterLieSubitem(me, sub.Container_origin, sub.Container_size, sub.Container_fontscale, sub.Container_alpha);
+}
+
+void Container_enterLieSubitem(entity me, vector o, vector s, vector f, float a)
+{
+       me.Container_save_shift = draw_shift;
+       me.Container_save_scale = draw_scale;
+       me.Container_save_alpha = draw_alpha;
+       me.Container_save_fontscale = draw_fontscale;
+
+       draw_shift = boxToGlobal(o, draw_shift, draw_scale);
+       draw_scale = boxToGlobalSize(s, draw_scale);
+       if(f != '0 0 0')
+               draw_fontscale = boxToGlobalSize(f, draw_fontscale);
+       draw_alpha *= a;
+}
+
+void Container_leaveSubitem(entity me)
+{
+       draw_shift = me.Container_save_shift;
+       draw_scale = me.Container_save_scale;
+       draw_alpha = me.Container_save_alpha;
+       draw_fontscale = me.Container_save_fontscale;
+}
+
+void Container_showNotify(entity me)
+{
+       entity e;
+       if(me.shown)
+               return;
+       me.shown = 1;
+       for(e = me.firstChild; e; e = e.nextSibling)
+               if(e.Container_alpha > 0)
+                       e.showNotify(e);
+}
+
+void Container_hideNotify(entity me)
+{
+       entity e;
+       if (!me.shown)
+               return;
+       me.shown = 0;
+       for(e = me.firstChild; e; e = e.nextSibling)
+               if(e.Container_alpha > 0)
+                       e.hideNotify(e);
+}
+
+void Container_setAlphaOf(entity me, entity other, float theAlpha)
+{
+       if(theAlpha <= 0)
+       {
+               if(other.Container_alpha > 0)
+                       other.hideNotify(other);
+       }
+       else // value > 0
+       {
+               if(other.Container_alpha <= 0)
+                       other.showNotify(other);
+       }
+       other.Container_alpha = theAlpha;
+}
+
+void Container_resizeNotifyLie(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize, .vector originField, .vector sizeField, .vector fontScaleField)
+{
+       entity e;
+       vector o, s;
+       float d;
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               o = e.originField;
+               s = e.sizeField;
+               me.enterLieSubitem(me, o, s, e.fontScaleField, e.Container_alpha);
+               e.resizeNotify(e, o, s, boxToGlobal(o, absOrigin, absSize), boxToGlobalSize(s, absSize));
+               me.leaveSubitem(me);
+       }
+       do
+       {
+               d = 0;
+               for(e = me.firstChild; e; e = e.nextSibling)
+                       if(e.resized)
+                       {
+                               e.resized = 0;
+                               d = 1;
+                               o = e.originField;
+                               s = e.sizeField;
+                               me.enterLieSubitem(me, o, s, e.fontScaleField, e.Container_alpha);
+                               e.resizeNotify(e, o, s, boxToGlobal(o, absOrigin, absSize), boxToGlobalSize(s, absSize));
+                               me.leaveSubitem(me);
+                       }
+       }
+       while(d);
+       SUPER(Container).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+}
+
+void Container_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.resizeNotifyLie(me, relOrigin, relSize, absOrigin, absSize, Container_origin, Container_size, Container_fontscale);
+}
+
+entity Container_itemFromPoint(entity me, vector pos)
+{
+       entity e;
+       vector o, s;
+       for(e = me.lastChild; e; e = e.prevSibling)
+       {
+               o = e.Container_origin;
+               s = e.Container_size;
+               if(pos.x < o.x) continue;
+               if(pos.y < o.y) continue;
+               if(pos.x >= o.x + s.x) continue;
+               if(pos.y >= o.y + s.y) continue;
+               return e;
+       }
+       return NULL;
+}
+
+void Container_draw(entity me)
+{
+       entity e;
+
+       me.focusable = 0;
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               if(e.focusable)
+                       me.focusable += 1;
+               if(e.Container_alpha < 0.003) // can't change color values anyway
+                       continue;
+               me.enterSubitem(me, e);
+               e.draw(e);
+               me.leaveSubitem(me);
+       }
+
+       SUPER(Container).draw(me);
+}
+
+void Container_focusLeave(entity me)
+{
+       me.setFocus(me, NULL);
+}
+
+float Container_keyUp(entity me, float scan, float ascii, float shift)
+{
+       entity f;
+       float r;
+       f = me.focusedChild;
+       if(f)
+       {
+               me.enterSubitem(me, f);
+               r = f.keyUp(f, scan, ascii, shift);
+               me.leaveSubitem(me);
+               return r;
+       }
+       return 0;
+}
+
+float Container_keyDown(entity me, float scan, float ascii, float shift)
+{
+       entity f;
+       float r;
+       f = me.focusedChild;
+       if(f)
+       {
+               me.enterSubitem(me, f);
+               r = f.keyDown(f, scan, ascii, shift);
+               me.leaveSubitem(me);
+               return r;
+       }
+       return 0;
+}
+
+float Container_mouseMove(entity me, vector pos)
+{
+       entity f;
+       float r;
+       f = me.focusedChild;
+       if(f)
+       {
+               me.enterSubitem(me, f);
+               r = f.mouseMove(f, globalToBox(pos, f.Container_origin, f.Container_size));
+               me.leaveSubitem(me);
+               return r;
+       }
+       return 0;
+}
+float Container_mousePress(entity me, vector pos)
+{
+       entity f;
+       float r;
+       f = me.focusedChild;
+       if(f)
+       {
+               me.enterSubitem(me, f);
+               r = f.mousePress(f, globalToBox(pos, f.Container_origin, f.Container_size));
+               me.leaveSubitem(me);
+               return r;
+       }
+       return 0;
+}
+float Container_mouseDrag(entity me, vector pos)
+{
+       entity f;
+       float r;
+       f = me.focusedChild;
+       if(f)
+       {
+               me.enterSubitem(me, f);
+               r = f.mouseDrag(f, globalToBox(pos, f.Container_origin, f.Container_size));
+               me.leaveSubitem(me);
+               return r;
+       }
+       return 0;
+}
+float Container_mouseRelease(entity me, vector pos)
+{
+       entity f;
+       float r;
+       f = me.focusedChild;
+       if(f)
+       {
+               me.enterSubitem(me, f);
+               r = f.mouseRelease(f, globalToBox(pos, f.Container_origin, f.Container_size));
+               me.leaveSubitem(me);
+               return r;
+       }
+       return 0;
+}
+
+void Container_addItemCentered(entity me, entity other, vector theSize, float theAlpha)
+{
+       me.addItem(me, other, '0.5 0.5 0' - 0.5 * theSize, theSize, theAlpha);
+}
+
+void Container_addItem(entity me, entity other, vector theOrigin, vector theSize, float theAlpha)
+{
+       if(other.parent)
+               error("Can't add already added item!");
+
+       if(other.focusable)
+               me.focusable += 1;
+
+       if(theSize.x > 1)
+       {
+               theOrigin.x -= 0.5 * (theSize.x - 1);
+               theSize.x = 1;
+       }
+       if(theSize.y > 1)
+       {
+               theOrigin.y -= 0.5 * (theSize.y - 1);
+               theSize.y = 1;
+       }
+       theOrigin.x = bound(0, theOrigin.x, 1 - theSize.x);
+       theOrigin.y = bound(0, theOrigin.y, 1 - theSize.y);
+
+       other.parent = me;
+       other.Container_origin = theOrigin;
+       other.Container_size = theSize;
+       me.setAlphaOf(me, other, theAlpha);
+
+       entity l;
+       l = me.lastChild;
+
+       if(l)
+               l.nextSibling = other;
+       else
+               me.firstChild = other;
+
+       other.prevSibling = l;
+       other.nextSibling = NULL;
+       me.lastChild = other;
+}
+
+void Container_removeItem(entity me, entity other)
+{
+       if(other.parent != me)
+               error("Can't remove from wrong container!");
+
+       if(other.focusable)
+               me.focusable -= 1;
+
+       other.parent = NULL;
+
+       entity n, p;
+       n = other.nextSibling;
+       p = other.prevSibling;
+
+       if(p)
+               p.nextSibling = n;
+       else
+               me.firstChild = n;
+
+       if(n)
+               n.prevSibling = p;
+       else
+               me.lastChild = p;
+}
+
+void Container_setFocus(entity me, entity other)
+{
+       if(me.focusedChild == other)
+               return;
+
+       if(me.focusedChild)
+       {
+               me.focusedChild.focused = 0;
+               me.focusedChild.focusLeave(me.focusedChild);
+               me.focusedChild = NULL;
+       }
+
+       if(other)
+       {
+               if(!me.focused)
+                       error("Trying to set focus in a non-focused control!");
+
+               if(me.savedFocus)
+               {
+                       me.focusedChild = me.savedFocus;
+                       me.savedFocus = NULL;
+                       me.focusedChild.focused = 1;
+                       me.focusedChild.focusEnter(me.focusedChild);
+
+                       if(me.focusedChild.instanceOfContainer)
+                               me.focusedChild.setFocus(me.focusedChild, me.focusedChild.savedFocus);
+               }
+               else
+               {
+                       me.focusedChild = other;
+                       me.focusedChild.focused = 1;
+                       me.focusedChild.focusEnter(me.focusedChild);
+               }
+       }
+}
+
+void Container_saveFocus(entity me)
+{
+       me.savedFocus = me.focusedChild;
+
+       if(me.focusedChild.instanceOfContainer)
+               me.focusedChild.saveFocus(me.focusedChild);
+}
+
+void Container_moveItemAfter(entity me, entity other, entity dest)
+{
+       // first: remove other from the chain
+       entity n, p;
+
+       if(other.parent != me)
+               error("Can't move in wrong container!");
+
+       n = other.nextSibling;
+       p = other.prevSibling;
+
+       if(p)
+               p.nextSibling = n;
+       else
+               me.firstChild = n;
+
+       if(n)
+               n.prevSibling = p;
+       else
+               me.lastChild = p;
+
+       // now other got removed. Insert it behind dest now.
+       other.prevSibling = dest;
+       if(dest)
+               other.nextSibling = dest.nextSibling;
+       else
+               other.nextSibling = me.firstChild;
+
+       if(dest)
+               dest.nextSibling = other;
+       else
+               me.firstChild = other;
+
+       if(other.nextSibling)
+               other.nextSibling.prevSibling = other;
+       else
+               me.lastChild = other;
+}
+
+entity Container_preferredFocusedGrandChild(entity me)
+{
+       entity e, e2;
+       entity best;
+
+       best = NULL;
+
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               if(e.instanceOfContainer)
+               {
+                       e2 = e.preferredFocusedGrandChild(e);
+                       if(e2)
+                               if(!best || best.preferredFocusPriority < e2.preferredFocusPriority)
+                                       best = e2;
+               }
+               if(e)
+                       if(!best || best.preferredFocusPriority < e.preferredFocusPriority)
+                               best = e;
+       }
+
+       return best;
+}
+#endif
diff --git a/qcsrc/menu/item/dialog.c b/qcsrc/menu/item/dialog.c
deleted file mode 100644 (file)
index 3835787..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-// Note: this class is called Dialog, but it can also handle a tab under the following conditions:
-// - isTabRoot is 0
-// - backgroundImage is the tab's background
-// - closable is 0
-// - rootDialog is 0
-// - title is ""
-// - marginTop is
-// - intendedHeight ends up to be the tab's actual height, or at least close
-// - titleFontSize is 0
-// - marginTop cancels out as much of titleHeight as needed (that is, it should be actualMarginTop - titleHeight)
-// To ensure the latter, you best create all tabs FIRST and insert the tabbed
-// control to your dialog THEN - with the right height
-//
-// a subclass may help with using this as a tab
-
-#ifdef INTERFACE
-CLASS(Dialog) EXTENDS(InputContainer)
-       METHOD(Dialog, configureDialog, void(entity)) // no runtime configuration, all parameters are given in the code!
-       METHOD(Dialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
-       METHOD(Dialog, keyDown, float(entity, float, float, float))
-       METHOD(Dialog, close, void(entity))
-       METHOD(Dialog, addItemSimple, void(entity, float, float, float, float, entity, vector))
-
-       METHOD(Dialog, TD, void(entity, float, float, entity))
-       METHOD(Dialog, TDNoMargin, void(entity, float, float, entity, vector))
-       METHOD(Dialog, TDempty, void(entity, float))
-       METHOD(Dialog, setFirstColumn, void(entity, float))
-       METHOD(Dialog, TR, void(entity))
-       METHOD(Dialog, gotoRC, void(entity, float, float))
-
-       ATTRIB(Dialog, isTabRoot, float, 1)
-       ATTRIB(Dialog, closeButton, entity, NULL)
-       ATTRIB(Dialog, intendedHeight, float, 0)
-       ATTRIB(Dialog, itemOrigin, vector, '0 0 0')
-       ATTRIB(Dialog, itemSize, vector, '0 0 0')
-       ATTRIB(Dialog, itemSpacing, vector, '0 0 0')
-       ATTRIB(Dialog, currentRow, float, 0)
-       ATTRIB(Dialog, currentColumn, float, 0)
-       ATTRIB(Dialog, firstColumn, float, 0)
-
-       // to be customized
-       ATTRIB(Dialog, closable, float, 1)
-       ATTRIB(Dialog, title, string, "Form1") // ;)
-       ATTRIB(Dialog, color, vector, '1 0.5 1')
-       ATTRIB(Dialog, intendedWidth, float, 0)
-       ATTRIB(Dialog, rows, float, 3)
-       ATTRIB(Dialog, columns, float, 2)
-
-       ATTRIB(Dialog, marginTop, float, 0) // pixels
-       ATTRIB(Dialog, marginBottom, float, 0) // pixels
-       ATTRIB(Dialog, marginLeft, float, 0) // pixels
-       ATTRIB(Dialog, marginRight, float, 0) // pixels
-       ATTRIB(Dialog, columnSpacing, float, 0) // pixels
-       ATTRIB(Dialog, rowSpacing, float, 0) // pixels
-       ATTRIB(Dialog, rowHeight, float, 0) // pixels
-       ATTRIB(Dialog, titleHeight, float, 0) // pixels
-       ATTRIB(Dialog, titleFontSize, float, 0) // pixels; if 0, title causes no margin
-       ATTRIB(Dialog, zoomedOutTitleBarPosition, float, 0)
-       ATTRIB(Dialog, zoomedOutTitleBar, float, 0)
-
-       ATTRIB(Dialog, requiresConnection, float, 0) // set to TRUE if the dialog requires a connection to be opened
-
-       ATTRIB(Dialog, backgroundImage, string, string_null)
-       ATTRIB(Dialog, borderLines, float, 1)
-       ATTRIB(Dialog, closeButtonImage, string, string_null)
-
-       ATTRIB(Dialog, frame, entity, NULL)
-ENDCLASS(Dialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void Dialog_Close(entity button, entity me)
-{
-       me.close(me);
-}
-
-void Dialog_fill(entity me)
-{
-}
-
-void Dialog_addItemSimple(entity me, float row, float col, float rowspan, float colspan, entity e, vector v)
-{
-       vector o, s;
-       o = me.itemOrigin + eX * ( col          * me.itemSpacing_x) + eY * ( row          * me.itemSpacing_y);
-       s = me.itemSize   + eX * ((colspan - 1) * me.itemSpacing_x) + eY * ((rowspan - 1) * me.itemSpacing_y);
-       o_x -= 0.5 * (me.itemSpacing_x - me.itemSize_x) * v_x;
-       s_x +=       (me.itemSpacing_x - me.itemSize_x) * v_x;
-       o_y -= 0.5 * (me.itemSpacing_y - me.itemSize_y) * v_y;
-       s_y +=       (me.itemSpacing_y - me.itemSize_y) * v_y;
-       me.addItem(me, e, o, s, 1);
-}
-
-void Dialog_gotoRC(entity me, float row, float col)
-{
-       me.currentRow = row;
-       me.currentColumn = col;
-}
-
-void Dialog_TR(entity me)
-{
-       me.currentRow += 1;
-       me.currentColumn = me.firstColumn;
-}
-
-void Dialog_TD(entity me, float rowspan, float colspan, entity e)
-{
-       me.addItemSimple(me, me.currentRow, me.currentColumn, rowspan, colspan, e, '0 0 0');
-       me.currentColumn += colspan;
-}
-
-void Dialog_TDNoMargin(entity me, float rowspan, float colspan, entity e, vector v)
-{
-       me.addItemSimple(me, me.currentRow, me.currentColumn, rowspan, colspan, e, v);
-       me.currentColumn += colspan;
-}
-
-void Dialog_setFirstColumn(entity me, float col)
-{
-       me.firstColumn = col;
-}
-
-void Dialog_TDempty(entity me, float colspan)
-{
-       me.currentColumn += colspan;
-}
-
-void Dialog_configureDialog(entity me)
-{
-       float absWidth, absHeight;
-
-       me.frame = spawnBorderImage();
-       me.frame.configureBorderImage(me.frame, me.title, me.titleFontSize, me.color, me.backgroundImage, me.borderLines * me.titleHeight);
-       me.frame.zoomedOutTitleBarPosition = me.zoomedOutTitleBarPosition;
-       me.frame.zoomedOutTitleBar = me.zoomedOutTitleBar;
-       me.frame.alpha = me.alpha;
-       me.addItem(me, me.frame, '0 0 0', '1 1 0', 1);
-
-       if (!me.titleFontSize)
-               me.titleHeight = 0; // no title bar
-
-       absWidth = me.intendedWidth * conwidth;
-       absHeight = me.borderLines * me.titleHeight + me.marginTop + me.rows * me.rowHeight + (me.rows - 1) * me.rowSpacing + me.marginBottom;
-       me.itemOrigin  = eX * (me.marginLeft / absWidth)
-                      + eY * ((me.borderLines * me.titleHeight + me.marginTop) / absHeight);
-       me.itemSize    = eX * ((1 - (me.marginLeft + me.marginRight + me.columnSpacing * (me.columns - 1)) / absWidth) / me.columns)
-                      + eY * (me.rowHeight / absHeight);
-       me.itemSpacing = me.itemSize
-                      + eX * (me.columnSpacing / absWidth)
-                      + eY * (me.rowSpacing / absHeight);
-       me.intendedHeight = absHeight / conheight;
-       me.currentRow = -1;
-       me.currentColumn = -1;
-
-       me.fill(me);
-
-       if(me.closable && me.borderLines > 0)
-       {
-               entity closebutton;
-               closebutton = me.closeButton = me.frame.closeButton = spawnButton();
-               closebutton.configureButton(closebutton, "", 0, me.closeButtonImage);
-               closebutton.onClick = Dialog_Close; closebutton.onClickEntity = me;
-               closebutton.srcMulti = 0;
-               me.addItem(me, closebutton, '0 0 0', '1 1 0', 1); // put it as LAST
-       }
-}
-
-void Dialog_close(entity me)
-{
-       if(me.parent.instanceOfNexposee)
-       {
-               ExposeeCloseButton_Click(me, me.parent);
-       }
-       else if(me.parent.instanceOfModalController)
-       {
-               DialogCloseButton_Click(me, me);
-       }
-}
-
-float Dialog_keyDown(entity me, float key, float ascii, float shift)
-{
-       if(me.closable)
-       {
-               if(key == K_ESCAPE)
-               {
-                       me.close(me);
-                       return 1;
-               }
-       }
-       return SUPER(Dialog).keyDown(me, key, ascii, shift);
-}
-#endif
diff --git a/qcsrc/menu/item/dialog.qc b/qcsrc/menu/item/dialog.qc
new file mode 100644 (file)
index 0000000..1723f27
--- /dev/null
@@ -0,0 +1,192 @@
+// Note: this class is called Dialog, but it can also handle a tab under the following conditions:
+// - isTabRoot is 0
+// - backgroundImage is the tab's background
+// - closable is 0
+// - rootDialog is 0
+// - title is ""
+// - marginTop is
+// - intendedHeight ends up to be the tab's actual height, or at least close
+// - titleFontSize is 0
+// - marginTop cancels out as much of titleHeight as needed (that is, it should be actualMarginTop - titleHeight)
+// To ensure the latter, you best create all tabs FIRST and insert the tabbed
+// control to your dialog THEN - with the right height
+//
+// a subclass may help with using this as a tab
+
+#ifdef INTERFACE
+CLASS(Dialog) EXTENDS(InputContainer)
+       METHOD(Dialog, configureDialog, void(entity)) // no runtime configuration, all parameters are given in the code!
+       METHOD(Dialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
+       METHOD(Dialog, keyDown, float(entity, float, float, float))
+       METHOD(Dialog, close, void(entity))
+       METHOD(Dialog, addItemSimple, void(entity, float, float, float, float, entity, vector))
+
+       METHOD(Dialog, TD, void(entity, float, float, entity))
+       METHOD(Dialog, TDNoMargin, void(entity, float, float, entity, vector))
+       METHOD(Dialog, TDempty, void(entity, float))
+       METHOD(Dialog, setFirstColumn, void(entity, float))
+       METHOD(Dialog, TR, void(entity))
+       METHOD(Dialog, gotoRC, void(entity, float, float))
+
+       ATTRIB(Dialog, isTabRoot, float, 1)
+       ATTRIB(Dialog, closeButton, entity, NULL)
+       ATTRIB(Dialog, intendedHeight, float, 0)
+       ATTRIB(Dialog, itemOrigin, vector, '0 0 0')
+       ATTRIB(Dialog, itemSize, vector, '0 0 0')
+       ATTRIB(Dialog, itemSpacing, vector, '0 0 0')
+       ATTRIB(Dialog, currentRow, float, 0)
+       ATTRIB(Dialog, currentColumn, float, 0)
+       ATTRIB(Dialog, firstColumn, float, 0)
+
+       // to be customized
+       ATTRIB(Dialog, closable, float, 1)
+       ATTRIB(Dialog, title, string, "Form1") // ;)
+       ATTRIB(Dialog, color, vector, '1 0.5 1')
+       ATTRIB(Dialog, intendedWidth, float, 0)
+       ATTRIB(Dialog, rows, float, 3)
+       ATTRIB(Dialog, columns, float, 2)
+
+       ATTRIB(Dialog, marginTop, float, 0) // pixels
+       ATTRIB(Dialog, marginBottom, float, 0) // pixels
+       ATTRIB(Dialog, marginLeft, float, 0) // pixels
+       ATTRIB(Dialog, marginRight, float, 0) // pixels
+       ATTRIB(Dialog, columnSpacing, float, 0) // pixels
+       ATTRIB(Dialog, rowSpacing, float, 0) // pixels
+       ATTRIB(Dialog, rowHeight, float, 0) // pixels
+       ATTRIB(Dialog, titleHeight, float, 0) // pixels
+       ATTRIB(Dialog, titleFontSize, float, 0) // pixels; if 0, title causes no margin
+       ATTRIB(Dialog, zoomedOutTitleBarPosition, float, 0)
+       ATTRIB(Dialog, zoomedOutTitleBar, float, 0)
+
+       ATTRIB(Dialog, requiresConnection, float, 0) // set to true if the dialog requires a connection to be opened
+
+       ATTRIB(Dialog, backgroundImage, string, string_null)
+       ATTRIB(Dialog, borderLines, float, 1)
+       ATTRIB(Dialog, closeButtonImage, string, string_null)
+
+       ATTRIB(Dialog, frame, entity, NULL)
+ENDCLASS(Dialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void Dialog_Close(entity button, entity me)
+{
+       me.close(me);
+}
+
+void Dialog_fill(entity me)
+{
+}
+
+void Dialog_addItemSimple(entity me, float row, float col, float rowspan, float colspan, entity e, vector v)
+{
+       vector o, s;
+       o = me.itemOrigin + eX * ( col          * me.itemSpacing.x) + eY * ( row          * me.itemSpacing.y);
+       s = me.itemSize   + eX * ((colspan - 1) * me.itemSpacing.x) + eY * ((rowspan - 1) * me.itemSpacing.y);
+       o.x -= 0.5 * (me.itemSpacing.x - me.itemSize.x) * v.x;
+       s.x +=       (me.itemSpacing.x - me.itemSize.x) * v.x;
+       o.y -= 0.5 * (me.itemSpacing.y - me.itemSize.y) * v.y;
+       s.y +=       (me.itemSpacing.y - me.itemSize.y) * v.y;
+       me.addItem(me, e, o, s, 1);
+}
+
+void Dialog_gotoRC(entity me, float row, float col)
+{
+       me.currentRow = row;
+       me.currentColumn = col;
+}
+
+void Dialog_TR(entity me)
+{
+       me.currentRow += 1;
+       me.currentColumn = me.firstColumn;
+}
+
+void Dialog_TD(entity me, float rowspan, float colspan, entity e)
+{
+       me.addItemSimple(me, me.currentRow, me.currentColumn, rowspan, colspan, e, '0 0 0');
+       me.currentColumn += colspan;
+}
+
+void Dialog_TDNoMargin(entity me, float rowspan, float colspan, entity e, vector v)
+{
+       me.addItemSimple(me, me.currentRow, me.currentColumn, rowspan, colspan, e, v);
+       me.currentColumn += colspan;
+}
+
+void Dialog_setFirstColumn(entity me, float col)
+{
+       me.firstColumn = col;
+}
+
+void Dialog_TDempty(entity me, float colspan)
+{
+       me.currentColumn += colspan;
+}
+
+void Dialog_configureDialog(entity me)
+{
+       float absWidth, absHeight;
+
+       me.frame = spawnBorderImage();
+       me.frame.configureBorderImage(me.frame, me.title, me.titleFontSize, me.color, me.backgroundImage, me.borderLines * me.titleHeight);
+       me.frame.zoomedOutTitleBarPosition = me.zoomedOutTitleBarPosition;
+       me.frame.zoomedOutTitleBar = me.zoomedOutTitleBar;
+       me.frame.alpha = me.alpha;
+       me.addItem(me, me.frame, '0 0 0', '1 1 0', 1);
+
+       if (!me.titleFontSize)
+               me.titleHeight = 0; // no title bar
+
+       absWidth = me.intendedWidth * conwidth;
+       absHeight = me.borderLines * me.titleHeight + me.marginTop + me.rows * me.rowHeight + (me.rows - 1) * me.rowSpacing + me.marginBottom;
+       me.itemOrigin  = eX * (me.marginLeft / absWidth)
+                      + eY * ((me.borderLines * me.titleHeight + me.marginTop) / absHeight);
+       me.itemSize    = eX * ((1 - (me.marginLeft + me.marginRight + me.columnSpacing * (me.columns - 1)) / absWidth) / me.columns)
+                      + eY * (me.rowHeight / absHeight);
+       me.itemSpacing = me.itemSize
+                      + eX * (me.columnSpacing / absWidth)
+                      + eY * (me.rowSpacing / absHeight);
+       me.intendedHeight = absHeight / conheight;
+       me.currentRow = -1;
+       me.currentColumn = -1;
+
+       me.fill(me);
+
+       if(me.closable && me.borderLines > 0)
+       {
+               entity closebutton;
+               closebutton = me.closeButton = me.frame.closeButton = spawnButton();
+               closebutton.configureButton(closebutton, "", 0, me.closeButtonImage);
+               closebutton.onClick = Dialog_Close; closebutton.onClickEntity = me;
+               closebutton.srcMulti = 0;
+               me.addItem(me, closebutton, '0 0 0', '1 1 0', 1); // put it as LAST
+       }
+}
+
+void Dialog_close(entity me)
+{
+       if(me.parent.instanceOfNexposee)
+       {
+               ExposeeCloseButton_Click(me, me.parent);
+       }
+       else if(me.parent.instanceOfModalController)
+       {
+               DialogCloseButton_Click(me, me);
+       }
+}
+
+float Dialog_keyDown(entity me, float key, float ascii, float shift)
+{
+       if(me.closable)
+       {
+               if(key == K_ESCAPE)
+               {
+                       m_play_click_sound(MENU_SOUND_CLOSE);
+                       me.close(me);
+                       return 1;
+               }
+       }
+       return SUPER(Dialog).keyDown(me, key, ascii, shift);
+}
+#endif
diff --git a/qcsrc/menu/item/image.c b/qcsrc/menu/item/image.c
deleted file mode 100644 (file)
index 8d1a6de..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-#ifdef INTERFACE
-CLASS(Image) EXTENDS(Item)
-       METHOD(Image, configureImage, void(entity, string))
-       METHOD(Image, draw, void(entity))
-       METHOD(Image, toString, string(entity))
-       METHOD(Image, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(Image, updateAspect, void(entity))
-       METHOD(Image, initZoom, void(entity))
-       METHOD(Image, setZoom, void(entity, float, float))
-       METHOD(Image, drag_setStartPos, float(entity, vector))
-       METHOD(Image, drag, float(entity, vector))
-       ATTRIB(Image, src, string, string_null)
-       ATTRIB(Image, color, vector, '1 1 1')
-       ATTRIB(Image, forcedAspect, float, 0) // special values: -1 keep image aspect ratio, -2 keep image size but bound to the containing box, -3 always keep image size
-       ATTRIB(Image, zoomBox, float, 0) // used by forcedAspect -2 when the image is larger than the containing box
-       ATTRIB(Image, zoomFactor, float, 1)
-       ATTRIB(Image, zoomOffset, vector, '0.5 0.5 0')
-       ATTRIB(Image, zoomSnapToTheBox, float, 1) // snap the zoomed in image to the box borders when zooming/dragging it
-       ATTRIB(Image, zoomTime, float, 0)
-       ATTRIB(Image, zoomLimitedByTheBox, float, 0) // forbids zoom if image would be larger than the containing box
-       ATTRIB(Image, zoomMax, float, 0)
-       ATTRIB(Image, start_zoomOffset, vector, '0 0 0')
-       ATTRIB(Image, start_coords, vector, '0 0 0')
-       ATTRIB(Image, imgOrigin, vector, '0 0 0')
-       ATTRIB(Image, imgSize, vector, '0 0 0')
-ENDCLASS(Image)
-#endif
-
-#ifdef IMPLEMENTATION
-string Image_toString(entity me)
-{
-       return me.src;
-}
-void Image_configureImage(entity me, string path)
-{
-       me.src = path;
-}
-void Image_initZoom(entity me)
-{
-       me.zoomOffset = '0.5 0.5 0';
-       me.zoomFactor = 1;
-       if (me.forcedAspect == -2)
-               me.zoomBox = -1; // calculate zoomBox at the first updateAspect call
-       if (me.zoomLimitedByTheBox)
-               me.zoomMax = -1; // calculate zoomMax at the first updateAspect call
-}
-
-void Image_draw(entity me)
-{
-       if(me.imgSize_x > 1 || me.imgSize_y > 1)
-               draw_SetClip();
-       draw_Picture(me.imgOrigin, me.src, me.imgSize, me.color, 1);
-       if(me.imgSize_x > 1 || me.imgSize_y > 1)
-               draw_ClearClip();
-       SUPER(Image).draw(me);
-}
-void Image_updateAspect(entity me)
-{
-       float asp = 0;
-       if(me.size_x <= 0 || me.size_y <= 0)
-               return;
-       if(me.forcedAspect == 0)
-       {
-               me.imgOrigin = '0 0 0';
-               me.imgSize = '1 1 0';
-       }
-       else
-       {
-               vector sz = '0 0 0';
-               if(me.forcedAspect < 0)
-               {
-                       if (me.src != "")
-                               sz = draw_PictureSize(me.src);
-                       if(sz_x <= 0 || sz_y <= 0)
-                       {
-                               // image is broken or doesn't exist, set the size for the placeholder image
-                               sz_x = me.size_x;
-                               sz_y = me.size_y;
-                       }
-                       asp = sz_x / sz_y;
-               }
-               else
-                       asp = me.forcedAspect;
-
-               if(me.forcedAspect <= -2)
-               {
-                       me.imgSize_x = sz_x / me.size_x;
-                       me.imgSize_y = sz_y / me.size_y;
-                       if(me.zoomBox < 0 && (me.imgSize_x > 1 || me.imgSize_y > 1))
-                       {
-                               // image larger than the containing box, zoom it out to fit into the box
-                               if(me.size_x > asp * me.size_y)
-                                       me.zoomBox = (me.size_y * asp / me.size_x) / me.imgSize_x;
-                               else
-                                       me.zoomBox = (me.size_x / (asp * me.size_y)) / me.imgSize_y;
-                               me.zoomFactor = me.zoomBox;
-                       }
-               }
-               else
-               {
-                       if(me.size_x > asp * me.size_y)
-                       {
-                               // x too large, so center x-wise
-                               me.imgSize = eY + eX * (me.size_y * asp / me.size_x);
-                       }
-                       else
-                       {
-                               // y too large, so center y-wise
-                               me.imgSize = eX + eY * (me.size_x / (asp * me.size_y));
-                       }
-               }
-       }
-
-       if (me.zoomMax < 0)
-       {
-               if(me.zoomBox > 0)
-                       me.zoomMax = me.zoomBox;
-               else
-               {
-                       if(me.size_x > asp * me.size_y)
-                               me.zoomMax = (me.size_y * asp / me.size_x) / me.imgSize_x;
-                       else
-                               me.zoomMax = (me.size_x / (asp * me.size_y)) / me.imgSize_y;
-               }
-       }
-
-       if (me.zoomMax > 0 && me.zoomFactor > me.zoomMax)
-               me.zoomFactor = me.zoomMax;
-       if (me.zoomFactor)
-               me.imgSize = me.imgSize * me.zoomFactor;
-
-       if(me.imgSize_x > 1 || me.imgSize_y > 1)
-       {
-               if(me.zoomSnapToTheBox)
-               {
-                       if(me.imgSize_x > 1)
-                               me.zoomOffset_x = bound(0.5/me.imgSize_x, me.zoomOffset_x, 1 - 0.5/me.imgSize_x);
-                       else
-                               me.zoomOffset_x = bound(1 - 0.5/me.imgSize_x, me.zoomOffset_x, 0.5/me.imgSize_x);
-
-                       if(me.imgSize_y > 1)
-                               me.zoomOffset_y = bound(0.5/me.imgSize_y, me.zoomOffset_y, 1 - 0.5/me.imgSize_y);
-                       else
-                               me.zoomOffset_y = bound(1 - 0.5/me.imgSize_y, me.zoomOffset_y, 0.5/me.imgSize_y);
-               }
-               else
-               {
-                       me.zoomOffset_x = bound(0, me.zoomOffset_x, 1);
-                       me.zoomOffset_y = bound(0, me.zoomOffset_y, 1);
-               }
-       }
-       else
-               me.zoomOffset = '0.5 0.5 0';
-
-       me.imgOrigin_x = 0.5 - me.zoomOffset_x * me.imgSize_x;
-       me.imgOrigin_y = 0.5 - me.zoomOffset_y * me.imgSize_y;
-}
-float Image_drag_setStartPos(entity me, vector coords)
-{
-       //if(me.imgSize_x > 1 || me.imgSize_y > 1) // check disabled: mousewheel zoom may start from a non-zoomed-in image
-       {
-               me.start_zoomOffset = me.zoomOffset;
-               me.start_coords = coords;
-       }
-       return 1;
-}
-float Image_drag(entity me, vector coords)
-{
-       if(me.imgSize_x > 1 || me.imgSize_y > 1)
-       {
-               me.zoomOffset_x = me.start_zoomOffset_x + (me.start_coords_x - coords_x) / me.imgSize_x;
-               me.zoomOffset_y = me.start_zoomOffset_y + (me.start_coords_y - coords_y) / me.imgSize_y;
-               me.updateAspect(me);
-       }
-       return 1;
-}
-void Image_setZoom(entity me, float z, float atMousePosition)
-{
-       float prev_zoomFactor;
-       prev_zoomFactor = me.zoomFactor;
-       if (z < 0) // multiply by the current zoomFactor (but can also snap to real dimensions or to box)
-       {
-               me.zoomFactor *= -z;
-               float realSize_in_the_middle, boxSize_in_the_middle;
-               realSize_in_the_middle = ((prev_zoomFactor - 1) * (me.zoomFactor - 1) < 0);
-               boxSize_in_the_middle = (me.zoomBox > 0 && (prev_zoomFactor - me.zoomBox) * (me.zoomFactor - me.zoomBox) < 0);
-               if (realSize_in_the_middle && boxSize_in_the_middle)
-               {
-                       // snap to real dimensions or to box
-                       if (prev_zoomFactor < me.zoomFactor)
-                               me.zoomFactor = min(1, me.zoomBox);
-                       else
-                               me.zoomFactor = max(1, me.zoomBox);
-               }
-               else if (realSize_in_the_middle)
-                       me.zoomFactor = 1; // snap to real dimensions
-               else if (boxSize_in_the_middle)
-                       me.zoomFactor = me.zoomBox; // snap to box
-       }
-       else if (z == 0) // reset (no zoom)
-       {
-               if (me.zoomBox > 0)
-                       me.zoomFactor = me.zoomBox;
-               else
-                       me.zoomFactor = 1;
-       }
-       else // directly set
-               me.zoomFactor = z;
-       me.zoomFactor = bound(1/16, me.zoomFactor, 16);
-       if (me.zoomMax > 0 && me.zoomFactor > me.zoomMax)
-               me.zoomFactor = me.zoomMax;
-       if (prev_zoomFactor != me.zoomFactor)
-       {
-               me.zoomTime = time;
-               if (atMousePosition)
-               {
-                       me.zoomOffset_x = me.start_zoomOffset_x + (me.start_coords_x - 0.5) / me.imgSize_x;
-                       me.zoomOffset_y = me.start_zoomOffset_y + (me.start_coords_y - 0.5) / me.imgSize_y;
-                       // updateAspect will reset zoomOffset to '0.5 0.5 0' if
-                       // with this zoomFactor the image will not be zoomed in
-                       // (updateAspect will check the new values of imgSize).
-               }
-       }
-       me.updateAspect(me);
-}
-void Image_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(Image).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-       me.updateAspect(me);
-}
-#endif
diff --git a/qcsrc/menu/item/image.qc b/qcsrc/menu/item/image.qc
new file mode 100644 (file)
index 0000000..b67df84
--- /dev/null
@@ -0,0 +1,231 @@
+#ifdef INTERFACE
+CLASS(Image) EXTENDS(Item)
+       METHOD(Image, configureImage, void(entity, string))
+       METHOD(Image, draw, void(entity))
+       METHOD(Image, toString, string(entity))
+       METHOD(Image, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(Image, updateAspect, void(entity))
+       METHOD(Image, initZoom, void(entity))
+       METHOD(Image, setZoom, void(entity, float, float))
+       METHOD(Image, drag_setStartPos, float(entity, vector))
+       METHOD(Image, drag, float(entity, vector))
+       ATTRIB(Image, src, string, string_null)
+       ATTRIB(Image, color, vector, '1 1 1')
+       ATTRIB(Image, forcedAspect, float, 0) // special values: -1 keep image aspect ratio, -2 keep image size but bound to the containing box, -3 always keep image size
+       ATTRIB(Image, zoomBox, float, 0) // used by forcedAspect -2 when the image is larger than the containing box
+       ATTRIB(Image, zoomFactor, float, 1)
+       ATTRIB(Image, zoomOffset, vector, '0.5 0.5 0')
+       ATTRIB(Image, zoomSnapToTheBox, float, 1) // snap the zoomed in image to the box borders when zooming/dragging it
+       ATTRIB(Image, zoomTime, float, 0)
+       ATTRIB(Image, zoomLimitedByTheBox, float, 0) // forbids zoom if image would be larger than the containing box
+       ATTRIB(Image, zoomMax, float, 0)
+       ATTRIB(Image, start_zoomOffset, vector, '0 0 0')
+       ATTRIB(Image, start_coords, vector, '0 0 0')
+       ATTRIB(Image, imgOrigin, vector, '0 0 0')
+       ATTRIB(Image, imgSize, vector, '0 0 0')
+ENDCLASS(Image)
+#endif
+
+#ifdef IMPLEMENTATION
+string Image_toString(entity me)
+{
+       return me.src;
+}
+void Image_configureImage(entity me, string path)
+{
+       me.src = path;
+}
+void Image_initZoom(entity me)
+{
+       me.zoomOffset = '0.5 0.5 0';
+       me.zoomFactor = 1;
+       if (me.forcedAspect == -2)
+               me.zoomBox = -1; // calculate zoomBox at the first updateAspect call
+       if (me.zoomLimitedByTheBox)
+               me.zoomMax = -1; // calculate zoomMax at the first updateAspect call
+}
+
+void Image_draw(entity me)
+{
+       if(me.imgSize.x > 1 || me.imgSize.y > 1)
+               draw_SetClip();
+       draw_Picture(me.imgOrigin, me.src, me.imgSize, me.color, 1);
+       if(me.imgSize.x > 1 || me.imgSize.y > 1)
+               draw_ClearClip();
+       SUPER(Image).draw(me);
+}
+void Image_updateAspect(entity me)
+{
+       float asp = 0;
+       if(me.size.x <= 0 || me.size.y <= 0)
+               return;
+       if(me.forcedAspect == 0)
+       {
+               me.imgOrigin = '0 0 0';
+               me.imgSize = '1 1 0';
+       }
+       else
+       {
+               vector sz = '0 0 0';
+               if(me.forcedAspect < 0)
+               {
+                       if (me.src != "")
+                               sz = draw_PictureSize(me.src);
+                       if(sz.x <= 0 || sz.y <= 0)
+                       {
+                               // image is broken or doesn't exist, set the size for the placeholder image
+                               sz.x = me.size.x;
+                               sz.y = me.size.y;
+                       }
+                       asp = sz.x / sz.y;
+               }
+               else
+                       asp = me.forcedAspect;
+
+               if(me.forcedAspect <= -2)
+               {
+                       me.imgSize_x = sz.x / me.size.x;
+                       me.imgSize_y = sz.y / me.size.y;
+                       if(me.zoomBox < 0 && (me.imgSize.x > 1 || me.imgSize.y > 1))
+                       {
+                               // image larger than the containing box, zoom it out to fit into the box
+                               if(me.size.x > asp * me.size.y)
+                                       me.zoomBox = (me.size.y * asp / me.size.x) / me.imgSize.x;
+                               else
+                                       me.zoomBox = (me.size.x / (asp * me.size.y)) / me.imgSize.y;
+                               me.zoomFactor = me.zoomBox;
+                       }
+               }
+               else
+               {
+                       if(me.size.x > asp * me.size.y)
+                       {
+                               // x too large, so center x-wise
+                               me.imgSize = eY + eX * (me.size.y * asp / me.size.x);
+                       }
+                       else
+                       {
+                               // y too large, so center y-wise
+                               me.imgSize = eX + eY * (me.size.x / (asp * me.size.y));
+                       }
+               }
+       }
+
+       if (me.zoomMax < 0)
+       {
+               if(me.zoomBox > 0)
+                       me.zoomMax = me.zoomBox;
+               else
+               {
+                       if(me.size.x > asp * me.size.y)
+                               me.zoomMax = (me.size.y * asp / me.size.x) / me.imgSize.x;
+                       else
+                               me.zoomMax = (me.size.x / (asp * me.size.y)) / me.imgSize.y;
+               }
+       }
+
+       if (me.zoomMax > 0 && me.zoomFactor > me.zoomMax)
+               me.zoomFactor = me.zoomMax;
+       if (me.zoomFactor)
+               me.imgSize = me.imgSize * me.zoomFactor;
+
+       if(me.imgSize.x > 1 || me.imgSize.y > 1)
+       {
+               if(me.zoomSnapToTheBox)
+               {
+                       if(me.imgSize.x > 1)
+                               me.zoomOffset_x = bound(0.5/me.imgSize.x, me.zoomOffset.x, 1 - 0.5/me.imgSize.x);
+                       else
+                               me.zoomOffset_x = bound(1 - 0.5/me.imgSize.x, me.zoomOffset.x, 0.5/me.imgSize.x);
+
+                       if(me.imgSize.y > 1)
+                               me.zoomOffset_y = bound(0.5/me.imgSize.y, me.zoomOffset.y, 1 - 0.5/me.imgSize.y);
+                       else
+                               me.zoomOffset_y = bound(1 - 0.5/me.imgSize.y, me.zoomOffset.y, 0.5/me.imgSize.y);
+               }
+               else
+               {
+                       me.zoomOffset_x = bound(0, me.zoomOffset.x, 1);
+                       me.zoomOffset_y = bound(0, me.zoomOffset.y, 1);
+               }
+       }
+       else
+               me.zoomOffset = '0.5 0.5 0';
+
+       me.imgOrigin_x = 0.5 - me.zoomOffset.x * me.imgSize.x;
+       me.imgOrigin_y = 0.5 - me.zoomOffset.y * me.imgSize.y;
+}
+float Image_drag_setStartPos(entity me, vector coords)
+{
+       //if(me.imgSize_x > 1 || me.imgSize_y > 1) // check disabled: mousewheel zoom may start from a non-zoomed-in image
+       {
+               me.start_zoomOffset = me.zoomOffset;
+               me.start_coords = coords;
+       }
+       return 1;
+}
+float Image_drag(entity me, vector coords)
+{
+       if(me.imgSize.x > 1 || me.imgSize.y > 1)
+       {
+               me.zoomOffset_x = me.start_zoomOffset.x + (me.start_coords.x - coords.x) / me.imgSize.x;
+               me.zoomOffset_y = me.start_zoomOffset.y + (me.start_coords.y - coords.y) / me.imgSize.y;
+               me.updateAspect(me);
+       }
+       return 1;
+}
+void Image_setZoom(entity me, float z, float atMousePosition)
+{
+       float prev_zoomFactor;
+       prev_zoomFactor = me.zoomFactor;
+       if (z < 0) // multiply by the current zoomFactor (but can also snap to real dimensions or to box)
+       {
+               me.zoomFactor *= -z;
+               float realSize_in_the_middle, boxSize_in_the_middle;
+               realSize_in_the_middle = ((prev_zoomFactor - 1) * (me.zoomFactor - 1) < 0);
+               boxSize_in_the_middle = (me.zoomBox > 0 && (prev_zoomFactor - me.zoomBox) * (me.zoomFactor - me.zoomBox) < 0);
+               if (realSize_in_the_middle && boxSize_in_the_middle)
+               {
+                       // snap to real dimensions or to box
+                       if (prev_zoomFactor < me.zoomFactor)
+                               me.zoomFactor = min(1, me.zoomBox);
+                       else
+                               me.zoomFactor = max(1, me.zoomBox);
+               }
+               else if (realSize_in_the_middle)
+                       me.zoomFactor = 1; // snap to real dimensions
+               else if (boxSize_in_the_middle)
+                       me.zoomFactor = me.zoomBox; // snap to box
+       }
+       else if (z == 0) // reset (no zoom)
+       {
+               if (me.zoomBox > 0)
+                       me.zoomFactor = me.zoomBox;
+               else
+                       me.zoomFactor = 1;
+       }
+       else // directly set
+               me.zoomFactor = z;
+       me.zoomFactor = bound(1/16, me.zoomFactor, 16);
+       if (me.zoomMax > 0 && me.zoomFactor > me.zoomMax)
+               me.zoomFactor = me.zoomMax;
+       if (prev_zoomFactor != me.zoomFactor)
+       {
+               me.zoomTime = time;
+               if (atMousePosition)
+               {
+                       me.zoomOffset_x = me.start_zoomOffset.x + (me.start_coords.x - 0.5) / me.imgSize.x;
+                       me.zoomOffset_y = me.start_zoomOffset.y + (me.start_coords.y - 0.5) / me.imgSize.y;
+                       // updateAspect will reset zoomOffset to '0.5 0.5 0' if
+                       // with this zoomFactor the image will not be zoomed in
+                       // (updateAspect will check the new values of imgSize).
+               }
+       }
+       me.updateAspect(me);
+}
+void Image_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(Image).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+       me.updateAspect(me);
+}
+#endif
diff --git a/qcsrc/menu/item/inputbox.c b/qcsrc/menu/item/inputbox.c
deleted file mode 100644 (file)
index 1c1bf51..0000000
+++ /dev/null
@@ -1,391 +0,0 @@
-#ifdef INTERFACE
-CLASS(InputBox) EXTENDS(Label)
-       METHOD(InputBox, configureInputBox, void(entity, string, float, float, string))
-       METHOD(InputBox, draw, void(entity))
-       METHOD(InputBox, setText, void(entity, string))
-       METHOD(InputBox, enterText, void(entity, string))
-       METHOD(InputBox, keyDown, float(entity, float, float, float))
-       METHOD(InputBox, mouseMove, float(entity, vector))
-       METHOD(InputBox, mouseRelease, float(entity, vector))
-       METHOD(InputBox, mousePress, float(entity, vector))
-       METHOD(InputBox, mouseDrag, float(entity, vector))
-       METHOD(InputBox, showNotify, void(entity))
-       METHOD(InputBox, resizeNotify, void(entity, vector, vector, vector, vector))
-
-       ATTRIB(InputBox, src, string, string_null)
-
-       ATTRIB(InputBox, cursorPos, float, 0) // characters
-       ATTRIB(InputBox, scrollPos, float, 0) // widths
-
-       ATTRIB(InputBox, focusable, float, 1)
-       ATTRIB(InputBox, disabled, float, 0)
-       ATTRIB(InputBox, lastChangeTime, float, 0)
-       ATTRIB(InputBox, dragScrollTimer, float, 0)
-       ATTRIB(InputBox, dragScrollPos, vector, '0 0 0')
-       ATTRIB(InputBox, pressed, float, 0)
-       ATTRIB(InputBox, editColorCodes, float, 1)
-       ATTRIB(InputBox, forbiddenCharacters, string, "")
-       ATTRIB(InputBox, color, vector, '1 1 1')
-       ATTRIB(InputBox, colorF, vector, '1 1 1')
-       ATTRIB(InputBox, maxLength, float, 255) // if negative, it counts bytes, not chars
-
-       ATTRIB(InputBox, enableClearButton, float, 1)
-       ATTRIB(InputBox, clearButton, entity, NULL)
-       ATTRIB(InputBox, cb_width, float, 0)
-       ATTRIB(InputBox, cb_pressed, float, 0)
-       ATTRIB(InputBox, cb_focused, float, 0)
-       ATTRIB(InputBox, cb_color, vector, '1 1 1')
-       ATTRIB(InputBox, cb_colorF, vector, '1 1 1')
-       ATTRIB(InputBox, cb_colorC, vector, '1 1 1')
-ENDCLASS(InputBox)
-void InputBox_Clear_Click(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-void InputBox_configureInputBox(entity me, string theText, float theCursorPos, float theFontSize, string gfx)
-{
-       SUPER(InputBox).configureLabel(me, theText, theFontSize, 0.0);
-       me.src = gfx;
-       me.cursorPos = theCursorPos;
-}
-void InputBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(InputBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-       if (me.enableClearButton)
-       {
-               me.cb_width = absSize_y / absSize_x;
-               me.cb_offset = bound(-1, me.cb_offset, 0) * me.cb_width; // bound to range -1, 0
-               me.keepspaceRight = me.keepspaceRight - me.cb_offset + me.cb_width;
-       }
-}
-
-void InputBox_setText(entity me, string txt)
-{
-       if(me.text)
-               strunzone(me.text);
-       SUPER(InputBox).setText(me, strzone(txt));
-}
-
-void InputBox_Clear_Click(entity btn, entity me)
-{
-       me.setText(me, "");
-}
-
-float over_ClearButton(entity me, vector pos)
-{
-       if (pos_x >= 1 + me.cb_offset - me.cb_width)
-       if (pos_x < 1 + me.cb_offset)
-       if (pos_y >= 0)
-       if (pos_y < 1)
-               return 1;
-       return 0;
-}
-
-float InputBox_mouseMove(entity me, vector pos)
-{
-       if (me.enableClearButton)
-       {
-               if (over_ClearButton(me, pos))
-               {
-                       me.cb_focused = 1;
-                       return 1;
-               }
-               me.cb_focused = 0;
-       }
-       return 1;
-}
-
-float InputBox_mouseDrag(entity me, vector pos)
-{
-       float p;
-       if(me.pressed)
-       {
-               me.dragScrollPos = pos;
-               p = me.scrollPos + pos_x - me.keepspaceLeft;
-               me.cursorPos = draw_TextLengthUpToWidth(me.text, p, 0, me.realFontSize);
-               me.lastChangeTime = time;
-       }
-       else if (me.enableClearButton)
-       {
-               if (over_ClearButton(me, pos))
-               {
-                       me.cb_pressed = 1;
-                       return 1;
-               }
-       }
-       me.cb_pressed = 0;
-       return 1;
-}
-
-float InputBox_mousePress(entity me, vector pos)
-{
-       if (me.enableClearButton)
-       if (over_ClearButton(me, pos))
-       {
-               me.cb_pressed = 1;
-               return 1;
-       }
-       me.dragScrollTimer = time;
-       me.pressed = 1;
-       return InputBox_mouseDrag(me, pos);
-}
-
-float InputBox_mouseRelease(entity me, vector pos)
-{
-       if(me.cb_pressed)
-       if (over_ClearButton(me, pos))
-       {
-               me.cb_pressed = 0;
-               InputBox_Clear_Click(world, me);
-               return 1;
-       }
-       float r = InputBox_mouseDrag(me, pos);
-       //reset cb_pressed after mouseDrag, mouseDrag could set cb_pressed in this case:
-       //mouse press out of the clear button, drag and then mouse release over the clear button
-       me.cb_pressed = 0;
-       me.pressed = 0;
-       return r;
-}
-
-void InputBox_enterText(entity me, string ch)
-{
-       float i;
-       for(i = 0; i < strlen(ch); ++i)
-               if(strstrofs(me.forbiddenCharacters, substring(ch, i, 1), 0) > -1)
-                       return;
-       if(me.maxLength > 0)
-       {
-               if(strlen(ch) + strlen(me.text) > me.maxLength)
-                       return;
-       }
-       else if(me.maxLength < 0)
-       {
-               if(u8_strsize(ch) + u8_strsize(me.text) > -me.maxLength)
-                       return;
-       }
-       me.setText(me, strcat(substring(me.text, 0, me.cursorPos), ch, substring(me.text, me.cursorPos, strlen(me.text) - me.cursorPos)));
-       me.cursorPos += strlen(ch);
-}
-
-float InputBox_keyDown(entity me, float key, float ascii, float shift)
-{
-       me.lastChangeTime = time;
-       me.dragScrollTimer = time;
-       if(ascii >= 32 && ascii != 127)
-       {
-               me.enterText(me, chr(ascii));
-               return 1;
-       }
-       switch(key)
-       {
-               case K_KP_LEFTARROW:
-               case K_LEFTARROW:
-                       me.cursorPos -= 1;
-                       return 1;
-               case K_KP_RIGHTARROW:
-               case K_RIGHTARROW:
-                       me.cursorPos += 1;
-                       return 1;
-               case K_KP_HOME:
-               case K_HOME:
-                       me.cursorPos = 0;
-                       return 1;
-               case K_KP_END:
-               case K_END:
-                       me.cursorPos = strlen(me.text);
-                       return 1;
-               case K_BACKSPACE:
-                       if(me.cursorPos > 0)
-                       {
-                               me.cursorPos -= 1;
-                               me.setText(me, strcat(substring(me.text, 0, me.cursorPos), substring(me.text, me.cursorPos + 1, strlen(me.text) - me.cursorPos - 1)));
-                       }
-                       return 1;
-               case K_KP_DEL:
-               case K_DEL:
-                       if(shift & S_CTRL)
-                               me.setText(me, "");
-                       else
-                               me.setText(me, strcat(substring(me.text, 0, me.cursorPos), substring(me.text, me.cursorPos + 1, strlen(me.text) - me.cursorPos - 1)));
-                       return 1;
-       }
-       return 0;
-}
-
-void InputBox_draw(entity me)
-{
-#define CURSOR "_"
-       float cursorPosInWidths, totalSizeInWidths;
-
-       if(me.pressed)
-               me.mouseDrag(me, me.dragScrollPos); // simulate mouseDrag event
-
-       if(me.recalcPos)
-               me.recalcPositionWithText(me, me.text);
-
-       me.focusable = !me.disabled;
-       if(me.disabled)
-               draw_alpha *= me.disabledAlpha;
-
-       if(me.src)
-       {
-               if(me.focused && !me.disabled)
-                       draw_ButtonPicture('0 0 0', strcat(me.src, "_f"), '1 1 0', me.colorF, 1);
-               else
-                       draw_ButtonPicture('0 0 0', strcat(me.src, "_n"), '1 1 0', me.color, 1);
-       }
-
-       me.cursorPos = bound(0, me.cursorPos, strlen(me.text));
-       cursorPosInWidths = draw_TextWidth(substring(me.text, 0, me.cursorPos), 0, me.realFontSize);
-       totalSizeInWidths = draw_TextWidth(strcat(me.text, CURSOR), 0, me.realFontSize);
-
-       if(me.dragScrollTimer < time)
-       {
-               float save;
-               save = me.scrollPos;
-               me.scrollPos = bound(cursorPosInWidths - (0.875 - me.keepspaceLeft - me.keepspaceRight), me.scrollPos, cursorPosInWidths - 0.125);
-               if(me.scrollPos != save)
-                       me.dragScrollTimer = time + 0.2;
-       }
-       me.scrollPos = min(me.scrollPos, totalSizeInWidths - (1 - me.keepspaceRight - me.keepspaceLeft));
-       me.scrollPos = max(0, me.scrollPos);
-
-       draw_SetClipRect(eX * me.keepspaceLeft, eX * (1 - me.keepspaceLeft - me.keepspaceRight) + eY);
-       if(me.editColorCodes)
-       {
-               string ch, ch2;
-               float i, n;
-               vector theColor;
-               float theAlpha;    //float theVariableAlpha;
-               vector p;
-               vector theTempColor;
-               float component;
-
-               p = me.realOrigin - eX * me.scrollPos;
-               theColor = '1 1 1';
-               theAlpha = 1;    //theVariableAlpha = 1; // changes when ^ax found
-
-               n = strlen(me.text);
-               for(i = 0; i < n; ++i)
-               {
-                       ch = substring(me.text, i, 1);
-                       if(ch == "^")
-                       {
-                               float w;
-                               ch2 = substring(me.text, i+1, 1);
-                               w = draw_TextWidth(strcat(ch, ch2), 0, me.realFontSize);
-                               if(ch2 == "^")
-                               {
-                                       draw_Fill(p, eX * w + eY * me.realFontSize_y, '1 1 1', 0.5);
-                                       draw_Text(p + eX * 0.25 * w, "^", me.realFontSize, theColor, theAlpha, 0);
-                               }
-                               else if(ch2 == "0" || stof(ch2)) // digit?
-                               {
-                                       switch(stof(ch2))
-                                       {
-                                               case 0: theColor = '0 0 0'; theAlpha = 1; break;
-                                               case 1: theColor = '1 0 0'; theAlpha = 1; break;
-                                               case 2: theColor = '0 1 0'; theAlpha = 1; break;
-                                               case 3: theColor = '1 1 0'; theAlpha = 1; break;
-                                               case 4: theColor = '0 0 1'; theAlpha = 1; break;
-                                               case 5: theColor = '0 1 1'; theAlpha = 1; break;
-                                               case 6: theColor = '1 0 1'; theAlpha = 1; break;
-                                               case 7: theColor = '1 1 1'; theAlpha = 1; break;
-                                               case 8: theColor = '1 1 1'; theAlpha = 0.5; break;
-                                               case 9: theColor = '0.5 0.5 0.5'; theAlpha = 1; break;
-                                       }
-                                       draw_Fill(p, eX * w + eY * me.realFontSize_y, '1 1 1', 0.5);
-                                       draw_Text(p, strcat(ch, ch2), me.realFontSize, theColor, theAlpha, 0);
-                               }
-                               else if(ch2 == "x") // ^x found
-                               {
-                                       theColor = '1 1 1';
-
-                                       component = HEXDIGIT_TO_DEC(substring(me.text, i+2, 1));
-                                       if (component >= 0) // ^xr found
-                                       {
-                                               theTempColor_x = component/15;
-
-                                               component = HEXDIGIT_TO_DEC(substring(me.text, i+3, 1));
-                                               if (component >= 0) // ^xrg found
-                                               {
-                                                       theTempColor_y = component/15;
-
-                                                       component = HEXDIGIT_TO_DEC(substring(me.text, i+4, 1));
-                                                       if (component >= 0) // ^xrgb found
-                                                       {
-                                                               theTempColor_z = component/15;
-                                                               theColor = theTempColor;
-                                                               w = draw_TextWidth(substring(me.text, i, 5), 0, me.realFontSize);
-
-                                                               draw_Fill(p, eX * w + eY * me.realFontSize_y, '1 1 1', 0.5);
-                                                               draw_Text(p, substring(me.text, i, 5), me.realFontSize, theColor, 1, 0);    // theVariableAlpha instead of 1 using alpha tags ^ax
-                                                               i += 3;
-                                                       }
-                                                       else
-                                                       {
-                                                               // blue missing
-                                                               w = draw_TextWidth(substring(me.text, i, 4), 0, me.realFontSize);
-                                                               draw_Fill(p, eX * w + eY * me.realFontSize_y, eZ, 0.5);
-                                                               draw_Text(p, substring(me.text, i, 4), me.realFontSize, '1 1 1', theAlpha, 0);
-                                                               i += 2;
-                                                       }
-                                               }
-                                               else
-                                               {
-                                                       // green missing
-                                                       w = draw_TextWidth(substring(me.text, i, 3), 0, me.realFontSize);
-                                                       draw_Fill(p, eX * w + eY * me.realFontSize_y, eY, 0.5);
-                                                       draw_Text(p, substring(me.text, i, 3), me.realFontSize, '1 1 1', theAlpha, 0);
-                                                       i += 1;
-                                               }
-                                       }
-                                       else
-                                       {
-                                               // red missing
-                                               //w = draw_TextWidth(substring(me.text, i, 2), 0) * me.realFontSize_x;
-                                               draw_Fill(p, eX * w + eY * me.realFontSize_y, eX, 0.5);
-                                               draw_Text(p, substring(me.text, i, 2), me.realFontSize, '1 1 1', theAlpha, 0);
-                                       }
-                               }
-                               else
-                               {
-                                       draw_Fill(p, eX * w + eY * me.realFontSize_y, '1 1 1', 0.5);
-                                       draw_Text(p, strcat(ch, ch2), me.realFontSize, theColor, theAlpha, 0);
-                               }
-                               p += w * eX;
-                               ++i;
-                               continue;
-                       }
-                       draw_Text(p, ch, me.realFontSize, theColor, theAlpha, 0); // TODO theVariableAlpha
-                       p += eX * draw_TextWidth(ch, 0, me.realFontSize);
-               }
-       }
-       else
-               draw_Text(me.realOrigin - eX * me.scrollPos, me.text, me.realFontSize, '1 1 1', 1, 0);
-
-       if(!me.focused || (time - me.lastChangeTime) < floor(time - me.lastChangeTime) + 0.5)
-               draw_Text(me.realOrigin + eX * (cursorPosInWidths - me.scrollPos), CURSOR, me.realFontSize, '1 1 1', 1, 0);
-
-       draw_ClearClip();
-
-       if (me.enableClearButton)
-       if (me.text != "")
-       {
-               if(me.focused && me.cb_pressed)
-                       draw_Picture(eX * (1 + me.cb_offset - me.cb_width), strcat(me.cb_src, "_c"), eX * me.cb_width + eY, me.cb_colorC, 1);
-               else if(me.focused && me.cb_focused)
-                       draw_Picture(eX * (1 + me.cb_offset - me.cb_width), strcat(me.cb_src, "_f"), eX * me.cb_width + eY, me.cb_colorF, 1);
-               else
-                       draw_Picture(eX * (1 + me.cb_offset - me.cb_width), strcat(me.cb_src, "_n"), eX * me.cb_width + eY, me.cb_color, 1);
-       }
-
-       // skipping SUPER(InputBox).draw(me);
-       Item_draw(me);
-}
-
-void InputBox_showNotify(entity me)
-{
-       me.focusable = !me.disabled;
-}
-#endif
diff --git a/qcsrc/menu/item/inputbox.qc b/qcsrc/menu/item/inputbox.qc
new file mode 100644 (file)
index 0000000..275b200
--- /dev/null
@@ -0,0 +1,390 @@
+#ifdef INTERFACE
+CLASS(InputBox) EXTENDS(Label)
+       METHOD(InputBox, configureInputBox, void(entity, string, float, float, string))
+       METHOD(InputBox, draw, void(entity))
+       METHOD(InputBox, setText, void(entity, string))
+       METHOD(InputBox, enterText, void(entity, string))
+       METHOD(InputBox, keyDown, float(entity, float, float, float))
+       METHOD(InputBox, mouseMove, float(entity, vector))
+       METHOD(InputBox, mouseRelease, float(entity, vector))
+       METHOD(InputBox, mousePress, float(entity, vector))
+       METHOD(InputBox, mouseDrag, float(entity, vector))
+       METHOD(InputBox, showNotify, void(entity))
+       METHOD(InputBox, resizeNotify, void(entity, vector, vector, vector, vector))
+
+       ATTRIB(InputBox, src, string, string_null)
+
+       ATTRIB(InputBox, cursorPos, float, 0) // characters
+       ATTRIB(InputBox, scrollPos, float, 0) // widths
+
+       ATTRIB(InputBox, focusable, float, 1)
+       ATTRIB(InputBox, allowFocusSound, float, 1)
+       ATTRIB(InputBox, disabled, float, 0)
+       ATTRIB(InputBox, lastChangeTime, float, 0)
+       ATTRIB(InputBox, dragScrollTimer, float, 0)
+       ATTRIB(InputBox, dragScrollPos, vector, '0 0 0')
+       ATTRIB(InputBox, pressed, float, 0)
+       ATTRIB(InputBox, editColorCodes, float, 1)
+       ATTRIB(InputBox, forbiddenCharacters, string, "")
+       ATTRIB(InputBox, color, vector, '1 1 1')
+       ATTRIB(InputBox, colorF, vector, '1 1 1')
+       ATTRIB(InputBox, maxLength, float, 255) // if negative, it counts bytes, not chars
+
+       ATTRIB(InputBox, enableClearButton, float, 1)
+       ATTRIB(InputBox, clearButton, entity, NULL)
+       ATTRIB(InputBox, cb_width, float, 0)
+       ATTRIB(InputBox, cb_pressed, float, 0)
+       ATTRIB(InputBox, cb_focused, float, 0)
+       ATTRIB(InputBox, cb_color, vector, '1 1 1')
+       ATTRIB(InputBox, cb_colorF, vector, '1 1 1')
+       ATTRIB(InputBox, cb_colorC, vector, '1 1 1')
+ENDCLASS(InputBox)
+#endif
+
+#ifdef IMPLEMENTATION
+void InputBox_configureInputBox(entity me, string theText, float theCursorPos, float theFontSize, string gfx)
+{
+       SUPER(InputBox).configureLabel(me, theText, theFontSize, 0.0);
+       me.src = gfx;
+       me.cursorPos = theCursorPos;
+}
+void InputBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(InputBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+       if (me.enableClearButton)
+       {
+               me.cb_width = absSize.y / absSize.x;
+               me.cb_offset = bound(-1, me.cb_offset, 0) * me.cb_width; // bound to range -1, 0
+               me.keepspaceRight = me.keepspaceRight - me.cb_offset + me.cb_width;
+       }
+}
+
+void InputBox_setText(entity me, string txt)
+{
+       if(me.text)
+               strunzone(me.text);
+       SUPER(InputBox).setText(me, strzone(txt));
+}
+
+float over_ClearButton(entity me, vector pos)
+{
+       if (pos.x >= 1 + me.cb_offset - me.cb_width)
+       if (pos.x < 1 + me.cb_offset)
+       if (pos.y >= 0)
+       if (pos.y < 1)
+               return 1;
+       return 0;
+}
+
+float InputBox_mouseMove(entity me, vector pos)
+{
+       if (me.enableClearButton)
+       {
+               if (over_ClearButton(me, pos))
+               {
+                       me.cb_focused = 1;
+                       return 1;
+               }
+               me.cb_focused = 0;
+       }
+       return 1;
+}
+
+float InputBox_mouseDrag(entity me, vector pos)
+{
+       float p;
+       if(me.pressed)
+       {
+               me.dragScrollPos = pos;
+               p = me.scrollPos + pos.x - me.keepspaceLeft;
+               me.cursorPos = draw_TextLengthUpToWidth(me.text, p, 0, me.realFontSize);
+               me.lastChangeTime = time;
+       }
+       else if (me.enableClearButton)
+       {
+               if (over_ClearButton(me, pos))
+               {
+                       me.cb_pressed = 1;
+                       return 1;
+               }
+       }
+       me.cb_pressed = 0;
+       return 1;
+}
+
+float InputBox_mousePress(entity me, vector pos)
+{
+       if (me.enableClearButton)
+       if (over_ClearButton(me, pos))
+       {
+               me.cb_pressed = 1;
+               return 1;
+       }
+       me.dragScrollTimer = time;
+       me.pressed = 1;
+       return InputBox_mouseDrag(me, pos);
+}
+
+float InputBox_mouseRelease(entity me, vector pos)
+{
+       if(me.cb_pressed)
+       if (over_ClearButton(me, pos))
+       {
+               m_play_click_sound(MENU_SOUND_CLEAR);
+               me.setText(me, "");
+               me.cb_pressed = 0;
+               return 1;
+       }
+       float r = InputBox_mouseDrag(me, pos);
+       //reset cb_pressed after mouseDrag, mouseDrag could set cb_pressed in this case:
+       //mouse press out of the clear button, drag and then mouse release over the clear button
+       me.cb_pressed = 0;
+       me.pressed = 0;
+       return r;
+}
+
+void InputBox_enterText(entity me, string ch)
+{
+       float i;
+       for(i = 0; i < strlen(ch); ++i)
+               if(strstrofs(me.forbiddenCharacters, substring(ch, i, 1), 0) > -1)
+                       return;
+       if(me.maxLength > 0)
+       {
+               if(strlen(ch) + strlen(me.text) > me.maxLength)
+                       return;
+       }
+       else if(me.maxLength < 0)
+       {
+               if(u8_strsize(ch) + u8_strsize(me.text) > -me.maxLength)
+                       return;
+       }
+       me.setText(me, strcat(substring(me.text, 0, me.cursorPos), ch, substring(me.text, me.cursorPos, strlen(me.text) - me.cursorPos)));
+       me.cursorPos += strlen(ch);
+}
+
+float InputBox_keyDown(entity me, float key, float ascii, float shift)
+{
+       me.lastChangeTime = time;
+       me.dragScrollTimer = time;
+       if(ascii >= 32 && ascii != 127)
+       {
+               me.enterText(me, chr(ascii));
+               return 1;
+       }
+       switch(key)
+       {
+               case K_KP_LEFTARROW:
+               case K_LEFTARROW:
+                       me.cursorPos -= 1;
+                       return 1;
+               case K_KP_RIGHTARROW:
+               case K_RIGHTARROW:
+                       me.cursorPos += 1;
+                       return 1;
+               case K_KP_HOME:
+               case K_HOME:
+                       me.cursorPos = 0;
+                       return 1;
+               case K_KP_END:
+               case K_END:
+                       me.cursorPos = strlen(me.text);
+                       return 1;
+               case K_BACKSPACE:
+                       if(me.cursorPos > 0)
+                       {
+                               me.cursorPos -= 1;
+                               me.setText(me, strcat(substring(me.text, 0, me.cursorPos), substring(me.text, me.cursorPos + 1, strlen(me.text) - me.cursorPos - 1)));
+                       }
+                       return 1;
+               case K_KP_DEL:
+               case K_DEL:
+                       if(shift & S_CTRL)
+                       {
+                               m_play_click_sound(MENU_SOUND_CLEAR);
+                               me.setText(me, "");
+                       }
+                       else
+                               me.setText(me, strcat(substring(me.text, 0, me.cursorPos), substring(me.text, me.cursorPos + 1, strlen(me.text) - me.cursorPos - 1)));
+                       return 1;
+       }
+       return 0;
+}
+
+void InputBox_draw(entity me)
+{
+       string CURSOR = "_";
+       float cursorPosInWidths, totalSizeInWidths;
+
+       if(me.pressed)
+               me.mouseDrag(me, me.dragScrollPos); // simulate mouseDrag event
+
+       if(me.recalcPos)
+               me.recalcPositionWithText(me, me.text);
+
+       me.focusable = !me.disabled;
+       if(me.disabled)
+               draw_alpha *= me.disabledAlpha;
+
+       if(me.src)
+       {
+               if(me.focused && !me.disabled)
+                       draw_ButtonPicture('0 0 0', strcat(me.src, "_f"), '1 1 0', me.colorF, 1);
+               else
+                       draw_ButtonPicture('0 0 0', strcat(me.src, "_n"), '1 1 0', me.color, 1);
+       }
+
+       me.cursorPos = bound(0, me.cursorPos, strlen(me.text));
+       cursorPosInWidths = draw_TextWidth(substring(me.text, 0, me.cursorPos), 0, me.realFontSize);
+       totalSizeInWidths = draw_TextWidth(strcat(me.text, CURSOR), 0, me.realFontSize);
+
+       if(me.dragScrollTimer < time)
+       {
+               float save;
+               save = me.scrollPos;
+               me.scrollPos = bound(cursorPosInWidths - (0.875 - me.keepspaceLeft - me.keepspaceRight), me.scrollPos, cursorPosInWidths - 0.125);
+               if(me.scrollPos != save)
+                       me.dragScrollTimer = time + 0.2;
+       }
+       me.scrollPos = min(me.scrollPos, totalSizeInWidths - (1 - me.keepspaceRight - me.keepspaceLeft));
+       me.scrollPos = max(0, me.scrollPos);
+
+       draw_SetClipRect(eX * me.keepspaceLeft, eX * (1 - me.keepspaceLeft - me.keepspaceRight) + eY);
+       if(me.editColorCodes)
+       {
+               string ch, ch2;
+               float i, n;
+               vector theColor;
+               float theAlpha;    //float theVariableAlpha;
+               vector p;
+               vector theTempColor;
+               float component;
+
+               p = me.realOrigin - eX * me.scrollPos;
+               theColor = '1 1 1';
+               theAlpha = 1;    //theVariableAlpha = 1; // changes when ^ax found
+
+               n = strlen(me.text);
+               for(i = 0; i < n; ++i)
+               {
+                       ch = substring(me.text, i, 1);
+                       if(ch == "^")
+                       {
+                               float w;
+                               ch2 = substring(me.text, i+1, 1);
+                               w = draw_TextWidth(strcat(ch, ch2), 0, me.realFontSize);
+                               if(ch2 == "^")
+                               {
+                                       draw_Fill(p, eX * w + eY * me.realFontSize.y, '1 1 1', 0.5);
+                                       draw_Text(p + eX * 0.25 * w, "^", me.realFontSize, theColor, theAlpha, 0);
+                               }
+                               else if(ch2 == "0" || stof(ch2)) // digit?
+                               {
+                                       switch(stof(ch2))
+                                       {
+                                               case 0: theColor = '0 0 0'; theAlpha = 1; break;
+                                               case 1: theColor = '1 0 0'; theAlpha = 1; break;
+                                               case 2: theColor = '0 1 0'; theAlpha = 1; break;
+                                               case 3: theColor = '1 1 0'; theAlpha = 1; break;
+                                               case 4: theColor = '0 0 1'; theAlpha = 1; break;
+                                               case 5: theColor = '0 1 1'; theAlpha = 1; break;
+                                               case 6: theColor = '1 0 1'; theAlpha = 1; break;
+                                               case 7: theColor = '1 1 1'; theAlpha = 1; break;
+                                               case 8: theColor = '1 1 1'; theAlpha = 0.5; break;
+                                               case 9: theColor = '0.5 0.5 0.5'; theAlpha = 1; break;
+                                       }
+                                       draw_Fill(p, eX * w + eY * me.realFontSize.y, '1 1 1', 0.5);
+                                       draw_Text(p, strcat(ch, ch2), me.realFontSize, theColor, theAlpha, 0);
+                               }
+                               else if(ch2 == "x") // ^x found
+                               {
+                                       theColor = '1 1 1';
+
+                                       component = HEXDIGIT_TO_DEC(substring(me.text, i+2, 1));
+                                       if (component >= 0) // ^xr found
+                                       {
+                                               theTempColor.x = component/15;
+
+                                               component = HEXDIGIT_TO_DEC(substring(me.text, i+3, 1));
+                                               if (component >= 0) // ^xrg found
+                                               {
+                                                       theTempColor.y = component/15;
+
+                                                       component = HEXDIGIT_TO_DEC(substring(me.text, i+4, 1));
+                                                       if (component >= 0) // ^xrgb found
+                                                       {
+                                                               theTempColor.z = component/15;
+                                                               theColor = theTempColor;
+                                                               w = draw_TextWidth(substring(me.text, i, 5), 0, me.realFontSize);
+
+                                                               draw_Fill(p, eX * w + eY * me.realFontSize.y, '1 1 1', 0.5);
+                                                               draw_Text(p, substring(me.text, i, 5), me.realFontSize, theColor, 1, 0);    // theVariableAlpha instead of 1 using alpha tags ^ax
+                                                               i += 3;
+                                                       }
+                                                       else
+                                                       {
+                                                               // blue missing
+                                                               w = draw_TextWidth(substring(me.text, i, 4), 0, me.realFontSize);
+                                                               draw_Fill(p, eX * w + eY * me.realFontSize.y, eZ, 0.5);
+                                                               draw_Text(p, substring(me.text, i, 4), me.realFontSize, '1 1 1', theAlpha, 0);
+                                                               i += 2;
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       // green missing
+                                                       w = draw_TextWidth(substring(me.text, i, 3), 0, me.realFontSize);
+                                                       draw_Fill(p, eX * w + eY * me.realFontSize.y, eY, 0.5);
+                                                       draw_Text(p, substring(me.text, i, 3), me.realFontSize, '1 1 1', theAlpha, 0);
+                                                       i += 1;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               // red missing
+                                               //w = draw_TextWidth(substring(me.text, i, 2), 0) * me.realFontSize_x;
+                                               draw_Fill(p, eX * w + eY * me.realFontSize.y, eX, 0.5);
+                                               draw_Text(p, substring(me.text, i, 2), me.realFontSize, '1 1 1', theAlpha, 0);
+                                       }
+                               }
+                               else
+                               {
+                                       draw_Fill(p, eX * w + eY * me.realFontSize.y, '1 1 1', 0.5);
+                                       draw_Text(p, strcat(ch, ch2), me.realFontSize, theColor, theAlpha, 0);
+                               }
+                               p += w * eX;
+                               ++i;
+                               continue;
+                       }
+                       draw_Text(p, ch, me.realFontSize, theColor, theAlpha, 0); // TODO theVariableAlpha
+                       p += eX * draw_TextWidth(ch, 0, me.realFontSize);
+               }
+       }
+       else
+               draw_Text(me.realOrigin - eX * me.scrollPos, me.text, me.realFontSize, '1 1 1', 1, 0);
+
+       if(!me.focused || (time - me.lastChangeTime) < floor(time - me.lastChangeTime) + 0.5)
+               draw_Text(me.realOrigin + eX * (cursorPosInWidths - me.scrollPos), CURSOR, me.realFontSize, '1 1 1', 1, 0);
+
+       draw_ClearClip();
+
+       if (me.enableClearButton)
+       if (me.text != "")
+       {
+               if(me.focused && me.cb_pressed)
+                       draw_Picture(eX * (1 + me.cb_offset - me.cb_width), strcat(me.cb_src, "_c"), eX * me.cb_width + eY, me.cb_colorC, 1);
+               else if(me.focused && me.cb_focused)
+                       draw_Picture(eX * (1 + me.cb_offset - me.cb_width), strcat(me.cb_src, "_f"), eX * me.cb_width + eY, me.cb_colorF, 1);
+               else
+                       draw_Picture(eX * (1 + me.cb_offset - me.cb_width), strcat(me.cb_src, "_n"), eX * me.cb_width + eY, me.cb_color, 1);
+       }
+
+       // skipping SUPER(InputBox).draw(me);
+       Item_draw(me);
+}
+
+void InputBox_showNotify(entity me)
+{
+       me.focusable = !me.disabled;
+}
+#endif
diff --git a/qcsrc/menu/item/inputcontainer.c b/qcsrc/menu/item/inputcontainer.c
deleted file mode 100644 (file)
index 0f80c2b..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-#ifdef INTERFACE
-CLASS(InputContainer) EXTENDS(Container)
-       METHOD(InputContainer, keyDown, float(entity, float, float, float))
-       METHOD(InputContainer, mouseMove, float(entity, vector))
-       METHOD(InputContainer, mousePress, float(entity, vector))
-       METHOD(InputContainer, mouseRelease, float(entity, vector))
-       METHOD(InputContainer, mouseDrag, float(entity, vector))
-       METHOD(InputContainer, focusLeave, void(entity))
-       METHOD(InputContainer, resizeNotify, void(entity, vector, vector, vector, vector))
-
-       METHOD(InputContainer, _changeFocusXY, float(entity, vector))
-       ATTRIB(InputContainer, mouseFocusedChild, entity, NULL)
-       ATTRIB(InputContainer, isTabRoot, float, 0)
-ENDCLASS(InputContainer)
-#endif
-
-#ifdef IMPLEMENTATION
-void InputContainer_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(InputContainer).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-       /*
-       if(me.parent.instanceOfInputContainer)
-               me.isTabRoot = 0;
-       else
-               me.isTabRoot = 1;
-       */
-}
-
-void InputContainer_focusLeave(entity me)
-{
-       SUPER(InputContainer).focusLeave(me);
-       me.mouseFocusedChild = NULL;
-}
-
-float InputContainer_keyDown(entity me, float scan, float ascii, float shift)
-{
-       entity f, ff;
-       if(SUPER(InputContainer).keyDown(me, scan, ascii, shift))
-               return 1;
-       if(scan == K_ESCAPE)
-       {
-               f = me.focusedChild;
-               if(f)
-               {
-                       me.setFocus(me, NULL);
-                       return 1;
-               }
-               return 0;
-       }
-       if(scan == K_TAB)
-       {
-               f = me.focusedChild;
-               if(shift & S_SHIFT)
-               {
-                       if(f)
-                       {
-                               for(ff = f.prevSibling; ff; ff = ff.prevSibling)
-                               {
-                                       if (!ff.focusable)
-                                               continue;
-                                       me.setFocus(me, ff);
-                                       return 1;
-                               }
-                       }
-                       if(!f || me.isTabRoot)
-                       {
-                               for(ff = me.lastChild; ff; ff = ff.prevSibling)
-                               {
-                                       if (!ff.focusable)
-                                               continue;
-                                       me.setFocus(me, ff);
-                                       return 1;
-                               }
-                               return 0; // AIIIIEEEEE!
-                       }
-               }
-               else
-               {
-                       if(f)
-                       {
-                               for(ff = f.nextSibling; ff; ff = ff.nextSibling)
-                               {
-                                       if (!ff.focusable)
-                                               continue;
-                                       me.setFocus(me, ff);
-                                       return 1;
-                               }
-                       }
-                       if(!f || me.isTabRoot)
-                       {
-                               for(ff = me.firstChild; ff; ff = ff.nextSibling)
-                               {
-                                       if (!ff.focusable)
-                                               continue;
-                                       me.setFocus(me, ff);
-                                       return 1;
-                               }
-                               return 0; // AIIIIEEEEE!
-                       }
-               }
-       }
-       return 0;
-}
-
-float InputContainer__changeFocusXY(entity me, vector pos)
-{
-       entity e, ne;
-       e = me.mouseFocusedChild;
-       ne = me.itemFromPoint(me, pos);
-       if(ne)
-               if (!ne.focusable)
-                       ne = NULL;
-       me.mouseFocusedChild = ne;
-       if(ne)
-               if(ne != e)
-               {
-                       me.setFocus(me, ne);
-                       if(ne.instanceOfInputContainer)
-                       {
-                               ne.focusedChild = NULL;
-                               ne._changeFocusXY(e, globalToBox(pos, ne.Container_origin, ne.Container_size));
-                       }
-               }
-       return (ne != NULL);
-}
-
-float InputContainer_mouseDrag(entity me, vector pos)
-{
-       if(SUPER(InputContainer).mouseDrag(me, pos))
-               return 1;
-       if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1)
-               return 1;
-       return 0;
-}
-float InputContainer_mouseMove(entity me, vector pos)
-{
-       if(me.mouseFocusedChild != me.focusedChild) // if the keyboard moved the focus away
-               me.mouseFocusedChild = NULL; // force focusing
-       if(me._changeFocusXY(me, pos))
-               if(SUPER(InputContainer).mouseMove(me, pos))
-                       return 1;
-       if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1)
-               return 1;
-       return 0;
-}
-float InputContainer_mousePress(entity me, vector pos)
-{
-       me.mouseFocusedChild = NULL; // force focusing
-       if(me._changeFocusXY(me, pos))
-               if(SUPER(InputContainer).mousePress(me, pos))
-                       return 1;
-       if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1)
-               return 1;
-       return 0;
-}
-float InputContainer_mouseRelease(entity me, vector pos)
-{
-       SUPER(InputContainer).mouseRelease(me, pos); // return value?
-       if(me.focused) // am I still eligible for this? (UGLY HACK, but a mouse event could have changed focus away)
-               if(me._changeFocusXY(me, pos))
-                       return 1;
-       if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1)
-               return 1;
-       return 0;
-}
-#endif
diff --git a/qcsrc/menu/item/inputcontainer.qc b/qcsrc/menu/item/inputcontainer.qc
new file mode 100644 (file)
index 0000000..8c09d19
--- /dev/null
@@ -0,0 +1,166 @@
+#ifdef INTERFACE
+CLASS(InputContainer) EXTENDS(Container)
+       METHOD(InputContainer, keyDown, float(entity, float, float, float))
+       METHOD(InputContainer, mouseMove, float(entity, vector))
+       METHOD(InputContainer, mousePress, float(entity, vector))
+       METHOD(InputContainer, mouseRelease, float(entity, vector))
+       METHOD(InputContainer, mouseDrag, float(entity, vector))
+       METHOD(InputContainer, focusLeave, void(entity))
+       METHOD(InputContainer, resizeNotify, void(entity, vector, vector, vector, vector))
+
+       METHOD(InputContainer, _changeFocusXY, float(entity, vector))
+       ATTRIB(InputContainer, mouseFocusedChild, entity, NULL)
+       ATTRIB(InputContainer, isTabRoot, float, 0)
+ENDCLASS(InputContainer)
+#endif
+
+#ifdef IMPLEMENTATION
+void InputContainer_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(InputContainer).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+       /*
+       if(me.parent.instanceOfInputContainer)
+               me.isTabRoot = 0;
+       else
+               me.isTabRoot = 1;
+       */
+}
+
+void InputContainer_focusLeave(entity me)
+{
+       SUPER(InputContainer).focusLeave(me);
+       me.mouseFocusedChild = NULL;
+}
+
+float InputContainer_keyDown(entity me, float scan, float ascii, float shift)
+{
+       entity f, ff;
+       if(SUPER(InputContainer).keyDown(me, scan, ascii, shift))
+               return 1;
+       if(scan == K_ESCAPE)
+       {
+               f = me.focusedChild;
+               if(f)
+               {
+                       me.setFocus(me, NULL);
+                       return 1;
+               }
+               return 0;
+       }
+       if(scan == K_TAB)
+       {
+               f = me.focusedChild;
+               if(shift & S_SHIFT)
+               {
+                       if(f)
+                       {
+                               for(ff = f.prevSibling; ff; ff = ff.prevSibling)
+                               {
+                                       if (!ff.focusable)
+                                               continue;
+                                       me.setFocus(me, ff);
+                                       return 1;
+                               }
+                       }
+                       if(!f || me.isTabRoot)
+                       {
+                               for(ff = me.lastChild; ff; ff = ff.prevSibling)
+                               {
+                                       if (!ff.focusable)
+                                               continue;
+                                       me.setFocus(me, ff);
+                                       return 1;
+                               }
+                               return 0; // AIIIIEEEEE!
+                       }
+               }
+               else
+               {
+                       if(f)
+                       {
+                               for(ff = f.nextSibling; ff; ff = ff.nextSibling)
+                               {
+                                       if (!ff.focusable)
+                                               continue;
+                                       me.setFocus(me, ff);
+                                       return 1;
+                               }
+                       }
+                       if(!f || me.isTabRoot)
+                       {
+                               for(ff = me.firstChild; ff; ff = ff.nextSibling)
+                               {
+                                       if (!ff.focusable)
+                                               continue;
+                                       me.setFocus(me, ff);
+                                       return 1;
+                               }
+                               return 0; // AIIIIEEEEE!
+                       }
+               }
+       }
+       return 0;
+}
+
+float InputContainer__changeFocusXY(entity me, vector pos)
+{
+       entity e, ne;
+       e = me.mouseFocusedChild;
+       ne = me.itemFromPoint(me, pos);
+       if(ne)
+               if (!ne.focusable)
+                       ne = NULL;
+       me.mouseFocusedChild = ne;
+       if(ne)
+               if(ne != e)
+               {
+                       me.setFocus(me, ne);
+                       if(ne.instanceOfInputContainer)
+                       {
+                               ne.focusedChild = NULL;
+                               ne._changeFocusXY(e, globalToBox(pos, ne.Container_origin, ne.Container_size));
+                       }
+               }
+       return (ne != NULL);
+}
+
+float InputContainer_mouseDrag(entity me, vector pos)
+{
+       if(SUPER(InputContainer).mouseDrag(me, pos))
+               return 1;
+       if(pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1)
+               return 1;
+       return 0;
+}
+float InputContainer_mouseMove(entity me, vector pos)
+{
+       if(me.mouseFocusedChild != me.focusedChild) // if the keyboard moved the focus away
+               me.mouseFocusedChild = NULL; // force focusing
+       if(me._changeFocusXY(me, pos))
+               if(SUPER(InputContainer).mouseMove(me, pos))
+                       return 1;
+       if(pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1)
+               return 1;
+       return 0;
+}
+float InputContainer_mousePress(entity me, vector pos)
+{
+       me.mouseFocusedChild = NULL; // force focusing
+       if(me._changeFocusXY(me, pos))
+               if(SUPER(InputContainer).mousePress(me, pos))
+                       return 1;
+       if(pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1)
+               return 1;
+       return 0;
+}
+float InputContainer_mouseRelease(entity me, vector pos)
+{
+       SUPER(InputContainer).mouseRelease(me, pos); // return value?
+       if(me.focused) // am I still eligible for this? (UGLY HACK, but a mouse event could have changed focus away)
+               if(me._changeFocusXY(me, pos))
+                       return 1;
+       if(pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1)
+               return 1;
+       return 0;
+}
+#endif
diff --git a/qcsrc/menu/item/label.c b/qcsrc/menu/item/label.c
deleted file mode 100644 (file)
index 592c3a7..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-#ifdef INTERFACE
-CLASS(Label) EXTENDS(Item)
-       METHOD(Label, configureLabel, void(entity, string, float, float))
-       METHOD(Label, draw, void(entity))
-       METHOD(Label, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(Label, setText, void(entity, string))
-       METHOD(Label, toString, string(entity))
-       METHOD(Label, recalcPositionWithText, void(entity, string))
-       ATTRIB(Label, isBold, float, 0)
-       ATTRIB(Label, text, string, string_null)
-       ATTRIB(Label, currentText, string, string_null)
-       ATTRIB(Label, fontSize, float, 8)
-       ATTRIB(Label, align, float, 0.5)
-       ATTRIB(Label, allowCut, float, 0)
-       ATTRIB(Label, allowColors, float, 0)
-       ATTRIB(Label, keepspaceLeft, float, 0) // for use by subclasses (radiobuttons for example)
-       ATTRIB(Label, keepspaceRight, float, 0)
-       ATTRIB(Label, marginLeft, float, 0) // alternate way to specify keepspace* (in characters from the font)
-       ATTRIB(Label, marginRight, float, 0)
-       ATTRIB(Label, realFontSize, vector, '0 0 0')
-       ATTRIB(Label, realOrigin, vector, '0 0 0')
-       ATTRIB(Label, alpha, float, 0.7)
-       ATTRIB(Label, colorL, vector, SKINCOLOR_TEXT)
-       ATTRIB(Label, disabled, float, 0)
-       ATTRIB(Label, disabledAlpha, float, 0.3)
-       ATTRIB(Label, textEntity, entity, NULL)
-       ATTRIB(Label, allowWrap, float, 0)
-       ATTRIB(Label, recalcPos, float, 0)
-       ATTRIB(Label, condenseFactor, float, 1)
-       ATTRIB(Label, overrideRealOrigin, vector, '0 0 0')
-       ATTRIB(Label, overrideCondenseFactor, float, 0)
-ENDCLASS(Label)
-#endif
-
-#ifdef IMPLEMENTATION
-string Label_toString(entity me)
-{
-       return me.text;
-}
-void Label_setText(entity me, string txt)
-{
-       me.text = txt;
-       if(txt != me.currentText)
-       {
-               if(me.currentText)
-                       strunzone(me.currentText);
-               me.currentText = strzone(txt);
-               me.recalcPos = 1;
-       }
-}
-void Label_recalcPositionWithText(entity me, string t)
-{
-       float spaceAvail;
-       spaceAvail = 1 - me.keepspaceLeft - me.keepspaceRight;
-
-       if(me.isBold)
-               draw_beginBoldFont();
-
-       float spaceUsed;
-       spaceUsed = draw_TextWidth(t, me.allowColors, me.realFontSize);
-
-       if(spaceUsed <= spaceAvail)
-       {
-               if(!me.overrideRealOrigin_x)
-                       me.realOrigin_x = me.align * (spaceAvail - spaceUsed) + me.keepspaceLeft;
-               if(!me.overrideCondenseFactor)
-                       me.condenseFactor = 1;
-       }
-       else if(me.allowCut || me.allowWrap)
-       {
-               if(!me.overrideRealOrigin_x)
-                       me.realOrigin_x = me.keepspaceLeft;
-               if(!me.overrideCondenseFactor)
-                       me.condenseFactor = 1;
-       }
-       else
-       {
-               if(!me.overrideRealOrigin_x)
-                       me.realOrigin_x = me.keepspaceLeft;
-               if(!me.overrideCondenseFactor)
-                       me.condenseFactor = spaceAvail / spaceUsed;
-               dprintf("NOTE: label text %s too wide for label, condensed by factor %f\n", t, me.condenseFactor);
-       }
-
-       if(!me.overrideRealOrigin_y)
-       {
-               float lines;
-               vector dfs;
-               vector fs;
-
-               // set up variables to draw in condensed size, but use hinting for original size
-               fs = me.realFontSize;
-               fs_x *= me.condenseFactor;
-
-               dfs = draw_fontscale;
-               draw_fontscale_x *= me.condenseFactor;
-
-               if(me.allowCut) // FIXME allowCut incompatible with align != 0
-                       lines = 1;
-               else if(me.allowWrap) // FIXME allowWrap incompatible with align != 0
-               {
-                       getWrappedLine_remaining = me.text;
-                       lines = 0;
-                       while(getWrappedLine_remaining)
-                       {
-                               if (me.allowColors)
-                                       getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight), fs, draw_TextWidth_WithColors);
-                               else
-                                       getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight), fs, draw_TextWidth_WithoutColors);
-                               ++lines;
-                       }
-               }
-               else
-                       lines = 1;
-
-               draw_fontscale = dfs;
-
-               me.realOrigin_y = 0.5 * (1 - lines * me.realFontSize_y);
-       }
-
-       if(me.isBold)
-               draw_endBoldFont();
-
-       me.recalcPos = 0;
-}
-void Label_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(Label).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       // absSize_y is height of label
-       me.realFontSize_y = me.fontSize / absSize_y;
-       me.realFontSize_x = me.fontSize / absSize_x;
-       if(me.marginLeft)
-               me.keepspaceLeft = me.marginLeft * me.realFontSize_x;
-       if(me.marginRight)
-               me.keepspaceRight = me.marginRight * me.realFontSize_x;
-
-       me.recalcPos = 1;
-}
-void Label_configureLabel(entity me, string txt, float sz, float algn)
-{
-       me.fontSize = sz;
-       me.align = algn;
-       me.setText(me, txt);
-}
-void Label_draw(entity me)
-{
-       string t;
-       vector o;
-       if(me.disabled)
-               draw_alpha *= me.disabledAlpha;
-
-       if(me.textEntity)
-       {
-               t = me.textEntity.toString(me.textEntity);
-               if(t != me.currentText)
-               {
-                       if(me.currentText)
-                               strunzone(me.currentText);
-                       me.currentText = strzone(t);
-                       me.recalcPos = 1;
-               }
-       }
-       else
-               t = me.text;
-
-       if(me.recalcPos)
-               me.recalcPositionWithText(me, t);
-
-       if(me.fontSize)
-               if(t)
-               {
-                       vector dfs;
-                       vector fs;
-
-                       if(me.isBold)
-                               draw_beginBoldFont();
-
-                       // set up variables to draw in condensed size, but use hinting for original size
-                       fs = me.realFontSize;
-                       fs_x *= me.condenseFactor;
-
-                       dfs = draw_fontscale;
-                       draw_fontscale_x *= me.condenseFactor;
-
-                       if(me.allowCut) // FIXME allowCut incompatible with align != 0
-                               draw_Text(me.realOrigin, draw_TextShortenToWidth(t, (1 - me.keepspaceLeft - me.keepspaceRight), me.allowColors, fs), fs, me.colorL, me.alpha, me.allowColors);
-                       else if(me.allowWrap) // FIXME allowWrap incompatible with align != 0
-                       {
-                               getWrappedLine_remaining = t;
-                               o = me.realOrigin;
-                               while(getWrappedLine_remaining)
-                               {
-                                       if (me.allowColors)
-                                               t = getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight), fs, draw_TextWidth_WithColors);
-                                       else
-                                               t = getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight), fs, draw_TextWidth_WithoutColors);
-                                       draw_Text(o, t, fs, me.colorL, me.alpha, me.allowColors);
-                                       o_y += me.realFontSize_y;
-                               }
-                       }
-                       else
-                               draw_Text(me.realOrigin, t, fs, me.colorL, me.alpha, me.allowColors);
-
-                       draw_fontscale = dfs;
-
-                       if(me.isBold)
-                               draw_endBoldFont();
-               }
-
-       SUPER(Label).draw(me);
-}
-#endif
diff --git a/qcsrc/menu/item/label.qc b/qcsrc/menu/item/label.qc
new file mode 100644 (file)
index 0000000..a1769fc
--- /dev/null
@@ -0,0 +1,213 @@
+#ifdef INTERFACE
+CLASS(Label) EXTENDS(Item)
+       METHOD(Label, configureLabel, void(entity, string, float, float))
+       METHOD(Label, draw, void(entity))
+       METHOD(Label, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(Label, setText, void(entity, string))
+       METHOD(Label, toString, string(entity))
+       METHOD(Label, recalcPositionWithText, void(entity, string))
+       ATTRIB(Label, isBold, float, 0)
+       ATTRIB(Label, text, string, string_null)
+       ATTRIB(Label, currentText, string, string_null)
+       ATTRIB(Label, fontSize, float, 8)
+       ATTRIB(Label, align, float, 0.5)
+       ATTRIB(Label, allowCut, float, 0)
+       ATTRIB(Label, allowColors, float, 0)
+       ATTRIB(Label, keepspaceLeft, float, 0) // for use by subclasses (radiobuttons for example)
+       ATTRIB(Label, keepspaceRight, float, 0)
+       ATTRIB(Label, marginLeft, float, 0) // alternate way to specify keepspace* (in characters from the font)
+       ATTRIB(Label, marginRight, float, 0)
+       ATTRIB(Label, realFontSize, vector, '0 0 0')
+       ATTRIB(Label, realOrigin, vector, '0 0 0')
+       ATTRIB(Label, alpha, float, 0.7)
+       ATTRIB(Label, colorL, vector, SKINCOLOR_TEXT)
+       ATTRIB(Label, disabled, float, 0)
+       ATTRIB(Label, disabledAlpha, float, 0.3)
+       ATTRIB(Label, textEntity, entity, NULL)
+       ATTRIB(Label, allowWrap, float, 0)
+       ATTRIB(Label, recalcPos, float, 0)
+       ATTRIB(Label, condenseFactor, float, 1)
+       ATTRIB(Label, overrideRealOrigin, vector, '0 0 0')
+       ATTRIB(Label, overrideCondenseFactor, float, 0)
+ENDCLASS(Label)
+#endif
+
+#ifdef IMPLEMENTATION
+string Label_toString(entity me)
+{
+       return me.text;
+}
+void Label_setText(entity me, string txt)
+{
+       me.text = txt;
+       if(txt != me.currentText)
+       {
+               if(me.currentText)
+                       strunzone(me.currentText);
+               me.currentText = strzone(txt);
+               me.recalcPos = 1;
+       }
+}
+void Label_recalcPositionWithText(entity me, string t)
+{
+       float spaceAvail;
+       spaceAvail = 1 - me.keepspaceLeft - me.keepspaceRight;
+
+       if(me.isBold)
+               draw_beginBoldFont();
+
+       float spaceUsed;
+       spaceUsed = draw_TextWidth(t, me.allowColors, me.realFontSize);
+
+       if(spaceUsed <= spaceAvail)
+       {
+               if(!me.overrideRealOrigin_x)
+                       me.realOrigin_x = me.align * (spaceAvail - spaceUsed) + me.keepspaceLeft;
+               if(!me.overrideCondenseFactor)
+                       me.condenseFactor = 1;
+       }
+       else if(me.allowCut || me.allowWrap)
+       {
+               if(!me.overrideRealOrigin_x)
+                       me.realOrigin_x = me.keepspaceLeft;
+               if(!me.overrideCondenseFactor)
+                       me.condenseFactor = 1;
+       }
+       else
+       {
+               if(!me.overrideRealOrigin_x)
+                       me.realOrigin_x = me.keepspaceLeft;
+               if(!me.overrideCondenseFactor)
+                       me.condenseFactor = spaceAvail / spaceUsed;
+               dprintf("NOTE: label text %s too wide for label, condensed by factor %f\n", t, me.condenseFactor);
+       }
+
+       if(!me.overrideRealOrigin_y)
+       {
+               float lines;
+               vector dfs;
+               vector fs;
+
+               // set up variables to draw in condensed size, but use hinting for original size
+               fs = me.realFontSize;
+               fs.x *= me.condenseFactor;
+
+               dfs = draw_fontscale;
+               draw_fontscale.x *= me.condenseFactor;
+
+               if(me.allowCut) // FIXME allowCut incompatible with align != 0
+                       lines = 1;
+               else if(me.allowWrap) // FIXME allowWrap incompatible with align != 0
+               {
+                       getWrappedLine_remaining = me.text;
+                       lines = 0;
+                       while(getWrappedLine_remaining)
+                       {
+                               if (me.allowColors)
+                                       getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight), fs, draw_TextWidth_WithColors);
+                               else
+                                       getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight), fs, draw_TextWidth_WithoutColors);
+                               ++lines;
+                       }
+               }
+               else
+                       lines = 1;
+
+               draw_fontscale = dfs;
+
+               me.realOrigin_y = 0.5 * (1 - lines * me.realFontSize.y);
+       }
+
+       if(me.isBold)
+               draw_endBoldFont();
+
+       me.recalcPos = 0;
+}
+void Label_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(Label).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       // absSize_y is height of label
+       me.realFontSize_y = me.fontSize / absSize.y;
+       me.realFontSize_x = me.fontSize / absSize.x;
+       if(me.marginLeft)
+               me.keepspaceLeft = me.marginLeft * me.realFontSize.x;
+       if(me.marginRight)
+               me.keepspaceRight = me.marginRight * me.realFontSize.x;
+
+       me.recalcPos = 1;
+}
+void Label_configureLabel(entity me, string txt, float sz, float algn)
+{
+       me.fontSize = sz;
+       me.align = algn;
+       me.setText(me, txt);
+}
+void Label_draw(entity me)
+{
+       string t;
+       vector o;
+       if(me.disabled)
+               draw_alpha *= me.disabledAlpha;
+
+       if(me.textEntity)
+       {
+               t = me.textEntity.toString(me.textEntity);
+               if(t != me.currentText)
+               {
+                       if(me.currentText)
+                               strunzone(me.currentText);
+                       me.currentText = strzone(t);
+                       me.recalcPos = 1;
+               }
+       }
+       else
+               t = me.text;
+
+       if(me.recalcPos)
+               me.recalcPositionWithText(me, t);
+
+       if(me.fontSize)
+               if(t)
+               {
+                       vector dfs;
+                       vector fs;
+
+                       if(me.isBold)
+                               draw_beginBoldFont();
+
+                       // set up variables to draw in condensed size, but use hinting for original size
+                       fs = me.realFontSize;
+                       fs.x *= me.condenseFactor;
+
+                       dfs = draw_fontscale;
+                       draw_fontscale.x *= me.condenseFactor;
+
+                       if(me.allowCut) // FIXME allowCut incompatible with align != 0
+                               draw_Text(me.realOrigin, draw_TextShortenToWidth(t, (1 - me.keepspaceLeft - me.keepspaceRight), me.allowColors, fs), fs, me.colorL, me.alpha, me.allowColors);
+                       else if(me.allowWrap) // FIXME allowWrap incompatible with align != 0
+                       {
+                               getWrappedLine_remaining = t;
+                               o = me.realOrigin;
+                               while(getWrappedLine_remaining)
+                               {
+                                       if (me.allowColors)
+                                               t = getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight), fs, draw_TextWidth_WithColors);
+                                       else
+                                               t = getWrappedLine((1 - me.keepspaceLeft - me.keepspaceRight), fs, draw_TextWidth_WithoutColors);
+                                       draw_Text(o, t, fs, me.colorL, me.alpha, me.allowColors);
+                                       o.y += me.realFontSize.y;
+                               }
+                       }
+                       else
+                               draw_Text(me.realOrigin, t, fs, me.colorL, me.alpha, me.allowColors);
+
+                       draw_fontscale = dfs;
+
+                       if(me.isBold)
+                               draw_endBoldFont();
+               }
+
+       SUPER(Label).draw(me);
+}
+#endif
diff --git a/qcsrc/menu/item/listbox.c b/qcsrc/menu/item/listbox.c
deleted file mode 100644 (file)
index d4eaab2..0000000
+++ /dev/null
@@ -1,384 +0,0 @@
-#ifdef INTERFACE
-CLASS(ListBox) EXTENDS(Item)
-       METHOD(ListBox, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(ListBox, configureListBox, void(entity, float, float))
-       METHOD(ListBox, draw, void(entity))
-       METHOD(ListBox, keyDown, float(entity, float, float, float))
-       METHOD(ListBox, mousePress, float(entity, vector))
-       METHOD(ListBox, mouseDrag, float(entity, vector))
-       METHOD(ListBox, mouseRelease, float(entity, vector))
-       METHOD(ListBox, focusLeave, void(entity))
-       ATTRIB(ListBox, focusable, float, 1)
-       ATTRIB(ListBox, selectedItem, float, 0)
-       ATTRIB(ListBox, size, vector, '0 0 0')
-       ATTRIB(ListBox, origin, vector, '0 0 0')
-       ATTRIB(ListBox, scrollPos, float, 0) // measured in window heights, fixed when needed
-       ATTRIB(ListBox, previousValue, float, 0)
-       ATTRIB(ListBox, pressed, float, 0) // 0 = normal, 1 = scrollbar dragging, 2 = item dragging, 3 = released
-       ATTRIB(ListBox, pressOffset, float, 0)
-
-       METHOD(ListBox, updateControlTopBottom, void(entity))
-       ATTRIB(ListBox, controlTop, float, 0)
-       ATTRIB(ListBox, controlBottom, float, 0)
-       ATTRIB(ListBox, controlWidth, float, 0)
-       ATTRIB(ListBox, dragScrollTimer, float, 0)
-       ATTRIB(ListBox, dragScrollPos, vector, '0 0 0')
-
-       ATTRIB(ListBox, src, string, string_null) // scrollbar
-       ATTRIB(ListBox, color, vector, '1 1 1')
-       ATTRIB(ListBox, color2, vector, '1 1 1')
-       ATTRIB(ListBox, colorC, vector, '1 1 1')
-       ATTRIB(ListBox, colorF, vector, '1 1 1')
-       ATTRIB(ListBox, tolerance, vector, '0 0 0') // drag tolerance
-       ATTRIB(ListBox, scrollbarWidth, float, 0) // pixels
-       ATTRIB(ListBox, nItems, float, 42)
-       ATTRIB(ListBox, itemHeight, float, 0)
-       ATTRIB(ListBox, colorBG, vector, '0 0 0')
-       ATTRIB(ListBox, alphaBG, float, 0)
-       METHOD(ListBox, drawListBoxItem, void(entity, float, vector, float)) // item number, width/height, selected
-       METHOD(ListBox, clickListBoxItem, void(entity, float, vector)) // item number, relative clickpos
-       METHOD(ListBox, setSelected, void(entity, float))
-
-       METHOD(ListBox, getLastFullyVisibleItemAtScrollPos, float(entity, float))
-       METHOD(ListBox, getFirstFullyVisibleItemAtScrollPos, float(entity, float))
-
-       // NOTE: override these four methods if you want variable sized list items
-       METHOD(ListBox, getTotalHeight, float(entity))
-       METHOD(ListBox, getItemAtPos, float(entity, float))
-       METHOD(ListBox, getItemStart, float(entity, float))
-       METHOD(ListBox, getItemHeight, float(entity, float))
-       // NOTE: if getItemAt* are overridden, it may make sense to cache the
-       // start and height of the last item returned by getItemAtPos and fast
-       // track returning their properties for getItemStart and getItemHeight.
-       // The "hot" code path calls getItemAtPos first, then will query
-       // getItemStart and getItemHeight on it soon.
-       // When overriding, the following consistency rules must hold:
-       // getTotalHeight() == SUM(getItemHeight(i), i, 0, me.nItems-1)
-       // getItemStart(i+1) == getItemStart(i) + getItemHeight(i)
-       //   for 0 <= i < me.nItems-1
-       // getItemStart(0) == 0
-       // getItemStart(getItemAtPos(p)) <= p
-       //   if p >= 0
-       // getItemAtPos(p) == 0
-       //   if p < 0
-       // getItemStart(getItemAtPos(p)) + getItemHeight(getItemAtPos(p)) > p
-       //   if p < getTotalHeigt()
-       // getItemAtPos(p) == me.nItems - 1
-       //   if p >= getTotalHeight()
-ENDCLASS(ListBox)
-#endif
-
-#ifdef IMPLEMENTATION
-void ListBox_setSelected(entity me, float i)
-{
-       me.selectedItem = bound(0, i, me.nItems - 1);
-}
-void ListBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(ListBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-       me.controlWidth = me.scrollbarWidth / absSize_x;
-}
-void ListBox_configureListBox(entity me, float theScrollbarWidth, float theItemHeight)
-{
-       me.scrollbarWidth = theScrollbarWidth;
-       me.itemHeight = theItemHeight;
-}
-
-float ListBox_getTotalHeight(entity me)
-{
-       return me.nItems * me.itemHeight;
-}
-float ListBox_getItemAtPos(entity me, float pos)
-{
-       return floor(pos / me.itemHeight);
-}
-float ListBox_getItemStart(entity me, float i)
-{
-       return me.itemHeight * i;
-}
-float ListBox_getItemHeight(entity me, float i)
-{
-       return me.itemHeight;
-}
-
-float ListBox_getLastFullyVisibleItemAtScrollPos(entity me, float pos)
-{
-       return me.getItemAtPos(me, pos + 1.001) - 1;
-}
-float ListBox_getFirstFullyVisibleItemAtScrollPos(entity me, float pos)
-{
-       return me.getItemAtPos(me, pos - 0.001) + 1;
-}
-float ListBox_keyDown(entity me, float key, float ascii, float shift)
-{
-       me.dragScrollTimer = time;
-       if(key == K_MWHEELUP)
-       {
-               me.scrollPos = max(me.scrollPos - 0.5, 0);
-               me.setSelected(me, min(me.selectedItem, me.getLastFullyVisibleItemAtScrollPos(me, me.scrollPos)));
-       }
-       else if(key == K_MWHEELDOWN)
-       {
-               me.scrollPos = min(me.scrollPos + 0.5, me.getTotalHeight(me) - 1);
-               me.setSelected(me, max(me.selectedItem, me.getFirstFullyVisibleItemAtScrollPos(me, me.scrollPos)));
-       }
-       else if(key == K_PGUP || key == K_KP_PGUP)
-       {
-               float i = me.selectedItem;
-               float a = me.getItemHeight(me, i);
-               for(;;)
-               {
-                       --i;
-                       if (i < 0)
-                               break;
-                       a += me.getItemHeight(me, i);
-                       if (a >= 1)
-                               break;
-               }
-               me.setSelected(me, i + 1);
-       }
-       else if(key == K_PGDN || key == K_KP_PGDN)
-       {
-               float i = me.selectedItem;
-               float a = me.getItemHeight(me, i);
-               for(;;)
-               {
-                       ++i;
-                       if (i >= me.nItems)
-                               break;
-                       a += me.getItemHeight(me, i);
-                       if (a >= 1)
-                               break;
-               }
-               me.setSelected(me, i - 1);
-       }
-       else if(key == K_UPARROW || key == K_KP_UPARROW)
-               me.setSelected(me, me.selectedItem - 1);
-       else if(key == K_DOWNARROW || key == K_KP_DOWNARROW)
-               me.setSelected(me, me.selectedItem + 1);
-       else if(key == K_HOME || key == K_KP_HOME)
-       {
-               me.scrollPos = 0;
-               me.setSelected(me, 0);
-       }
-       else if(key == K_END || key == K_KP_END)
-       {
-               me.scrollPos = max(0, me.getTotalHeight(me) - 1);
-               me.setSelected(me, me.nItems - 1);
-       }
-       else
-               return 0;
-       return 1;
-}
-float ListBox_mouseDrag(entity me, vector pos)
-{
-       float hit;
-       float i;
-       me.updateControlTopBottom(me);
-       me.dragScrollPos = pos;
-       if(me.pressed == 1)
-       {
-               hit = 1;
-               if(pos_x < 1 - me.controlWidth - me.tolerance_y * me.controlWidth) hit = 0;
-               if(pos_y < 0 - me.tolerance_x) hit = 0;
-               if(pos_x >= 1 + me.tolerance_y * me.controlWidth) hit = 0;
-               if(pos_y >= 1 + me.tolerance_x) hit = 0;
-               if(hit)
-               {
-                       // calculate new pos to v
-                       float d;
-                       d = (pos_y - me.pressOffset) / (1 - (me.controlBottom - me.controlTop)) * (me.getTotalHeight(me) - 1);
-                       me.scrollPos = me.previousValue + d;
-               }
-               else
-                       me.scrollPos = me.previousValue;
-               me.scrollPos = min(me.scrollPos, me.getTotalHeight(me) - 1);
-               me.scrollPos = max(me.scrollPos, 0);
-               i = min(me.selectedItem, me.getLastFullyVisibleItemAtScrollPos(me, me.scrollPos));
-               i = max(i, ListBox_getFirstFullyVisibleItemAtScrollPos(me, me.scrollPos));
-               me.setSelected(me, i);
-       }
-       else if(me.pressed == 2)
-       {
-               me.setSelected(me, me.getItemAtPos(me, me.scrollPos + pos_y));
-       }
-       return 1;
-}
-float ListBox_mousePress(entity me, vector pos)
-{
-       if(pos_x < 0) return 0;
-       if(pos_y < 0) return 0;
-       if(pos_x >= 1) return 0;
-       if(pos_y >= 1) return 0;
-       me.dragScrollPos = pos;
-       me.updateControlTopBottom(me);
-       me.dragScrollTimer = time;
-       if(pos_x >= 1 - me.controlWidth)
-       {
-               // if hit, set me.pressed, otherwise scroll by one page
-               if(pos_y < me.controlTop)
-               {
-                       // page up
-                       me.scrollPos = max(me.scrollPos - 1, 0);
-                       me.setSelected(me, min(me.selectedItem, ListBox_getLastFullyVisibleItemAtScrollPos(me, me.scrollPos)));
-               }
-               else if(pos_y > me.controlBottom)
-               {
-                       // page down
-                       me.scrollPos = min(me.scrollPos + 1, me.getTotalHeight(me) - 1);
-                       me.setSelected(me, max(me.selectedItem, ListBox_getFirstFullyVisibleItemAtScrollPos(me, me.scrollPos)));
-               }
-               else
-               {
-                       me.pressed = 1;
-                       me.pressOffset = pos_y;
-                       me.previousValue = me.scrollPos;
-               }
-       }
-       else
-       {
-               // continue doing that while dragging (even when dragging outside). When releasing, forward the click to the then selected item.
-               me.pressed = 2;
-               // an item has been clicked. Select it, ...
-               me.setSelected(me, me.getItemAtPos(me, me.scrollPos + pos_y));
-       }
-       return 1;
-}
-float ListBox_mouseRelease(entity me, vector pos)
-{
-       if(me.pressed == 1)
-       {
-               // slider dragging mode
-               // in that case, nothing happens on releasing
-       }
-       else if(me.pressed == 2)
-       {
-               me.pressed = 3; // do that here, so setSelected can know the mouse has been released
-               // item dragging mode
-               // select current one one last time...
-               me.setSelected(me, me.getItemAtPos(me, me.scrollPos + pos_y));
-               // and give it a nice click event
-               if(me.nItems > 0)
-               {
-                       me.clickListBoxItem(me, me.selectedItem, globalToBox(pos, eY * (me.getItemStart(me, me.selectedItem) - me.scrollPos), eX * (1 - me.controlWidth) + eY * me.getItemHeight(me, me.selectedItem)));
-               }
-       }
-       me.pressed = 0;
-       return 1;
-}
-void ListBox_focusLeave(entity me)
-{
-       // Reset the var pressed in case listbox loses focus
-       // by a mouse click on an item of the list
-       // for example showing a dialog on right click
-       me.pressed = 0;
-}
-void ListBox_updateControlTopBottom(entity me)
-{
-       float f;
-       // scrollPos is in 0..1 and indicates where the "page" currently shown starts.
-       if(me.getTotalHeight(me) <= 1)
-       {
-               // we don't need no stinkin' scrollbar, we don't need no view control...
-               me.controlTop = 0;
-               me.controlBottom = 1;
-               me.scrollPos = 0;
-       }
-       else
-       {
-               if(frametime) // only do this in draw frames
-               {
-                       if(me.dragScrollTimer < time)
-                       {
-                               float save;
-                               save = me.scrollPos;
-                               // if selected item is below listbox, increase scrollpos so it is in
-                               me.scrollPos = max(me.scrollPos, me.getItemStart(me, me.selectedItem) + me.getItemHeight(me, me.selectedItem) - 1);
-                               // if selected item is above listbox, decrease scrollpos so it is in
-                               me.scrollPos = min(me.scrollPos, me.getItemStart(me, me.selectedItem));
-                               if(me.scrollPos != save)
-                                       me.dragScrollTimer = time + 0.2;
-                       }
-               }
-               // if scroll pos is below end of list, fix it
-               me.scrollPos = min(me.scrollPos, me.getTotalHeight(me) - 1);
-               // if scroll pos is above beginning of list, fix it
-               me.scrollPos = max(me.scrollPos, 0);
-               // now that we know where the list is scrolled to, find out where to draw the control
-               me.controlTop = max(0, me.scrollPos / me.getTotalHeight(me));
-               me.controlBottom = min((me.scrollPos + 1) / me.getTotalHeight(me), 1);
-
-               float minfactor;
-               minfactor = 2 * me.controlWidth / me.size_y * me.size_x;
-               f = me.controlBottom - me.controlTop;
-               if(f < minfactor) // FIXME good default?
-               {
-                       // f * X + 1 * (1-X) = minfactor
-                       // (f - 1) * X + 1 = minfactor
-                       // (f - 1) * X = minfactor - 1
-                       // X = (minfactor - 1) / (f - 1)
-                       f = (minfactor - 1) / (f - 1);
-                       me.controlTop = me.controlTop * f + 0 * (1 - f);
-                       me.controlBottom = me.controlBottom * f + 1 * (1 - f);
-               }
-       }
-}
-void ListBox_draw(entity me)
-{
-       float i;
-       vector absSize, fillSize = '0 0 0';
-       vector oldshift, oldscale;
-       if(me.pressed == 2)
-               me.mouseDrag(me, me.dragScrollPos); // simulate mouseDrag event
-       me.updateControlTopBottom(me);
-       fillSize_x = (1 - me.controlWidth);
-       if(me.alphaBG)
-               draw_Fill('0 0 0', '0 1 0' + fillSize, me.colorBG, me.alphaBG);
-       if(me.controlWidth)
-       {
-               draw_VertButtonPicture(eX * (1 - me.controlWidth), strcat(me.src, "_s"), eX * me.controlWidth + eY, me.color2, 1);
-               if(me.getTotalHeight(me) > 1)
-               {
-                       vector o, s;
-                       o = eX * (1 - me.controlWidth) + eY * me.controlTop;
-                       s = eX * me.controlWidth + eY * (me.controlBottom - me.controlTop);
-                       if(me.pressed == 1)
-                               draw_VertButtonPicture(o, strcat(me.src, "_c"), s, me.colorC, 1);
-                       else if(me.focused)
-                               draw_VertButtonPicture(o, strcat(me.src, "_f"), s, me.colorF, 1);
-                       else
-                               draw_VertButtonPicture(o, strcat(me.src, "_n"), s, me.color, 1);
-               }
-       }
-       draw_SetClip();
-       oldshift = draw_shift;
-       oldscale = draw_scale;
-       float y;
-       i = me.getItemAtPos(me, me.scrollPos);
-       y = me.getItemStart(me, i) - me.scrollPos;
-       for(; i < me.nItems && y < 1; ++i)
-       {
-               draw_shift = boxToGlobal(eY * y, oldshift, oldscale);
-               vector relSize = eX * (1 - me.controlWidth) + eY * me.getItemHeight(me, i);
-               absSize = boxToGlobalSize(relSize, me.size);
-               draw_scale = boxToGlobalSize(relSize, oldscale);
-               me.drawListBoxItem(me, i, absSize, (me.selectedItem == i));
-               y += relSize_y;
-       }
-       draw_ClearClip();
-
-       draw_shift = oldshift;
-       draw_scale = oldscale;
-       SUPER(ListBox).draw(me);
-}
-
-void ListBox_clickListBoxItem(entity me, float i, vector where)
-{
-       // itemclick, itemclick, does whatever itemclick does
-}
-
-void ListBox_drawListBoxItem(entity me, float i, vector absSize, float selected)
-{
-       draw_Text('0 0 0', sprintf(_("Item %d"), i), eX * (8 / absSize_x) + eY * (8 / absSize_y), (selected ? '0 1 0' : '1 1 1'), 1, 0);
-}
-#endif
diff --git a/qcsrc/menu/item/listbox.qc b/qcsrc/menu/item/listbox.qc
new file mode 100644 (file)
index 0000000..178b12b
--- /dev/null
@@ -0,0 +1,403 @@
+#ifdef INTERFACE
+CLASS(ListBox) EXTENDS(Item)
+       METHOD(ListBox, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(ListBox, configureListBox, void(entity, float, float))
+       METHOD(ListBox, draw, void(entity))
+       METHOD(ListBox, keyDown, float(entity, float, float, float))
+       METHOD(ListBox, mousePress, float(entity, vector))
+       METHOD(ListBox, mouseDrag, float(entity, vector))
+       METHOD(ListBox, mouseRelease, float(entity, vector))
+       METHOD(ListBox, focusLeave, void(entity))
+       ATTRIB(ListBox, focusable, float, 1)
+       ATTRIB(ListBox, allowFocusSound, float, 1)
+       ATTRIB(ListBox, selectedItem, float, 0)
+       ATTRIB(ListBox, size, vector, '0 0 0')
+       ATTRIB(ListBox, origin, vector, '0 0 0')
+       ATTRIB(ListBox, scrollPos, float, 0) // measured in window heights, fixed when needed
+       ATTRIB(ListBox, previousValue, float, 0)
+       ATTRIB(ListBox, pressed, float, 0) // 0 = normal, 1 = scrollbar dragging, 2 = item dragging, 3 = released
+       ATTRIB(ListBox, pressOffset, float, 0)
+
+       METHOD(ListBox, updateControlTopBottom, void(entity))
+       ATTRIB(ListBox, controlTop, float, 0)
+       ATTRIB(ListBox, controlBottom, float, 0)
+       ATTRIB(ListBox, controlWidth, float, 0)
+       ATTRIB(ListBox, dragScrollTimer, float, 0)
+       ATTRIB(ListBox, dragScrollPos, vector, '0 0 0')
+
+       ATTRIB(ListBox, src, string, string_null) // scrollbar
+       ATTRIB(ListBox, color, vector, '1 1 1')
+       ATTRIB(ListBox, color2, vector, '1 1 1')
+       ATTRIB(ListBox, colorC, vector, '1 1 1')
+       ATTRIB(ListBox, colorF, vector, '1 1 1')
+       ATTRIB(ListBox, tolerance, vector, '0 0 0') // drag tolerance
+       ATTRIB(ListBox, scrollbarWidth, float, 0) // pixels
+       ATTRIB(ListBox, nItems, float, 42)
+       ATTRIB(ListBox, itemHeight, float, 0)
+       ATTRIB(ListBox, colorBG, vector, '0 0 0')
+       ATTRIB(ListBox, alphaBG, float, 0)
+
+       ATTRIB(ListBox, lastClickedItem, float, -1)
+       ATTRIB(ListBox, lastClickedTime, float, 0)
+
+       METHOD(ListBox, drawListBoxItem, void(entity, float, vector, float)) // item number, width/height, selected
+       METHOD(ListBox, clickListBoxItem, void(entity, float, vector)) // item number, relative clickpos
+       METHOD(ListBox, doubleClickListBoxItem, void(entity, float, vector)) // item number, relative clickpos
+       METHOD(ListBox, setSelected, void(entity, float))
+
+       METHOD(ListBox, getLastFullyVisibleItemAtScrollPos, float(entity, float))
+       METHOD(ListBox, getFirstFullyVisibleItemAtScrollPos, float(entity, float))
+
+       // NOTE: override these four methods if you want variable sized list items
+       METHOD(ListBox, getTotalHeight, float(entity))
+       METHOD(ListBox, getItemAtPos, float(entity, float))
+       METHOD(ListBox, getItemStart, float(entity, float))
+       METHOD(ListBox, getItemHeight, float(entity, float))
+       // NOTE: if getItemAt* are overridden, it may make sense to cache the
+       // start and height of the last item returned by getItemAtPos and fast
+       // track returning their properties for getItemStart and getItemHeight.
+       // The "hot" code path calls getItemAtPos first, then will query
+       // getItemStart and getItemHeight on it soon.
+       // When overriding, the following consistency rules must hold:
+       // getTotalHeight() == SUM(getItemHeight(i), i, 0, me.nItems-1)
+       // getItemStart(i+1) == getItemStart(i) + getItemHeight(i)
+       //   for 0 <= i < me.nItems-1
+       // getItemStart(0) == 0
+       // getItemStart(getItemAtPos(p)) <= p
+       //   if p >= 0
+       // getItemAtPos(p) == 0
+       //   if p < 0
+       // getItemStart(getItemAtPos(p)) + getItemHeight(getItemAtPos(p)) > p
+       //   if p < getTotalHeigt()
+       // getItemAtPos(p) == me.nItems - 1
+       //   if p >= getTotalHeight()
+ENDCLASS(ListBox)
+#endif
+
+#ifdef IMPLEMENTATION
+void ListBox_setSelected(entity me, float i)
+{
+       me.selectedItem = bound(0, i, me.nItems - 1);
+}
+void ListBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(ListBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+       me.controlWidth = me.scrollbarWidth / absSize.x;
+}
+void ListBox_configureListBox(entity me, float theScrollbarWidth, float theItemHeight)
+{
+       me.scrollbarWidth = theScrollbarWidth;
+       me.itemHeight = theItemHeight;
+}
+
+float ListBox_getTotalHeight(entity me)
+{
+       return me.nItems * me.itemHeight;
+}
+float ListBox_getItemAtPos(entity me, float pos)
+{
+       return floor(pos / me.itemHeight);
+}
+float ListBox_getItemStart(entity me, float i)
+{
+       return me.itemHeight * i;
+}
+float ListBox_getItemHeight(entity me, float i)
+{
+       return me.itemHeight;
+}
+
+float ListBox_getLastFullyVisibleItemAtScrollPos(entity me, float pos)
+{
+       return me.getItemAtPos(me, pos + 1.001) - 1;
+}
+float ListBox_getFirstFullyVisibleItemAtScrollPos(entity me, float pos)
+{
+       return me.getItemAtPos(me, pos - 0.001) + 1;
+}
+float ListBox_keyDown(entity me, float key, float ascii, float shift)
+{
+       me.dragScrollTimer = time;
+       if(key == K_MWHEELUP)
+       {
+               me.scrollPos = max(me.scrollPos - 0.5, 0);
+               me.setSelected(me, min(me.selectedItem, me.getLastFullyVisibleItemAtScrollPos(me, me.scrollPos)));
+       }
+       else if(key == K_MWHEELDOWN)
+       {
+               me.scrollPos = min(me.scrollPos + 0.5, me.getTotalHeight(me) - 1);
+               me.setSelected(me, max(me.selectedItem, me.getFirstFullyVisibleItemAtScrollPos(me, me.scrollPos)));
+       }
+       else if(key == K_PGUP || key == K_KP_PGUP)
+       {
+               float i = me.selectedItem;
+               float a = me.getItemHeight(me, i);
+               for (;;)
+               {
+                       --i;
+                       if (i < 0)
+                               break;
+                       a += me.getItemHeight(me, i);
+                       if (a >= 1)
+                               break;
+               }
+               me.setSelected(me, i + 1);
+       }
+       else if(key == K_PGDN || key == K_KP_PGDN)
+       {
+               float i = me.selectedItem;
+               float a = me.getItemHeight(me, i);
+               for (;;)
+               {
+                       ++i;
+                       if (i >= me.nItems)
+                               break;
+                       a += me.getItemHeight(me, i);
+                       if (a >= 1)
+                               break;
+               }
+               me.setSelected(me, i - 1);
+       }
+       else if(key == K_UPARROW || key == K_KP_UPARROW)
+               me.setSelected(me, me.selectedItem - 1);
+       else if(key == K_DOWNARROW || key == K_KP_DOWNARROW)
+               me.setSelected(me, me.selectedItem + 1);
+       else if(key == K_HOME || key == K_KP_HOME)
+       {
+               me.scrollPos = 0;
+               me.setSelected(me, 0);
+       }
+       else if(key == K_END || key == K_KP_END)
+       {
+               me.scrollPos = max(0, me.getTotalHeight(me) - 1);
+               me.setSelected(me, me.nItems - 1);
+       }
+       else
+               return 0;
+       return 1;
+}
+float ListBox_mouseDrag(entity me, vector pos)
+{
+       float hit;
+       float i;
+       me.updateControlTopBottom(me);
+       me.dragScrollPos = pos;
+       if(me.pressed == 1)
+       {
+               hit = 1;
+               if(pos.x < 1 - me.controlWidth - me.tolerance.y * me.controlWidth) hit = 0;
+               if(pos.y < 0 - me.tolerance.x) hit = 0;
+               if(pos.x >= 1 + me.tolerance.y * me.controlWidth) hit = 0;
+               if(pos.y >= 1 + me.tolerance.x) hit = 0;
+               if(hit)
+               {
+                       // calculate new pos to v
+                       float d;
+                       d = (pos.y - me.pressOffset) / (1 - (me.controlBottom - me.controlTop)) * (me.getTotalHeight(me) - 1);
+                       me.scrollPos = me.previousValue + d;
+               }
+               else
+                       me.scrollPos = me.previousValue;
+               me.scrollPos = min(me.scrollPos, me.getTotalHeight(me) - 1);
+               me.scrollPos = max(me.scrollPos, 0);
+               i = min(me.selectedItem, me.getLastFullyVisibleItemAtScrollPos(me, me.scrollPos));
+               i = max(i, ListBox_getFirstFullyVisibleItemAtScrollPos(me, me.scrollPos));
+               me.setSelected(me, i);
+       }
+       else if(me.pressed == 2)
+       {
+               me.setSelected(me, me.getItemAtPos(me, me.scrollPos + pos.y));
+       }
+       return 1;
+}
+float ListBox_mousePress(entity me, vector pos)
+{
+       if(pos.x < 0) return 0;
+       if(pos.y < 0) return 0;
+       if(pos.x >= 1) return 0;
+       if(pos.y >= 1) return 0;
+       me.dragScrollPos = pos;
+       me.updateControlTopBottom(me);
+       me.dragScrollTimer = time;
+       if(pos.x >= 1 - me.controlWidth)
+       {
+               // if hit, set me.pressed, otherwise scroll by one page
+               if(pos.y < me.controlTop)
+               {
+                       // page up
+                       me.scrollPos = max(me.scrollPos - 1, 0);
+                       me.setSelected(me, min(me.selectedItem, ListBox_getLastFullyVisibleItemAtScrollPos(me, me.scrollPos)));
+               }
+               else if(pos.y > me.controlBottom)
+               {
+                       // page down
+                       me.scrollPos = min(me.scrollPos + 1, me.getTotalHeight(me) - 1);
+                       me.setSelected(me, max(me.selectedItem, ListBox_getFirstFullyVisibleItemAtScrollPos(me, me.scrollPos)));
+               }
+               else
+               {
+                       me.pressed = 1;
+                       me.pressOffset = pos.y;
+                       me.previousValue = me.scrollPos;
+               }
+       }
+       else
+       {
+               // continue doing that while dragging (even when dragging outside). When releasing, forward the click to the then selected item.
+               me.pressed = 2;
+               // an item has been clicked. Select it, ...
+               me.setSelected(me, me.getItemAtPos(me, me.scrollPos + pos.y));
+       }
+       return 1;
+}
+float ListBox_mouseRelease(entity me, vector pos)
+{
+       if(me.pressed == 1)
+       {
+               // slider dragging mode
+               // in that case, nothing happens on releasing
+       }
+       else if(me.pressed == 2)
+       {
+               me.pressed = 3; // do that here, so setSelected can know the mouse has been released
+               // item dragging mode
+               // select current one one last time...
+               me.setSelected(me, me.getItemAtPos(me, me.scrollPos + pos.y));
+               // and give it a nice click event
+               if(me.nItems > 0)
+               {
+                       vector where = globalToBox(pos, eY * (me.getItemStart(me, me.selectedItem) - me.scrollPos), eX * (1 - me.controlWidth) + eY * me.getItemHeight(me, me.selectedItem));
+
+                       if((me.selectedItem == me.lastClickedItem) && (time < me.lastClickedTime + 0.3))
+                               me.doubleClickListBoxItem(me, me.selectedItem, where);
+                       else
+                               me.clickListBoxItem(me, me.selectedItem, where);
+
+                       me.lastClickedItem = me.selectedItem;
+                       me.lastClickedTime = time;
+               }
+       }
+       me.pressed = 0;
+       return 1;
+}
+void ListBox_focusLeave(entity me)
+{
+       // Reset the var pressed in case listbox loses focus
+       // by a mouse click on an item of the list
+       // for example showing a dialog on right click
+       me.pressed = 0;
+}
+void ListBox_updateControlTopBottom(entity me)
+{
+       float f;
+       // scrollPos is in 0..1 and indicates where the "page" currently shown starts.
+       if(me.getTotalHeight(me) <= 1)
+       {
+               // we don't need no stinkin' scrollbar, we don't need no view control...
+               me.controlTop = 0;
+               me.controlBottom = 1;
+               me.scrollPos = 0;
+       }
+       else
+       {
+               if(frametime) // only do this in draw frames
+               {
+                       if(me.dragScrollTimer < time)
+                       {
+                               float save;
+                               save = me.scrollPos;
+                               // if selected item is below listbox, increase scrollpos so it is in
+                               me.scrollPos = max(me.scrollPos, me.getItemStart(me, me.selectedItem) + me.getItemHeight(me, me.selectedItem) - 1);
+                               // if selected item is above listbox, decrease scrollpos so it is in
+                               me.scrollPos = min(me.scrollPos, me.getItemStart(me, me.selectedItem));
+                               if(me.scrollPos != save)
+                                       me.dragScrollTimer = time + 0.2;
+                       }
+               }
+               // if scroll pos is below end of list, fix it
+               me.scrollPos = min(me.scrollPos, me.getTotalHeight(me) - 1);
+               // if scroll pos is above beginning of list, fix it
+               me.scrollPos = max(me.scrollPos, 0);
+               // now that we know where the list is scrolled to, find out where to draw the control
+               me.controlTop = max(0, me.scrollPos / me.getTotalHeight(me));
+               me.controlBottom = min((me.scrollPos + 1) / me.getTotalHeight(me), 1);
+
+               float minfactor;
+               minfactor = 2 * me.controlWidth / me.size.y * me.size.x;
+               f = me.controlBottom - me.controlTop;
+               if(f < minfactor) // FIXME good default?
+               {
+                       // f * X + 1 * (1-X) = minfactor
+                       // (f - 1) * X + 1 = minfactor
+                       // (f - 1) * X = minfactor - 1
+                       // X = (minfactor - 1) / (f - 1)
+                       f = (minfactor - 1) / (f - 1);
+                       me.controlTop = me.controlTop * f + 0 * (1 - f);
+                       me.controlBottom = me.controlBottom * f + 1 * (1 - f);
+               }
+       }
+}
+void ListBox_draw(entity me)
+{
+       float i;
+       vector absSize, fillSize = '0 0 0';
+       vector oldshift, oldscale;
+       if(me.pressed == 2)
+               me.mouseDrag(me, me.dragScrollPos); // simulate mouseDrag event
+       me.updateControlTopBottom(me);
+       fillSize.x = (1 - me.controlWidth);
+       if(me.alphaBG)
+               draw_Fill('0 0 0', '0 1 0' + fillSize, me.colorBG, me.alphaBG);
+       if(me.controlWidth)
+       {
+               draw_VertButtonPicture(eX * (1 - me.controlWidth), strcat(me.src, "_s"), eX * me.controlWidth + eY, me.color2, 1);
+               if(me.getTotalHeight(me) > 1)
+               {
+                       vector o, s;
+                       o = eX * (1 - me.controlWidth) + eY * me.controlTop;
+                       s = eX * me.controlWidth + eY * (me.controlBottom - me.controlTop);
+                       if(me.pressed == 1)
+                               draw_VertButtonPicture(o, strcat(me.src, "_c"), s, me.colorC, 1);
+                       else if(me.focused)
+                               draw_VertButtonPicture(o, strcat(me.src, "_f"), s, me.colorF, 1);
+                       else
+                               draw_VertButtonPicture(o, strcat(me.src, "_n"), s, me.color, 1);
+               }
+       }
+       draw_SetClip();
+       oldshift = draw_shift;
+       oldscale = draw_scale;
+       float y;
+       i = me.getItemAtPos(me, me.scrollPos);
+       y = me.getItemStart(me, i) - me.scrollPos;
+       for (; i < me.nItems && y < 1; ++i)
+       {
+               draw_shift = boxToGlobal(eY * y, oldshift, oldscale);
+               vector relSize = eX * (1 - me.controlWidth) + eY * me.getItemHeight(me, i);
+               absSize = boxToGlobalSize(relSize, me.size);
+               draw_scale = boxToGlobalSize(relSize, oldscale);
+               me.drawListBoxItem(me, i, absSize, (me.selectedItem == i));
+               y += relSize.y;
+       }
+       draw_ClearClip();
+
+       draw_shift = oldshift;
+       draw_scale = oldscale;
+       SUPER(ListBox).draw(me);
+}
+
+void ListBox_clickListBoxItem(entity me, float i, vector where)
+{
+       // template method
+}
+
+void ListBox_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       // template method
+}
+
+void ListBox_drawListBoxItem(entity me, float i, vector absSize, float selected)
+{
+       draw_Text('0 0 0', sprintf(_("Item %d"), i), eX * (8 / absSize.x) + eY * (8 / absSize.y), (selected ? '0 1 0' : '1 1 1'), 1, 0);
+}
+#endif
diff --git a/qcsrc/menu/item/modalcontroller.c b/qcsrc/menu/item/modalcontroller.c
deleted file mode 100644 (file)
index 8a025cb..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-#ifdef INTERFACE
-CLASS(ModalController) EXTENDS(Container)
-       METHOD(ModalController, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(ModalController, draw, void(entity))
-       METHOD(ModalController, showChild, void(entity, entity, vector, vector, float))
-       METHOD(ModalController, hideChild, void(entity, entity, float))
-       METHOD(ModalController, hideAll, void(entity, float))
-       METHOD(ModalController, addItem, void(entity, entity, vector, vector, float))
-       METHOD(ModalController, addTab, void(entity, entity, entity))
-
-       METHOD(ModalController, initializeDialog, void(entity, entity))
-
-       METHOD(ModalController, switchState, void(entity, entity, float, float))
-       ATTRIB(ModalController, origin, vector, '0 0 0')
-       ATTRIB(ModalController, size, vector, '0 0 0')
-       ATTRIB(ModalController, previousButton, entity, NULL)
-       ATTRIB(ModalController, fadedAlpha, float, 0.3)
-ENDCLASS(ModalController)
-
-.entity tabSelectingButton;
-.vector origin;
-.vector size;
-void TabButton_Click(entity button, entity tab); // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
-void DialogOpenButton_Click(entity button, entity tab); // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
-void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize);
-void DialogCloseButton_Click(entity button, entity tab); // assumes a button has set the above fields to the tab to close
-#endif
-
-#ifdef IMPLEMENTATION
-
-// modal dialog controller
-// handles a stack of dialog elements
-// each element can have one of the following states:
-//   0: hidden (fading out)
-//   1: visible (zooming in)
-//   2: greyed out (inactive)
-// While an animation is running, no item has focus. When an animation is done,
-// the topmost item gets focus.
-// The items are assumed to be added in overlapping order, that is, the lowest
-// window must get added first.
-//
-// Possible uses:
-// - to control a modal dialog:
-//   - show modal dialog: me.showChild(me, childItem, buttonAbsOrigin, buttonAbsSize, 0) // childItem also gets focus
-//   - dismiss modal dialog: me.hideChild(me, childItem, 0) // childItem fades out and relinquishes focus
-//   - show first screen in m_show: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
-// - to show a temporary dialog instead of the menu (teamselect): me.hideAll(me, 1); me.showChild(me, teamSelectDialog, '0 0 0', '0 0 0', 1);
-// - as a tabbed dialog control:
-//   - to initialize: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
-//   - to show a tab: me.hideChild(me, currentTab, 0); me.showChild(me, newTab, buttonAbsOrigin, buttonAbsSize, 0);
-
-.vector ModalController_initialSize;
-.vector ModalController_initialOrigin;
-.vector ModalController_initialFontScale;
-.float ModalController_initialAlpha;
-.vector ModalController_buttonSize;
-.vector ModalController_buttonOrigin;
-.float ModalController_state;
-.float ModalController_factor;
-.entity ModalController_controllingButton;
-
-void ModalController_initializeDialog(entity me, entity root)
-{
-       me.hideAll(me, 1);
-       me.showChild(me, root, '0 0 0', '0 0 0', 1); // someone else animates for us
-}
-
-void TabButton_Click(entity button, entity tab)
-{
-       if(tab.ModalController_state == 1)
-               return;
-       tab.parent.hideAll(tab.parent, 0);
-       button.forcePressed = 1;
-       tab.ModalController_controllingButton = button;
-       tab.parent.showChild(tab.parent, tab, button.origin, button.size, 0);
-}
-
-void DialogOpenButton_Click(entity button, entity tab)
-{
-       DialogOpenButton_Click_withCoords(button, tab, button.origin, button.size);
-}
-
-void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize)
-{
-       if(tab.ModalController_state)
-               return;
-       if(button)
-               button.forcePressed = 1;
-       if(tab.parent.focusedChild)
-               tab.parent.focusedChild.saveFocus(tab.parent.focusedChild);
-       tab.ModalController_controllingButton = button;
-       tab.parent.showChild(tab.parent, tab, theOrigin, theSize, 0);
-}
-
-void DialogCloseButton_Click(entity button, entity tab)
-{
-       tab.parent.hideChild(tab.parent, tab, 0);
-}
-
-void ModalController_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.resizeNotifyLie(me, relOrigin, relSize, absOrigin, absSize, ModalController_initialOrigin, ModalController_initialSize, ModalController_initialFontScale);
-}
-
-void ModalController_switchState(entity me, entity other, float state, float skipAnimation)
-{
-       float previousState;
-       previousState = other.ModalController_state;
-       if(state == previousState && !skipAnimation)
-               return;
-       other.ModalController_state = state;
-       switch(state)
-       {
-               case 0:
-                       other.ModalController_factor = 1 - other.Container_alpha / other.ModalController_initialAlpha;
-                       // fading out
-                       break;
-               case 1:
-                       other.ModalController_factor = other.Container_alpha / other.ModalController_initialAlpha;
-                       if(previousState == 0 && !skipAnimation)
-                       {
-                               other.Container_origin = other.ModalController_buttonOrigin;
-                               other.Container_size = other.ModalController_buttonSize;
-                       }
-                       // zooming in
-                       break;
-               case 2:
-                       other.ModalController_factor = bound(0, (1 - other.Container_alpha / other.ModalController_initialAlpha) / me.fadedAlpha, 1);
-                       // fading out halfway
-                       break;
-       }
-       if(skipAnimation)
-               other.ModalController_factor = 1;
-}
-
-void ModalController_draw(entity me)
-{
-       entity e;
-       entity front;
-       float animating;
-       float f; // animation factor
-       float df; // animation step size
-       float prevFactor, targetFactor;
-       vector targetOrigin, targetSize; float targetAlpha;
-       vector fs;
-       animating = 0;
-
-       front = world;
-       for(e = me.firstChild; e; e = e.nextSibling)
-               if(e.ModalController_state)
-               {
-                       if(front)
-                               me.switchState(me, front, 2, 0);
-                       front = e;
-               }
-       if(front)
-               me.switchState(me, front, 1, 0);
-
-       df = frametime * 3; // animation speed
-
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               f = (e.ModalController_factor = min(1, e.ModalController_factor + df));
-               if(e.ModalController_state)
-                       if(f < 1)
-                               animating = 1;
-
-               if(f < 1)
-               {
-                       prevFactor   = (1 - f) / (1 - f + df);
-                       targetFactor =     df  / (1 - f + df);
-               }
-               else
-               {
-                       prevFactor = 0;
-                       targetFactor = 1;
-               }
-
-               if(e.ModalController_state == 2)
-               {
-                       // fading out partially
-                       targetOrigin = e.Container_origin; // stay as is
-                       targetSize = e.Container_size; // stay as is
-                       targetAlpha = me.fadedAlpha * e.ModalController_initialAlpha;
-               }
-               else if(e.ModalController_state == 1)
-               {
-                       // zooming in
-                       targetOrigin = e.ModalController_initialOrigin;
-                       targetSize = e.ModalController_initialSize;
-                       targetAlpha = e.ModalController_initialAlpha;
-               }
-               else
-               {
-                       // fading out
-                       if(f < 1)
-                               animating = 1;
-                       targetOrigin = e.Container_origin; // stay as is
-                       targetSize = e.Container_size; // stay as is
-                       targetAlpha = 0;
-               }
-
-               if(f == 1)
-               {
-                       e.Container_origin = targetOrigin;
-                       e.Container_size = targetSize;
-                       me.setAlphaOf(me, e, targetAlpha);
-               }
-               else
-               {
-                       e.Container_origin = e.Container_origin * prevFactor + targetOrigin * targetFactor;
-                       e.Container_size   = e.Container_size   * prevFactor + targetSize   * targetFactor;
-                       me.setAlphaOf(me, e, e.Container_alpha  * prevFactor + targetAlpha  * targetFactor);
-               }
-               // assume: o == to * f_prev + X * (1 - f_prev)
-               // make:   o' = to * f  + X * (1 - f)
-               // -->
-               // X == (o - to * f_prev) / (1 - f_prev)
-               // o' = to * f + (o - to * f_prev) / (1 - f_prev) * (1 - f)
-               // --> (maxima)
-               // o' = (to * (f - f_prev) + o * (1 - f)) / (1 - f_prev)
-
-               fs = globalToBoxSize(e.Container_size, e.ModalController_initialSize);
-               e.Container_fontscale_x = fs_x * e.ModalController_initialFontScale_x;
-               e.Container_fontscale_y = fs_y * e.ModalController_initialFontScale_y;
-       }
-       if(animating || !me.focused)
-               me.setFocus(me, NULL);
-       else
-               me.setFocus(me, front);
-       SUPER(ModalController).draw(me);
-}
-
-void ModalController_addTab(entity me, entity other, entity tabButton)
-{
-       me.addItem(me, other, '0 0 0', '1 1 1', 1);
-       tabButton.onClick = TabButton_Click;
-       tabButton.onClickEntity = other;
-       other.tabSelectingButton = tabButton;
-       if(other == me.firstChild)
-       {
-               tabButton.forcePressed = 1;
-               other.ModalController_controllingButton = tabButton;
-               me.showChild(me, other, '0 0 0', '0 0 0', 1);
-       }
-}
-
-void ModalController_addItem(entity me, entity other, vector theOrigin, vector theSize, float theAlpha)
-{
-       SUPER(ModalController).addItem(me, other, theOrigin, theSize, (other == me.firstChild) ? theAlpha : 0);
-       other.ModalController_initialFontScale = other.Container_fontscale;
-       other.ModalController_initialSize = other.Container_size;
-       other.ModalController_initialOrigin = other.Container_origin;
-       other.ModalController_initialAlpha = theAlpha; // hope Container never modifies this
-       if(other.ModalController_initialFontScale == '0 0 0')
-               other.ModalController_initialFontScale = '1 1 0';
-}
-
-void ModalController_showChild(entity me, entity other, vector theOrigin, vector theSize, float skipAnimation)
-{
-       if(other.ModalController_state == 0 || skipAnimation)
-       {
-               me.setFocus(me, NULL);
-               if(!skipAnimation)
-               {
-                       other.ModalController_buttonOrigin = globalToBox(theOrigin, me.origin, me.size);
-                       other.ModalController_buttonSize = globalToBoxSize(theSize, me.size);
-               }
-               me.switchState(me, other, 1, skipAnimation);
-       } // zoom in from button (factor increases)
-}
-
-void ModalController_hideAll(entity me, float skipAnimation)
-{
-       entity e;
-       for(e = me.firstChild; e; e = e.nextSibling)
-               me.hideChild(me, e, skipAnimation);
-}
-
-void ModalController_hideChild(entity me, entity other, float skipAnimation)
-{
-       if(other.ModalController_state || skipAnimation)
-       {
-               me.setFocus(me, NULL);
-               me.switchState(me, other, 0, skipAnimation);
-               if(other.ModalController_controllingButton)
-               {
-                       other.ModalController_controllingButton.forcePressed = 0;
-                       other.ModalController_controllingButton = NULL;
-               }
-       } // just alpha fade out (factor increases and decreases alpha)
-}
-#endif
diff --git a/qcsrc/menu/item/modalcontroller.qc b/qcsrc/menu/item/modalcontroller.qc
new file mode 100644 (file)
index 0000000..3ef6567
--- /dev/null
@@ -0,0 +1,294 @@
+#ifdef INTERFACE
+CLASS(ModalController) EXTENDS(Container)
+       METHOD(ModalController, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(ModalController, draw, void(entity))
+       METHOD(ModalController, showChild, void(entity, entity, vector, vector, float))
+       METHOD(ModalController, hideChild, void(entity, entity, float))
+       METHOD(ModalController, hideAll, void(entity, float))
+       METHOD(ModalController, addItem, void(entity, entity, vector, vector, float))
+       METHOD(ModalController, addTab, void(entity, entity, entity))
+
+       METHOD(ModalController, initializeDialog, void(entity, entity))
+
+       METHOD(ModalController, switchState, void(entity, entity, float, float))
+       ATTRIB(ModalController, origin, vector, '0 0 0')
+       ATTRIB(ModalController, size, vector, '0 0 0')
+       ATTRIB(ModalController, previousButton, entity, NULL)
+       ATTRIB(ModalController, fadedAlpha, float, 0.3)
+ENDCLASS(ModalController)
+
+.entity tabSelectingButton;
+.vector origin;
+.vector size;
+void TabButton_Click(entity button, entity tab); // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
+void DialogOpenButton_Click(entity button, entity tab); // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
+void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize);
+void DialogCloseButton_Click(entity button, entity tab); // assumes a button has set the above fields to the tab to close
+#endif
+
+#ifdef IMPLEMENTATION
+
+// modal dialog controller
+// handles a stack of dialog elements
+// each element can have one of the following states:
+//   0: hidden (fading out)
+//   1: visible (zooming in)
+//   2: greyed out (inactive)
+// While an animation is running, no item has focus. When an animation is done,
+// the topmost item gets focus.
+// The items are assumed to be added in overlapping order, that is, the lowest
+// window must get added first.
+//
+// Possible uses:
+// - to control a modal dialog:
+//   - show modal dialog: me.showChild(me, childItem, buttonAbsOrigin, buttonAbsSize, 0) // childItem also gets focus
+//   - dismiss modal dialog: me.hideChild(me, childItem, 0) // childItem fades out and relinquishes focus
+//   - show first screen in m_show: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
+// - to show a temporary dialog instead of the menu (teamselect): me.hideAll(me, 1); me.showChild(me, teamSelectDialog, '0 0 0', '0 0 0', 1);
+// - as a tabbed dialog control:
+//   - to initialize: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
+//   - to show a tab: me.hideChild(me, currentTab, 0); me.showChild(me, newTab, buttonAbsOrigin, buttonAbsSize, 0);
+
+.vector ModalController_initialSize;
+.vector ModalController_initialOrigin;
+.vector ModalController_initialFontScale;
+.float ModalController_initialAlpha;
+.vector ModalController_buttonSize;
+.vector ModalController_buttonOrigin;
+.float ModalController_state;
+.float ModalController_factor;
+.entity ModalController_controllingButton;
+
+void ModalController_initializeDialog(entity me, entity root)
+{
+       me.hideAll(me, 1);
+       me.showChild(me, root, '0 0 0', '0 0 0', 1); // someone else animates for us
+}
+
+void TabButton_Click(entity button, entity tab)
+{
+       if(tab.ModalController_state == 1)
+               return;
+       tab.parent.hideAll(tab.parent, 0);
+       button.forcePressed = 1;
+       tab.ModalController_controllingButton = button;
+       tab.parent.showChild(tab.parent, tab, button.origin, button.size, 0);
+}
+
+void DialogOpenButton_Click(entity button, entity tab)
+{
+       DialogOpenButton_Click_withCoords(button, tab, button.origin, button.size);
+}
+
+void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize)
+{
+       if(tab.ModalController_state)
+               return;
+       if(button)
+               button.forcePressed = 1;
+       if(tab.parent.focusedChild)
+               tab.parent.focusedChild.saveFocus(tab.parent.focusedChild);
+       tab.ModalController_controllingButton = button;
+       tab.parent.showChild(tab.parent, tab, theOrigin, theSize, 0);
+}
+
+void DialogCloseButton_Click(entity button, entity tab)
+{
+       tab.parent.hideChild(tab.parent, tab, 0);
+}
+
+void ModalController_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.resizeNotifyLie(me, relOrigin, relSize, absOrigin, absSize, ModalController_initialOrigin, ModalController_initialSize, ModalController_initialFontScale);
+}
+
+void ModalController_switchState(entity me, entity other, float state, float skipAnimation)
+{
+       float previousState;
+       previousState = other.ModalController_state;
+       if(state == previousState && !skipAnimation)
+               return;
+       other.ModalController_state = state;
+       switch(state)
+       {
+               case 0:
+                       other.ModalController_factor = 1 - other.Container_alpha / other.ModalController_initialAlpha;
+                       // fading out
+                       break;
+               case 1:
+                       other.ModalController_factor = other.Container_alpha / other.ModalController_initialAlpha;
+                       if(previousState == 0 && !skipAnimation)
+                       {
+                               other.Container_origin = other.ModalController_buttonOrigin;
+                               other.Container_size = other.ModalController_buttonSize;
+                       }
+                       // zooming in
+                       break;
+               case 2:
+                       other.ModalController_factor = bound(0, (1 - other.Container_alpha / other.ModalController_initialAlpha) / me.fadedAlpha, 1);
+                       // fading out halfway
+                       break;
+       }
+       if(skipAnimation)
+               other.ModalController_factor = 1;
+}
+
+void ModalController_draw(entity me)
+{
+       entity e;
+       entity front;
+       float animating;
+       float f; // animation factor
+       float df; // animation step size
+       float prevFactor, targetFactor;
+       vector targetOrigin, targetSize; float targetAlpha;
+       vector fs;
+       animating = 0;
+
+       front = world;
+       for(e = me.firstChild; e; e = e.nextSibling)
+               if(e.ModalController_state)
+               {
+                       if(front)
+                               me.switchState(me, front, 2, 0);
+                       front = e;
+               }
+       if(front)
+               me.switchState(me, front, 1, 0);
+
+       df = frametime * 3; // animation speed
+
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               if(e.ModalController_state == 2)
+               {
+                       // fading out partially
+                       targetOrigin = e.Container_origin; // stay as is
+                       targetSize = e.Container_size; // stay as is
+                       targetAlpha = me.fadedAlpha * e.ModalController_initialAlpha;
+               }
+               else if(e.ModalController_state == 1)
+               {
+                       // zooming in
+                       targetOrigin = e.ModalController_initialOrigin;
+                       targetSize = e.ModalController_initialSize;
+                       targetAlpha = e.ModalController_initialAlpha;
+               }
+               else
+               {
+                       // fading out
+                       targetOrigin = e.Container_origin; // stay as is
+                       targetSize = e.Container_size; // stay as is
+                       targetAlpha = 0;
+               }
+
+               f = (e.ModalController_factor = min(1, e.ModalController_factor + df));
+               if(f == 1)
+               {
+                       prevFactor = 0;
+                       targetFactor = 1;
+                       e.Container_origin = targetOrigin;
+                       e.Container_size = targetSize;
+                       me.setAlphaOf(me, e, targetAlpha);
+               }
+               else
+               {
+                       prevFactor = (1 - f) / (1 - f + df);
+                       if(!e.ModalController_state) // optimize code and avoid precision errors
+                               me.setAlphaOf(me, e, e.Container_alpha  * prevFactor);
+                       else
+                       {
+                               animating = 1;
+                               targetFactor = df / (1 - f + df);
+
+                               if(e.ModalController_state == 1)
+                               {
+                                       e.Container_origin = e.Container_origin * prevFactor + targetOrigin * targetFactor;
+                                       e.Container_size   = e.Container_size   * prevFactor + targetSize   * targetFactor;
+                               }
+                               me.setAlphaOf(me, e, e.Container_alpha  * prevFactor + targetAlpha  * targetFactor);
+                       }
+               }
+               // assume: o == to * f_prev + X * (1 - f_prev)
+               // make:   o' = to * f  + X * (1 - f)
+               // -->
+               // X == (o - to * f_prev) / (1 - f_prev)
+               // o' = to * f + (o - to * f_prev) / (1 - f_prev) * (1 - f)
+               // --> (maxima)
+               // o' = (to * (f - f_prev) + o * (1 - f)) / (1 - f_prev)
+
+               if(e.ModalController_state == 1)
+               {
+                       fs = globalToBoxSize(e.Container_size, e.ModalController_initialSize);
+                       e.Container_fontscale_x = fs.x * e.ModalController_initialFontScale.x;
+                       e.Container_fontscale_y = fs.y * e.ModalController_initialFontScale.y;
+               }
+       }
+
+       if(animating || !me.focused)
+               me.setFocus(me, NULL);
+       else
+               me.setFocus(me, front);
+       SUPER(ModalController).draw(me);
+}
+
+void ModalController_addTab(entity me, entity other, entity tabButton)
+{
+       me.addItem(me, other, '0 0 0', '1 1 1', 1);
+       tabButton.onClick = TabButton_Click;
+       tabButton.onClickEntity = other;
+       other.tabSelectingButton = tabButton;
+       if(other == me.firstChild)
+       {
+               tabButton.forcePressed = 1;
+               other.ModalController_controllingButton = tabButton;
+               me.showChild(me, other, '0 0 0', '0 0 0', 1);
+       }
+}
+
+void ModalController_addItem(entity me, entity other, vector theOrigin, vector theSize, float theAlpha)
+{
+       SUPER(ModalController).addItem(me, other, theOrigin, theSize, (other == me.firstChild) ? theAlpha : 0);
+       other.ModalController_initialFontScale = other.Container_fontscale;
+       other.ModalController_initialSize = other.Container_size;
+       other.ModalController_initialOrigin = other.Container_origin;
+       other.ModalController_initialAlpha = theAlpha; // hope Container never modifies this
+       if(other.ModalController_initialFontScale == '0 0 0')
+               other.ModalController_initialFontScale = '1 1 0';
+}
+
+void ModalController_showChild(entity me, entity other, vector theOrigin, vector theSize, float skipAnimation)
+{
+       if(other.ModalController_state == 0 || skipAnimation)
+       {
+               me.setFocus(me, NULL);
+               if(!skipAnimation)
+               {
+                       other.ModalController_buttonOrigin = globalToBox(theOrigin, me.origin, me.size);
+                       other.ModalController_buttonSize = globalToBoxSize(theSize, me.size);
+               }
+               me.switchState(me, other, 1, skipAnimation);
+       } // zoom in from button (factor increases)
+}
+
+void ModalController_hideAll(entity me, float skipAnimation)
+{
+       entity e;
+       for(e = me.firstChild; e; e = e.nextSibling)
+               me.hideChild(me, e, skipAnimation);
+}
+
+void ModalController_hideChild(entity me, entity other, float skipAnimation)
+{
+       if(other.ModalController_state || skipAnimation)
+       {
+               me.setFocus(me, NULL);
+               me.switchState(me, other, 0, skipAnimation);
+               if(other.ModalController_controllingButton)
+               {
+                       other.ModalController_controllingButton.forcePressed = 0;
+                       other.ModalController_controllingButton = NULL;
+               }
+       } // just alpha fade out (factor increases and decreases alpha)
+}
+#endif
diff --git a/qcsrc/menu/item/nexposee.c b/qcsrc/menu/item/nexposee.c
deleted file mode 100644 (file)
index ca7ab8f..0000000
+++ /dev/null
@@ -1,363 +0,0 @@
-#ifdef INTERFACE
-CLASS(Nexposee) EXTENDS(Container)
-       METHOD(Nexposee, draw, void(entity))
-       METHOD(Nexposee, keyDown, float(entity, float, float, float))
-       METHOD(Nexposee, keyUp, float(entity, float, float, float))
-       METHOD(Nexposee, mousePress, float(entity, vector))
-       METHOD(Nexposee, mouseMove, float(entity, vector))
-       METHOD(Nexposee, mouseRelease, float(entity, vector))
-       METHOD(Nexposee, mouseDrag, float(entity, vector))
-       METHOD(Nexposee, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(Nexposee, focusEnter, void(entity))
-       METHOD(Nexposee, close, void(entity))
-
-       ATTRIB(Nexposee, animationState, float, -1)
-       ATTRIB(Nexposee, animationFactor, float, 0)
-       ATTRIB(Nexposee, selectedChild, entity, NULL)
-       ATTRIB(Nexposee, mouseFocusedChild, entity, NULL)
-       METHOD(Nexposee, addItem, void(entity, entity, vector, vector, float))
-       METHOD(Nexposee, calc, void(entity))
-       METHOD(Nexposee, setNexposee, void(entity, entity, vector, float, float))
-       ATTRIB(Nexposee, mousePosition, vector, '0 0 0')
-       METHOD(Nexposee, pullNexposee, void(entity, entity, vector))
-ENDCLASS(Nexposee)
-
-void ExposeeCloseButton_Click(entity button, entity other); // un-exposees the current state
-#endif
-
-// animation states:
-//   0 = thumbnails seen
-//   1 = zooming in
-//   2 = zoomed in
-//   3 = zooming out
-// animation factor: 0 = minimum theSize, 1 = maximum theSize
-
-#ifdef IMPLEMENTATION
-
-.vector Nexposee_initialSize;
-.vector Nexposee_initialFontScale;
-.vector Nexposee_initialOrigin;
-.float Nexposee_initialAlpha;
-
-.vector Nexposee_smallSize;
-.vector Nexposee_smallOrigin;
-.float Nexposee_smallAlpha;
-.float Nexposee_mediumAlpha;
-.vector Nexposee_scaleCenter;
-.vector Nexposee_align;
-.float Nexposee_animationFactor;
-
-void Nexposee_close(entity me)
-{
-       // user must override this
-}
-
-void ExposeeCloseButton_Click(entity button, entity other)
-{
-       other.selectedChild = other.focusedChild;
-       other.setFocus(other, NULL);
-       other.animationState = 3;
-}
-
-void Nexposee_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.calc(me);
-       me.resizeNotifyLie(me, relOrigin, relSize, absOrigin, absSize, Nexposee_initialOrigin, Nexposee_initialSize, Nexposee_initialFontScale);
-}
-
-void Nexposee_Calc_Scale(entity me, float scale)
-{
-       entity e;
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               e.Nexposee_smallOrigin = (e.Nexposee_initialOrigin - e.Nexposee_scaleCenter) * scale + e.Nexposee_scaleCenter;
-               e.Nexposee_smallSize = e.Nexposee_initialSize * scale;
-               if(e.Nexposee_align_x > 0)
-                       e.Nexposee_smallOrigin_x = 1 - e.Nexposee_align_x * scale;
-               if(e.Nexposee_align_x < 0)
-                       e.Nexposee_smallOrigin_x = -e.Nexposee_smallSize_x + e.Nexposee_align_x * scale;
-               if(e.Nexposee_align_y > 0)
-                       e.Nexposee_smallOrigin_y = 1 - e.Nexposee_align_y * scale;
-               if(e.Nexposee_align_y < 0)
-                       e.Nexposee_smallOrigin_y = -e.Nexposee_smallSize_y + e.Nexposee_align_y * scale;
-       }
-}
-
-void Nexposee_calc(entity me)
-{
-       /*
-        * patented by Apple
-        * can't put that here ;)
-        */
-       float scale;
-       entity e, e2;
-       vector emins, emaxs, e2mins, e2maxs;
-
-       for(scale = 0.7;; scale *= 0.99)
-       {
-               Nexposee_Calc_Scale(me, scale);
-
-               for(e = me.firstChild; e; e = e.nextSibling)
-               {
-                       emins = e.Nexposee_smallOrigin;
-                       emaxs = emins + e.Nexposee_smallSize;
-                       for(e2 = e.nextSibling; e2; e2 = e2.nextSibling)
-                       {
-                               e2mins = e2.Nexposee_smallOrigin;
-                               e2maxs = e2mins + e2.Nexposee_smallSize;
-
-                               // two intervals [amins, amaxs] and [bmins, bmaxs] overlap if:
-                               //   amins < bmins < amaxs < bmaxs
-                               // for which suffices
-                               //   bmins < amaxs
-                               //   amins < bmaxs
-                               if((e2mins_x - emaxs_x) * (emins_x - e2maxs_x) > 0) // x overlap
-                                       if((e2mins_y - emaxs_y) * (emins_y - e2maxs_y) > 0) // y overlap
-                                       {
-                                               goto have_overlap;
-                                       }
-                       }
-               }
-
-               break;
-:have_overlap
-       }
-
-       scale *= 0.95;
-
-       Nexposee_Calc_Scale(me, scale);
-}
-
-void Nexposee_setNexposee(entity me, entity other, vector scalecenter, float a0, float a1)
-{
-       other.Nexposee_scaleCenter = scalecenter;
-       other.Nexposee_smallAlpha = a0;
-       me.setAlphaOf(me, other, a0);
-       other.Nexposee_mediumAlpha = a1;
-}
-
-void Nexposee_draw(entity me)
-{
-       float a;
-       float a0;
-       entity e;
-       float f;
-       vector fs;
-
-       if(me.animationState == -1)
-       {
-               me.animationState = 0;
-       }
-
-       f = min(1, frametime * 5);
-       switch(me.animationState)
-       {
-               case 0:
-                       me.animationFactor = 0;
-                       break;
-               case 1:
-                       me.animationFactor += f;
-                       if(me.animationFactor >= 1)
-                       {
-                               me.animationFactor = 1;
-                               me.animationState = 2;
-                               SUPER(Nexposee).setFocus(me, me.selectedChild);
-                       }
-                       break;
-               case 2:
-                       me.animationFactor = 1;
-                       break;
-               case 3:
-                       me.animationFactor -= f;
-                       me.mouseFocusedChild = me.itemFromPoint(me, me.mousePosition);
-                       if(me.animationFactor <= 0)
-                       {
-                               me.animationFactor = 0;
-                               me.animationState = 0;
-                               me.selectedChild = me.mouseFocusedChild;
-                       }
-                       break;
-       }
-
-       f = min(1, frametime * 10);
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
-               if(e == me.selectedChild)
-               {
-                       e.Container_origin = e.Nexposee_smallOrigin * (1 - me.animationFactor) + e.Nexposee_initialOrigin * me.animationFactor;
-                       e.Container_size = e.Nexposee_smallSize * (1 - me.animationFactor) + e.Nexposee_initialSize * me.animationFactor;
-                       e.Nexposee_animationFactor = me.animationFactor;
-                       a0 = e.Nexposee_mediumAlpha;
-                       if(me.animationState == 3)
-                               if(e != me.mouseFocusedChild)
-                                       a0 = e.Nexposee_smallAlpha;
-                       a = a0 * (1 - me.animationFactor) + me.animationFactor;
-               }
-               else
-               {
-                       // minimum theSize counts
-                       e.Container_origin = e.Nexposee_smallOrigin;
-                       e.Container_size = e.Nexposee_smallSize;
-                       e.Nexposee_animationFactor = 0;
-                       a = e.Nexposee_smallAlpha * (1 - me.animationFactor);
-               }
-               me.setAlphaOf(me, e, e.Container_alpha * (1 - f) + a * f);
-
-               fs = globalToBoxSize(e.Container_size, e.Nexposee_initialSize);
-               e.Container_fontscale_x = fs_x * e.Nexposee_initialFontScale_x;
-               e.Container_fontscale_y = fs_y * e.Nexposee_initialFontScale_y;
-       }
-
-       SUPER(Nexposee).draw(me);
-}
-
-float Nexposee_mousePress(entity me, vector pos)
-{
-       if(me.animationState == 0)
-       {
-               me.mouseFocusedChild = NULL;
-               Nexposee_mouseMove(me, pos);
-               if(me.mouseFocusedChild)
-               {
-                       me.animationState = 1;
-                       SUPER(Nexposee).setFocus(me, NULL);
-               }
-               else
-                       me.close(me);
-               return 1;
-       }
-       else if(me.animationState == 2)
-       {
-               if (!(SUPER(Nexposee).mousePress(me, pos)))
-               {
-                       me.animationState = 3;
-                       SUPER(Nexposee).setFocus(me, NULL);
-               }
-               return 1;
-       }
-       return 0;
-}
-
-float Nexposee_mouseRelease(entity me, vector pos)
-{
-       if(me.animationState == 2)
-               return SUPER(Nexposee).mouseRelease(me, pos);
-       return 0;
-}
-
-float Nexposee_mouseDrag(entity me, vector pos)
-{
-       if(me.animationState == 2)
-               return SUPER(Nexposee).mouseDrag(me, pos);
-       return 0;
-}
-
-float Nexposee_mouseMove(entity me, vector pos)
-{
-       entity e;
-       me.mousePosition = pos;
-       e = me.mouseFocusedChild;
-       me.mouseFocusedChild = me.itemFromPoint(me, pos);
-       if(me.animationState == 2)
-               return SUPER(Nexposee).mouseMove(me, pos);
-       if(me.animationState == 0)
-       {
-               if(me.mouseFocusedChild)
-                       if(me.mouseFocusedChild != e || me.mouseFocusedChild != me.selectedChild)
-                               me.selectedChild = me.mouseFocusedChild;
-               return 1;
-       }
-       return 0;
-}
-
-float Nexposee_keyUp(entity me, float scan, float ascii, float shift)
-{
-       if(me.animationState == 2)
-               return SUPER(Nexposee).keyUp(me, scan, ascii, shift);
-       return 0;
-}
-
-float Nexposee_keyDown(entity me, float scan, float ascii, float shift)
-{
-       float nexposeeKey = 0;
-       if(me.animationState == 2)
-               if(SUPER(Nexposee).keyDown(me, scan, ascii, shift))
-                       return 1;
-       if(scan == K_TAB)
-       {
-               if(me.animationState == 0)
-               {
-                       if(shift & S_SHIFT)
-                       {
-                               if(me.selectedChild)
-                                       me.selectedChild = me.selectedChild.prevSibling;
-                               if (!me.selectedChild)
-                                       me.selectedChild = me.lastChild;
-                       }
-                       else
-                       {
-                               if(me.selectedChild)
-                                       me.selectedChild = me.selectedChild.nextSibling;
-                               if (!me.selectedChild)
-                                       me.selectedChild = me.firstChild;
-                       }
-               }
-       }
-       switch(me.animationState)
-       {
-               default:
-               case 0:
-               case 3:
-                       nexposeeKey = ((scan == K_SPACE) || (scan == K_ENTER) || (scan == K_KP_ENTER));
-                       break;
-               case 1:
-               case 2:
-                       nexposeeKey = (scan == K_ESCAPE);
-                       break;
-       }
-       if(nexposeeKey)
-       {
-               switch(me.animationState)
-               {
-                       default:
-                       case 0:
-                       case 3:
-                               me.animationState = 1;
-                               break;
-                       case 1:
-                       case 2:
-                               me.animationState = 3;
-                               break;
-               }
-               if(me.focusedChild)
-                       me.selectedChild = me.focusedChild;
-               if (!me.selectedChild)
-                       me.animationState = 0;
-               SUPER(Nexposee).setFocus(me, NULL);
-               return 1;
-       }
-       return 0;
-}
-
-void Nexposee_addItem(entity me, entity other, vector theOrigin, vector theSize, float theAlpha)
-{
-       SUPER(Nexposee).addItem(me, other, theOrigin, theSize, theAlpha);
-       other.Nexposee_initialFontScale = other.Container_fontscale;
-       other.Nexposee_initialSize = other.Container_size;
-       other.Nexposee_initialOrigin = other.Container_origin;
-       other.Nexposee_initialAlpha = other.Container_alpha;
-       if(other.Nexposee_initialFontScale == '0 0 0')
-               other.Nexposee_initialFontScale = '1 1 0';
-}
-
-void Nexposee_focusEnter(entity me)
-{
-       if(me.animationState == 2)
-               SUPER(Nexposee).setFocus(me, me.selectedChild);
-}
-
-void Nexposee_pullNexposee(entity me, entity other, vector theAlign)
-{
-       other.Nexposee_align = theAlign;
-}
-#endif
diff --git a/qcsrc/menu/item/nexposee.qc b/qcsrc/menu/item/nexposee.qc
new file mode 100644 (file)
index 0000000..1413039
--- /dev/null
@@ -0,0 +1,367 @@
+#ifdef INTERFACE
+CLASS(Nexposee) EXTENDS(Container)
+       METHOD(Nexposee, draw, void(entity))
+       METHOD(Nexposee, keyDown, float(entity, float, float, float))
+       METHOD(Nexposee, keyUp, float(entity, float, float, float))
+       METHOD(Nexposee, mousePress, float(entity, vector))
+       METHOD(Nexposee, mouseMove, float(entity, vector))
+       METHOD(Nexposee, mouseRelease, float(entity, vector))
+       METHOD(Nexposee, mouseDrag, float(entity, vector))
+       METHOD(Nexposee, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(Nexposee, focusEnter, void(entity))
+       METHOD(Nexposee, close, void(entity))
+
+       ATTRIB(Nexposee, animationState, float, -1)
+       ATTRIB(Nexposee, animationFactor, float, 0)
+       ATTRIB(Nexposee, selectedChild, entity, NULL)
+       ATTRIB(Nexposee, mouseFocusedChild, entity, NULL)
+       METHOD(Nexposee, addItem, void(entity, entity, vector, vector, float))
+       METHOD(Nexposee, calc, void(entity))
+       METHOD(Nexposee, setNexposee, void(entity, entity, vector, float, float))
+       ATTRIB(Nexposee, mousePosition, vector, '0 0 0')
+       METHOD(Nexposee, pullNexposee, void(entity, entity, vector))
+ENDCLASS(Nexposee)
+
+void ExposeeCloseButton_Click(entity button, entity other); // un-exposees the current state
+#endif
+
+// animation states:
+//   0 = thumbnails seen
+//   1 = zooming in
+//   2 = zoomed in
+//   3 = zooming out
+// animation factor: 0 = minimum theSize, 1 = maximum theSize
+
+#ifdef IMPLEMENTATION
+
+.vector Nexposee_initialSize;
+.vector Nexposee_initialFontScale;
+.vector Nexposee_initialOrigin;
+.float Nexposee_initialAlpha;
+
+.vector Nexposee_smallSize;
+.vector Nexposee_smallOrigin;
+.float Nexposee_smallAlpha;
+.float Nexposee_mediumAlpha;
+.vector Nexposee_scaleCenter;
+.vector Nexposee_align;
+.float Nexposee_animationFactor;
+
+void Nexposee_close(entity me)
+{
+       // user must override this
+}
+
+void ExposeeCloseButton_Click(entity button, entity other)
+{
+       other.selectedChild = other.focusedChild;
+       other.setFocus(other, NULL);
+       other.animationState = 3;
+}
+
+void Nexposee_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.calc(me);
+       me.resizeNotifyLie(me, relOrigin, relSize, absOrigin, absSize, Nexposee_initialOrigin, Nexposee_initialSize, Nexposee_initialFontScale);
+}
+
+void Nexposee_Calc_Scale(entity me, float scale)
+{
+       entity e;
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               e.Nexposee_smallOrigin = (e.Nexposee_initialOrigin - e.Nexposee_scaleCenter) * scale + e.Nexposee_scaleCenter;
+               e.Nexposee_smallSize = e.Nexposee_initialSize * scale;
+               if(e.Nexposee_align.x > 0)
+                       e.Nexposee_smallOrigin_x = 1 - e.Nexposee_align.x * scale;
+               if(e.Nexposee_align.x < 0)
+                       e.Nexposee_smallOrigin_x = -e.Nexposee_smallSize.x + e.Nexposee_align.x * scale;
+               if(e.Nexposee_align.y > 0)
+                       e.Nexposee_smallOrigin_y = 1 - e.Nexposee_align.y * scale;
+               if(e.Nexposee_align.y < 0)
+                       e.Nexposee_smallOrigin_y = -e.Nexposee_smallSize.y + e.Nexposee_align.y * scale;
+       }
+}
+
+void Nexposee_calc(entity me)
+{
+       /*
+        * patented by Apple
+        * can't put that here ;)
+        */
+       float scale;
+       entity e, e2;
+       vector emins, emaxs, e2mins, e2maxs;
+
+       for(scale = 0.7;; scale *= 0.99)
+       {
+               Nexposee_Calc_Scale(me, scale);
+
+               for(e = me.firstChild; e; e = e.nextSibling)
+               {
+                       emins = e.Nexposee_smallOrigin;
+                       emaxs = emins + e.Nexposee_smallSize;
+                       for(e2 = e.nextSibling; e2; e2 = e2.nextSibling)
+                       {
+                               e2mins = e2.Nexposee_smallOrigin;
+                               e2maxs = e2mins + e2.Nexposee_smallSize;
+
+                               // two intervals [amins, amaxs] and [bmins, bmaxs] overlap if:
+                               //   amins < bmins < amaxs < bmaxs
+                               // for which suffices
+                               //   bmins < amaxs
+                               //   amins < bmaxs
+                               if((e2mins.x - emaxs.x) * (emins.x - e2maxs.x) > 0) // x overlap
+                                       if((e2mins.y - emaxs.y) * (emins.y - e2maxs.y) > 0) // y overlap
+                                       {
+                                               goto have_overlap;
+                                       }
+                       }
+               }
+
+               break;
+:have_overlap
+       }
+
+       scale *= 0.95;
+
+       Nexposee_Calc_Scale(me, scale);
+}
+
+void Nexposee_setNexposee(entity me, entity other, vector scalecenter, float a0, float a1)
+{
+       other.Nexposee_scaleCenter = scalecenter;
+       other.Nexposee_smallAlpha = a0;
+       me.setAlphaOf(me, other, a0);
+       other.Nexposee_mediumAlpha = a1;
+}
+
+void Nexposee_draw(entity me)
+{
+       float a;
+       float a0;
+       entity e;
+       float f;
+       vector fs;
+
+       if(me.animationState == -1)
+       {
+               me.animationState = 0;
+       }
+
+       f = min(1, frametime * 5);
+       switch(me.animationState)
+       {
+               case 0:
+                       me.animationFactor = 0;
+                       break;
+               case 1:
+                       me.animationFactor += f;
+                       if(me.animationFactor >= 1)
+                       {
+                               me.animationFactor = 1;
+                               me.animationState = 2;
+                               SUPER(Nexposee).setFocus(me, me.selectedChild);
+                       }
+                       break;
+               case 2:
+                       me.animationFactor = 1;
+                       break;
+               case 3:
+                       me.animationFactor -= f;
+                       me.mouseFocusedChild = me.itemFromPoint(me, me.mousePosition);
+                       if(me.animationFactor <= 0)
+                       {
+                               me.animationFactor = 0;
+                               me.animationState = 0;
+                               me.selectedChild = me.mouseFocusedChild;
+                       }
+                       break;
+       }
+
+       f = min(1, frametime * 10);
+       for(e = me.firstChild; e; e = e.nextSibling)
+       {
+               if(e == me.selectedChild)
+               {
+                       e.Container_origin = e.Nexposee_smallOrigin * (1 - me.animationFactor) + e.Nexposee_initialOrigin * me.animationFactor;
+                       e.Container_size = e.Nexposee_smallSize * (1 - me.animationFactor) + e.Nexposee_initialSize * me.animationFactor;
+                       e.Nexposee_animationFactor = me.animationFactor;
+                       a0 = e.Nexposee_mediumAlpha;
+                       if(me.animationState == 3)
+                               if(e != me.mouseFocusedChild)
+                                       a0 = e.Nexposee_smallAlpha;
+                       a = a0 * (1 - me.animationFactor) + me.animationFactor;
+               }
+               else
+               {
+                       // minimum theSize counts
+                       e.Container_origin = e.Nexposee_smallOrigin;
+                       e.Container_size = e.Nexposee_smallSize;
+                       e.Nexposee_animationFactor = 0;
+                       a = e.Nexposee_smallAlpha * (1 - me.animationFactor);
+               }
+               me.setAlphaOf(me, e, e.Container_alpha * (1 - f) + a * f);
+
+               fs = globalToBoxSize(e.Container_size, e.Nexposee_initialSize);
+               e.Container_fontscale_x = fs.x * e.Nexposee_initialFontScale.x;
+               e.Container_fontscale_y = fs.y * e.Nexposee_initialFontScale.y;
+       }
+
+       SUPER(Nexposee).draw(me);
+}
+
+float Nexposee_mousePress(entity me, vector pos)
+{
+       if(me.animationState == 0)
+       {
+               me.mouseFocusedChild = NULL;
+               Nexposee_mouseMove(me, pos);
+               if(me.mouseFocusedChild)
+               {
+                       m_play_click_sound(MENU_SOUND_OPEN);
+                       me.animationState = 1;
+                       SUPER(Nexposee).setFocus(me, NULL);
+               }
+               else
+                       me.close(me);
+               return 1;
+       }
+       else if(me.animationState == 2)
+       {
+               if (!(SUPER(Nexposee).mousePress(me, pos)))
+               {
+                       m_play_click_sound(MENU_SOUND_CLOSE);
+                       me.animationState = 3;
+                       SUPER(Nexposee).setFocus(me, NULL);
+               }
+               return 1;
+       }
+       return 0;
+}
+
+float Nexposee_mouseRelease(entity me, vector pos)
+{
+       if(me.animationState == 2)
+               return SUPER(Nexposee).mouseRelease(me, pos);
+       return 0;
+}
+
+float Nexposee_mouseDrag(entity me, vector pos)
+{
+       if(me.animationState == 2)
+               return SUPER(Nexposee).mouseDrag(me, pos);
+       return 0;
+}
+
+float Nexposee_mouseMove(entity me, vector pos)
+{
+       entity e;
+       me.mousePosition = pos;
+       e = me.mouseFocusedChild;
+       me.mouseFocusedChild = me.itemFromPoint(me, pos);
+       if(me.animationState == 2)
+               return SUPER(Nexposee).mouseMove(me, pos);
+       if(me.animationState == 0)
+       {
+               if(me.mouseFocusedChild)
+                       if(me.mouseFocusedChild != e || me.mouseFocusedChild != me.selectedChild)
+                               me.selectedChild = me.mouseFocusedChild;
+               return 1;
+       }
+       return 0;
+}
+
+float Nexposee_keyUp(entity me, float scan, float ascii, float shift)
+{
+       if(me.animationState == 2)
+               return SUPER(Nexposee).keyUp(me, scan, ascii, shift);
+       return 0;
+}
+
+float Nexposee_keyDown(entity me, float scan, float ascii, float shift)
+{
+       float nexposeeKey = 0;
+       if(me.animationState == 2)
+               if(SUPER(Nexposee).keyDown(me, scan, ascii, shift))
+                       return 1;
+       if(scan == K_TAB)
+       {
+               if(me.animationState == 0)
+               {
+                       if(shift & S_SHIFT)
+                       {
+                               if(me.selectedChild)
+                                       me.selectedChild = me.selectedChild.prevSibling;
+                               if (!me.selectedChild)
+                                       me.selectedChild = me.lastChild;
+                       }
+                       else
+                       {
+                               if(me.selectedChild)
+                                       me.selectedChild = me.selectedChild.nextSibling;
+                               if (!me.selectedChild)
+                                       me.selectedChild = me.firstChild;
+                       }
+               }
+       }
+       switch(me.animationState)
+       {
+               default:
+               case 0:
+               case 3:
+                       nexposeeKey = ((scan == K_SPACE) || (scan == K_ENTER) || (scan == K_KP_ENTER));
+                       break;
+               case 1:
+               case 2:
+                       nexposeeKey = (scan == K_ESCAPE);
+                       break;
+       }
+       if(nexposeeKey)
+       {
+               switch(me.animationState)
+               {
+                       default:
+                       case 0:
+                       case 3:
+                               m_play_click_sound(MENU_SOUND_OPEN);
+                               me.animationState = 1;
+                               break;
+                       case 1:
+                       case 2:
+                               m_play_click_sound(MENU_SOUND_CLOSE);
+                               me.animationState = 3;
+                               break;
+               }
+               if(me.focusedChild)
+                       me.selectedChild = me.focusedChild;
+               if (!me.selectedChild)
+                       me.animationState = 0;
+               SUPER(Nexposee).setFocus(me, NULL);
+               return 1;
+       }
+       return 0;
+}
+
+void Nexposee_addItem(entity me, entity other, vector theOrigin, vector theSize, float theAlpha)
+{
+       SUPER(Nexposee).addItem(me, other, theOrigin, theSize, theAlpha);
+       other.Nexposee_initialFontScale = other.Container_fontscale;
+       other.Nexposee_initialSize = other.Container_size;
+       other.Nexposee_initialOrigin = other.Container_origin;
+       other.Nexposee_initialAlpha = other.Container_alpha;
+       if(other.Nexposee_initialFontScale == '0 0 0')
+               other.Nexposee_initialFontScale = '1 1 0';
+}
+
+void Nexposee_focusEnter(entity me)
+{
+       if(me.animationState == 2)
+               SUPER(Nexposee).setFocus(me, me.selectedChild);
+}
+
+void Nexposee_pullNexposee(entity me, entity other, vector theAlign)
+{
+       other.Nexposee_align = theAlign;
+}
+#endif
diff --git a/qcsrc/menu/item/radiobutton.c b/qcsrc/menu/item/radiobutton.c
deleted file mode 100644 (file)
index 80fd532..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifdef INTERFACE
-void RadioButton_Click(entity me, entity other);
-CLASS(RadioButton) EXTENDS(CheckBox)
-       METHOD(RadioButton, configureRadioButton, void(entity, string, float, string, float, float))
-       ATTRIB(RadioButton, checked, float, 0)
-       ATTRIB(RadioButton, group, float, 0)
-       ATTRIB(RadioButton, allowDeselect, float, 0)
-       ATTRIB(RadioButton, onClick, void(entity, entity), RadioButton_Click)
-ENDCLASS(RadioButton)
-#endif
-
-#ifdef IMPLEMENTATION
-void RadioButton_configureRadioButton(entity me, string txt, float sz, string gfx, float theGroup, float doAllowDeselect)
-{
-       me.configureCheckBox(me, txt, sz, gfx);
-       me.align = 0;
-       me.group = theGroup;
-       me.allowDeselect = doAllowDeselect;
-}
-void RadioButton_Click(entity me, entity other)
-{
-       if(me.checked)
-       {
-               if(me.allowDeselect)
-                       me.setChecked(me, 0);
-       }
-       else
-       {
-               entity e;
-               for(e = me.parent.firstChild; e; e = e.nextSibling)
-                       if(e != me)
-                               if(e.group == me.group)
-                                       e.setChecked(e, 0);
-               me.setChecked(me, 1);
-       }
-}
-#endif
diff --git a/qcsrc/menu/item/radiobutton.qc b/qcsrc/menu/item/radiobutton.qc
new file mode 100644 (file)
index 0000000..80fd532
--- /dev/null
@@ -0,0 +1,37 @@
+#ifdef INTERFACE
+void RadioButton_Click(entity me, entity other);
+CLASS(RadioButton) EXTENDS(CheckBox)
+       METHOD(RadioButton, configureRadioButton, void(entity, string, float, string, float, float))
+       ATTRIB(RadioButton, checked, float, 0)
+       ATTRIB(RadioButton, group, float, 0)
+       ATTRIB(RadioButton, allowDeselect, float, 0)
+       ATTRIB(RadioButton, onClick, void(entity, entity), RadioButton_Click)
+ENDCLASS(RadioButton)
+#endif
+
+#ifdef IMPLEMENTATION
+void RadioButton_configureRadioButton(entity me, string txt, float sz, string gfx, float theGroup, float doAllowDeselect)
+{
+       me.configureCheckBox(me, txt, sz, gfx);
+       me.align = 0;
+       me.group = theGroup;
+       me.allowDeselect = doAllowDeselect;
+}
+void RadioButton_Click(entity me, entity other)
+{
+       if(me.checked)
+       {
+               if(me.allowDeselect)
+                       me.setChecked(me, 0);
+       }
+       else
+       {
+               entity e;
+               for(e = me.parent.firstChild; e; e = e.nextSibling)
+                       if(e != me)
+                               if(e.group == me.group)
+                                       e.setChecked(e, 0);
+               me.setChecked(me, 1);
+       }
+}
+#endif
diff --git a/qcsrc/menu/item/slider.c b/qcsrc/menu/item/slider.c
deleted file mode 100644 (file)
index c92db27..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-// Note:
-//   to use this, you FIRST call configureSliderVisuals, then configureSliderValues
-#ifdef INTERFACE
-CLASS(Slider) EXTENDS(Label)
-       METHOD(Slider, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(Slider, configureSliderVisuals, void(entity, float, float, float, string))
-       METHOD(Slider, configureSliderValues, void(entity, float, float, float, float, float, float))
-       METHOD(Slider, draw, void(entity))
-       METHOD(Slider, keyDown, float(entity, float, float, float))
-       METHOD(Slider, mousePress, float(entity, vector))
-       METHOD(Slider, mouseDrag, float(entity, vector))
-       METHOD(Slider, mouseRelease, float(entity, vector))
-       METHOD(Slider, focusEnter, void(entity))
-       METHOD(Slider, valueToText, string(entity, float))
-       METHOD(Slider, toString, string(entity))
-       METHOD(Slider, setValue, void(entity, float))
-       METHOD(Slider, setSliderValue, void(entity, float))
-       METHOD(Slider, showNotify, void(entity))
-       ATTRIB(Slider, src, string, string_null)
-       ATTRIB(Slider, focusable, float, 1)
-       ATTRIB(Slider, value, float, 0)
-       ATTRIB(Slider, animated, float, 1)
-       ATTRIB(Slider, sliderValue, float, 0)
-       ATTRIB(Slider, valueMin, float, 0)
-       ATTRIB(Slider, valueMax, float, 0)
-       ATTRIB(Slider, valueStep, float, 0)
-       ATTRIB(Slider, valueDigits, float, 0)
-       ATTRIB(Slider, valueKeyStep, float, 0)
-       ATTRIB(Slider, valuePageStep, float, 0)
-       ATTRIB(Slider, valueDisplayMultiplier, float, 1.0)
-       ATTRIB(Slider, textSpace, float, 0)
-       ATTRIB(Slider, controlWidth, float, 0)
-       ATTRIB(Slider, pressed, float, 0)
-       ATTRIB(Slider, pressOffset, float, 0)
-       ATTRIB(Slider, previousValue, float, 0)
-       ATTRIB(Slider, tolerance, vector, '0 0 0')
-       ATTRIB(Slider, disabled, float, 0)
-       ATTRIB(Slider, color, vector, '1 1 1')
-       ATTRIB(Slider, color2, vector, '1 1 1')
-       ATTRIB(Slider, colorD, vector, '1 1 1')
-       ATTRIB(Slider, colorC, vector, '1 1 1')
-       ATTRIB(Slider, colorF, vector, '1 1 1')
-       ATTRIB(Slider, disabledAlpha, float, 0.3)
-ENDCLASS(Slider)
-#endif
-
-#ifdef IMPLEMENTATION
-void Slider_setValue(entity me, float val)
-{
-       if (me.animated) {
-               anim.removeObjAnim(anim, me);
-               makeHostedEasing(me, Slider_setSliderValue, easingQuadInOut, 1, me.sliderValue, val);
-       } else {
-               me.setSliderValue(me, val);
-       }
-       me.value = val;
-}
-void Slider_setSliderValue(entity me, float val)
-{
-       me.sliderValue = val;
-}
-string Slider_toString(entity me)
-{
-       return sprintf("%d (%s)", me.value, me.valueToText(me, me.value));
-}
-void Slider_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(Slider).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-       me.controlWidth = absSize_y / absSize_x;
-}
-string Slider_valueToText(entity me, float val)
-{
-       if(almost_in_bounds(me.valueMin, val, me.valueMax))
-               return ftos_decimals(val * me.valueDisplayMultiplier, me.valueDigits);
-       return "";
-}
-void Slider_configureSliderVisuals(entity me, float sz, float theAlign, float theTextSpace, string gfx)
-{
-       SUPER(Slider).configureLabel(me, string_null, sz, theAlign);
-       me.textSpace = theTextSpace;
-       me.keepspaceLeft = (theTextSpace == 0) ? 0 : (1 - theTextSpace);
-       me.src = gfx;
-}
-void Slider_configureSliderValues(entity me, float theValueMin, float theValue, float theValueMax, float theValueStep, float theValueKeyStep, float theValuePageStep)
-{
-       me.value = theValue;
-       me.sliderValue = theValue;
-       me.valueStep = theValueStep;
-       me.valueMin = theValueMin;
-       me.valueMax = theValueMax;
-       me.valueKeyStep = theValueKeyStep;
-       me.valuePageStep = theValuePageStep;
-       me.valueDigits = 3;
-       if(fabs(floor(me.valueStep * 100 + 0.5) - (me.valueStep * 100)) < 0.01) // about a whole number of 100ths
-               me.valueDigits = 2;
-       if(fabs(floor(me.valueStep * 10 + 0.5) - (me.valueStep * 10)) < 0.01) // about a whole number of 10ths
-               me.valueDigits = 1;
-       if(fabs(floor(me.valueStep * 1 + 0.5) - (me.valueStep * 1)) < 0.01) // about a whole number
-               me.valueDigits = 0;
-}
-float Slider_keyDown(entity me, float key, float ascii, float shift)
-{
-       float inRange;
-       if(me.disabled)
-               return 0;
-       inRange = (almost_in_bounds(me.valueMin, me.value, me.valueMax));
-       if(key == K_LEFTARROW || key == K_KP_LEFTARROW || key == K_MWHEELDOWN)
-       {
-               if(inRange)
-                       me.setValue(me, median(me.valueMin, me.value - me.valueKeyStep, me.valueMax));
-               else
-                       me.setValue(me, me.valueMax);
-               return 1;
-       }
-       if(key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_MWHEELUP)
-       {
-               if(inRange)
-                       me.setValue(me, median(me.valueMin, me.value + me.valueKeyStep, me.valueMax));
-               else
-                       me.setValue(me, me.valueMin);
-               return 1;
-       }
-       if(key == K_PGDN || key == K_KP_PGDN)
-       {
-               if(inRange)
-                       me.setValue(me, median(me.valueMin, me.value - me.valuePageStep, me.valueMax));
-               else
-                       me.setValue(me, me.valueMax);
-               return 1;
-       }
-       if(key == K_PGUP || key == K_KP_PGUP)
-       {
-               if(inRange)
-                       me.setValue(me, median(me.valueMin, me.value + me.valuePageStep, me.valueMax));
-               else
-                       me.setValue(me, me.valueMin);
-               return 1;
-       }
-       if(key == K_HOME || key == K_KP_HOME)
-       {
-               me.setValue(me, me.valueMin);
-               return 1;
-       }
-       if(key == K_END || key == K_KP_END)
-       {
-               me.setValue(me, me.valueMax);
-               return 1;
-       }
-       // TODO more keys
-       return 0;
-}
-float Slider_mouseDrag(entity me, vector pos)
-{
-       float hit;
-       float v, animed;
-       if(me.disabled)
-               return 0;
-
-       anim.removeObjAnim(anim, me);
-       animed = me.animated;
-       me.animated = false;
-
-       if(me.pressed)
-       {
-               hit = 1;
-               if(pos_x < 0 - me.tolerance_x) hit = 0;
-               if(pos_y < 0 - me.tolerance_y) hit = 0;
-               if(pos_x >= 1 - me.textSpace + me.tolerance_x) hit = 0;
-               if(pos_y >= 1 + me.tolerance_y) hit = 0;
-               if(hit)
-               {
-                       v = median(0, (pos_x - me.pressOffset - 0.5 * me.controlWidth) / (1 - me.textSpace - me.controlWidth), 1) * (me.valueMax - me.valueMin) + me.valueMin;
-                       if(me.valueStep)
-                               v = floor(0.5 + v / me.valueStep) * me.valueStep;
-                       me.setValue(me, v);
-               }
-               else
-                       me.setValue(me, me.previousValue);
-       }
-
-       me.animated = animed;
-
-       return 1;
-}
-float Slider_mousePress(entity me, vector pos)
-{
-       float controlCenter;
-       if(me.disabled)
-               return 0;
-       if(pos_x < 0) return 0;
-       if(pos_y < 0) return 0;
-       if(pos_x >= 1 - me.textSpace) return 0;
-       if(pos_y >= 1) return 0;
-       controlCenter = (me.value - me.valueMin) / (me.valueMax - me.valueMin) * (1 - me.textSpace - me.controlWidth) + 0.5 * me.controlWidth;
-       if(fabs(pos_x - controlCenter) <= 0.5 * me.controlWidth)
-       {
-               me.pressed = 1;
-               me.pressOffset = pos_x - controlCenter;
-               me.previousValue = me.value;
-               //me.mouseDrag(me, pos);
-       }
-       else
-       {
-               float clickValue, pageValue, inRange;
-               clickValue = median(0, (pos_x - me.pressOffset - 0.5 * me.controlWidth) / (1 - me.textSpace - me.controlWidth), 1) * (me.valueMax - me.valueMin) + me.valueMin;
-               inRange = (almost_in_bounds(me.valueMin, me.value, me.valueMax));
-               if(pos_x < controlCenter)
-               {
-                       pageValue = me.value - me.valuePageStep;
-                       if(me.valueStep)
-                               clickValue = floor(clickValue / me.valueStep) * me.valueStep;
-                       pageValue = max(pageValue, clickValue);
-                       if(inRange)
-                               me.setValue(me, median(me.valueMin, pageValue, me.valueMax));
-                       else
-                               me.setValue(me, me.valueMax);
-               }
-               else
-               {
-                       pageValue = me.value + me.valuePageStep;
-                       if(me.valueStep)
-                               clickValue = ceil(clickValue / me.valueStep) * me.valueStep;
-                       pageValue = min(pageValue, clickValue);
-                       if(inRange)
-                               me.setValue(me, median(me.valueMin, pageValue, me.valueMax));
-                       else
-                               me.setValue(me, me.valueMax);
-               }
-               if(pageValue == clickValue)
-               {
-                       controlCenter = (me.value - me.valueMin) / (me.valueMax - me.valueMin) * (1 - me.textSpace - me.controlWidth) + 0.5 * me.controlWidth;
-                       me.pressed = 1;
-                       me.pressOffset = pos_x - controlCenter;
-                       me.previousValue = me.value;
-                       //me.mouseDrag(me, pos);
-               }
-       }
-       return 1;
-}
-float Slider_mouseRelease(entity me, vector pos)
-{
-       me.pressed = 0;
-       if(me.disabled)
-               return 0;
-       if(cvar("menu_sounds"))
-               localsound("sound/misc/menu2.wav");
-       return 1;
-}
-void Slider_showNotify(entity me)
-{
-       me.focusable = !me.disabled;
-}
-void Slider_focusEnter(entity me)
-{
-       if(cvar("menu_sounds") > 1)
-               localsound("sound/misc/menu1.wav");
-       SUPER(Slider).focusEnter(me);
-}
-void Slider_draw(entity me)
-{
-       float controlLeft;
-       float save;
-       me.focusable = !me.disabled;
-       save = draw_alpha;
-       if(me.disabled)
-               draw_alpha *= me.disabledAlpha;
-       draw_ButtonPicture('0 0 0', strcat(me.src, "_s"), eX * (1 - me.textSpace) + eY, me.color2, 1);
-       if(almost_in_bounds(me.valueMin, me.sliderValue, me.valueMax))
-       {
-               controlLeft = (me.sliderValue - me.valueMin) / (me.valueMax - me.valueMin) * (1 - me.textSpace - me.controlWidth);
-               if(me.disabled)
-                       draw_Picture(eX * controlLeft, strcat(me.src, "_d"), eX * me.controlWidth + eY, me.colorD, 1);
-               else if(me.pressed)
-                       draw_Picture(eX * controlLeft, strcat(me.src, "_c"), eX * me.controlWidth + eY, me.colorC, 1);
-               else if(me.focused)
-                       draw_Picture(eX * controlLeft, strcat(me.src, "_f"), eX * me.controlWidth + eY, me.colorF, 1);
-               else
-                       draw_Picture(eX * controlLeft, strcat(me.src, "_n"), eX * me.controlWidth + eY, me.color, 1);
-       }
-       me.setText(me, me.valueToText(me, me.value));
-       draw_alpha = save;
-       SUPER(Slider).draw(me);
-       me.text = string_null; // TEMPSTRING!
-}
-#endif
diff --git a/qcsrc/menu/item/slider.qc b/qcsrc/menu/item/slider.qc
new file mode 100644 (file)
index 0000000..2c74f61
--- /dev/null
@@ -0,0 +1,301 @@
+// Note:
+//   to use this, you FIRST call configureSliderVisuals, then configureSliderValues
+#ifdef INTERFACE
+CLASS(Slider) EXTENDS(Label)
+       METHOD(Slider, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(Slider, configureSliderVisuals, void(entity, float, float, float, string))
+       METHOD(Slider, configureSliderValues, void(entity, float, float, float, float, float, float))
+       METHOD(Slider, draw, void(entity))
+       METHOD(Slider, keyDown, float(entity, float, float, float))
+       METHOD(Slider, keyUp, float(entity, float, float, float))
+       METHOD(Slider, mousePress, float(entity, vector))
+       METHOD(Slider, mouseDrag, float(entity, vector))
+       METHOD(Slider, mouseRelease, float(entity, vector))
+       METHOD(Slider, valueToText, string(entity, float))
+       METHOD(Slider, toString, string(entity))
+       METHOD(Slider, setValue, void(entity, float))
+       METHOD(Slider, setSliderValue, void(entity, float))
+       METHOD(Slider, showNotify, void(entity))
+       ATTRIB(Slider, src, string, string_null)
+       ATTRIB(Slider, focusable, float, 1)
+       ATTRIB(Slider, allowFocusSound, float, 1)
+       ATTRIB(Slider, value, float, 0)
+       ATTRIB(Slider, animated, float, 1)
+       ATTRIB(Slider, sliderValue, float, 0)
+       ATTRIB(Slider, valueMin, float, 0)
+       ATTRIB(Slider, valueMax, float, 0)
+       ATTRIB(Slider, valueStep, float, 0)
+       ATTRIB(Slider, valueDigits, float, 0)
+       ATTRIB(Slider, valueKeyStep, float, 0)
+       ATTRIB(Slider, valuePageStep, float, 0)
+       ATTRIB(Slider, valueDisplayMultiplier, float, 1.0)
+       ATTRIB(Slider, textSpace, float, 0)
+       ATTRIB(Slider, controlWidth, float, 0)
+       ATTRIB(Slider, pressed, float, 0)
+       ATTRIB(Slider, pressOffset, float, 0)
+       ATTRIB(Slider, previousValue, float, 0)
+       ATTRIB(Slider, tolerance, vector, '0 0 0')
+       ATTRIB(Slider, disabled, float, 0)
+       ATTRIB(Slider, color, vector, '1 1 1')
+       ATTRIB(Slider, color2, vector, '1 1 1')
+       ATTRIB(Slider, colorD, vector, '1 1 1')
+       ATTRIB(Slider, colorC, vector, '1 1 1')
+       ATTRIB(Slider, colorF, vector, '1 1 1')
+       ATTRIB(Slider, disabledAlpha, float, 0.3)
+ENDCLASS(Slider)
+#endif
+
+#ifdef IMPLEMENTATION
+void Slider_setValue(entity me, float val)
+{
+       if (me.animated) {
+               anim.removeObjAnim(anim, me);
+               makeHostedEasing(me, Slider_setSliderValue, easingQuadInOut, 1, me.sliderValue, val);
+       } else {
+               me.setSliderValue(me, val);
+       }
+       me.value = val;
+}
+void Slider_setSliderValue(entity me, float val)
+{
+       me.sliderValue = val;
+}
+string Slider_toString(entity me)
+{
+       return sprintf("%d (%s)", me.value, me.valueToText(me, me.value));
+}
+void Slider_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(Slider).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+       me.controlWidth = absSize.y / absSize.x;
+}
+string Slider_valueToText(entity me, float val)
+{
+       if(almost_in_bounds(me.valueMin, val, me.valueMax))
+               return ftos_decimals(val * me.valueDisplayMultiplier, me.valueDigits);
+       return "";
+}
+void Slider_configureSliderVisuals(entity me, float sz, float theAlign, float theTextSpace, string gfx)
+{
+       SUPER(Slider).configureLabel(me, string_null, sz, theAlign);
+       me.textSpace = theTextSpace;
+       me.keepspaceLeft = (theTextSpace == 0) ? 0 : (1 - theTextSpace);
+       me.src = gfx;
+}
+void Slider_configureSliderValues(entity me, float theValueMin, float theValue, float theValueMax, float theValueStep, float theValueKeyStep, float theValuePageStep)
+{
+       me.value = theValue;
+       me.sliderValue = theValue;
+       me.valueStep = theValueStep;
+       me.valueMin = theValueMin;
+       me.valueMax = theValueMax;
+       me.valueKeyStep = theValueKeyStep;
+       me.valuePageStep = theValuePageStep;
+       me.valueDigits = 3;
+       if(fabs(floor(me.valueStep * 100 + 0.5) - (me.valueStep * 100)) < 0.01) // about a whole number of 100ths
+               me.valueDigits = 2;
+       if(fabs(floor(me.valueStep * 10 + 0.5) - (me.valueStep * 10)) < 0.01) // about a whole number of 10ths
+               me.valueDigits = 1;
+       if(fabs(floor(me.valueStep * 1 + 0.5) - (me.valueStep * 1)) < 0.01) // about a whole number
+               me.valueDigits = 0;
+}
+float Slider_keyDown(entity me, float key, float ascii, float shift)
+{
+       float inRange;
+       if(me.disabled)
+               return 0;
+       inRange = (almost_in_bounds(me.valueMin, me.value, me.valueMax));
+       if(key == K_LEFTARROW || key == K_KP_LEFTARROW || key == K_MWHEELDOWN)
+       {
+               if(inRange)
+                       me.setValue(me, median(me.valueMin, me.value - me.valueKeyStep, me.valueMax));
+               else
+                       me.setValue(me, me.valueMax);
+               return 1;
+       }
+       if(key == K_RIGHTARROW || key == K_KP_RIGHTARROW || key == K_MWHEELUP)
+       {
+               if(inRange)
+                       me.setValue(me, median(me.valueMin, me.value + me.valueKeyStep, me.valueMax));
+               else
+                       me.setValue(me, me.valueMin);
+               return 1;
+       }
+       if(key == K_PGDN || key == K_KP_PGDN)
+       {
+               if(inRange)
+                       me.setValue(me, median(me.valueMin, me.value - me.valuePageStep, me.valueMax));
+               else
+                       me.setValue(me, me.valueMax);
+               return 1;
+       }
+       if(key == K_PGUP || key == K_KP_PGUP)
+       {
+               if(inRange)
+                       me.setValue(me, median(me.valueMin, me.value + me.valuePageStep, me.valueMax));
+               else
+                       me.setValue(me, me.valueMin);
+               return 1;
+       }
+       if(key == K_HOME || key == K_KP_HOME)
+       {
+               me.setValue(me, me.valueMin);
+               return 1;
+       }
+       if(key == K_END || key == K_KP_END)
+       {
+               me.setValue(me, me.valueMax);
+               return 1;
+       }
+       // TODO more keys (NOTE also add them to Slider_keyUp)
+       return 0;
+}
+float Slider_keyUp(entity me, float key, float ascii, float shift)
+{
+       if(me.disabled)
+               return 0;
+       switch(key)
+       {
+               case K_LEFTARROW:
+               case K_KP_LEFTARROW:
+               case K_RIGHTARROW:
+               case K_KP_RIGHTARROW:
+               case K_PGUP:
+               case K_KP_PGUP:
+               case K_PGDN:
+               case K_KP_PGDN:
+               case K_HOME:
+               case K_KP_HOME:
+               case K_END:
+               case K_KP_END:
+                       m_play_click_sound(MENU_SOUND_SLIDE);
+       }
+       return 0;
+}
+float Slider_mouseDrag(entity me, vector pos)
+{
+       float hit;
+       float v, animed;
+       if(me.disabled)
+               return 0;
+
+       anim.removeObjAnim(anim, me);
+       animed = me.animated;
+       me.animated = false;
+
+       if(me.pressed)
+       {
+               hit = 1;
+               if(pos.x < 0 - me.tolerance.x) hit = 0;
+               if(pos.y < 0 - me.tolerance.y) hit = 0;
+               if(pos.x >= 1 - me.textSpace + me.tolerance.x) hit = 0;
+               if(pos.y >= 1 + me.tolerance.y) hit = 0;
+               if(hit)
+               {
+                       v = median(0, (pos.x - me.pressOffset - 0.5 * me.controlWidth) / (1 - me.textSpace - me.controlWidth), 1) * (me.valueMax - me.valueMin) + me.valueMin;
+                       if(me.valueStep)
+                               v = floor(0.5 + v / me.valueStep) * me.valueStep;
+                       me.setValue(me, v);
+               }
+               else
+                       me.setValue(me, me.previousValue);
+       }
+
+       me.animated = animed;
+
+       return 1;
+}
+float Slider_mousePress(entity me, vector pos)
+{
+       float controlCenter;
+       if(me.disabled)
+               return 0;
+       if(pos.x < 0) return 0;
+       if(pos.y < 0) return 0;
+       if(pos.x >= 1 - me.textSpace) return 0;
+       if(pos.y >= 1) return 0;
+       controlCenter = (me.value - me.valueMin) / (me.valueMax - me.valueMin) * (1 - me.textSpace - me.controlWidth) + 0.5 * me.controlWidth;
+       if(fabs(pos.x - controlCenter) <= 0.5 * me.controlWidth)
+       {
+               me.pressed = 1;
+               me.pressOffset = pos.x - controlCenter;
+               me.previousValue = me.value;
+               //me.mouseDrag(me, pos);
+       }
+       else
+       {
+               float clickValue, pageValue, inRange;
+               clickValue = median(0, (pos.x - me.pressOffset - 0.5 * me.controlWidth) / (1 - me.textSpace - me.controlWidth), 1) * (me.valueMax - me.valueMin) + me.valueMin;
+               inRange = (almost_in_bounds(me.valueMin, me.value, me.valueMax));
+               if(pos.x < controlCenter)
+               {
+                       pageValue = me.value - me.valuePageStep;
+                       if(me.valueStep)
+                               clickValue = floor(clickValue / me.valueStep) * me.valueStep;
+                       pageValue = max(pageValue, clickValue);
+                       if(inRange)
+                               me.setValue(me, median(me.valueMin, pageValue, me.valueMax));
+                       else
+                               me.setValue(me, me.valueMax);
+               }
+               else
+               {
+                       pageValue = me.value + me.valuePageStep;
+                       if(me.valueStep)
+                               clickValue = ceil(clickValue / me.valueStep) * me.valueStep;
+                       pageValue = min(pageValue, clickValue);
+                       if(inRange)
+                               me.setValue(me, median(me.valueMin, pageValue, me.valueMax));
+                       else
+                               me.setValue(me, me.valueMax);
+               }
+               if(pageValue == clickValue)
+               {
+                       controlCenter = (me.value - me.valueMin) / (me.valueMax - me.valueMin) * (1 - me.textSpace - me.controlWidth) + 0.5 * me.controlWidth;
+                       me.pressed = 1;
+                       me.pressOffset = pos.x - controlCenter;
+                       me.previousValue = me.value;
+                       //me.mouseDrag(me, pos);
+               }
+       }
+       return 1;
+}
+float Slider_mouseRelease(entity me, vector pos)
+{
+       me.pressed = 0;
+       if(me.disabled)
+               return 0;
+       m_play_click_sound(MENU_SOUND_SLIDE);
+       return 1;
+}
+void Slider_showNotify(entity me)
+{
+       me.focusable = !me.disabled;
+}
+void Slider_draw(entity me)
+{
+       float controlLeft;
+       float save;
+       me.focusable = !me.disabled;
+       save = draw_alpha;
+       if(me.disabled)
+               draw_alpha *= me.disabledAlpha;
+       draw_ButtonPicture('0 0 0', strcat(me.src, "_s"), eX * (1 - me.textSpace) + eY, me.color2, 1);
+       if(almost_in_bounds(me.valueMin, me.sliderValue, me.valueMax))
+       {
+               controlLeft = (me.sliderValue - me.valueMin) / (me.valueMax - me.valueMin) * (1 - me.textSpace - me.controlWidth);
+               if(me.disabled)
+                       draw_Picture(eX * controlLeft, strcat(me.src, "_d"), eX * me.controlWidth + eY, me.colorD, 1);
+               else if(me.pressed)
+                       draw_Picture(eX * controlLeft, strcat(me.src, "_c"), eX * me.controlWidth + eY, me.colorC, 1);
+               else if(me.focused)
+                       draw_Picture(eX * controlLeft, strcat(me.src, "_f"), eX * me.controlWidth + eY, me.colorF, 1);
+               else
+                       draw_Picture(eX * controlLeft, strcat(me.src, "_n"), eX * me.controlWidth + eY, me.color, 1);
+       }
+       me.setText(me, me.valueToText(me, me.value));
+       draw_alpha = save;
+       SUPER(Slider).draw(me);
+       me.text = string_null; // TEMPSTRING!
+}
+#endif
diff --git a/qcsrc/menu/item/tab.c b/qcsrc/menu/item/tab.c
deleted file mode 100644 (file)
index 8cd72ba..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifdef INTERFACE
-CLASS(Tab) EXTENDS(Dialog)
-       ATTRIB(Tab, isTabRoot, float, 0)
-       ATTRIB(Tab, closable, float, 0)
-       ATTRIB(Tab, rootDialog, float, 0)
-       ATTRIB(Tab, title, string, string_null)
-       ATTRIB(Tab, titleFontSize, float, 0) // pixels
-
-       // still to be customized
-       ATTRIB(Tab, intendedWidth, float, 0)
-       ATTRIB(Tab, rows, float, 3)
-       ATTRIB(Tab, columns, float, 2)
-
-       ATTRIB(Tab, marginTop, float, 0) // pixels
-       ATTRIB(Tab, marginBottom, float, 0) // pixels
-       ATTRIB(Tab, marginLeft, float, 0) // pixels
-       ATTRIB(Tab, marginRight, float, 0) // pixels
-       ATTRIB(Tab, columnSpacing, float, 0) // pixels
-       ATTRIB(Tab, rowSpacing, float, 0) // pixels
-       ATTRIB(Tab, rowHeight, float, 0) // pixels
-       ATTRIB(Tab, titleHeight, float, 0) // pixels
-
-       ATTRIB(Tab, backgroundImage, string, string_null)
-ENDCLASS(Tab)
-#endif
-
-#ifdef IMPLEMENTATION
-#endif
diff --git a/qcsrc/menu/item/tab.qc b/qcsrc/menu/item/tab.qc
new file mode 100644 (file)
index 0000000..8cd72ba
--- /dev/null
@@ -0,0 +1,28 @@
+#ifdef INTERFACE
+CLASS(Tab) EXTENDS(Dialog)
+       ATTRIB(Tab, isTabRoot, float, 0)
+       ATTRIB(Tab, closable, float, 0)
+       ATTRIB(Tab, rootDialog, float, 0)
+       ATTRIB(Tab, title, string, string_null)
+       ATTRIB(Tab, titleFontSize, float, 0) // pixels
+
+       // still to be customized
+       ATTRIB(Tab, intendedWidth, float, 0)
+       ATTRIB(Tab, rows, float, 3)
+       ATTRIB(Tab, columns, float, 2)
+
+       ATTRIB(Tab, marginTop, float, 0) // pixels
+       ATTRIB(Tab, marginBottom, float, 0) // pixels
+       ATTRIB(Tab, marginLeft, float, 0) // pixels
+       ATTRIB(Tab, marginRight, float, 0) // pixels
+       ATTRIB(Tab, columnSpacing, float, 0) // pixels
+       ATTRIB(Tab, rowSpacing, float, 0) // pixels
+       ATTRIB(Tab, rowHeight, float, 0) // pixels
+       ATTRIB(Tab, titleHeight, float, 0) // pixels
+
+       ATTRIB(Tab, backgroundImage, string, string_null)
+ENDCLASS(Tab)
+#endif
+
+#ifdef IMPLEMENTATION
+#endif
diff --git a/qcsrc/menu/item/textslider.c b/qcsrc/menu/item/textslider.c
deleted file mode 100644 (file)
index 59d8c10..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// Note:
-//   to use this, you FIRST call configureSliderVisuals, then multiple times addValue, then configureTextSlider
-#ifdef INTERFACE
-CLASS(TextSlider) EXTENDS(Slider)
-       METHOD(TextSlider, valueToText, string(entity, float))
-       METHOD(TextSlider, valueToIdentifier, string(entity, float))
-       METHOD(TextSlider, setValueFromIdentifier, void(entity, string))
-       METHOD(TextSlider, getIdentifier, string(entity))
-       METHOD(TextSlider, clearValues, void(entity))
-       METHOD(TextSlider, addValue, void(entity, string, string))
-       METHOD(TextSlider, insertValue, void(entity, float, string, string))
-       METHOD(TextSlider, configureTextSliderValues, void(entity, string))
-       ATTRIBARRAY(TextSlider, valueStrings, string, 256)
-       ATTRIBARRAY(TextSlider, valueIdentifiers, string, 256)
-       ATTRIB(TextSlider, nValues, float, 0)
-ENDCLASS(TextSlider)
-#endif
-
-#ifdef IMPLEMENTATION
-string TextSlider_valueToIdentifier(entity me, float val)
-{
-       if(val >= me.nValues)
-               return "custom";
-       if(val < 0)
-               return "custom";
-       return me.(valueIdentifiers[val]);
-}
-string TextSlider_valueToText(entity me, float val)
-{
-       if(val >= me.nValues)
-               return _("Custom");
-       if(val < 0)
-               return _("Custom");
-       return me.(valueStrings[val]);
-}
-void TextSlider_setValueFromIdentifier(entity me, string id)
-{
-       float i;
-       for(i = 0; i < me.nValues; ++i)
-               if(me.valueToIdentifier(me, i) == id)
-               {
-                       SUPER(TextSlider).setValue( me, i );
-                       return;
-               }
-       SUPER(TextSlider).setValue( me, -1 );
-}
-string TextSlider_getIdentifier(entity me)
-{
-       return me.valueToIdentifier(me, me.value);
-}
-void TextSlider_clearValues(entity me)
-{
-       me.nValues = 0;
-}
-void TextSlider_addValue(entity me, string theString, string theIdentifier)
-{
-       me.(valueStrings[me.nValues]) = theString;
-       me.(valueIdentifiers[me.nValues]) = theIdentifier;
-       me.nValues += 1;
-}
-void TextSlider_insertValue(entity me, float pos, string theString, string theIdentifier)
-{
-       float i;
-       for (i = me.nValues; i > pos; --i)
-       {
-               me.(valueStrings[i]) = me.(valueStrings[i-1]);
-               me.(valueIdentifiers[i]) = me.(valueIdentifiers[i-1]);
-       }
-       me.(valueStrings[pos]) = theString;
-       me.(valueIdentifiers[pos]) = theIdentifier;
-       me.nValues += 1;
-}
-void TextSlider_configureTextSliderValues(entity me, string theDefault)
-{
-       me.configureSliderValues(me, 0, 0, me.nValues - 1, 1, 1, 1);
-       me.setValueFromIdentifier(me, theDefault);
-}
-#endif
diff --git a/qcsrc/menu/item/textslider.qc b/qcsrc/menu/item/textslider.qc
new file mode 100644 (file)
index 0000000..59d8c10
--- /dev/null
@@ -0,0 +1,78 @@
+// Note:
+//   to use this, you FIRST call configureSliderVisuals, then multiple times addValue, then configureTextSlider
+#ifdef INTERFACE
+CLASS(TextSlider) EXTENDS(Slider)
+       METHOD(TextSlider, valueToText, string(entity, float))
+       METHOD(TextSlider, valueToIdentifier, string(entity, float))
+       METHOD(TextSlider, setValueFromIdentifier, void(entity, string))
+       METHOD(TextSlider, getIdentifier, string(entity))
+       METHOD(TextSlider, clearValues, void(entity))
+       METHOD(TextSlider, addValue, void(entity, string, string))
+       METHOD(TextSlider, insertValue, void(entity, float, string, string))
+       METHOD(TextSlider, configureTextSliderValues, void(entity, string))
+       ATTRIBARRAY(TextSlider, valueStrings, string, 256)
+       ATTRIBARRAY(TextSlider, valueIdentifiers, string, 256)
+       ATTRIB(TextSlider, nValues, float, 0)
+ENDCLASS(TextSlider)
+#endif
+
+#ifdef IMPLEMENTATION
+string TextSlider_valueToIdentifier(entity me, float val)
+{
+       if(val >= me.nValues)
+               return "custom";
+       if(val < 0)
+               return "custom";
+       return me.(valueIdentifiers[val]);
+}
+string TextSlider_valueToText(entity me, float val)
+{
+       if(val >= me.nValues)
+               return _("Custom");
+       if(val < 0)
+               return _("Custom");
+       return me.(valueStrings[val]);
+}
+void TextSlider_setValueFromIdentifier(entity me, string id)
+{
+       float i;
+       for(i = 0; i < me.nValues; ++i)
+               if(me.valueToIdentifier(me, i) == id)
+               {
+                       SUPER(TextSlider).setValue( me, i );
+                       return;
+               }
+       SUPER(TextSlider).setValue( me, -1 );
+}
+string TextSlider_getIdentifier(entity me)
+{
+       return me.valueToIdentifier(me, me.value);
+}
+void TextSlider_clearValues(entity me)
+{
+       me.nValues = 0;
+}
+void TextSlider_addValue(entity me, string theString, string theIdentifier)
+{
+       me.(valueStrings[me.nValues]) = theString;
+       me.(valueIdentifiers[me.nValues]) = theIdentifier;
+       me.nValues += 1;
+}
+void TextSlider_insertValue(entity me, float pos, string theString, string theIdentifier)
+{
+       float i;
+       for (i = me.nValues; i > pos; --i)
+       {
+               me.(valueStrings[i]) = me.(valueStrings[i-1]);
+               me.(valueIdentifiers[i]) = me.(valueIdentifiers[i-1]);
+       }
+       me.(valueStrings[pos]) = theString;
+       me.(valueIdentifiers[pos]) = theIdentifier;
+       me.nValues += 1;
+}
+void TextSlider_configureTextSliderValues(entity me, string theDefault)
+{
+       me.configureSliderValues(me, 0, 0, me.nValues - 1, 1, 1, 1);
+       me.setValueFromIdentifier(me, theDefault);
+}
+#endif
index aa771649d663fa705e6980d4870ef3d5174624b0..e348796a0f89747b89e16fa315684d4ae0edddc7 100644 (file)
@@ -1,3 +1,8 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
 ///////////////////////////////////////////////
 // Menu Source File
 ///////////////////////
@@ -7,7 +12,7 @@
 
 float mouseButtonsPressed;
 vector menuMousePos;
-float menuShiftState;
+int menuShiftState;
 float menuPrevTime;
 float menuAlpha;
 float menuLogoAlpha;
@@ -194,7 +199,7 @@ void m_init_delayed()
        }
        fclose(fh);
 
-       glob = search_begin(strcat(draw_currentSkin, "/*.tga"), TRUE, TRUE);
+       glob = search_begin(strcat(draw_currentSkin, "/*.tga"), true, true);
        if(glob >= 0)
        {
                n = search_getsize(glob);
@@ -264,7 +269,7 @@ void m_keydown(float key, float ascii)
        {
                // detect a click outside of the game window
                vector p = getmousepos();
-               if(p_x < 0 || p_x > realconwidth || p_y < 0 || p_y > realconheight)
+               if(p.x < 0 || p.x > realconwidth || p.y < 0 || p.y > realconheight)
                {
                        ++mouseButtonsPressed;
                        return;
@@ -314,13 +319,10 @@ void draw_Picture_Aligned(vector algn, float scalemode, string img, float a)
        float width_is_larger;
 
        sz = draw_PictureSize(img);
-       width_is_larger = (sz_x * draw_scale_y >= sz_y * draw_scale_x);
-       isz_w = '1 0 0' + '0 1 0' * ((sz_y / sz_x) * (draw_scale_x / draw_scale_y));
-       isz_h = '0 1 0' + '1 0 0' * ((sz_x / sz_y) * (draw_scale_y / draw_scale_x));
+       width_is_larger = (sz.x * draw_scale.y >= sz.y * draw_scale.x);
+       isz_w = '1 0 0' + '0 1 0' * ((sz.y / sz.x) * (draw_scale.x / draw_scale.y));
+       isz_h = '0 1 0' + '1 0 0' * ((sz.x / sz.y) * (draw_scale.y / draw_scale.x));
 
-#ifdef GMQCC
-       isz = '0 0 0';
-#endif
        switch(scalemode)
        {
                default:
@@ -341,7 +343,7 @@ void draw_Picture_Aligned(vector algn, float scalemode, string img, float a)
                        break;
        }
 
-       org = eX * (algn_x * (1 - isz_x)) + eY * (algn_y * (1 - isz_y));
+       org = eX * (algn.x * (1 - isz.x)) + eY * (algn.y * (1 - isz.y));
        draw_Picture(org, img, isz, '1 1 1', a);
 }
 
@@ -355,7 +357,7 @@ void drawBackground(string img, float a, string algn, float force1)
        string c;
        float scalemode;
 
-       v_z = 0;
+       v.z = 0;
 
        scalemode = SCALEMODE_CROP;
 
@@ -370,17 +372,17 @@ void drawBackground(string img, float a, string algn, float force1)
                        case "h": scalemode = SCALEMODE_HEIGHT; goto nopic;
                        case "w": scalemode = SCALEMODE_WIDTH; goto nopic;
                        case "s": scalemode = SCALEMODE_STRETCH; goto nopic;
-                       case "1": case "4": case "7": v_x = 0.0; break;
-                       case "2": case "5": case "8": v_x = 0.5; break;
-                       case "3": case "6": case "9": v_x = 1.0; break;
-                       default: v_x = random(); break;
+                       case "1": case "4": case "7": v.x = 0.0; break;
+                       case "2": case "5": case "8": v.x = 0.5; break;
+                       case "3": case "6": case "9": v.x = 1.0; break;
+                       default: v.x = random(); break;
                }
                switch(c)
                {
-                       case "7": case "8": case "9": v_y = 0.0; break;
-                       case "4": case "5": case "6": v_y = 0.5; break;
-                       case "1": case "2": case "3": v_y = 1.0; break;
-                       default: v_y = random(); break;
+                       case "7": case "8": case "9": v.y = 0.0; break;
+                       case "4": case "5": case "6": v.y = 0.5; break;
+                       case "1": case "2": case "3": v.y = 1.0; break;
+                       default: v.y = random(); break;
                }
                if(l == 0)
                        draw_Picture_Aligned(v, scalemode, img, a);
@@ -407,68 +409,68 @@ string menuTooltipText;
 float menuTooltipState; // 0: static, 1: fading in, 2: fading out
 float m_testmousetooltipbox(vector pos)
 {
-       if(pos_x >= menuTooltipOrigin_x && pos_x < menuTooltipOrigin_x + menuTooltipSize_x)
-       if(pos_y >= menuTooltipOrigin_y && pos_y < menuTooltipOrigin_y + menuTooltipSize_y)
-               return FALSE;
-       return TRUE;
+       if(pos.x >= menuTooltipOrigin.x && pos.x < menuTooltipOrigin.x + menuTooltipSize.x)
+       if(pos.y >= menuTooltipOrigin.y && pos.y < menuTooltipOrigin.y + menuTooltipSize.y)
+               return false;
+       return true;
 }
 float m_testtooltipbox(vector tooltippos)
 {
-       if(tooltippos_x < 0)
-               return FALSE;
-       if(tooltippos_y < 0)
-               return FALSE;
-       if(tooltippos_x + menuTooltipSize_x > 1)
-               return FALSE;
-       if(tooltippos_y + menuTooltipSize_y > 1)
-               return FALSE;
+       if(tooltippos.x < 0)
+               return false;
+       if(tooltippos.y < 0)
+               return false;
+       if(tooltippos.x + menuTooltipSize.x > 1)
+               return false;
+       if(tooltippos.y + menuTooltipSize.y > 1)
+               return false;
        menuTooltipOrigin = tooltippos;
-       return TRUE;
+       return true;
 }
 float m_allocatetooltipbox(vector pos)
 {
        vector avoidplus, avoidminus;
        vector v;
 
-       avoidplus_x = (SKINAVOID_TOOLTIP_x + SKINSIZE_CURSOR_x - SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth;
-       avoidplus_y = (SKINAVOID_TOOLTIP_y + SKINSIZE_CURSOR_y - SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight;
-       avoidplus_z = 0;
+       avoidplus.x = (SKINAVOID_TOOLTIP_x + SKINSIZE_CURSOR_x - SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth;
+       avoidplus.y = (SKINAVOID_TOOLTIP_y + SKINSIZE_CURSOR_y - SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight;
+       avoidplus.z = 0;
 
-       avoidminus_x = (SKINAVOID_TOOLTIP_x + SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth + menuTooltipSize_x;
-       avoidminus_y = (SKINAVOID_TOOLTIP_y + SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight + menuTooltipSize_y;
-       avoidminus_z = 0;
+       avoidminus.x = (SKINAVOID_TOOLTIP_x + SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth + menuTooltipSize.x;
+       avoidminus.y = (SKINAVOID_TOOLTIP_y + SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight + menuTooltipSize.y;
+       avoidminus.z = 0;
 
        // bottom right
        v = pos + avoidplus;
        if(m_testtooltipbox(v))
-               return TRUE;
+               return true;
 
        // bottom center
-       v_x = pos_x - menuTooltipSize_x * 0.5;
+       v.x = pos.x - menuTooltipSize.x * 0.5;
        if(m_testtooltipbox(v))
-               return TRUE;
+               return true;
 
        // bottom left
-       v_x = pos_x - avoidminus_x;
+       v.x = pos.x - avoidminus.x;
        if(m_testtooltipbox(v))
-               return TRUE;
+               return true;
 
        // top left
-       v_y = pos_y - avoidminus_y;
+       v.y = pos.y - avoidminus.y;
        if(m_testtooltipbox(v))
-               return TRUE;
+               return true;
 
        // top center
-       v_x = pos_x - menuTooltipSize_x * 0.5;
+       v.x = pos.x - menuTooltipSize.x * 0.5;
        if(m_testtooltipbox(v))
-               return TRUE;
+               return true;
 
        // top right
-       v_x = pos_x + avoidplus_x;
+       v.x = pos.x + avoidplus.x;
        if(m_testtooltipbox(v))
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 entity m_findtooltipitem(entity root, vector pos)
 {
@@ -576,7 +578,7 @@ void m_tooltip(vector pos)
                                        menuTooltipState = 1;
                                        menuTooltipItem = it;
 
-                                       menuTooltipOrigin_x = -1; // unallocated
+                                       menuTooltipOrigin.x = -1; // unallocated
 
                                        if (menuTooltipText)
                                                strunzone(menuTooltipText);
@@ -589,13 +591,13 @@ void m_tooltip(vector pos)
                                        {
                                                s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
                                                ++i;
-                                               f = draw_TextWidth(s, FALSE, fontsize);
+                                               f = draw_TextWidth(s, false, fontsize);
                                                if(f > w)
                                                        w = f;
                                        }
-                                       menuTooltipSize_x = w + 2 * (SKINMARGIN_TOOLTIP_x / conwidth);
-                                       menuTooltipSize_y = i * fontsize_y + 2 * (SKINMARGIN_TOOLTIP_y / conheight);
-                                       menuTooltipSize_z = 0;
+                                       menuTooltipSize.x = w + 2 * (SKINMARGIN_TOOLTIP_x / conwidth);
+                                       menuTooltipSize.y = i * fontsize.y + 2 * (SKINMARGIN_TOOLTIP_y / conheight);
+                                       menuTooltipSize.z = 0;
                                }
                                break;
                        case 1:
@@ -648,25 +650,25 @@ void m_tooltip(vector pos)
                                menuTooltipItem = world; // reload tooltip next frame
                        menu_tooltips_old = menu_tooltips;
                }
-               else if(menuTooltipOrigin_x < 0) // unallocated?
+               else if(menuTooltipOrigin.x < 0) // unallocated?
                        m_allocatetooltipbox(pos);
 
-               if(menuTooltipOrigin_x >= 0)
+               if(menuTooltipOrigin.x >= 0)
                {
                        // draw the tooltip!
                        p = SKINBORDER_TOOLTIP;
-                       p_x *= 1 / conwidth;
-                       p_y *= 1 / conheight;
+                       p.x *= 1 / conwidth;
+                       p.y *= 1 / conheight;
                        draw_BorderPicture(menuTooltipOrigin, SKINGFX_TOOLTIP, menuTooltipSize, '1 1 1', menuTooltipAlpha, p);
                        p = menuTooltipOrigin;
-                       p_x += SKINMARGIN_TOOLTIP_x / conwidth;
-                       p_y += SKINMARGIN_TOOLTIP_y / conheight;
+                       p.x += SKINMARGIN_TOOLTIP_x / conwidth;
+                       p.y += SKINMARGIN_TOOLTIP_y / conheight;
                        getWrappedLine_remaining = menuTooltipText;
                        while(getWrappedLine_remaining)
                        {
                                s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
-                               draw_Text(p, s, fontsize, SKINCOLOR_TOOLTIP, SKINALPHA_TOOLTIP * menuTooltipAlpha, FALSE);
-                               p_y += fontsize_y;
+                               draw_Text(p, s, fontsize, SKINCOLOR_TOOLTIP, SKINALPHA_TOOLTIP * menuTooltipAlpha, false);
+                               p.y += fontsize.y;
                        }
                }
        }
@@ -759,7 +761,7 @@ void m_draw(float width, float height)
                {
                        draw_reset_full();
                        draw_Fill('0 0 0', '1 1 0', SKINCOLOR_BACKGROUND, 1);
-                       drawBackground(SKINGFX_BACKGROUND, bound(0, menuLogoAlpha, 1), SKINALIGN_BACKGROUND, TRUE);
+                       drawBackground(SKINGFX_BACKGROUND, bound(0, menuLogoAlpha, 1), SKINALIGN_BACKGROUND, true);
                        draw_reset_cropped();
                        if(menuAlpha <= 0 && SKINALPHA_CURSOR_INTRO > 0)
                        {
@@ -774,7 +776,7 @@ void m_draw(float width, float height)
                if(menuAlpha > 0)
                {
                        draw_reset_full();
-                       drawBackground(SKINGFX_BACKGROUND_INGAME, menuAlpha * SKINALPHA_BACKGROUND_INGAME, SKINALIGN_BACKGROUND_INGAME, FALSE);
+                       drawBackground(SKINGFX_BACKGROUND_INGAME, menuAlpha * SKINALPHA_BACKGROUND_INGAME, SKINALIGN_BACKGROUND_INGAME, false);
                        draw_reset_cropped();
                }
        }
@@ -828,8 +830,8 @@ void m_draw(float width, float height)
                                maxpos = globalToBox(eX * (realconwidth - 1) + eY * (realconheight - 1), draw_shift, draw_scale);
                                dMouse = globalToBoxSize(dMouse, draw_scale);
                                menuMousePos += dMouse * cvar("menu_mouse_speed");
-                               menuMousePos_x = bound(minpos_x, menuMousePos_x, maxpos_x);
-                               menuMousePos_y = bound(minpos_y, menuMousePos_y, maxpos_y);
+                               menuMousePos.x = bound(minpos.x, menuMousePos.x, maxpos.x);
+                               menuMousePos.y = bound(minpos.y, menuMousePos.y, maxpos.y);
                                if(mouseButtonsPressed)
                                        main.mouseDrag(main, menuMousePos);
                                else
@@ -956,8 +958,8 @@ void m_setpointerfocus(entity wnd)
                if(focus)
                {
                        menuMousePos = focus.origin + 0.5 * focus.size;
-                       menuMousePos_x *= 1 / conwidth;
-                       menuMousePos_y *= 1 / conheight;
+                       menuMousePos.x *= 1 / conwidth;
+                       menuMousePos.y *= 1 / conheight;
                        if(wnd.focused) // why does this never happen?
                                m_focus_item_chain(wnd, focus);
                }
@@ -1001,3 +1003,20 @@ void m_goto(string itemname)
                }
        }
 }
+
+float menuLastFocusSoundTime;
+void m_play_focus_sound()
+{
+       if(cvar("menu_sounds") > 1)
+               if(time - menuLastFocusSoundTime > 0.25)
+               {
+                       localsound(MENU_SOUND_FOCUS);
+                       menuLastFocusSoundTime = time;
+               }
+}
+
+void m_play_click_sound(string soundfile)
+{
+       if(cvar("menu_sounds"))
+               localsound(soundfile);
+}
index b6c0795a8544424d505b8392d8d7f4f7cec59825..00f6017aa06b3bdf4b2143fbd132cd4dac4885e3 100644 (file)
@@ -1,3 +1,17 @@
+#ifndef MENU_H
+#define MENU_H
+
+#include "draw.qh"
+#include "skin.qh"
+
+#include "oo/base.qh"
+
+#include "xonotic/util.qh"
+
+#include "../common/constants.qh"
+#include "../common/test.qh"
+#include "../common/util.qh"
+
 #define localcmd cmd
 
 #define NULL (null_entity)
 
 // constants
 
-const float GAME_ISSERVER      = 1;
-const float GAME_CONNECTED     = 2;
-const float GAME_DEVELOPER     = 4;
+const int GAME_ISSERVER        = 1;
+const int GAME_CONNECTED       = 2;
+const int GAME_DEVELOPER       = 4;
 
 // prototypes
 
 float Menu_Active;
-float gamestatus;
+int gamestatus;
 
-const float S_SHIFT = 1;
-const float S_CTRL = 2;
-const float S_ALT = 4;
+const int S_SHIFT = 1;
+const int S_CTRL = 2;
+const int S_ALT = 4;
 
 float frametime;
 float time;
@@ -38,3 +52,18 @@ void preMenuDraw(); // this is run before the menu is drawn. You may put some st
 void postMenuDraw(); // this is run just after the menu is drawn (or not). Useful to draw something over everything else.
 
 void m_sync();
+
+// sounds
+
+const string MENU_SOUND_CLEAR   = "sound/menu/clear.wav";
+const string MENU_SOUND_CLOSE   = "sound/menu/close.wav";
+const string MENU_SOUND_EXECUTE = "sound/menu/execute.wav";
+const string MENU_SOUND_FOCUS   = "sound/menu/focus.wav";
+const string MENU_SOUND_OPEN    = "sound/menu/open.wav";
+const string MENU_SOUND_SELECT  = "sound/menu/select.wav";
+const string MENU_SOUND_SLIDE   = "sound/menu/slide.wav";
+const string MENU_SOUND_WINNER  = "sound/menu/winner.wav";
+
+void m_play_focus_sound();
+void m_play_click_sound(string soundfile);
+#endif
diff --git a/qcsrc/menu/oo/base.h b/qcsrc/menu/oo/base.h
deleted file mode 100644 (file)
index ed4eba5..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-.string classname;
-entity Object_vtbl;
-.string vtblname;
-.entity vtblbase;
-// THIS LINE INTENTIONALLY LEFT BLANK
-entity spawnVtbl(entity e, entity b)
-{
-       entity v;
-       v = spawn();
-       copyentity(e, v);
-       v.vtblname = v.classname;
-       v.classname = "vtbl";
-       if(b)
-               v.vtblbase = b;
-       else
-               v.vtblbase = v;
-       return v;
-}
-entity spawnObject()
-{
-       entity e;
-       e = spawn();
-       e.classname = "Object";
-       if(!Object_vtbl)
-               Object_vtbl = spawnVtbl(e, null_entity);
-       return e;
-}
diff --git a/qcsrc/menu/oo/base.qh b/qcsrc/menu/oo/base.qh
new file mode 100644 (file)
index 0000000..55af8ad
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef BASE_H
+#define BASE_H
+
+.string classname;
+entity Object_vtbl;
+.string vtblname;
+.entity vtblbase;
+// THIS LINE INTENTIONALLY LEFT BLANK
+entity spawnVtbl(entity e, entity b)
+{
+       entity v;
+       v = spawn();
+       copyentity(e, v);
+       v.vtblname = v.classname;
+       v.classname = "vtbl";
+       if(b)
+               v.vtblbase = b;
+       else
+               v.vtblbase = v;
+       return v;
+}
+entity spawnObject()
+{
+       entity e;
+       e = spawn();
+       e.classname = "Object";
+       if(!Object_vtbl)
+               Object_vtbl = spawnVtbl(e, null_entity);
+       return e;
+}
+#endif
diff --git a/qcsrc/menu/oo/implementation.h b/qcsrc/menu/oo/implementation.h
deleted file mode 100644 (file)
index 28b7f08..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef INTERFACE
-#define INTERFACE
-#endif
-
-#ifndef IMPLEMENTATION
-#define IMPLEMENTATION
-#endif
-
-#ifdef CLASS
-#undef CLASS
-#undef EXTENDS
-#undef METHOD
-#undef ATTRIB
-#undef ATTRIBARRAY
-#undef ENDCLASS
-#undef SUPER
-#endif
-
-// for the constructor
-#define CLASS(cname)                       entity spawn##cname() { entity me;
-#define EXTENDS(base)                      me = spawn##base (); entity basevtbl; basevtbl = base##_vtbl;
-#define METHOD(cname,name,prototype)       me.name = cname##_##name;
-#define ATTRIB(cname,name,type,val)        me.name = val;
-#define ATTRIBARRAY(cname,name,type,cnt)
-#define ENDCLASS(cname)                    me.instanceOf##cname = 1; me.classname = #cname; if(!cname##_vtbl) cname##_vtbl = spawnVtbl(me, basevtbl); return me; }
-
-// for the implementation
-#define SUPER(cname) (cname##_vtbl.vtblbase)
diff --git a/qcsrc/menu/oo/implementation.qh b/qcsrc/menu/oo/implementation.qh
new file mode 100644 (file)
index 0000000..42a74be
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef IMPLEMENTATION_H
+#define IMPLEMENTATION_H
+
+#ifndef INTERFACE
+#define INTERFACE
+#endif
+
+#ifndef IMPLEMENTATION
+#define IMPLEMENTATION
+#endif
+
+#ifdef CLASS
+#undef CLASS
+#undef EXTENDS
+#undef METHOD
+#undef ATTRIB
+#undef ATTRIBARRAY
+#undef ENDCLASS
+#undef SUPER
+#endif
+
+// for the constructor
+#define CLASS(cname)                       entity spawn##cname() { entity me;
+#define EXTENDS(base)                      me = spawn##base (); entity basevtbl; basevtbl = base##_vtbl;
+#define METHOD(cname,name,prototype)       me.name = cname##_##name;
+#define ATTRIB(cname,name,type,val)        me.name = val;
+#define ATTRIBARRAY(cname,name,type,cnt)
+#define ENDCLASS(cname)                    me.instanceOf##cname = 1; me.classname = #cname; if(!cname##_vtbl) cname##_vtbl = spawnVtbl(me, basevtbl); return me; }
+
+// for the implementation
+#define SUPER(cname) (cname##_vtbl.vtblbase)
+#endif
diff --git a/qcsrc/menu/oo/interface.h b/qcsrc/menu/oo/interface.h
deleted file mode 100644 (file)
index 1e12206..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef INTERFACE
-#define INTERFACE
-#endif
-
-#ifdef IMPLEMENTATION
-#undef IMPLEMENTATION
-#endif
-
-#ifdef CLASS
-#undef CLASS
-#undef EXTENDS
-#undef METHOD
-#undef ATTRIB
-#undef ATTRIBARRAY
-#undef ENDCLASS
-#undef SUPER
-#endif
-
-#define CLASS(cname)                       entity spawn##cname(); entity cname##_vtbl;
-#define EXTENDS(base)
-#define METHOD(cname,name,prototype)       prototype cname##_##name; .prototype name;
-#define ATTRIB(cname,name,type,val)        .type name;
-#define ATTRIBARRAY(cname,name,type,cnt)   .type name[cnt];
-#define ENDCLASS(cname)                    .float instanceOf##cname;
-#define SUPER(cname)
diff --git a/qcsrc/menu/oo/interface.qh b/qcsrc/menu/oo/interface.qh
new file mode 100644 (file)
index 0000000..e24bb3f
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef INTERFACE_H
+#define INTERFACE_H
+
+#ifndef INTERFACE
+#define INTERFACE
+#endif
+
+#ifdef IMPLEMENTATION
+#undef IMPLEMENTATION
+#endif
+
+#ifdef CLASS
+#undef CLASS
+#undef EXTENDS
+#undef METHOD
+#undef ATTRIB
+#undef ATTRIBARRAY
+#undef ENDCLASS
+#undef SUPER
+#endif
+
+#define CLASS(cname)                       entity spawn##cname(); entity cname##_vtbl;
+#define EXTENDS(base)
+#define METHOD(cname,name,prototype)       prototype cname##_##name; .prototype name;
+#define ATTRIB(cname,name,type,val)        .type name;
+#define ATTRIBARRAY(cname,name,type,cnt)   .type name[cnt];
+#define ENDCLASS(cname)                    .float instanceOf##cname;
+#define SUPER(cname)
+#endif
index 79b0f9023cd28dedfbde120252393dd53ffb172b..a1fb38b1a12bec97dcc2026da161c364a779563b 100644 (file)
@@ -1,60 +1,35 @@
 ../../menu.dat
 
-sys-pre.qh
-../dpdefs/menudefs.qc
-../dpdefs/keycodes.qc
-sys-post.qh
-
-config.qh
 ../common/util-pre.qh
+../dpdefs/menudefs.qh
+../dpdefs/keycodes.qh
 
-../warpzonelib/mathlib.qh
-../common/util.qh
-../common/test.qh
-
-oo/base.h
-
-../common/playerstats.qh
-../common/teams.qh
-../common/constants.qh
-../common/mapinfo.qh
-../common/campaign_common.qh
-../common/weapons/weapons.qh // TODO
-../common/counting.qh
-../common/command/markup.qh
-../common/command/rpn.qh
-../common/command/generic.qh
-../common/command/shared_defs.qh
-../common/urllib.qh
-../common/monsters/monsters.qh
-
-command/menu_cmd.qh
-menu.qh
-draw.qh
-skin.qh
-xonotic/util.qh
-
-oo/interface.h
-       classes.c
-oo/implementation.h
-       classes.c
+oo/interface.qh
+       classes.qc
+oo/implementation.qh
+       classes.qc
 
-../common/util.qc
-../common/test.qc
-../common/playerstats.qc
-../common/command/markup.qc
-../common/command/rpn.qc
-../common/command/generic.qc
-command/menu_cmd.qc
-menu.qc
 draw.qc
+menu.qc
+
+command/menu_cmd.qc
+
 xonotic/util.qc
 
 ../common/campaign_file.qc
 ../common/campaign_setup.qc
 ../common/mapinfo.qc
-../common/weapons/weapons.qc // TODO
+../common/playerstats.qc
+../common/test.qc
 ../common/urllib.qc
+../common/util.qc
+
+../common/command/generic.qc
+../common/command/markup.qc
+../common/command/rpn.qc
+
 ../common/monsters/monsters.qc
 
+../common/weapons/weapons.qc // TODO
+
 ../warpzonelib/mathlib.qc
index 437c49bf72c3327f3b17b4ef70903fce63c47b4e..84f9029c0f155d1317ed355209a5b88e9ae2ac6a 100644 (file)
@@ -1,8 +1,11 @@
+#ifndef SKIN_H
+#define SKIN_H
+
 #define SKINBEGIN
-#define SKINVECTOR(name,def) var vector SKIN##name = def
-#define SKINFLOAT(name,def) var float SKIN##name = def
+#define SKINVECTOR(name,def) vector SKIN##name = def
+#define SKINFLOAT(name,def) float SKIN##name = def
 //#define SKINSTRING(name,def) const string SKIN##name = def
-#define SKINSTRING(name,def) var string SKIN##name = def
+#define SKINSTRING(name,def) string SKIN##name = def
 #define SKINEND
 #include "skin-customizables.inc"
 #undef SKINEND
@@ -24,3 +27,4 @@
 #undef SKINFLOAT
 #undef SKINVECTOR
 #undef SKINBEGIN
+#endif
index e466fb482ab008961c9395c5389f7339025dc845..2b4120e8b061e73a178c3cdb9e6e69858c4f2d28 100644 (file)
@@ -1 +1,5 @@
+#ifndef SYS_POST_H
+#define SYS_POST_H
+
 #pragma noref 0
+#endif
index a964ae96130129f90897e0f7b1657eb236c8bf75..333d5c6bc998b22ccae3c43699af8772fc6c7f9c 100644 (file)
@@ -1 +1,5 @@
+#ifndef SYS_PRE_H
+#define SYS_PRE_H
+
 #pragma noref 1
+#endif
diff --git a/qcsrc/menu/xonotic/bigbutton.c b/qcsrc/menu/xonotic/bigbutton.c
deleted file mode 100644 (file)
index a63189b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticBigButton) EXTENDS(XonoticButton)
-       METHOD(XonoticBigButton, configureXonoticBigButton, void(entity, string, vector))
-       ATTRIB(XonoticBigButton, image, string, SKINGFX_BUTTON_BIG)
-       ATTRIB(XonoticBigButton, grayImage, string, SKINGFX_BUTTON_BIG_GRAY)
-ENDCLASS(XonoticBigButton)
-entity makeXonoticButton(string theText, vector theColor);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticBigButton(string theText, vector theColor)
-{
-       entity me;
-       me = spawnXonoticBigButton();
-       me.configureXonoticBigButton(me, theText, theColor);
-       return me;
-}
-
-void XonoticBigButton_configureXonoticBigButton(entity me, string theText, vector theColor)
-{
-       me.configureXonoticButton(me, theText, theColor);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/bigbutton.qc b/qcsrc/menu/xonotic/bigbutton.qc
new file mode 100644 (file)
index 0000000..a63189b
--- /dev/null
@@ -0,0 +1,23 @@
+#ifdef INTERFACE
+CLASS(XonoticBigButton) EXTENDS(XonoticButton)
+       METHOD(XonoticBigButton, configureXonoticBigButton, void(entity, string, vector))
+       ATTRIB(XonoticBigButton, image, string, SKINGFX_BUTTON_BIG)
+       ATTRIB(XonoticBigButton, grayImage, string, SKINGFX_BUTTON_BIG_GRAY)
+ENDCLASS(XonoticBigButton)
+entity makeXonoticButton(string theText, vector theColor);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticBigButton(string theText, vector theColor)
+{
+       entity me;
+       me = spawnXonoticBigButton();
+       me.configureXonoticBigButton(me, theText, theColor);
+       return me;
+}
+
+void XonoticBigButton_configureXonoticBigButton(entity me, string theText, vector theColor)
+{
+       me.configureXonoticButton(me, theText, theColor);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/bigcommandbutton.c b/qcsrc/menu/xonotic/bigcommandbutton.c
deleted file mode 100644 (file)
index c96dd57..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticBigCommandButton) EXTENDS(XonoticCommandButton)
-       METHOD(XonoticBigCommandButton, configureXonoticBigCommandButton, void(entity, string, vector, string, float))
-       ATTRIB(XonoticBigCommandButton, image, string, SKINGFX_BUTTON_BIG)
-       ATTRIB(XonoticBigCommandButton, grayImage, string, SKINGFX_BUTTON_BIG_GRAY)
-ENDCLASS(XonoticBigCommandButton)
-entity makeXonoticBigCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticBigCommandButton(string theText, vector theColor, string theCommand, float theFlags)
-{
-       entity me;
-       me = spawnXonoticBigCommandButton();
-       me.configureXonoticBigCommandButton(me, theText, theColor, theCommand, theFlags);
-       return me;
-}
-
-void XonoticBigCommandButton_configureXonoticBigCommandButton(entity me, string theText, vector theColor, string theCommand, float theFlags)
-{
-       me.configureXonoticCommandButton(me, theText, theColor, theCommand, theFlags);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/bigcommandbutton.qc b/qcsrc/menu/xonotic/bigcommandbutton.qc
new file mode 100644 (file)
index 0000000..c96dd57
--- /dev/null
@@ -0,0 +1,23 @@
+#ifdef INTERFACE
+CLASS(XonoticBigCommandButton) EXTENDS(XonoticCommandButton)
+       METHOD(XonoticBigCommandButton, configureXonoticBigCommandButton, void(entity, string, vector, string, float))
+       ATTRIB(XonoticBigCommandButton, image, string, SKINGFX_BUTTON_BIG)
+       ATTRIB(XonoticBigCommandButton, grayImage, string, SKINGFX_BUTTON_BIG_GRAY)
+ENDCLASS(XonoticBigCommandButton)
+entity makeXonoticBigCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticBigCommandButton(string theText, vector theColor, string theCommand, float theFlags)
+{
+       entity me;
+       me = spawnXonoticBigCommandButton();
+       me.configureXonoticBigCommandButton(me, theText, theColor, theCommand, theFlags);
+       return me;
+}
+
+void XonoticBigCommandButton_configureXonoticBigCommandButton(entity me, string theText, vector theColor, string theCommand, float theFlags)
+{
+       me.configureXonoticCommandButton(me, theText, theColor, theCommand, theFlags);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/button.c b/qcsrc/menu/xonotic/button.c
deleted file mode 100644 (file)
index cbc7c47..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticButton) EXTENDS(Button)
-       METHOD(XonoticButton, configureXonoticButton, void(entity, string, vector))
-       ATTRIB(XonoticButton, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticButton, image, string, SKINGFX_BUTTON)
-       ATTRIB(XonoticButton, grayImage, string, SKINGFX_BUTTON_GRAY)
-       ATTRIB(XonoticButton, color, vector, SKINCOLOR_BUTTON_N)
-       ATTRIB(XonoticButton, colorC, vector, SKINCOLOR_BUTTON_C)
-       ATTRIB(XonoticButton, colorF, vector, SKINCOLOR_BUTTON_F)
-       ATTRIB(XonoticButton, colorD, vector, SKINCOLOR_BUTTON_D)
-       ATTRIB(XonoticButton, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticButton, disabledAlpha, float, SKINALPHA_DISABLED)
-       ATTRIB(XonoticButton, marginLeft, float, SKINMARGIN_BUTTON) // chars
-       ATTRIB(XonoticButton, marginRight, float, SKINMARGIN_BUTTON) // chars
-ENDCLASS(XonoticButton)
-entity makeXonoticButton(string theText, vector theColor);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticButton(string theText, vector theColor)
-{
-       entity me;
-       me = spawnXonoticButton();
-       me.configureXonoticButton(me, theText, theColor);
-       return me;
-}
-
-void XonoticButton_configureXonoticButton(entity me, string theText, vector theColor)
-{
-       if(theColor == '0 0 0')
-       {
-               me.configureButton(me, theText, me.fontSize, me.image);
-       }
-       else
-       {
-               me.configureButton(me, theText, me.fontSize, me.grayImage);
-               me.color = theColor;
-               me.colorC = theColor;
-               me.colorF = theColor;
-       }
-       me.tooltip = getZonedTooltipForIdentifier(strcat(currentDialog.classname, "/", me.text));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/button.qc b/qcsrc/menu/xonotic/button.qc
new file mode 100644 (file)
index 0000000..cbc7c47
--- /dev/null
@@ -0,0 +1,43 @@
+#ifdef INTERFACE
+CLASS(XonoticButton) EXTENDS(Button)
+       METHOD(XonoticButton, configureXonoticButton, void(entity, string, vector))
+       ATTRIB(XonoticButton, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticButton, image, string, SKINGFX_BUTTON)
+       ATTRIB(XonoticButton, grayImage, string, SKINGFX_BUTTON_GRAY)
+       ATTRIB(XonoticButton, color, vector, SKINCOLOR_BUTTON_N)
+       ATTRIB(XonoticButton, colorC, vector, SKINCOLOR_BUTTON_C)
+       ATTRIB(XonoticButton, colorF, vector, SKINCOLOR_BUTTON_F)
+       ATTRIB(XonoticButton, colorD, vector, SKINCOLOR_BUTTON_D)
+       ATTRIB(XonoticButton, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticButton, disabledAlpha, float, SKINALPHA_DISABLED)
+       ATTRIB(XonoticButton, marginLeft, float, SKINMARGIN_BUTTON) // chars
+       ATTRIB(XonoticButton, marginRight, float, SKINMARGIN_BUTTON) // chars
+ENDCLASS(XonoticButton)
+entity makeXonoticButton(string theText, vector theColor);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticButton(string theText, vector theColor)
+{
+       entity me;
+       me = spawnXonoticButton();
+       me.configureXonoticButton(me, theText, theColor);
+       return me;
+}
+
+void XonoticButton_configureXonoticButton(entity me, string theText, vector theColor)
+{
+       if(theColor == '0 0 0')
+       {
+               me.configureButton(me, theText, me.fontSize, me.image);
+       }
+       else
+       {
+               me.configureButton(me, theText, me.fontSize, me.grayImage);
+               me.color = theColor;
+               me.colorC = theColor;
+               me.colorF = theColor;
+       }
+       me.tooltip = getZonedTooltipForIdentifier(strcat(currentDialog.classname, "/", me.text));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/campaign.c b/qcsrc/menu/xonotic/campaign.c
deleted file mode 100644 (file)
index 454b4ad..0000000
+++ /dev/null
@@ -1,326 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticCampaignList) EXTENDS(XonoticListBox)
-       METHOD(XonoticCampaignList, configureXonoticCampaignList, void(entity))
-       ATTRIB(XonoticCampaignList, rowsPerItem, float, 10)
-       METHOD(XonoticCampaignList, draw, void(entity))
-       METHOD(XonoticCampaignList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticCampaignList, clickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticCampaignList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticCampaignList, setSelected, void(entity, float))
-       METHOD(XonoticCampaignList, keyDown, float(entity, float, float, float))
-       METHOD(XonoticCampaignList, campaignGo, void(entity, float))
-       METHOD(XonoticCampaignList, destroy, void(entity))
-
-       ATTRIB(XonoticCampaignList, campaignGlob, float, 0)
-       ATTRIB(XonoticCampaignList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticCampaignList, columnPreviewOrigin, float, 0)
-       ATTRIB(XonoticCampaignList, columnPreviewSize, float, 0)
-       ATTRIB(XonoticCampaignList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticCampaignList, columnNameSize, float, 0)
-       ATTRIB(XonoticCampaignList, columnCheckMarkOrigin, float, 0)
-       ATTRIB(XonoticCampaignList, columnCheckMarkSize, float, 0)
-       ATTRIB(XonoticCampaignList, checkMarkOrigin, vector, '0 0 0')
-       ATTRIB(XonoticCampaignList, checkMarkSize, vector, '0 0 0')
-       ATTRIB(XonoticCampaignList, realUpperMargin1, float, 0)
-       ATTRIB(XonoticCampaignList, realUpperMargin2, float, 0)
-
-       ATTRIB(XonoticCampaignList, lastClickedMap, float, -1)
-       ATTRIB(XonoticCampaignList, lastClickedTime, float, 0)
-
-       ATTRIB(XonoticCampaignList, origin, vector, '0 0 0')
-       ATTRIB(XonoticCampaignList, itemAbsSize, vector, '0 0 0')
-       ATTRIB(XonoticCampaignList, emptyLineHeight, float, 0.5)
-
-       ATTRIB(XonoticCampaignList, campaignIndex, float, 0)
-       ATTRIB(XonoticCampaignList, cvarName, string, string_null)
-       METHOD(XonoticCampaignList, loadCvars, void(entity))
-       METHOD(XonoticCampaignList, saveCvars, void(entity))
-
-       ATTRIB(XonoticCampaignList, buttonNext, entity, NULL)
-       ATTRIB(XonoticCampaignList, buttonPrev, entity, NULL)
-       ATTRIB(XonoticCampaignList, labelTitle, entity, NULL)
-ENDCLASS(XonoticCampaignList)
-entity makeXonoticCampaignList();
-void CampaignList_LoadMap(entity btn, entity me);
-void MultiCampaign_Next(entity btn, entity me);
-void MultiCampaign_Prev(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-string campaign_longdesc_wrapped[CAMPAIGN_MAX_ENTRIES];
-
-void rewrapCampaign(float w, float l0, float emptyheight, vector theFontSize)
-{
-       float i, j;
-       float n, l;
-       string r, s;
-       for(i = 0; i < campaign_entries; ++i)
-       {
-               l = l0;
-               if(campaign_longdesc_wrapped[i])
-                       strunzone(campaign_longdesc_wrapped[i]);
-               n = tokenizebyseparator(campaign_longdesc[i], "\n");
-               r = "";
-               for(j = 0; j < n; ++j)
-               {
-                       s = argv(j);
-                       if(s == "")
-                       {
-                               l -= emptyheight;
-                               r = strcat(r, "\n");
-                               continue;
-                       }
-
-                       getWrappedLine_remaining = s;
-                       while(getWrappedLine_remaining)
-                       {
-                               s = getWrappedLine(w, theFontSize, draw_TextWidth_WithoutColors);
-                               if(--l < 0) goto toolong;
-                               r = strcat(r, s, "\n");
-                       }
-               }
-               goto nottoolong;
-:toolong
-               while(substring(r, strlen(r) - 1, 1) == "\n")
-                       r = substring(r, 0, strlen(r) - 1);
-               r = strcat(r, "...\n");
-:nottoolong
-               campaign_longdesc_wrapped[i] = strzone(substring(r, 0, strlen(r) - 1));
-       }
-}
-
-entity makeXonoticCampaignList()
-{
-       entity me;
-       me = spawnXonoticCampaignList();
-       me.configureXonoticCampaignList(me);
-       return me;
-}
-void XonoticCampaignList_configureXonoticCampaignList(entity me)
-{
-       me.configureXonoticListBox(me);
-       me.campaignGlob = search_begin("maps/campaign*.txt", TRUE, TRUE);
-       me.loadCvars(me);
-       me.campaignGo(me, 0); // takes care of enabling/disabling buttons too
-}
-
-void XonoticCampaignList_destroy(entity me)
-{
-       if(me.campaignGlob >= 0)
-               search_end(me.campaignGlob);
-}
-
-void XonoticCampaignList_loadCvars(entity me)
-{
-       // read campaign cvars
-       if(campaign_name)
-               strunzone(campaign_name);
-       if(me.cvarName)
-               strunzone(me.cvarName);
-       campaign_name = strzone(cvar_string("g_campaign_name"));
-       me.cvarName = strzone(strcat("g_campaign", campaign_name, "_index"));
-       registercvar(me.cvarName, "", 0); // saved by server QC anyway
-       CampaignFile_Unload();
-       CampaignFile_Load(0, CAMPAIGN_MAX_ENTRIES);
-       me.campaignIndex = bound(0, cvar(me.cvarName), campaign_entries);
-       cvar_set(me.cvarName, ftos(me.campaignIndex));
-       if(me.columnNameSize)
-               rewrapCampaign(me.columnNameSize, me.rowsPerItem - 3, me.emptyLineHeight, me.realFontSize);
-       me.nItems = min(me.campaignIndex + 2, campaign_entries);
-       me.selectedItem = min(me.campaignIndex, me.nItems - 1);
-       me.scrollPos = me.nItems * me.itemHeight - 1;
-       if(me.labelTitle)
-               me.labelTitle.setText(me.labelTitle, campaign_title);
-}
-
-void XonoticCampaignList_saveCvars(entity me)
-{
-       // write campaign cvars
-       // no reason to do this!
-       // cvar_set("g_campaign_name", campaign_name);
-       // cvar_set(me.cvarName, ftos(me.campaignIndex)); // NOTE: only server QC does that!
-}
-
-void XonoticCampaignList_campaignGo(entity me, float step)
-{
-       float canNext, canPrev;
-       string s;
-       float i, j, n;
-
-       canNext = canPrev = 0;
-
-       if(me.campaignGlob >= 0)
-       {
-               n = search_getsize(me.campaignGlob);
-               if(n > 0)
-               {
-                       j = -1;
-                       s = strcat("maps/campaign", campaign_name, ".txt");
-                       for(i = 0; i < n; ++i)
-                       {
-                               if(search_getfilename(me.campaignGlob, i) == s)
-                                       j = i;
-                       }
-                       if(j < 0)
-                       {
-                               s = strcat("maps/campaign", cvar_defstring("g_campaign_name"), ".txt");
-                               for(i = 0; i < n; ++i)
-                               {
-                                       if(search_getfilename(me.campaignGlob, i) == s)
-                                               j = i;
-                               }
-                       }
-                       if(j < 0)
-                       {
-                               if(step >= 0)
-                                       j = 0;
-                               else
-                                       j = n - 1;
-                       }
-                       else
-                               j = mod(j + step, n);
-                       s = search_getfilename(me.campaignGlob, j);
-                       s = substring(s, 13, strlen(s) - 17);
-                       cvar_set("g_campaign_name", s);
-                       me.loadCvars(me);
-                       canNext = (j != n - 1);
-                       canPrev = (j != 0);
-               }
-       }
-
-       if(me.buttonNext)
-               me.buttonNext.disabled = !canNext;
-       if(me.buttonPrev)
-               me.buttonPrev.disabled = !canPrev;
-}
-
-void MultiCampaign_Next(entity btn, entity me)
-{
-       me.campaignGo(me, +1);
-}
-void MultiCampaign_Prev(entity btn, entity me)
-{
-       me.campaignGo(me, -1);
-}
-
-void XonoticCampaignList_draw(entity me)
-{
-       if(cvar(me.cvarName) != me.campaignIndex || cvar_string("g_campaign_name") != campaign_name)
-               me.loadCvars(me);
-       SUPER(XonoticCampaignList).draw(me);
-}
-
-void XonoticCampaignList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.itemAbsSize = '0 0 0';
-       SUPER(XonoticCampaignList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight));
-       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth)));
-       me.realUpperMargin1 = 0.5 * me.realFontSize_y;
-       me.realUpperMargin2 = me.realUpperMargin1 + 2 * me.realFontSize_y;
-
-       me.checkMarkSize = (eX * (me.itemAbsSize_y / me.itemAbsSize_x) + eY) * 0.5;
-
-       me.columnPreviewOrigin = 0;
-       me.columnPreviewSize = me.itemAbsSize_y / me.itemAbsSize_x * 4 / 3;
-       me.columnCheckMarkSize = me.checkMarkSize_x;
-       me.columnNameSize = 1 - me.columnPreviewSize - me.columnCheckMarkSize - 4 * me.realFontSize_x;
-       me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize_x;
-       me.columnCheckMarkOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize_x * 2;
-
-       me.checkMarkOrigin = eY + eX * (me.columnCheckMarkOrigin + me.columnCheckMarkSize) - me.checkMarkSize;
-
-       rewrapCampaign(me.columnNameSize, me.rowsPerItem - 3, me.emptyLineHeight, me.realFontSize);
-}
-void XonoticCampaignList_clickListBoxItem(entity me, float i, vector where)
-{
-       if(i == me.lastClickedMap)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       // start game
-                       CampaignList_LoadMap(me, me);
-                       return;
-               }
-       me.lastClickedMap = i;
-       me.lastClickedTime = time;
-}
-void XonoticCampaignList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       string s;
-       vector theColor;
-       float theAlpha;
-       float j, n;
-       vector o;
-
-       if(i < me.campaignIndex)
-       {
-               theAlpha = SKINALPHA_CAMPAIGN_SELECTABLE;
-               theColor = SKINCOLOR_CAMPAIGN_SELECTABLE;
-       }
-       else if(i == me.campaignIndex)
-       {
-               theAlpha = SKINALPHA_CAMPAIGN_CURRENT;
-               theColor = SKINCOLOR_CAMPAIGN_CURRENT;
-       }
-       else
-       {
-               theAlpha = SKINALPHA_CAMPAIGN_FUTURE;
-               theColor = SKINCOLOR_CAMPAIGN_FUTURE;
-       }
-
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
-       if(draw_PictureSize(strcat("/maps/", campaign_mapname[i])) == '0 0 0')
-               draw_Picture(me.columnPreviewOrigin * eX, "nopreview_map", me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
-       else
-               draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", campaign_mapname[i]), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
-
-       if(i < me.campaignIndex)
-               draw_Picture(me.checkMarkOrigin, "checkmark", me.checkMarkSize, '1 1 1', 1);
-       if(i <= me.campaignIndex)
-               s = campaign_shortdesc[i]; // fteqcc sucks
-       else
-               s = "???";
-       s = draw_TextShortenToWidth(sprintf(_("Level %d: %s"), i+1, s), me.columnNameSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, theColor, theAlpha, 0);
-
-       if(i <= me.campaignIndex)
-       {
-               s = campaign_longdesc_wrapped[i];
-               n = tokenizebyseparator(s, "\n");
-               o = me.realUpperMargin2 * eY + me.columnNameOrigin * eX;
-               for(j = 0; j < n; ++j)
-                       if(argv(j) != "")
-                       {
-                               draw_Text(o, argv(j), me.realFontSize, theColor, theAlpha * SKINALPHA_CAMPAIGN_DESCRIPTION, 0);
-                               o_y += me.realFontSize_y;
-                       }
-                       else
-                               o_y += me.realFontSize_y * me.emptyLineHeight;
-       }
-}
-void CampaignList_LoadMap(entity btn, entity me)
-{
-       if(me.selectedItem >= me.nItems || me.selectedItem < 0)
-               return;
-       CampaignSetup(me.selectedItem);
-}
-
-void XonoticCampaignList_setSelected(entity me, float i)
-{
-       // prevent too late items from being played
-       SUPER(XonoticCampaignList).setSelected(me, min(i, me.campaignIndex));
-}
-
-float XonoticCampaignList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       if(scan == K_ENTER || scan == K_SPACE || scan == K_KP_ENTER)
-               CampaignList_LoadMap(me, me);
-       else
-               return SUPER(XonoticCampaignList).keyDown(me, scan, ascii, shift);
-       return 1;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/campaign.qc b/qcsrc/menu/xonotic/campaign.qc
new file mode 100644 (file)
index 0000000..885c891
--- /dev/null
@@ -0,0 +1,316 @@
+#include "../../common/campaign_common.qh"
+
+#ifdef INTERFACE
+CLASS(XonoticCampaignList) EXTENDS(XonoticListBox)
+       METHOD(XonoticCampaignList, configureXonoticCampaignList, void(entity))
+       ATTRIB(XonoticCampaignList, rowsPerItem, float, 10)
+       METHOD(XonoticCampaignList, draw, void(entity))
+       METHOD(XonoticCampaignList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticCampaignList, doubleClickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticCampaignList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticCampaignList, setSelected, void(entity, float))
+       METHOD(XonoticCampaignList, keyDown, float(entity, float, float, float))
+       METHOD(XonoticCampaignList, campaignGo, void(entity, float))
+       METHOD(XonoticCampaignList, destroy, void(entity))
+
+       ATTRIB(XonoticCampaignList, campaignGlob, float, 0)
+       ATTRIB(XonoticCampaignList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticCampaignList, columnPreviewOrigin, float, 0)
+       ATTRIB(XonoticCampaignList, columnPreviewSize, float, 0)
+       ATTRIB(XonoticCampaignList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticCampaignList, columnNameSize, float, 0)
+       ATTRIB(XonoticCampaignList, columnCheckMarkOrigin, float, 0)
+       ATTRIB(XonoticCampaignList, columnCheckMarkSize, float, 0)
+       ATTRIB(XonoticCampaignList, checkMarkOrigin, vector, '0 0 0')
+       ATTRIB(XonoticCampaignList, checkMarkSize, vector, '0 0 0')
+       ATTRIB(XonoticCampaignList, realUpperMargin1, float, 0)
+       ATTRIB(XonoticCampaignList, realUpperMargin2, float, 0)
+
+       ATTRIB(XonoticCampaignList, origin, vector, '0 0 0')
+       ATTRIB(XonoticCampaignList, itemAbsSize, vector, '0 0 0')
+       ATTRIB(XonoticCampaignList, emptyLineHeight, float, 0.5)
+
+       ATTRIB(XonoticCampaignList, campaignIndex, float, 0)
+       ATTRIB(XonoticCampaignList, cvarName, string, string_null)
+       METHOD(XonoticCampaignList, loadCvars, void(entity))
+       METHOD(XonoticCampaignList, saveCvars, void(entity))
+
+       ATTRIB(XonoticCampaignList, buttonNext, entity, NULL)
+       ATTRIB(XonoticCampaignList, buttonPrev, entity, NULL)
+       ATTRIB(XonoticCampaignList, labelTitle, entity, NULL)
+ENDCLASS(XonoticCampaignList)
+entity makeXonoticCampaignList();
+void CampaignList_LoadMap(entity btn, entity me);
+void MultiCampaign_Next(entity btn, entity me);
+void MultiCampaign_Prev(entity btn, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+string campaign_longdesc_wrapped[CAMPAIGN_MAX_ENTRIES];
+
+void rewrapCampaign(float w, float l0, float emptyheight, vector theFontSize)
+{
+       float i, j;
+       float n, l;
+       string r, s;
+       for(i = 0; i < campaign_entries; ++i)
+       {
+               l = l0;
+               if(campaign_longdesc_wrapped[i])
+                       strunzone(campaign_longdesc_wrapped[i]);
+               n = tokenizebyseparator(campaign_longdesc[i], "\n");
+               r = "";
+               for(j = 0; j < n; ++j)
+               {
+                       s = argv(j);
+                       if(s == "")
+                       {
+                               l -= emptyheight;
+                               r = strcat(r, "\n");
+                               continue;
+                       }
+
+                       getWrappedLine_remaining = s;
+                       while(getWrappedLine_remaining)
+                       {
+                               s = getWrappedLine(w, theFontSize, draw_TextWidth_WithoutColors);
+                               if(--l < 0) goto toolong;
+                               r = strcat(r, s, "\n");
+                       }
+               }
+               goto nottoolong;
+:toolong
+               while(substring(r, strlen(r) - 1, 1) == "\n")
+                       r = substring(r, 0, strlen(r) - 1);
+               r = strcat(r, "...\n");
+:nottoolong
+               campaign_longdesc_wrapped[i] = strzone(substring(r, 0, strlen(r) - 1));
+       }
+}
+
+entity makeXonoticCampaignList()
+{
+       entity me;
+       me = spawnXonoticCampaignList();
+       me.configureXonoticCampaignList(me);
+       return me;
+}
+void XonoticCampaignList_configureXonoticCampaignList(entity me)
+{
+       me.configureXonoticListBox(me);
+       me.campaignGlob = search_begin("maps/campaign*.txt", true, true);
+       me.loadCvars(me);
+       me.campaignGo(me, 0); // takes care of enabling/disabling buttons too
+}
+
+void XonoticCampaignList_destroy(entity me)
+{
+       if(me.campaignGlob >= 0)
+               search_end(me.campaignGlob);
+}
+
+void XonoticCampaignList_loadCvars(entity me)
+{
+       // read campaign cvars
+       if(campaign_name)
+               strunzone(campaign_name);
+       if(me.cvarName)
+               strunzone(me.cvarName);
+       campaign_name = strzone(cvar_string("g_campaign_name"));
+       me.cvarName = strzone(strcat("g_campaign", campaign_name, "_index"));
+       registercvar(me.cvarName, "", 0); // saved by server QC anyway
+       CampaignFile_Unload();
+       CampaignFile_Load(0, CAMPAIGN_MAX_ENTRIES);
+       me.campaignIndex = bound(0, cvar(me.cvarName), campaign_entries);
+       cvar_set(me.cvarName, ftos(me.campaignIndex));
+       if(me.columnNameSize)
+               rewrapCampaign(me.columnNameSize, me.rowsPerItem - 3, me.emptyLineHeight, me.realFontSize);
+       me.nItems = min(me.campaignIndex + 2, campaign_entries);
+       me.selectedItem = min(me.campaignIndex, me.nItems - 1);
+       me.scrollPos = me.nItems * me.itemHeight - 1;
+       if(me.labelTitle)
+               me.labelTitle.setText(me.labelTitle, campaign_title);
+}
+
+void XonoticCampaignList_saveCvars(entity me)
+{
+       // write campaign cvars
+       // no reason to do this!
+       // cvar_set("g_campaign_name", campaign_name);
+       // cvar_set(me.cvarName, ftos(me.campaignIndex)); // NOTE: only server QC does that!
+}
+
+void XonoticCampaignList_campaignGo(entity me, float step)
+{
+       float canNext, canPrev;
+       string s;
+       float i, j, n;
+
+       canNext = canPrev = 0;
+
+       if(me.campaignGlob >= 0)
+       {
+               n = search_getsize(me.campaignGlob);
+               if(n > 0)
+               {
+                       j = -1;
+                       s = strcat("maps/campaign", campaign_name, ".txt");
+                       for(i = 0; i < n; ++i)
+                       {
+                               if(search_getfilename(me.campaignGlob, i) == s)
+                                       j = i;
+                       }
+                       if(j < 0)
+                       {
+                               s = strcat("maps/campaign", cvar_defstring("g_campaign_name"), ".txt");
+                               for(i = 0; i < n; ++i)
+                               {
+                                       if(search_getfilename(me.campaignGlob, i) == s)
+                                               j = i;
+                               }
+                       }
+                       if(j < 0)
+                       {
+                               if(step >= 0)
+                                       j = 0;
+                               else
+                                       j = n - 1;
+                       }
+                       else
+                               j = mod(j + step, n);
+                       s = search_getfilename(me.campaignGlob, j);
+                       s = substring(s, 13, strlen(s) - 17);
+                       cvar_set("g_campaign_name", s);
+                       me.loadCvars(me);
+                       canNext = (j != n - 1);
+                       canPrev = (j != 0);
+               }
+       }
+
+       if(me.buttonNext)
+               me.buttonNext.disabled = !canNext;
+       if(me.buttonPrev)
+               me.buttonPrev.disabled = !canPrev;
+}
+
+void MultiCampaign_Next(entity btn, entity me)
+{
+       me.campaignGo(me, +1);
+}
+void MultiCampaign_Prev(entity btn, entity me)
+{
+       me.campaignGo(me, -1);
+}
+
+void XonoticCampaignList_draw(entity me)
+{
+       if(cvar(me.cvarName) != me.campaignIndex || cvar_string("g_campaign_name") != campaign_name)
+               me.loadCvars(me);
+       SUPER(XonoticCampaignList).draw(me);
+}
+
+void XonoticCampaignList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.itemAbsSize = '0 0 0';
+       SUPER(XonoticCampaignList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
+       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
+       me.realUpperMargin1 = 0.5 * me.realFontSize.y;
+       me.realUpperMargin2 = me.realUpperMargin1 + 2 * me.realFontSize.y;
+
+       me.checkMarkSize = (eX * (me.itemAbsSize.y / me.itemAbsSize.x) + eY) * 0.5;
+
+       me.columnPreviewOrigin = 0;
+       me.columnPreviewSize = me.itemAbsSize.y / me.itemAbsSize.x * 4 / 3;
+       me.columnCheckMarkSize = me.checkMarkSize.x;
+       me.columnNameSize = 1 - me.columnPreviewSize - me.columnCheckMarkSize - 4 * me.realFontSize.x;
+       me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize.x;
+       me.columnCheckMarkOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize.x * 2;
+
+       me.checkMarkOrigin = eY + eX * (me.columnCheckMarkOrigin + me.columnCheckMarkSize) - me.checkMarkSize;
+
+       rewrapCampaign(me.columnNameSize, me.rowsPerItem - 3, me.emptyLineHeight, me.realFontSize);
+}
+void XonoticCampaignList_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       CampaignList_LoadMap(me, me);
+}
+void XonoticCampaignList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       string s;
+       vector theColor;
+       float theAlpha;
+       float j, n;
+       vector o;
+
+       if(i < me.campaignIndex)
+       {
+               theAlpha = SKINALPHA_CAMPAIGN_SELECTABLE;
+               theColor = SKINCOLOR_CAMPAIGN_SELECTABLE;
+       }
+       else if(i == me.campaignIndex)
+       {
+               theAlpha = SKINALPHA_CAMPAIGN_CURRENT;
+               theColor = SKINCOLOR_CAMPAIGN_CURRENT;
+       }
+       else
+       {
+               theAlpha = SKINALPHA_CAMPAIGN_FUTURE;
+               theColor = SKINCOLOR_CAMPAIGN_FUTURE;
+       }
+
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+
+       if(draw_PictureSize(strcat("/maps/", campaign_mapname[i])) == '0 0 0')
+               draw_Picture(me.columnPreviewOrigin * eX, "nopreview_map", me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
+       else
+               draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", campaign_mapname[i]), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
+
+       if(i < me.campaignIndex)
+               draw_Picture(me.checkMarkOrigin, "checkmark", me.checkMarkSize, '1 1 1', 1);
+       if(i <= me.campaignIndex)
+               s = campaign_shortdesc[i]; // fteqcc sucks
+       else
+               s = "???";
+       s = draw_TextShortenToWidth(sprintf(_("Level %d: %s"), i+1, s), me.columnNameSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, theColor, theAlpha, 0);
+
+       if(i <= me.campaignIndex)
+       {
+               s = campaign_longdesc_wrapped[i];
+               n = tokenizebyseparator(s, "\n");
+               o = me.realUpperMargin2 * eY + me.columnNameOrigin * eX;
+               for(j = 0; j < n; ++j)
+                       if(argv(j) != "")
+                       {
+                               draw_Text(o, argv(j), me.realFontSize, theColor, theAlpha * SKINALPHA_CAMPAIGN_DESCRIPTION, 0);
+                               o.y += me.realFontSize.y;
+                       }
+                       else
+                               o.y += me.realFontSize.y * me.emptyLineHeight;
+       }
+}
+void CampaignList_LoadMap(entity btn, entity me)
+{
+       if(me.selectedItem >= me.nItems || me.selectedItem < 0)
+               return;
+       CampaignSetup(me.selectedItem);
+}
+
+void XonoticCampaignList_setSelected(entity me, float i)
+{
+       // prevent too late items from being played
+       SUPER(XonoticCampaignList).setSelected(me, min(i, me.campaignIndex));
+}
+
+float XonoticCampaignList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       if(scan == K_ENTER || scan == K_SPACE || scan == K_KP_ENTER)
+               CampaignList_LoadMap(me, me);
+       else
+               return SUPER(XonoticCampaignList).keyDown(me, scan, ascii, shift);
+       return 1;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/charmap.c b/qcsrc/menu/xonotic/charmap.c
deleted file mode 100644 (file)
index 686d900..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticCharmap) EXTENDS(Item)
-       METHOD(XonoticCharmap, configureXonoticCharmap, void(entity, entity))
-       METHOD(XonoticCharmap, mousePress, float(entity, vector))
-       METHOD(XonoticCharmap, mouseRelease, float(entity, vector))
-       METHOD(XonoticCharmap, mouseMove, float(entity, vector))
-       METHOD(XonoticCharmap, mouseDrag, float(entity, vector))
-       METHOD(XonoticCharmap, keyDown, float(entity, float, float, float))
-       METHOD(XonoticCharmap, focusLeave, void(entity))
-       METHOD(XonoticCharmap, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticCharmap, draw, void(entity))
-       ATTRIB(XonoticCharmap, focusable, float, 1)
-
-       METHOD(XonoticCharmap, moveFocus, void(entity, vector, vector))
-       METHOD(XonoticCharmap, enterChar, void(entity))
-       ATTRIB(XonoticCharmap, inputBox, entity, NULL)
-       ATTRIB(XonoticCharmap, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticCharmap, realCellSize, vector, '0 0 0')
-       ATTRIB(XonoticCharmap, focusedCell, vector, '-1 -1 0')
-       ATTRIB(XonoticCharmap, previouslyFocusedCell, vector, '-1 -1 0')
-ENDCLASS(XonoticCharmap)
-entity makeXonoticCharmap(entity controlledInputBox);
-#endif
-
-#ifdef IMPLEMENTATION
-
-#define CHARMAP_COLS 14
-#define CHARMAP_ROWS 10
-
-string CHARMAP =
-       "★◆■▮▰▬◣◤◥◢◀▲▶▼"
-       "🌍🌎🌏🚀🌌👽🔫⌖❇❈←↑→↓"
-       "☠☣☢⚛⚡⚙🔥❌⚠⛔❰❱❲❳"
-       "😃😊😁😄😆😎😈😇😉😛😝😘❤ "
-       "😐😒😕😮😲😞😟😠😣😭😵😴  "
-       "\xEE\x83\xA1\xEE\x83\xA2\xEE\x83\xA3\xEE\x83\xA4\xEE\x83\xA5\xEE\x83\xA6\xEE\x83\xA7"
-       "\xEE\x83\xA8\xEE\x83\xA9\xEE\x83\xAA\xEE\x83\xAB\xEE\x83\xAC\xEE\x83\xAD\xEE\x83\xAE"
-       "\xEE\x83\xAF\xEE\x83\xB0\xEE\x83\xB1\xEE\x83\xB2\xEE\x83\xB3\xEE\x83\xB4\xEE\x83\xB5"
-       "\xEE\x83\xB6\xEE\x83\xB7\xEE\x83\xB8\xEE\x83\xB9\xEE\x83\xBA\xEE\x80\x90\xEE\x80\x91"
-       "\xEE\x82\xB0\xEE\x82\xB1\xEE\x82\xB2\xEE\x82\xB3\xEE\x82\xB4\xEE\x82\xB5\xEE\x82\xB6"
-       "\xEE\x82\xB7\xEE\x82\xB8\xEE\x82\xB9\xEE\x82\xA1\xEE\x82\xBF\xEE\x82\xA6\xEE\x82\xA5"
-       "\xEE\x83\x81\xEE\x83\x82\xEE\x83\x83\xEE\x83\x84\xEE\x83\x85\xEE\x83\x86\xEE\x83\x87"
-       "\xEE\x83\x88\xEE\x83\x89\xEE\x83\x8A\xEE\x83\x8B\xEE\x83\x8C\xEE\x83\x8D\xEE\x83\x8E"
-       "\xEE\x83\x8F\xEE\x83\x90\xEE\x83\x91\xEE\x83\x92\xEE\x83\x93\xEE\x83\x94\xEE\x83\x95"
-       "\xEE\x83\x96\xEE\x83\x97\xEE\x83\x98\xEE\x83\x99\xEE\x83\x9A\xEE\x81\x9B\xEE\x81\x9D";
-
-string charmap_cellToChar(vector cell)
-{
-       string character = substring(CHARMAP, cell_y * CHARMAP_COLS + cell_x, 1);
-
-       if (character != " ")
-               return character;
-       else
-               return "";
-}
-
-entity makeXonoticCharmap(entity controlledInputBox)
-{
-       entity me;
-       me = spawnXonoticCharmap();
-       me.configureXonoticCharmap(me, controlledInputBox);
-       return me;
-}
-
-void XonoticCharmap_configureXonoticCharmap(entity me, entity controlledInputBox)
-{
-       me.inputBox = controlledInputBox;
-       me.realCellSize = eX / CHARMAP_COLS + eY / CHARMAP_ROWS;
-}
-
-void XonoticCharmap_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(XonoticCharmap).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       float maxFontWidth = SKINFONTSIZE_NORMAL / absSize_x;
-       float maxFontHeight = SKINFONTSIZE_NORMAL / absSize_y;
-
-       if((me.realCellSize_x * absSize_x) > (me.realCellSize_y * absSize_y))
-       {
-               me.realFontSize_x = me.realCellSize_y * absSize_y / absSize_x;
-               me.realFontSize_y = me.realCellSize_y;
-       }
-       else
-       {
-               me.realFontSize_x = me.realCellSize_x;
-               me.realFontSize_y = me.realCellSize_x * absSize_x / absSize_y;
-       }
-
-       if(me.realFontSize_x > maxFontWidth || me.realFontSize_y > maxFontHeight)
-               me.realFontSize = eX * maxFontWidth + eY * maxFontHeight;
-}
-
-float XonoticCharmap_mouseMove(entity me, vector coords)
-{
-       me.focusedCell_x = floor(coords_x * CHARMAP_COLS);
-       me.focusedCell_y = floor(coords_y * CHARMAP_ROWS);
-
-       if(me.focusedCell_x < 0 || me.focusedCell_y < 0 ||
-          me.focusedCell_x >= CHARMAP_COLS || me.focusedCell_y >= CHARMAP_ROWS)
-       {
-               me.focusedCell = '-1 -1 0';
-               return 0;
-       }
-
-       return 1;
-}
-
-float XonoticCharmap_mouseDrag(entity me, vector coords)
-{
-       return me.mouseMove(me, coords);
-}
-
-float XonoticCharmap_mousePress(entity me, vector coords)
-{
-       me.mouseMove(me, coords);
-
-       if(me.focusedCell_x >= 0)
-       {
-               me.pressed = 1;
-               me.previouslyFocusedCell = me.focusedCell;
-       }
-
-       return 1;
-}
-
-float XonoticCharmap_mouseRelease(entity me, vector coords)
-{
-       if(!me.pressed)
-               return 0;
-
-       me.mouseMove(me, coords);
-
-       if(me.focusedCell == me.previouslyFocusedCell)
-               me.enterChar(me);
-
-       me.pressed = 0;
-       return 1;
-}
-
-float XonoticCharmap_keyDown(entity me, float key, float ascii, float shift)
-{
-       switch(key)
-       {
-               case K_LEFTARROW:
-               case K_KP_LEFTARROW:
-                       me.moveFocus(me, me.focusedCell, '-1 0 0');
-                       return 1;
-               case K_RIGHTARROW:
-               case K_KP_RIGHTARROW:
-                       me.moveFocus(me, me.focusedCell, '1 0 0');
-                       return 1;
-               case K_UPARROW:
-               case K_KP_UPARROW:
-                       me.moveFocus(me, me.focusedCell, '0 -1 0');
-                       return 1;
-               case K_DOWNARROW:
-               case K_KP_DOWNARROW:
-                       me.moveFocus(me, me.focusedCell, '0 1 0');
-                       return 1;
-               case K_HOME:
-               case K_KP_HOME:
-                       me.focusedCell = '0 0 0';
-                       return 1;
-               case K_END:
-               case K_KP_END:
-                       me.focusedCell_x = CHARMAP_COLS - 1;
-                       me.focusedCell_y = CHARMAP_ROWS - 1;
-                       return 1;
-               case K_ENTER:
-               case K_KP_ENTER:
-               case K_INS:
-               case K_KP_INS:
-                       me.enterChar(me);
-                       return 1;
-               default:
-                       return me.inputBox.keyDown(me.inputBox, key, ascii, shift);
-       }
-}
-
-void XonoticCharmap_moveFocus(entity me, vector initialCell, vector step)
-{
-       me.focusedCell_x = mod(me.focusedCell_x + step_x + CHARMAP_COLS, CHARMAP_COLS);
-       me.focusedCell_y = mod(me.focusedCell_y + step_y + CHARMAP_ROWS, CHARMAP_ROWS);
-
-       if(me.focusedCell != initialCell) // Recursion break
-               if(charmap_cellToChar(me.focusedCell) == "")
-                       me.moveFocus(me, initialCell, step);
-}
-
-void XonoticCharmap_enterChar(entity me)
-{
-       string character = charmap_cellToChar(me.focusedCell);
-       if(character != "")
-               me.inputBox.enterText(me.inputBox, character);
-}
-
-void XonoticCharmap_focusLeave(entity me)
-{
-       me.inputBox.saveCvars(me.inputBox);
-}
-
-void XonoticCharmap_draw(entity me)
-{
-       string character;
-       vector cell, cellPos, charPos;
-       cell = '0 0 0';
-       cellPos = '0 0 0';
-       charPos = '0 0 0';
-
-       float CHAR_OFFSET_X = me.realCellSize_x / 2;
-       float CHAR_OFFSET_Y = (me.realCellSize_y - me.realFontSize_y) / 2;
-
-       for(cell_y = 0; cell_y < CHARMAP_ROWS; ++cell_y)
-       {
-               charPos_y = cell_y / CHARMAP_ROWS + CHAR_OFFSET_Y;
-               for(cell_x = 0; cell_x < CHARMAP_COLS; ++cell_x)
-               {
-                       character = charmap_cellToChar(cell);
-
-                       if(character == "")
-                               continue;
-
-                       // Draw focused cell
-                       if(cell == me.focusedCell && me.focused)
-                       {
-                               if(!me.pressed || me.focusedCell == me.previouslyFocusedCell)
-                               {
-                                       cellPos_x = mod(me.focusedCell_x, CHARMAP_COLS) / CHARMAP_COLS;
-                                       cellPos_y = mod(me.focusedCell_y, CHARMAP_ROWS) / CHARMAP_ROWS;
-                                       draw_Fill(cellPos, me.realCellSize, SKINCOLOR_CHARMAP_FOCUS, SKINALPHA_CHARMAP_FOCUS);
-                               }
-                       }
-
-                       // Draw character
-                       charPos_x = cell_x / CHARMAP_COLS + CHAR_OFFSET_X;
-                       draw_CenterText(charPos, character, me.realFontSize, SKINCOLOR_CHARMAP_CHAR, SKINALPHA_CHARMAP_CHAR, 0);
-               }
-       }
-}
-#endif
diff --git a/qcsrc/menu/xonotic/charmap.qc b/qcsrc/menu/xonotic/charmap.qc
new file mode 100644 (file)
index 0000000..0ba72a5
--- /dev/null
@@ -0,0 +1,240 @@
+#ifdef INTERFACE
+CLASS(XonoticCharmap) EXTENDS(Item)
+       METHOD(XonoticCharmap, configureXonoticCharmap, void(entity, entity))
+       METHOD(XonoticCharmap, mousePress, float(entity, vector))
+       METHOD(XonoticCharmap, mouseRelease, float(entity, vector))
+       METHOD(XonoticCharmap, mouseMove, float(entity, vector))
+       METHOD(XonoticCharmap, mouseDrag, float(entity, vector))
+       METHOD(XonoticCharmap, keyDown, float(entity, float, float, float))
+       METHOD(XonoticCharmap, focusLeave, void(entity))
+       METHOD(XonoticCharmap, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticCharmap, draw, void(entity))
+       ATTRIB(XonoticCharmap, focusable, float, 1)
+
+       METHOD(XonoticCharmap, moveFocus, void(entity, vector, vector))
+       METHOD(XonoticCharmap, enterChar, void(entity))
+       ATTRIB(XonoticCharmap, inputBox, entity, NULL)
+       ATTRIB(XonoticCharmap, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticCharmap, realCellSize, vector, '0 0 0')
+       ATTRIB(XonoticCharmap, focusedCell, vector, '-1 -1 0')
+       ATTRIB(XonoticCharmap, previouslyFocusedCell, vector, '-1 -1 0')
+ENDCLASS(XonoticCharmap)
+entity makeXonoticCharmap(entity controlledInputBox);
+#endif
+
+#ifdef IMPLEMENTATION
+
+const float CHARMAP_COLS = 14;
+const float CHARMAP_ROWS = 10;
+
+string CHARMAP =
+       "★◆■▮▰▬◣◤◥◢◀▲▶▼"
+       "🌍🌎🌏🚀🌌👽🔫⌖❇❈←↑→↓"
+       "☠☣☢⚛⚡⚙🔥❌⚠⛔❰❱❲❳"
+       "😃😊😁😄😆😎😈😇😉😛😝😘❤ "
+       "😐😒😕😮😲😞😟😠😣😭😵😴  "
+       "\xEE\x83\xA1\xEE\x83\xA2\xEE\x83\xA3\xEE\x83\xA4\xEE\x83\xA5\xEE\x83\xA6\xEE\x83\xA7"
+       "\xEE\x83\xA8\xEE\x83\xA9\xEE\x83\xAA\xEE\x83\xAB\xEE\x83\xAC\xEE\x83\xAD\xEE\x83\xAE"
+       "\xEE\x83\xAF\xEE\x83\xB0\xEE\x83\xB1\xEE\x83\xB2\xEE\x83\xB3\xEE\x83\xB4\xEE\x83\xB5"
+       "\xEE\x83\xB6\xEE\x83\xB7\xEE\x83\xB8\xEE\x83\xB9\xEE\x83\xBA\xEE\x80\x90\xEE\x80\x91"
+       "\xEE\x82\xB0\xEE\x82\xB1\xEE\x82\xB2\xEE\x82\xB3\xEE\x82\xB4\xEE\x82\xB5\xEE\x82\xB6"
+       "\xEE\x82\xB7\xEE\x82\xB8\xEE\x82\xB9\xEE\x82\xA1\xEE\x82\xBF\xEE\x82\xA6\xEE\x82\xA5"
+       "\xEE\x83\x81\xEE\x83\x82\xEE\x83\x83\xEE\x83\x84\xEE\x83\x85\xEE\x83\x86\xEE\x83\x87"
+       "\xEE\x83\x88\xEE\x83\x89\xEE\x83\x8A\xEE\x83\x8B\xEE\x83\x8C\xEE\x83\x8D\xEE\x83\x8E"
+       "\xEE\x83\x8F\xEE\x83\x90\xEE\x83\x91\xEE\x83\x92\xEE\x83\x93\xEE\x83\x94\xEE\x83\x95"
+       "\xEE\x83\x96\xEE\x83\x97\xEE\x83\x98\xEE\x83\x99\xEE\x83\x9A\xEE\x81\x9B\xEE\x81\x9D";
+
+string charmap_cellToChar(vector cell)
+{
+       string character = substring(CHARMAP, cell.y * CHARMAP_COLS + cell.x, 1);
+
+       if (character != " ")
+               return character;
+       else
+               return "";
+}
+
+entity makeXonoticCharmap(entity controlledInputBox)
+{
+       entity me;
+       me = spawnXonoticCharmap();
+       me.configureXonoticCharmap(me, controlledInputBox);
+       return me;
+}
+
+void XonoticCharmap_configureXonoticCharmap(entity me, entity controlledInputBox)
+{
+       me.inputBox = controlledInputBox;
+       me.realCellSize = eX / CHARMAP_COLS + eY / CHARMAP_ROWS;
+}
+
+void XonoticCharmap_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(XonoticCharmap).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       float maxFontWidth = SKINFONTSIZE_NORMAL / absSize.x;
+       float maxFontHeight = SKINFONTSIZE_NORMAL / absSize.y;
+
+       if((me.realCellSize.x * absSize.x) > (me.realCellSize.y * absSize.y))
+       {
+               me.realFontSize_x = me.realCellSize.y * absSize.y / absSize.x;
+               me.realFontSize_y = me.realCellSize.y;
+       }
+       else
+       {
+               me.realFontSize_x = me.realCellSize.x;
+               me.realFontSize_y = me.realCellSize.x * absSize.x / absSize.y;
+       }
+
+       if(me.realFontSize.x > maxFontWidth || me.realFontSize.y > maxFontHeight)
+               me.realFontSize = eX * maxFontWidth + eY * maxFontHeight;
+}
+
+float XonoticCharmap_mouseMove(entity me, vector coords)
+{
+       me.focusedCell_x = floor(coords.x * CHARMAP_COLS);
+       me.focusedCell_y = floor(coords.y * CHARMAP_ROWS);
+
+       if(me.focusedCell.x < 0 || me.focusedCell.y < 0 ||
+          me.focusedCell.x >= CHARMAP_COLS || me.focusedCell.y >= CHARMAP_ROWS)
+       {
+               me.focusedCell = '-1 -1 0';
+               return 0;
+       }
+
+       return 1;
+}
+
+float XonoticCharmap_mouseDrag(entity me, vector coords)
+{
+       return me.mouseMove(me, coords);
+}
+
+float XonoticCharmap_mousePress(entity me, vector coords)
+{
+       me.mouseMove(me, coords);
+
+       if(me.focusedCell.x >= 0)
+       {
+               me.pressed = 1;
+               me.previouslyFocusedCell = me.focusedCell;
+       }
+
+       return 1;
+}
+
+float XonoticCharmap_mouseRelease(entity me, vector coords)
+{
+       if(!me.pressed)
+               return 0;
+
+       me.mouseMove(me, coords);
+
+       if(me.focusedCell == me.previouslyFocusedCell)
+               me.enterChar(me);
+
+       me.pressed = 0;
+       return 1;
+}
+
+float XonoticCharmap_keyDown(entity me, float key, float ascii, float shift)
+{
+       switch(key)
+       {
+               case K_LEFTARROW:
+               case K_KP_LEFTARROW:
+                       me.moveFocus(me, me.focusedCell, '-1 0 0');
+                       return 1;
+               case K_RIGHTARROW:
+               case K_KP_RIGHTARROW:
+                       me.moveFocus(me, me.focusedCell, '1 0 0');
+                       return 1;
+               case K_UPARROW:
+               case K_KP_UPARROW:
+                       me.moveFocus(me, me.focusedCell, '0 -1 0');
+                       return 1;
+               case K_DOWNARROW:
+               case K_KP_DOWNARROW:
+                       me.moveFocus(me, me.focusedCell, '0 1 0');
+                       return 1;
+               case K_HOME:
+               case K_KP_HOME:
+                       me.focusedCell = '0 0 0';
+                       return 1;
+               case K_END:
+               case K_KP_END:
+                       me.focusedCell_x = CHARMAP_COLS - 1;
+                       me.focusedCell_y = CHARMAP_ROWS - 1;
+                       return 1;
+               case K_ENTER:
+               case K_KP_ENTER:
+               case K_INS:
+               case K_KP_INS:
+                       me.enterChar(me);
+                       return 1;
+               default:
+                       return me.inputBox.keyDown(me.inputBox, key, ascii, shift);
+       }
+}
+
+void XonoticCharmap_moveFocus(entity me, vector initialCell, vector step)
+{
+       me.focusedCell_x = mod(me.focusedCell.x + step.x + CHARMAP_COLS, CHARMAP_COLS);
+       me.focusedCell_y = mod(me.focusedCell.y + step.y + CHARMAP_ROWS, CHARMAP_ROWS);
+
+       if(me.focusedCell != initialCell) // Recursion break
+               if(charmap_cellToChar(me.focusedCell) == "")
+                       me.moveFocus(me, initialCell, step);
+}
+
+void XonoticCharmap_enterChar(entity me)
+{
+       string character = charmap_cellToChar(me.focusedCell);
+       if(character != "")
+               me.inputBox.enterText(me.inputBox, character);
+}
+
+void XonoticCharmap_focusLeave(entity me)
+{
+       me.inputBox.saveCvars(me.inputBox);
+}
+
+void XonoticCharmap_draw(entity me)
+{
+       string character;
+       vector cell, cellPos, charPos;
+       cell = '0 0 0';
+       cellPos = '0 0 0';
+       charPos = '0 0 0';
+
+       float CHAR_OFFSET_X = me.realCellSize.x / 2;
+       float CHAR_OFFSET_Y = (me.realCellSize.y - me.realFontSize.y) / 2;
+
+       for(cell_y = 0; cell.y < CHARMAP_ROWS; ++cell.y)
+       {
+               charPos_y = cell.y / CHARMAP_ROWS + CHAR_OFFSET_Y;
+               for(cell_x = 0; cell.x < CHARMAP_COLS; ++cell.x)
+               {
+                       character = charmap_cellToChar(cell);
+
+                       if(character == "")
+                               continue;
+
+                       // Draw focused cell
+                       if(cell == me.focusedCell && me.focused)
+                       {
+                               if(!me.pressed || me.focusedCell == me.previouslyFocusedCell)
+                               {
+                                       cellPos_x = mod(me.focusedCell.x, CHARMAP_COLS) / CHARMAP_COLS;
+                                       cellPos_y = mod(me.focusedCell.y, CHARMAP_ROWS) / CHARMAP_ROWS;
+                                       draw_Fill(cellPos, me.realCellSize, SKINCOLOR_CHARMAP_FOCUS, SKINALPHA_CHARMAP_FOCUS);
+                               }
+                       }
+
+                       // Draw character
+                       charPos_x = cell.x / CHARMAP_COLS + CHAR_OFFSET_X;
+                       draw_CenterText(charPos, character, me.realFontSize, SKINCOLOR_CHARMAP_CHAR, SKINALPHA_CHARMAP_CHAR, 0);
+               }
+       }
+}
+#endif
diff --git a/qcsrc/menu/xonotic/checkbox.c b/qcsrc/menu/xonotic/checkbox.c
deleted file mode 100644 (file)
index 631a430..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticCheckBox) EXTENDS(CheckBox)
-       METHOD(XonoticCheckBox, configureXonoticCheckBox, void(entity, float, float, string, string))
-       METHOD(XonoticCheckBox, setChecked, void(entity, float))
-       ATTRIB(XonoticCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticCheckBox, image, string, SKINGFX_CHECKBOX)
-       ATTRIB(XonoticCheckBox, yesValue, float, 1)
-       ATTRIB(XonoticCheckBox, noValue, float, 0)
-
-       ATTRIB(XonoticCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
-       ATTRIB(XonoticCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
-       ATTRIB(XonoticCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
-       ATTRIB(XonoticCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
-
-       ATTRIB(XonoticCheckBox, cvarName, string, string_null)
-       METHOD(XonoticCheckBox, loadCvars, void(entity))
-       METHOD(XonoticCheckBox, saveCvars, void(entity))
-       ATTRIB(XonoticCheckBox, sendCvars, float, 0)
-
-       ATTRIB(XonoticCheckBox, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticCheckBox)
-entity makeXonoticCheckBox(float, string, string);
-entity makeXonoticCheckBoxEx(float, float, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticCheckBox(float isInverted, string theCvar, string theText)
-{
-       float y, n;
-       if(isInverted > 1)
-       {
-               n = isInverted - 1;
-               y = -n;
-       }
-       else if(isInverted < -1)
-       {
-               n = isInverted + 1;
-               y = -n;
-       }
-       else if(isInverted == 1)
-       {
-               n = 1;
-               y = 0;
-       }
-       else
-       {
-               n = 0;
-               y = 1;
-       }
-       return makeXonoticCheckBoxEx(y, n, theCvar, theText);
-}
-entity makeXonoticCheckBoxEx(float theYesValue, float theNoValue, string theCvar, string theText)
-{
-       entity me;
-       me = spawnXonoticCheckBox();
-       me.configureXonoticCheckBox(me, theYesValue, theNoValue, theCvar, theText);
-       return me;
-}
-void XonoticCheckBox_configureXonoticCheckBox(entity me, float theYesValue, float theNoValue, string theCvar, string theText)
-{
-       me.yesValue = theYesValue;
-       me.noValue = theNoValue;
-       me.checked = 0;
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.tooltip = getZonedTooltipForIdentifier(theCvar);
-               me.loadCvars(me);
-       }
-       me.configureCheckBox(me, theText, me.fontSize, me.image);
-}
-void XonoticCheckBox_setChecked(entity me, float val)
-{
-       if(val != me.checked)
-       {
-               me.checked = val;
-               me.saveCvars(me);
-       }
-}
-void XonoticCheckBox_loadCvars(entity me)
-{
-       float m, d;
-
-       if (!me.cvarName)
-               return;
-
-       m = (me.yesValue + me.noValue) * 0.5;
-       d = (cvar(me.cvarName) - m) / (me.yesValue - m);
-       me.checked = (d > 0);
-}
-void XonoticCheckBox_saveCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       if(me.checked)
-               cvar_set(me.cvarName, ftos(me.yesValue));
-       else
-               cvar_set(me.cvarName, ftos(me.noValue));
-
-       CheckSendCvars(me, me.cvarName);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/checkbox.qc b/qcsrc/menu/xonotic/checkbox.qc
new file mode 100644 (file)
index 0000000..631a430
--- /dev/null
@@ -0,0 +1,104 @@
+#ifdef INTERFACE
+CLASS(XonoticCheckBox) EXTENDS(CheckBox)
+       METHOD(XonoticCheckBox, configureXonoticCheckBox, void(entity, float, float, string, string))
+       METHOD(XonoticCheckBox, setChecked, void(entity, float))
+       ATTRIB(XonoticCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticCheckBox, image, string, SKINGFX_CHECKBOX)
+       ATTRIB(XonoticCheckBox, yesValue, float, 1)
+       ATTRIB(XonoticCheckBox, noValue, float, 0)
+
+       ATTRIB(XonoticCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
+       ATTRIB(XonoticCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
+       ATTRIB(XonoticCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
+       ATTRIB(XonoticCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
+
+       ATTRIB(XonoticCheckBox, cvarName, string, string_null)
+       METHOD(XonoticCheckBox, loadCvars, void(entity))
+       METHOD(XonoticCheckBox, saveCvars, void(entity))
+       ATTRIB(XonoticCheckBox, sendCvars, float, 0)
+
+       ATTRIB(XonoticCheckBox, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticCheckBox)
+entity makeXonoticCheckBox(float, string, string);
+entity makeXonoticCheckBoxEx(float, float, string, string);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticCheckBox(float isInverted, string theCvar, string theText)
+{
+       float y, n;
+       if(isInverted > 1)
+       {
+               n = isInverted - 1;
+               y = -n;
+       }
+       else if(isInverted < -1)
+       {
+               n = isInverted + 1;
+               y = -n;
+       }
+       else if(isInverted == 1)
+       {
+               n = 1;
+               y = 0;
+       }
+       else
+       {
+               n = 0;
+               y = 1;
+       }
+       return makeXonoticCheckBoxEx(y, n, theCvar, theText);
+}
+entity makeXonoticCheckBoxEx(float theYesValue, float theNoValue, string theCvar, string theText)
+{
+       entity me;
+       me = spawnXonoticCheckBox();
+       me.configureXonoticCheckBox(me, theYesValue, theNoValue, theCvar, theText);
+       return me;
+}
+void XonoticCheckBox_configureXonoticCheckBox(entity me, float theYesValue, float theNoValue, string theCvar, string theText)
+{
+       me.yesValue = theYesValue;
+       me.noValue = theNoValue;
+       me.checked = 0;
+       if(theCvar)
+       {
+               me.cvarName = theCvar;
+               me.tooltip = getZonedTooltipForIdentifier(theCvar);
+               me.loadCvars(me);
+       }
+       me.configureCheckBox(me, theText, me.fontSize, me.image);
+}
+void XonoticCheckBox_setChecked(entity me, float val)
+{
+       if(val != me.checked)
+       {
+               me.checked = val;
+               me.saveCvars(me);
+       }
+}
+void XonoticCheckBox_loadCvars(entity me)
+{
+       float m, d;
+
+       if (!me.cvarName)
+               return;
+
+       m = (me.yesValue + me.noValue) * 0.5;
+       d = (cvar(me.cvarName) - m) / (me.yesValue - m);
+       me.checked = (d > 0);
+}
+void XonoticCheckBox_saveCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       if(me.checked)
+               cvar_set(me.cvarName, ftos(me.yesValue));
+       else
+               cvar_set(me.cvarName, ftos(me.noValue));
+
+       CheckSendCvars(me, me.cvarName);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/checkbox_slider_invalid.c b/qcsrc/menu/xonotic/checkbox_slider_invalid.c
deleted file mode 100644 (file)
index e304318..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticSliderCheckBox) EXTENDS(CheckBox)
-       METHOD(XonoticSliderCheckBox, configureXonoticSliderCheckBox, void(entity, float, float, entity, string))
-       METHOD(XonoticSliderCheckBox, setChecked, void(entity, float))
-       METHOD(XonoticSliderCheckBox, draw, void(entity))
-       ATTRIB(XonoticSliderCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticSliderCheckBox, image, string, SKINGFX_CHECKBOX)
-
-       ATTRIB(XonoticSliderCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
-       ATTRIB(XonoticSliderCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
-       ATTRIB(XonoticSliderCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
-       ATTRIB(XonoticSliderCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
-
-       ATTRIB(XonoticSliderCheckBox, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticSliderCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
-
-       ATTRIB(XonoticSliderCheckBox, controlledSlider, entity, NULL)
-       ATTRIB(XonoticSliderCheckBox, offValue, float, -1)
-       ATTRIB(XonoticSliderCheckBox, inverted, float, 0)
-       ATTRIB(XonoticSliderCheckBox, savedValue, float, -1)
-ENDCLASS(XonoticSliderCheckBox)
-entity makeXonoticSliderCheckBox(float, float, entity, string);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticSliderCheckBox(float theOffValue, float isInverted, entity theControlledSlider, string theText)
-{
-       entity me;
-       me = spawnXonoticSliderCheckBox();
-       me.configureXonoticSliderCheckBox(me, theOffValue, isInverted, theControlledSlider, theText);
-       return me;
-}
-void XonoticSliderCheckBox_configureXonoticSliderCheckBox(entity me, float theOffValue, float isInverted, entity theControlledSlider, string theText)
-{
-       me.offValue = theOffValue;
-       me.inverted = isInverted;
-       me.checked = (theControlledSlider.value == theOffValue);
-       if(theControlledSlider.value == median(theControlledSlider.valueMin, theControlledSlider.value, theControlledSlider.valueMax))
-               me.savedValue = theControlledSlider.value;
-       else
-               me.savedValue = theControlledSlider.valueMin;
-       me.controlledSlider = theControlledSlider;
-       me.configureCheckBox(me, theText, me.fontSize, me.image);
-       me.tooltip = theControlledSlider.tooltip;
-       me.cvarName = theControlledSlider.cvarName; // in case we want to display the cvar in the tooltip
-}
-void XonoticSliderCheckBox_draw(entity me)
-{
-       me.checked = ((me.controlledSlider.value == me.offValue) != me.inverted);
-       if(me.controlledSlider.value == median(me.controlledSlider.valueMin, me.controlledSlider.value, me.controlledSlider.valueMax))
-               me.savedValue = me.controlledSlider.value;
-       SUPER(XonoticSliderCheckBox).draw(me);
-}
-void XonoticSliderCheckBox_setChecked(entity me, float val)
-{
-       if(me.checked == val)
-               return;
-       me.checked = val;
-       if(val == me.inverted)
-               me.controlledSlider.setValue(me.controlledSlider, median(me.controlledSlider.valueMin, me.savedValue, me.controlledSlider.valueMax));
-       else
-               me.controlledSlider.setValue(me.controlledSlider, me.offValue);
-}
-
-#endif
diff --git a/qcsrc/menu/xonotic/checkbox_slider_invalid.qc b/qcsrc/menu/xonotic/checkbox_slider_invalid.qc
new file mode 100644 (file)
index 0000000..e304318
--- /dev/null
@@ -0,0 +1,65 @@
+#ifdef INTERFACE
+CLASS(XonoticSliderCheckBox) EXTENDS(CheckBox)
+       METHOD(XonoticSliderCheckBox, configureXonoticSliderCheckBox, void(entity, float, float, entity, string))
+       METHOD(XonoticSliderCheckBox, setChecked, void(entity, float))
+       METHOD(XonoticSliderCheckBox, draw, void(entity))
+       ATTRIB(XonoticSliderCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticSliderCheckBox, image, string, SKINGFX_CHECKBOX)
+
+       ATTRIB(XonoticSliderCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
+       ATTRIB(XonoticSliderCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
+       ATTRIB(XonoticSliderCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
+       ATTRIB(XonoticSliderCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
+
+       ATTRIB(XonoticSliderCheckBox, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticSliderCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
+
+       ATTRIB(XonoticSliderCheckBox, controlledSlider, entity, NULL)
+       ATTRIB(XonoticSliderCheckBox, offValue, float, -1)
+       ATTRIB(XonoticSliderCheckBox, inverted, float, 0)
+       ATTRIB(XonoticSliderCheckBox, savedValue, float, -1)
+ENDCLASS(XonoticSliderCheckBox)
+entity makeXonoticSliderCheckBox(float, float, entity, string);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticSliderCheckBox(float theOffValue, float isInverted, entity theControlledSlider, string theText)
+{
+       entity me;
+       me = spawnXonoticSliderCheckBox();
+       me.configureXonoticSliderCheckBox(me, theOffValue, isInverted, theControlledSlider, theText);
+       return me;
+}
+void XonoticSliderCheckBox_configureXonoticSliderCheckBox(entity me, float theOffValue, float isInverted, entity theControlledSlider, string theText)
+{
+       me.offValue = theOffValue;
+       me.inverted = isInverted;
+       me.checked = (theControlledSlider.value == theOffValue);
+       if(theControlledSlider.value == median(theControlledSlider.valueMin, theControlledSlider.value, theControlledSlider.valueMax))
+               me.savedValue = theControlledSlider.value;
+       else
+               me.savedValue = theControlledSlider.valueMin;
+       me.controlledSlider = theControlledSlider;
+       me.configureCheckBox(me, theText, me.fontSize, me.image);
+       me.tooltip = theControlledSlider.tooltip;
+       me.cvarName = theControlledSlider.cvarName; // in case we want to display the cvar in the tooltip
+}
+void XonoticSliderCheckBox_draw(entity me)
+{
+       me.checked = ((me.controlledSlider.value == me.offValue) != me.inverted);
+       if(me.controlledSlider.value == median(me.controlledSlider.valueMin, me.controlledSlider.value, me.controlledSlider.valueMax))
+               me.savedValue = me.controlledSlider.value;
+       SUPER(XonoticSliderCheckBox).draw(me);
+}
+void XonoticSliderCheckBox_setChecked(entity me, float val)
+{
+       if(me.checked == val)
+               return;
+       me.checked = val;
+       if(val == me.inverted)
+               me.controlledSlider.setValue(me.controlledSlider, median(me.controlledSlider.valueMin, me.savedValue, me.controlledSlider.valueMax));
+       else
+               me.controlledSlider.setValue(me.controlledSlider, me.offValue);
+}
+
+#endif
diff --git a/qcsrc/menu/xonotic/checkbox_string.c b/qcsrc/menu/xonotic/checkbox_string.c
deleted file mode 100644 (file)
index aeda757..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticCheckBoxString) EXTENDS(CheckBox)
-       METHOD(XonoticCheckBoxString, configureXonoticCheckBoxString, void(entity, string, string, string, string))
-       METHOD(XonoticCheckBoxString, setChecked, void(entity, float))
-       ATTRIB(XonoticCheckBoxString, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticCheckBoxString, image, string, SKINGFX_CHECKBOX)
-       ATTRIB(XonoticCheckBoxString, yesString, string, string_null)
-       ATTRIB(XonoticCheckBoxString, noString, string, string_null)
-
-       ATTRIB(XonoticCheckBoxString, color, vector, SKINCOLOR_CHECKBOX_N)
-       ATTRIB(XonoticCheckBoxString, colorC, vector, SKINCOLOR_CHECKBOX_C)
-       ATTRIB(XonoticCheckBoxString, colorF, vector, SKINCOLOR_CHECKBOX_F)
-       ATTRIB(XonoticCheckBoxString, colorD, vector, SKINCOLOR_CHECKBOX_D)
-
-       ATTRIB(XonoticCheckBoxString, cvarName, string, string_null)
-       METHOD(XonoticCheckBoxString, loadCvars, void(entity))
-       METHOD(XonoticCheckBoxString, saveCvars, void(entity))
-       ATTRIB(XonoticCheckBoxString, sendCvars, float, 0)
-
-       ATTRIB(XonoticCheckBoxString, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticCheckBoxString, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticCheckBoxString)
-entity makeXonoticCheckBoxString(string, string, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticCheckBoxString(string theYesValue, string theNoValue, string theCvar, string theText)
-{
-       entity me;
-       me = spawnXonoticCheckBoxString();
-       me.configureXonoticCheckBoxString(me, theYesValue, theNoValue, theCvar, theText);
-       return me;
-}
-void XonoticCheckBoxString_configureXonoticCheckBoxString(entity me, string theYesValue, string theNoValue, string theCvar, string theText)
-{
-       me.yesString = theYesValue;
-       me.noString = theNoValue;
-       me.checked = 0;
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.tooltip = getZonedTooltipForIdentifier(theCvar);
-               me.loadCvars(me);
-       }
-       me.configureCheckBox(me, theText, me.fontSize, me.image);
-}
-void XonoticCheckBoxString_setChecked(entity me, float foo)
-{
-       me.checked = !me.checked;
-       me.saveCvars(me);
-}
-void XonoticCheckBoxString_loadCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       if(cvar_string(me.cvarName) == me.yesString)
-               me.checked = 1;
-}
-void XonoticCheckBoxString_saveCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       if(me.checked)
-               cvar_set(me.cvarName, me.yesString);
-       else
-               cvar_set(me.cvarName, me.noString);
-
-       CheckSendCvars(me, me.cvarName);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/checkbox_string.qc b/qcsrc/menu/xonotic/checkbox_string.qc
new file mode 100644 (file)
index 0000000..aeda757
--- /dev/null
@@ -0,0 +1,72 @@
+#ifdef INTERFACE
+CLASS(XonoticCheckBoxString) EXTENDS(CheckBox)
+       METHOD(XonoticCheckBoxString, configureXonoticCheckBoxString, void(entity, string, string, string, string))
+       METHOD(XonoticCheckBoxString, setChecked, void(entity, float))
+       ATTRIB(XonoticCheckBoxString, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticCheckBoxString, image, string, SKINGFX_CHECKBOX)
+       ATTRIB(XonoticCheckBoxString, yesString, string, string_null)
+       ATTRIB(XonoticCheckBoxString, noString, string, string_null)
+
+       ATTRIB(XonoticCheckBoxString, color, vector, SKINCOLOR_CHECKBOX_N)
+       ATTRIB(XonoticCheckBoxString, colorC, vector, SKINCOLOR_CHECKBOX_C)
+       ATTRIB(XonoticCheckBoxString, colorF, vector, SKINCOLOR_CHECKBOX_F)
+       ATTRIB(XonoticCheckBoxString, colorD, vector, SKINCOLOR_CHECKBOX_D)
+
+       ATTRIB(XonoticCheckBoxString, cvarName, string, string_null)
+       METHOD(XonoticCheckBoxString, loadCvars, void(entity))
+       METHOD(XonoticCheckBoxString, saveCvars, void(entity))
+       ATTRIB(XonoticCheckBoxString, sendCvars, float, 0)
+
+       ATTRIB(XonoticCheckBoxString, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticCheckBoxString, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticCheckBoxString)
+entity makeXonoticCheckBoxString(string, string, string, string);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticCheckBoxString(string theYesValue, string theNoValue, string theCvar, string theText)
+{
+       entity me;
+       me = spawnXonoticCheckBoxString();
+       me.configureXonoticCheckBoxString(me, theYesValue, theNoValue, theCvar, theText);
+       return me;
+}
+void XonoticCheckBoxString_configureXonoticCheckBoxString(entity me, string theYesValue, string theNoValue, string theCvar, string theText)
+{
+       me.yesString = theYesValue;
+       me.noString = theNoValue;
+       me.checked = 0;
+       if(theCvar)
+       {
+               me.cvarName = theCvar;
+               me.tooltip = getZonedTooltipForIdentifier(theCvar);
+               me.loadCvars(me);
+       }
+       me.configureCheckBox(me, theText, me.fontSize, me.image);
+}
+void XonoticCheckBoxString_setChecked(entity me, float foo)
+{
+       me.checked = !me.checked;
+       me.saveCvars(me);
+}
+void XonoticCheckBoxString_loadCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       if(cvar_string(me.cvarName) == me.yesString)
+               me.checked = 1;
+}
+void XonoticCheckBoxString_saveCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       if(me.checked)
+               cvar_set(me.cvarName, me.yesString);
+       else
+               cvar_set(me.cvarName, me.noString);
+
+       CheckSendCvars(me, me.cvarName);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/colorbutton.c b/qcsrc/menu/xonotic/colorbutton.c
deleted file mode 100644 (file)
index bcbdfee..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticColorButton) EXTENDS(RadioButton)
-       METHOD(XonoticColorButton, configureXonoticColorButton, void(entity, float, float, float))
-       METHOD(XonoticColorButton, setChecked, void(entity, float))
-       METHOD(XonoticColorButton, draw, void(entity))
-       ATTRIB(XonoticColorButton, fontSize, float, 0)
-       ATTRIB(XonoticColorButton, image, string, SKINGFX_COLORBUTTON)
-
-       ATTRIB(XonoticColorButton, useDownAsChecked, float, 1)
-
-       ATTRIB(XonoticColorButton, cvarPart, float, 0)
-       ATTRIB(XonoticColorButton, cvarName, string, string_null)
-       ATTRIB(XonoticColorButton, cvarValueFloat, float, 0)
-       METHOD(XonoticColorButton, loadCvars, void(entity))
-       METHOD(XonoticColorButton, saveCvars, void(entity))
-ENDCLASS(XonoticColorButton)
-entity makeXonoticColorButton(float, float, float);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticColorButton(float theGroup, float theColor, float theValue)
-{
-       entity me;
-       me = spawnXonoticColorButton();
-       me.configureXonoticColorButton(me, theGroup, theColor, theValue);
-       return me;
-}
-void XonoticColorButton_configureXonoticColorButton(entity me, float theGroup, float theColor, float theValue)
-{
-       switch(theValue)
-       {
-               // rearrange 1..14 for rainbow order
-               case  1: theValue = 10; break;
-               case  2: theValue =  4; break;
-               case  3: theValue =  1; break;
-               case  4: theValue = 14; break;
-               case  5: theValue = 12; break;
-               case  6: theValue =  7; break;
-               case  7: theValue =  3; break;
-               case  8: theValue =  2; break;
-               case  9: theValue =  6; break;
-               case 10: theValue =  5; break;
-               case 11: theValue = 13; break;
-               case 12: theValue = 11; break;
-               case 13: theValue =  8; break;
-               case 14: theValue =  9; break;
-               default:
-                       // no change
-                       break;
-       }
-       me.cvarName = "_cl_color";
-       me.cvarValueFloat = theValue;
-       me.cvarPart = theColor;
-       me.loadCvars(me);
-       me.configureRadioButton(me, string_null, me.fontSize, me.image, theGroup, 0);
-}
-void XonoticColorButton_setChecked(entity me, float val)
-{
-       if(val != me.checked)
-       {
-               me.checked = val;
-               me.saveCvars(me);
-       }
-}
-void XonoticColorButton_loadCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       if(cvar_string(me.cvarName) == cvar_defstring(me.cvarName))
-               cvar_set(me.cvarName, ftos(16 * floor(random() * 15) + floor(random() * 15)));
-
-       if(me.cvarPart == 1)
-               me.checked = (cvar(me.cvarName) & 240) == me.cvarValueFloat * 16;
-       else
-               me.checked = (cvar(me.cvarName) & 15) == me.cvarValueFloat;
-}
-void XonoticColorButton_saveCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       if(me.checked)
-       {
-               if(me.cvarPart == 1)
-                       cvar_set(me.cvarName, ftos((cvar(me.cvarName) & 15) + me.cvarValueFloat * 16));
-               else
-                       cvar_set(me.cvarName, ftos((cvar(me.cvarName) & 240) + me.cvarValueFloat));
-       }
-       // TODO on an apply button, read _cl_color and execute the color command for it
-}
-void XonoticColorButton_draw(entity me)
-{
-       me.color  = colormapPaletteColor(me.cvarValueFloat, me.cvarPart);
-       me.colorC = me.color;
-       me.colorF = me.color;
-       me.colorD = me.color;
-       SUPER(XonoticColorButton).draw(me);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/colorbutton.qc b/qcsrc/menu/xonotic/colorbutton.qc
new file mode 100644 (file)
index 0000000..bcbdfee
--- /dev/null
@@ -0,0 +1,100 @@
+#ifdef INTERFACE
+CLASS(XonoticColorButton) EXTENDS(RadioButton)
+       METHOD(XonoticColorButton, configureXonoticColorButton, void(entity, float, float, float))
+       METHOD(XonoticColorButton, setChecked, void(entity, float))
+       METHOD(XonoticColorButton, draw, void(entity))
+       ATTRIB(XonoticColorButton, fontSize, float, 0)
+       ATTRIB(XonoticColorButton, image, string, SKINGFX_COLORBUTTON)
+
+       ATTRIB(XonoticColorButton, useDownAsChecked, float, 1)
+
+       ATTRIB(XonoticColorButton, cvarPart, float, 0)
+       ATTRIB(XonoticColorButton, cvarName, string, string_null)
+       ATTRIB(XonoticColorButton, cvarValueFloat, float, 0)
+       METHOD(XonoticColorButton, loadCvars, void(entity))
+       METHOD(XonoticColorButton, saveCvars, void(entity))
+ENDCLASS(XonoticColorButton)
+entity makeXonoticColorButton(float, float, float);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticColorButton(float theGroup, float theColor, float theValue)
+{
+       entity me;
+       me = spawnXonoticColorButton();
+       me.configureXonoticColorButton(me, theGroup, theColor, theValue);
+       return me;
+}
+void XonoticColorButton_configureXonoticColorButton(entity me, float theGroup, float theColor, float theValue)
+{
+       switch(theValue)
+       {
+               // rearrange 1..14 for rainbow order
+               case  1: theValue = 10; break;
+               case  2: theValue =  4; break;
+               case  3: theValue =  1; break;
+               case  4: theValue = 14; break;
+               case  5: theValue = 12; break;
+               case  6: theValue =  7; break;
+               case  7: theValue =  3; break;
+               case  8: theValue =  2; break;
+               case  9: theValue =  6; break;
+               case 10: theValue =  5; break;
+               case 11: theValue = 13; break;
+               case 12: theValue = 11; break;
+               case 13: theValue =  8; break;
+               case 14: theValue =  9; break;
+               default:
+                       // no change
+                       break;
+       }
+       me.cvarName = "_cl_color";
+       me.cvarValueFloat = theValue;
+       me.cvarPart = theColor;
+       me.loadCvars(me);
+       me.configureRadioButton(me, string_null, me.fontSize, me.image, theGroup, 0);
+}
+void XonoticColorButton_setChecked(entity me, float val)
+{
+       if(val != me.checked)
+       {
+               me.checked = val;
+               me.saveCvars(me);
+       }
+}
+void XonoticColorButton_loadCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       if(cvar_string(me.cvarName) == cvar_defstring(me.cvarName))
+               cvar_set(me.cvarName, ftos(16 * floor(random() * 15) + floor(random() * 15)));
+
+       if(me.cvarPart == 1)
+               me.checked = (cvar(me.cvarName) & 240) == me.cvarValueFloat * 16;
+       else
+               me.checked = (cvar(me.cvarName) & 15) == me.cvarValueFloat;
+}
+void XonoticColorButton_saveCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       if(me.checked)
+       {
+               if(me.cvarPart == 1)
+                       cvar_set(me.cvarName, ftos((cvar(me.cvarName) & 15) + me.cvarValueFloat * 16));
+               else
+                       cvar_set(me.cvarName, ftos((cvar(me.cvarName) & 240) + me.cvarValueFloat));
+       }
+       // TODO on an apply button, read _cl_color and execute the color command for it
+}
+void XonoticColorButton_draw(entity me)
+{
+       me.color  = colormapPaletteColor(me.cvarValueFloat, me.cvarPart);
+       me.colorC = me.color;
+       me.colorF = me.color;
+       me.colorD = me.color;
+       SUPER(XonoticColorButton).draw(me);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/colorpicker.c b/qcsrc/menu/xonotic/colorpicker.c
deleted file mode 100644 (file)
index e072737..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticColorpicker) EXTENDS(Image)
-       METHOD(XonoticColorpicker, configureXonoticColorpicker, void(entity, entity))
-       METHOD(XonoticColorpicker, mousePress, float(entity, vector))
-       METHOD(XonoticColorpicker, mouseRelease, float(entity, vector))
-       METHOD(XonoticColorpicker, mouseDrag, float(entity, vector))
-       ATTRIB(XonoticColorpicker, controlledTextbox, entity, NULL)
-       ATTRIB(XonoticColorpicker, image, string, SKINGFX_COLORPICKER)
-       ATTRIB(XonoticColorpicker, imagemargin, vector, SKINMARGIN_COLORPICKER)
-       ATTRIB(XonoticColorpicker, focusable, float, 1)
-       METHOD(XonoticColorpicker, focusLeave, void(entity))
-       METHOD(XonoticColorpicker, keyDown, float(entity, float, float, float))
-       METHOD(XonoticColorpicker, draw, void(entity))
-ENDCLASS(XonoticColorpicker)
-entity makeXonoticColorpicker(entity theTextbox);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticColorpicker(entity theTextbox)
-{
-       entity me;
-       me = spawnXonoticColorpicker();
-       me.configureXonoticColorpicker(me, theTextbox);
-       return me;
-}
-
-void XonoticColorpicker_configureXonoticColorpicker(entity me, entity theTextbox)
-{
-       me.controlledTextbox = theTextbox;
-       me.configureImage(me, me.image);
-}
-
-float XonoticColorpicker_mousePress(entity me, vector coords)
-{
-       me.mouseDrag(me, coords);
-       return 1;
-}
-
-// must match hslimage.c
-vector hslimage_color(vector v, vector margin)
-{
-    v_x = (v_x - margin_x) / (1 - 2 * margin_x);
-    v_y = (v_y - margin_y) / (1 - 2 * margin_y);
-    if(v_x < 0) v_x = 0;
-    if(v_y < 0) v_y = 0;
-    if(v_x > 1) v_x = 1;
-    if(v_y > 1) v_y = 1;
-    if(v_y > 0.875) // grey bar
-        return hsl_to_rgb(eZ * v_x);
-    else
-        return hsl_to_rgb(v_x * 6 * eX + eY + v_y / 0.875 * eZ);
-}
-
-vector color_hslimage(vector v, vector margin)
-{
-       vector pos = '0 0 0';
-       v = rgb_to_hsl(v);
-       if (v_y)
-       {
-               pos_x = v_x / 6;
-               pos_y = v_z * 0.875;
-       }
-       else // grey scale
-       {
-               pos_x = v_z;
-               pos_y = 0.875 + 0.07;
-       }
-       pos_x = margin_x + pos_x * (1 - 2 * margin_x);
-       pos_y = margin_y + pos_y * (1 - 2 * margin_y);
-       return pos;
-}
-
-float XonoticColorpicker_mouseDrag(entity me, vector coords)
-{
-       float i, carets;
-       for(;;)
-       {
-               i = me.controlledTextbox.cursorPos;
-               if(i >= 2)
-               {
-                       if(substring(me.controlledTextbox.text, i-2, 1) == "^")
-                       {
-                               carets = 1;
-                               while (i - 2 - carets >= 0 && substring(me.controlledTextbox.text, i - 2 - carets, 1) == "^")
-                                       ++carets;
-                               if (carets & 1)
-                                       if(strstrofs("0123456789", substring(me.controlledTextbox.text, i-1, 1), 0) >= 0)
-                                       {
-                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
-                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
-                                               continue;
-                                       }
-                       }
-               }
-
-               if(i >= 5)
-               {
-                       if(substring(me.controlledTextbox.text, i-5, 2) == "^x")
-                       {
-                               carets = 1;
-                               while (i - 5 - carets >= 0 && substring(me.controlledTextbox.text, i - 5 - carets, 1) == "^")
-                                       ++carets;
-                               if (carets & 1)
-                                       if(strstrofs("0123456789abcdefABCDEF", substring(me.controlledTextbox.text, i-3, 1), 0) >= 0)
-                                               if(strstrofs("0123456789abcdefABCDEF", substring(me.controlledTextbox.text, i-2, 1), 0) >= 0)
-                                                       if(strstrofs("0123456789abcdefABCDEF", substring(me.controlledTextbox.text, i-1, 1), 0) >= 0)
-                                                       {
-                                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
-                                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
-                                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
-                                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
-                                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
-                                                               continue;
-                                                       }
-                       }
-               }
-               break;
-       }
-
-       if(substring(me.controlledTextbox.text, i-1, 1) == "^")
-       {
-               carets = 1;
-               while (i - 1 - carets >= 0 && substring(me.controlledTextbox.text, i - 1 - carets, 1) == "^")
-                       ++carets;
-               if (carets & 1)
-                       me.controlledTextbox.enterText(me.controlledTextbox, "^"); // escape previous caret
-       }
-
-       vector margin;
-       margin = me.imagemargin;
-       if(coords_x >= margin_x)
-       if(coords_y >= margin_y)
-       if(coords_x <= 1 - margin_x)
-       if(coords_y <= 1 - margin_y)
-               me.controlledTextbox.enterText(me.controlledTextbox, rgb_to_hexcolor(hslimage_color(coords, margin)));
-
-       return 1;
-}
-
-float XonoticColorpicker_mouseRelease(entity me, vector coords)
-{
-       me.mouseDrag(me, coords);
-       return 1;
-}
-
-void XonoticColorpicker_focusLeave(entity me)
-{
-       me.controlledTextbox.saveCvars(me.controlledTextbox);
-}
-float XonoticColorpicker_keyDown(entity me, float key, float ascii, float shift)
-{
-       return me.controlledTextbox.keyDown(me.controlledTextbox, key, ascii, shift);
-}
-void XonoticColorpicker_draw(entity me)
-{
-       SUPER(XonoticColorpicker).draw(me);
-
-       float B, C, aC;
-       C = cvar("r_textcontrast");
-       B = cvar("r_textbrightness");
-
-       // for this to work, C/(1-B) must be in 0..1
-       // B must be < 1
-       // C must be < 1-B
-
-       B = bound(0, B, 1);
-       C = bound(0, C, 1-B);
-
-       aC = 1 - C / (1 - B);
-
-       draw_Picture(me.imgOrigin, strcat(me.src, "_m"), me.imgSize, '0 0 0', aC);
-       draw_Picture(me.imgOrigin, strcat(me.src, "_m"), me.imgSize, me.color, B);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/colorpicker.qc b/qcsrc/menu/xonotic/colorpicker.qc
new file mode 100644 (file)
index 0000000..f16ab0e
--- /dev/null
@@ -0,0 +1,175 @@
+#ifdef INTERFACE
+CLASS(XonoticColorpicker) EXTENDS(Image)
+       METHOD(XonoticColorpicker, configureXonoticColorpicker, void(entity, entity))
+       METHOD(XonoticColorpicker, mousePress, float(entity, vector))
+       METHOD(XonoticColorpicker, mouseRelease, float(entity, vector))
+       METHOD(XonoticColorpicker, mouseDrag, float(entity, vector))
+       ATTRIB(XonoticColorpicker, controlledTextbox, entity, NULL)
+       ATTRIB(XonoticColorpicker, image, string, SKINGFX_COLORPICKER)
+       ATTRIB(XonoticColorpicker, imagemargin, vector, SKINMARGIN_COLORPICKER)
+       ATTRIB(XonoticColorpicker, focusable, float, 1)
+       METHOD(XonoticColorpicker, focusLeave, void(entity))
+       METHOD(XonoticColorpicker, keyDown, float(entity, float, float, float))
+       METHOD(XonoticColorpicker, draw, void(entity))
+ENDCLASS(XonoticColorpicker)
+entity makeXonoticColorpicker(entity theTextbox);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticColorpicker(entity theTextbox)
+{
+       entity me;
+       me = spawnXonoticColorpicker();
+       me.configureXonoticColorpicker(me, theTextbox);
+       return me;
+}
+
+void XonoticColorpicker_configureXonoticColorpicker(entity me, entity theTextbox)
+{
+       me.controlledTextbox = theTextbox;
+       me.configureImage(me, me.image);
+}
+
+float XonoticColorpicker_mousePress(entity me, vector coords)
+{
+       me.mouseDrag(me, coords);
+       return 1;
+}
+
+// must match hslimage.c
+vector hslimage_color(vector v, vector margin)
+{
+    v_x = (v.x - margin.x) / (1 - 2 * margin.x);
+    v_y = (v.y - margin.y) / (1 - 2 * margin.y);
+    if(v.x < 0) v_x = 0;
+    if(v.y < 0) v_y = 0;
+    if(v.x > 1) v_x = 1;
+    if(v.y > 1) v_y = 1;
+    if(v.y > 0.875) // grey bar
+        return hsl_to_rgb(eZ * v.x);
+    else
+        return hsl_to_rgb(v.x * 6 * eX + eY + v.y / 0.875 * eZ);
+}
+
+vector color_hslimage(vector v, vector margin)
+{
+       vector pos = '0 0 0';
+       v = rgb_to_hsl(v);
+       if (v.y)
+       {
+               pos_x = v.x / 6;
+               pos_y = v.z * 0.875;
+       }
+       else // grey scale
+       {
+               pos_x = v.z;
+               pos_y = 0.875 + 0.07;
+       }
+       pos_x = margin.x + pos.x * (1 - 2 * margin.x);
+       pos_y = margin.y + pos.y * (1 - 2 * margin.y);
+       return pos;
+}
+
+float XonoticColorpicker_mouseDrag(entity me, vector coords)
+{
+       float i, carets;
+       for (;;)
+       {
+               i = me.controlledTextbox.cursorPos;
+               if(i >= 2)
+               {
+                       if(substring(me.controlledTextbox.text, i-2, 1) == "^")
+                       {
+                               carets = 1;
+                               while (i - 2 - carets >= 0 && substring(me.controlledTextbox.text, i - 2 - carets, 1) == "^")
+                                       ++carets;
+                               if (carets & 1)
+                                       if(strstrofs("0123456789", substring(me.controlledTextbox.text, i-1, 1), 0) >= 0)
+                                       {
+                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+                                               continue;
+                                       }
+                       }
+               }
+
+               if(i >= 5)
+               {
+                       if(substring(me.controlledTextbox.text, i-5, 2) == "^x")
+                       {
+                               carets = 1;
+                               while (i - 5 - carets >= 0 && substring(me.controlledTextbox.text, i - 5 - carets, 1) == "^")
+                                       ++carets;
+                               if (carets & 1)
+                                       if(strstrofs("0123456789abcdefABCDEF", substring(me.controlledTextbox.text, i-3, 1), 0) >= 0)
+                                               if(strstrofs("0123456789abcdefABCDEF", substring(me.controlledTextbox.text, i-2, 1), 0) >= 0)
+                                                       if(strstrofs("0123456789abcdefABCDEF", substring(me.controlledTextbox.text, i-1, 1), 0) >= 0)
+                                                       {
+                                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+                                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+                                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+                                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+                                                               me.controlledTextbox.keyDown(me.controlledTextbox, K_BACKSPACE, 8, 0);
+                                                               continue;
+                                                       }
+                       }
+               }
+               break;
+       }
+
+       if(substring(me.controlledTextbox.text, i-1, 1) == "^")
+       {
+               carets = 1;
+               while (i - 1 - carets >= 0 && substring(me.controlledTextbox.text, i - 1 - carets, 1) == "^")
+                       ++carets;
+               if (carets & 1)
+                       me.controlledTextbox.enterText(me.controlledTextbox, "^"); // escape previous caret
+       }
+
+       vector margin;
+       margin = me.imagemargin;
+       if(coords.x >= margin.x)
+       if(coords.y >= margin.y)
+       if(coords.x <= 1 - margin.x)
+       if(coords.y <= 1 - margin.y)
+               me.controlledTextbox.enterText(me.controlledTextbox, rgb_to_hexcolor(hslimage_color(coords, margin)));
+
+       return 1;
+}
+
+float XonoticColorpicker_mouseRelease(entity me, vector coords)
+{
+       m_play_click_sound(MENU_SOUND_SLIDE);
+       me.mouseDrag(me, coords);
+       return 1;
+}
+
+void XonoticColorpicker_focusLeave(entity me)
+{
+       me.controlledTextbox.saveCvars(me.controlledTextbox);
+}
+float XonoticColorpicker_keyDown(entity me, float key, float ascii, float shift)
+{
+       return me.controlledTextbox.keyDown(me.controlledTextbox, key, ascii, shift);
+}
+void XonoticColorpicker_draw(entity me)
+{
+       SUPER(XonoticColorpicker).draw(me);
+
+       float B, C, aC;
+       C = cvar("r_textcontrast");
+       B = cvar("r_textbrightness");
+
+       // for this to work, C/(1-B) must be in 0..1
+       // B must be < 1
+       // C must be < 1-B
+
+       B = bound(0, B, 1);
+       C = bound(0, C, 1-B);
+
+       aC = 1 - C / (1 - B);
+
+       draw_Picture(me.imgOrigin, strcat(me.src, "_m"), me.imgSize, '0 0 0', aC);
+       draw_Picture(me.imgOrigin, strcat(me.src, "_m"), me.imgSize, me.color, B);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/colorpicker_string.c b/qcsrc/menu/xonotic/colorpicker_string.c
deleted file mode 100644 (file)
index 5d53135..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticColorpickerString) EXTENDS(Image)
-       METHOD(XonoticColorpickerString, configureXonoticColorpickerString, void(entity, string, string))
-       METHOD(XonoticColorpickerString, mousePress, float(entity, vector))
-       METHOD(XonoticColorpickerString, mouseRelease, float(entity, vector))
-       METHOD(XonoticColorpickerString, mouseDrag, float(entity, vector))
-       ATTRIB(XonoticColorpickerString, cvarName, string, string_null)
-       METHOD(XonoticColorPickerString, loadCvars, void(entity))
-       METHOD(XonoticColorPickerString, saveCvars, void(entity))
-       ATTRIB(XonoticColorpickerString, prevcoords, vector, '0 0 0')
-       ATTRIB(XonoticColorpickerString, image, string, SKINGFX_COLORPICKER)
-       ATTRIB(XonoticColorpickerString, imagemargin, vector, SKINMARGIN_COLORPICKER)
-       ATTRIB(XonoticColorpickerString, focusable, float, 1)
-       METHOD(XonoticColorpickerString, draw, void(entity))
-       ATTRIB(XonoticColorpickerString, disabledAlpha, float, 0.3)
-ENDCLASS(XonoticColorpickerString)
-entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar)
-{
-       entity me;
-       me = spawnXonoticColorpickerString();
-       me.configureXonoticColorpickerString(me, theCvar, theDefaultCvar);
-       return me;
-}
-
-void XonoticColorpickerString_configureXonoticColorpickerString(entity me, string theCvar, string theDefaultCvar)
-{
-       me.cvarName = theCvar;
-       me.configureImage(me, me.image);
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.tooltip = getZonedTooltipForIdentifier(theCvar);
-               me.loadCvars(me);
-       }
-}
-
-void XonoticColorPickerString_loadCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       if(substring(me.cvarName, -1, 1) == "_")
-       {
-               me.prevcoords = color_hslimage(
-                       eX * cvar(strcat(me.cvarName, "red")) +
-                       eY * cvar(strcat(me.cvarName, "green")) +
-                       eZ * cvar(strcat(me.cvarName, "blue")),
-                       me.imagemargin);
-       }
-       else
-               me.prevcoords = color_hslimage(stov(cvar_string(me.cvarName)), me.imagemargin);
-}
-
-void XonoticColorPickerString_saveCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       if(substring(me.cvarName, -1, 1) == "_")
-       {
-               vector v = hslimage_color(me.prevcoords, me.imagemargin);
-               cvar_set(strcat(me.cvarName, "red"), ftos(v_x));
-               cvar_set(strcat(me.cvarName, "green"), ftos(v_y));
-               cvar_set(strcat(me.cvarName, "blue"), ftos(v_z));
-       }
-       else
-               cvar_set(me.cvarName, sprintf("%v", hslimage_color(me.prevcoords, me.imagemargin)));
-}
-
-float XonoticColorpickerString_mousePress(entity me, vector coords)
-{
-       me.mouseDrag(me, coords);
-       return 1;
-}
-
-float XonoticColorpickerString_mouseDrag(entity me, vector coords)
-{
-       if(me.disabled)
-               return 0;
-       vector margin;
-       margin = me.imagemargin;
-       if(coords_x >= margin_x)
-       if(coords_y >= margin_y)
-       if(coords_x <= 1 - margin_x)
-       if(coords_y <= 1 - margin_y)
-       {
-               me.prevcoords = coords;
-               me.saveCvars(me);
-       }
-
-       return 1;
-}
-
-float XonoticColorpickerString_mouseRelease(entity me, vector coords)
-{
-       me.mouseDrag(me, coords);
-       return 1;
-}
-
-void XonoticColorpickerString_draw(entity me)
-{
-       float save;
-       save = draw_alpha;
-       if(me.disabled)
-               draw_alpha *= me.disabledAlpha;
-
-       SUPER(XonoticColorpickerString).draw(me);
-
-       vector sz;
-       sz = draw_PictureSize(strcat(me.src, "_selected"));
-       sz = globalToBoxSize(sz, draw_scale);
-
-       if(!me.disabled)
-               draw_Picture(me.imgOrigin + me.prevcoords - 0.5 * sz, strcat(me.src, "_selected"), sz, '1 1 1', 1);
-
-       draw_alpha = save;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/colorpicker_string.qc b/qcsrc/menu/xonotic/colorpicker_string.qc
new file mode 100644 (file)
index 0000000..458a72c
--- /dev/null
@@ -0,0 +1,123 @@
+#ifdef INTERFACE
+CLASS(XonoticColorpickerString) EXTENDS(Image)
+       METHOD(XonoticColorpickerString, configureXonoticColorpickerString, void(entity, string, string))
+       METHOD(XonoticColorpickerString, mousePress, float(entity, vector))
+       METHOD(XonoticColorpickerString, mouseRelease, float(entity, vector))
+       METHOD(XonoticColorpickerString, mouseDrag, float(entity, vector))
+       ATTRIB(XonoticColorpickerString, cvarName, string, string_null)
+       METHOD(XonoticColorPickerString, loadCvars, void(entity))
+       METHOD(XonoticColorPickerString, saveCvars, void(entity))
+       ATTRIB(XonoticColorpickerString, prevcoords, vector, '0 0 0')
+       ATTRIB(XonoticColorpickerString, image, string, SKINGFX_COLORPICKER)
+       ATTRIB(XonoticColorpickerString, imagemargin, vector, SKINMARGIN_COLORPICKER)
+       ATTRIB(XonoticColorpickerString, focusable, float, 1)
+       METHOD(XonoticColorpickerString, draw, void(entity))
+       ATTRIB(XonoticColorpickerString, disabledAlpha, float, 0.3)
+ENDCLASS(XonoticColorpickerString)
+entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar)
+{
+       entity me;
+       me = spawnXonoticColorpickerString();
+       me.configureXonoticColorpickerString(me, theCvar, theDefaultCvar);
+       return me;
+}
+
+void XonoticColorpickerString_configureXonoticColorpickerString(entity me, string theCvar, string theDefaultCvar)
+{
+       me.cvarName = theCvar;
+       me.configureImage(me, me.image);
+       if(theCvar)
+       {
+               me.cvarName = theCvar;
+               me.tooltip = getZonedTooltipForIdentifier(theCvar);
+               me.loadCvars(me);
+       }
+}
+
+void XonoticColorPickerString_loadCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       if(substring(me.cvarName, -1, 1) == "_")
+       {
+               me.prevcoords = color_hslimage(
+                       eX * cvar(strcat(me.cvarName, "red")) +
+                       eY * cvar(strcat(me.cvarName, "green")) +
+                       eZ * cvar(strcat(me.cvarName, "blue")),
+                       me.imagemargin);
+       }
+       else
+               me.prevcoords = color_hslimage(stov(cvar_string(me.cvarName)), me.imagemargin);
+}
+
+void XonoticColorPickerString_saveCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       if(substring(me.cvarName, -1, 1) == "_")
+       {
+               vector v = hslimage_color(me.prevcoords, me.imagemargin);
+               cvar_set(strcat(me.cvarName, "red"), ftos(v.x));
+               cvar_set(strcat(me.cvarName, "green"), ftos(v.y));
+               cvar_set(strcat(me.cvarName, "blue"), ftos(v.z));
+       }
+       else
+               cvar_set(me.cvarName, sprintf("%v", hslimage_color(me.prevcoords, me.imagemargin)));
+}
+
+float XonoticColorpickerString_mousePress(entity me, vector coords)
+{
+       me.mouseDrag(me, coords);
+       return 1;
+}
+
+float XonoticColorpickerString_mouseDrag(entity me, vector coords)
+{
+       if(me.disabled)
+               return 0;
+       vector margin;
+       margin = me.imagemargin;
+       if(coords.x >= margin.x)
+       if(coords.y >= margin.y)
+       if(coords.x <= 1 - margin.x)
+       if(coords.y <= 1 - margin.y)
+       {
+               me.prevcoords = coords;
+               me.saveCvars(me);
+       }
+
+       return 1;
+}
+
+float XonoticColorpickerString_mouseRelease(entity me, vector coords)
+{
+       m_play_click_sound(MENU_SOUND_SLIDE);
+       me.mouseDrag(me, coords);
+       return 1;
+}
+
+void XonoticColorpickerString_draw(entity me)
+{
+       float save;
+       save = draw_alpha;
+       if(me.disabled)
+               draw_alpha *= me.disabledAlpha;
+
+       SUPER(XonoticColorpickerString).draw(me);
+
+       vector sz;
+       sz = draw_PictureSize(strcat(me.src, "_selected"));
+       sz = globalToBoxSize(sz, draw_scale);
+
+       if(!me.disabled)
+               draw_Picture(me.imgOrigin + me.prevcoords - 0.5 * sz, strcat(me.src, "_selected"), sz, '1 1 1', 1);
+
+       draw_alpha = save;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/commandbutton.c b/qcsrc/menu/xonotic/commandbutton.c
deleted file mode 100644 (file)
index 8ee4e7d..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef COMMANDBUTTON_CLOSE
-# define COMMANDBUTTON_CLOSE 1
-# define COMMANDBUTTON_APPLY 2
-//# define COMMANDBUTTON_REVERT 4
-#endif
-
-#ifdef INTERFACE
-CLASS(XonoticCommandButton) EXTENDS(XonoticButton)
-       METHOD(XonoticCommandButton, configureXonoticCommandButton, void(entity, string, vector, string, float))
-       ATTRIB(XonoticCommandButton, onClickCommand, string, string_null)
-       ATTRIB(XonoticCommandButton, flags, float, 0)
-ENDCLASS(XonoticCommandButton)
-entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float theFlags)
-{
-       entity me;
-       me = spawnXonoticCommandButton();
-       me.configureXonoticCommandButton(me, theText, theColor, theCommand, theFlags);
-       return me;
-}
-
-void XonoticCommandButton_Click(entity me, entity other)
-{
-       //if(me.flags & COMMANDBUTTON_APPLY)
-       //      saveAllCvars(me.parent);
-       cmd("\n", me.onClickCommand, "\n");
-       //if(me.flags & COMMANDBUTTON_REVERT)
-       //      loadAllCvars(me.parent);
-       if(me.flags & COMMANDBUTTON_CLOSE)
-               m_goto(string_null);
-}
-
-void XonoticCommandButton_configureXonoticCommandButton(entity me, string theText, vector theColor, string theCommand, float theFlags)
-{
-       me.configureXonoticButton(me, theText, theColor);
-       me.onClickCommand = theCommand;
-       me.flags = theFlags;
-       me.onClick = XonoticCommandButton_Click;
-       me.onClickEntity = me;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/commandbutton.qc b/qcsrc/menu/xonotic/commandbutton.qc
new file mode 100644 (file)
index 0000000..8ee4e7d
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef COMMANDBUTTON_CLOSE
+# define COMMANDBUTTON_CLOSE 1
+# define COMMANDBUTTON_APPLY 2
+//# define COMMANDBUTTON_REVERT 4
+#endif
+
+#ifdef INTERFACE
+CLASS(XonoticCommandButton) EXTENDS(XonoticButton)
+       METHOD(XonoticCommandButton, configureXonoticCommandButton, void(entity, string, vector, string, float))
+       ATTRIB(XonoticCommandButton, onClickCommand, string, string_null)
+       ATTRIB(XonoticCommandButton, flags, float, 0)
+ENDCLASS(XonoticCommandButton)
+entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float theFlags)
+{
+       entity me;
+       me = spawnXonoticCommandButton();
+       me.configureXonoticCommandButton(me, theText, theColor, theCommand, theFlags);
+       return me;
+}
+
+void XonoticCommandButton_Click(entity me, entity other)
+{
+       //if(me.flags & COMMANDBUTTON_APPLY)
+       //      saveAllCvars(me.parent);
+       cmd("\n", me.onClickCommand, "\n");
+       //if(me.flags & COMMANDBUTTON_REVERT)
+       //      loadAllCvars(me.parent);
+       if(me.flags & COMMANDBUTTON_CLOSE)
+               m_goto(string_null);
+}
+
+void XonoticCommandButton_configureXonoticCommandButton(entity me, string theText, vector theColor, string theCommand, float theFlags)
+{
+       me.configureXonoticButton(me, theText, theColor);
+       me.onClickCommand = theCommand;
+       me.flags = theFlags;
+       me.onClick = XonoticCommandButton_Click;
+       me.onClickEntity = me;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/credits.c b/qcsrc/menu/xonotic/credits.c
deleted file mode 100644 (file)
index 0d998d7..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticCreditsList) EXTENDS(XonoticListBox)
-       METHOD(XonoticCreditsList, configureXonoticCreditsList, void(entity))
-       ATTRIB(XonoticCreditsList, rowsPerItem, float, 1)
-       METHOD(XonoticCreditsList, draw, void(entity))
-       METHOD(XonoticCreditsList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticCreditsList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticCreditsList, keyDown, float(entity, float, float, float))
-       METHOD(XonoticCreditsList, destroy, void(entity))
-
-       ATTRIB(XonoticCreditsList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticCreditsList, realUpperMargin, float, 0)
-       ATTRIB(XonoticCreditsList, bufferIndex, float, 0)
-       ATTRIB(XonoticCreditsList, scrolling, float, 0)
-
-       ATTRIB(XonoticListBox, alphaBG, float, 0)
-ENDCLASS(XonoticCreditsList)
-entity makeXonoticCreditsList();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticCreditsList()
-{
-       entity me;
-       me = spawnXonoticCreditsList();
-       me.configureXonoticCreditsList(me);
-       return me;
-}
-void XonoticCreditsList_configureXonoticCreditsList(entity me)
-{
-       me.configureXonoticListBox(me);
-       // load the file
-       me.bufferIndex = buf_load(language_filename("xonotic-credits.txt"));
-       me.nItems = buf_getsize(me.bufferIndex);
-}
-void XonoticCreditsList_destroy(entity me)
-{
-       buf_del(me.bufferIndex);
-}
-void XonoticCreditsList_draw(entity me)
-{
-       float i;
-       if(me.scrolling)
-       {
-               me.scrollPos = bound(0, (time - me.scrolling) * me.itemHeight, me.nItems * me.itemHeight - 1);
-               i = min(me.selectedItem, floor((me.scrollPos + 1) / me.itemHeight - 1));
-               i = max(i, ceil(me.scrollPos / me.itemHeight));
-               me.setSelected(me, i);
-       }
-       SUPER(XonoticCreditsList).draw(me);
-}
-void XonoticCreditsList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(XonoticCreditsList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight);
-       me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-}
-void XonoticCreditsList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       // layout: Ping, Credits name, Map name, NP, TP, MP
-       string s;
-       float theAlpha;
-       vector theColor;
-
-       s = bufstr_get(me.bufferIndex, i);
-
-       if(substring(s, 0, 2) == "**")
-       {
-               s = substring(s, 2, strlen(s) - 2);
-               theColor = SKINCOLOR_CREDITS_TITLE;
-               theAlpha = SKINALPHA_CREDITS_TITLE;
-       }
-       else if(substring(s, 0, 1) == "*")
-       {
-               s = substring(s, 1, strlen(s) - 1);
-               theColor = SKINCOLOR_CREDITS_FUNCTION;
-               theAlpha = SKINALPHA_CREDITS_FUNCTION;
-       }
-       else
-       {
-               theColor = SKINCOLOR_CREDITS_PERSON;
-               theAlpha = SKINALPHA_CREDITS_PERSON;
-       }
-
-       draw_CenterText(me.realUpperMargin * eY + 0.5 * eX, s, me.realFontSize, theColor, theAlpha, 0);
-}
-
-float XonoticCreditsList_keyDown(entity me, float key, float ascii, float shift)
-{
-       float i;
-       me.dragScrollTimer = time;
-       me.scrolling = 0;
-       if(key == K_PGUP || key == K_KP_PGUP)
-               me.scrollPos = max(me.scrollPos - 0.5, 0);
-       else if(key == K_PGDN || key == K_KP_PGDN)
-               me.scrollPos = min(me.scrollPos + 0.5, me.nItems * me.itemHeight - 1);
-       else if(key == K_UPARROW || key == K_KP_UPARROW)
-               me.scrollPos = max(me.scrollPos - me.itemHeight, 0);
-       else if(key == K_DOWNARROW || key == K_KP_DOWNARROW)
-               me.scrollPos = min(me.scrollPos + me.itemHeight, me.nItems * me.itemHeight - 1);
-       else
-               return SUPER(XonoticCreditsList).keyDown(me, key, ascii, shift);
-
-       i = min(me.selectedItem, floor((me.scrollPos + 1) / me.itemHeight - 1));
-       i = max(i, ceil(me.scrollPos / me.itemHeight));
-       me.setSelected(me, i);
-
-       return 1;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/credits.qc b/qcsrc/menu/xonotic/credits.qc
new file mode 100644 (file)
index 0000000..67848f9
--- /dev/null
@@ -0,0 +1,112 @@
+#ifdef INTERFACE
+CLASS(XonoticCreditsList) EXTENDS(XonoticListBox)
+       METHOD(XonoticCreditsList, configureXonoticCreditsList, void(entity))
+       ATTRIB(XonoticCreditsList, rowsPerItem, float, 1)
+       METHOD(XonoticCreditsList, draw, void(entity))
+       METHOD(XonoticCreditsList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticCreditsList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticCreditsList, keyDown, float(entity, float, float, float))
+       METHOD(XonoticCreditsList, destroy, void(entity))
+
+       ATTRIB(XonoticCreditsList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticCreditsList, realUpperMargin, float, 0)
+       ATTRIB(XonoticCreditsList, bufferIndex, float, 0)
+       ATTRIB(XonoticCreditsList, scrolling, float, 0)
+
+       ATTRIB(XonoticListBox, alphaBG, float, 0)
+ENDCLASS(XonoticCreditsList)
+entity makeXonoticCreditsList();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticCreditsList()
+{
+       entity me;
+       me = spawnXonoticCreditsList();
+       me.configureXonoticCreditsList(me);
+       return me;
+}
+void XonoticCreditsList_configureXonoticCreditsList(entity me)
+{
+       me.configureXonoticListBox(me);
+       // load the file
+       me.bufferIndex = buf_load(language_filename("xonotic-credits.txt"));
+       me.nItems = buf_getsize(me.bufferIndex);
+}
+void XonoticCreditsList_destroy(entity me)
+{
+       buf_del(me.bufferIndex);
+}
+void XonoticCreditsList_draw(entity me)
+{
+       float i;
+       if(me.scrolling)
+       {
+               me.scrollPos = bound(0, (time - me.scrolling) * me.itemHeight, me.nItems * me.itemHeight - 1);
+               i = min(me.selectedItem, floor((me.scrollPos + 1) / me.itemHeight - 1));
+               i = max(i, ceil(me.scrollPos / me.itemHeight));
+               me.setSelected(me, i);
+       }
+       SUPER(XonoticCreditsList).draw(me);
+}
+void XonoticCreditsList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(XonoticCreditsList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight);
+       me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+}
+void XonoticCreditsList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       // layout: Ping, Credits name, Map name, NP, TP, MP
+       string s;
+       float theAlpha;
+       vector theColor;
+
+       s = bufstr_get(me.bufferIndex, i);
+
+       if(substring(s, 0, 2) == "**")
+       {
+               s = substring(s, 2, strlen(s) - 2);
+               theColor = SKINCOLOR_CREDITS_TITLE;
+               theAlpha = SKINALPHA_CREDITS_TITLE;
+       }
+       else if(substring(s, 0, 1) == "*")
+       {
+               s = substring(s, 1, strlen(s) - 1);
+               theColor = SKINCOLOR_CREDITS_FUNCTION;
+               theAlpha = SKINALPHA_CREDITS_FUNCTION;
+       }
+       else
+       {
+               theColor = SKINCOLOR_CREDITS_PERSON;
+               theAlpha = SKINALPHA_CREDITS_PERSON;
+       }
+
+       draw_CenterText(me.realUpperMargin * eY + 0.5 * eX, s, me.realFontSize, theColor, theAlpha, 0);
+}
+
+float XonoticCreditsList_keyDown(entity me, float key, float ascii, float shift)
+{
+       float i;
+       me.dragScrollTimer = time;
+       me.scrolling = 0;
+       if(key == K_PGUP || key == K_KP_PGUP)
+               me.scrollPos = max(me.scrollPos - 0.5, 0);
+       else if(key == K_PGDN || key == K_KP_PGDN)
+               me.scrollPos = min(me.scrollPos + 0.5, me.nItems * me.itemHeight - 1);
+       else if(key == K_UPARROW || key == K_KP_UPARROW)
+               me.scrollPos = max(me.scrollPos - me.itemHeight, 0);
+       else if(key == K_DOWNARROW || key == K_KP_DOWNARROW)
+               me.scrollPos = min(me.scrollPos + me.itemHeight, me.nItems * me.itemHeight - 1);
+       else
+               return SUPER(XonoticCreditsList).keyDown(me, key, ascii, shift);
+
+       i = min(me.selectedItem, floor((me.scrollPos + 1) / me.itemHeight - 1));
+       i = max(i, ceil(me.scrollPos / me.itemHeight));
+       me.setSelected(me, i);
+
+       return 1;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/crosshairbutton.c b/qcsrc/menu/xonotic/crosshairbutton.c
deleted file mode 100644 (file)
index 7fe3a60..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticCrosshairButton) EXTENDS(RadioButton)
-       METHOD(XonoticCrosshairButton, configureXonoticCrosshairButton, void(entity, float, float))
-       METHOD(XonoticCrosshairButton, setChecked, void(entity, float))
-       METHOD(XonoticCrosshairButton, draw, void(entity))
-       ATTRIB(XonoticCrosshairButton, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticCrosshairButton, image, string, SKINGFX_CROSSHAIRBUTTON)
-
-       ATTRIB(XonoticCrosshairButton, useDownAsChecked, float, 1)
-       ATTRIB(XonoticCrosshairButton, src3, string, string_null)
-       ATTRIB(XonoticCrosshairButton, src4, string, string_null)
-
-       ATTRIB(XonoticCrosshairButton, cvarName, string, string_null)
-       ATTRIB(XonoticCrosshairButton, cvarValueFloat, float, 0)
-       METHOD(XonoticCrosshairButton, loadCvars, void(entity))
-       METHOD(XonoticCrosshairButton, saveCvars, void(entity))
-ENDCLASS(XonoticCrosshairButton)
-entity makeXonoticCrosshairButton(float, float);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticCrosshairButton(float theGroup, float theCrosshair)
-{
-       entity me;
-       me = spawnXonoticCrosshairButton();
-       me.configureXonoticCrosshairButton(me, theGroup, theCrosshair);
-       return me;
-}
-void XonoticCrosshairButton_configureXonoticCrosshairButton(entity me, float theGroup, float theCrosshair)
-{
-       me.cvarName = "crosshair";
-       me.cvarValueFloat = theCrosshair;
-       me.loadCvars(me);
-       me.configureRadioButton(me, string_null, me.fontSize, me.image, theGroup, 0);
-       me.srcMulti = 1;
-       if(me.cvarValueFloat == -1)
-               me.src3 = strzone(strcat("/gfx/crosshair", cvar_string("crosshair")));
-       else
-               me.src3 = strzone(strcat("/gfx/crosshair", ftos(me.cvarValueFloat)));
-       me.src4 = "/gfx/crosshairdot";
-}
-void XonoticCrosshairButton_setChecked(entity me, float val)
-{
-       if(me.cvarValueFloat != -1) // preview shouldn't work as a button
-       if(val != me.checked)
-       {
-               me.checked = val;
-               me.saveCvars(me);
-       }
-}
-void XonoticCrosshairButton_loadCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       me.checked = (cvar(me.cvarName) == me.cvarValueFloat);
-}
-void XonoticCrosshairButton_saveCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       if(me.checked)
-               cvar_set(me.cvarName, ftos(me.cvarValueFloat));
-       // TODO on an apply button, read _cl_color and execute the color command for it
-}
-void XonoticCrosshairButton_draw(entity me)
-{
-       vector sz, rgb;
-       float a;
-
-
-       if(me.cvarValueFloat == -1)
-       {
-               rgb = stov(cvar_string("crosshair_color"));
-               a = cvar("crosshair_alpha");
-       }
-       else if(me.checked || me.focused)
-       {
-               a = 1;
-               rgb = '1 1 1';
-       }
-       else
-       {
-               a = me.disabledAlpha;
-               rgb = '1 1 1';
-       }
-
-       if(me.cvarValueFloat == -1) // update the preview if this is the preview button
-       {
-               if(me.src3)
-                       strunzone(me.src3);
-               me.src3 = strzone(strcat("/gfx/crosshair", cvar_string("crosshair")));
-               me.focused = 1;
-               me.checked = 0;
-       }
-
-       SUPER(XonoticCrosshairButton).draw(me);
-
-       sz = draw_PictureSize(me.src3);
-       sz = globalToBoxSize(sz, me.size);
-       if(me.cvarValueFloat == -1)
-       {
-               sz = sz * cvar("crosshair_size"); // (6 * '1 1 0' + ...) * 0.08 here to make visible size changes happen also at bigger sizes
-               /*
-               if(sz_x > 0.95)
-                       sz = sz * (0.95 / sz_x);
-               if(sz_y > 0.95)
-                       sz = sz * (0.95 / sz_y);
-               */
-       }
-       else // show the crosshair picker at full size
-       {
-               sz = sz * (0.95 / sz_x);
-               if(sz_y > 0.95)
-                       sz = sz * (0.95 / sz_y);
-       }
-
-       draw_Picture('0.5 0.5 0' - 0.5 * sz, me.src3, sz, rgb, a);
-       if(cvar("crosshair_dot"))
-       {
-               if(cvar("crosshair_dot_color_custom") && (cvar_string("crosshair_dot_color") != "0"))
-                       rgb = stov(cvar_string("crosshair_dot_color"));
-
-               draw_Picture('0.5 0.5 0' - 0.5 * sz * cvar("crosshair_dot_size"), me.src4, sz * cvar("crosshair_dot_size"), rgb, a * cvar("crosshair_dot_alpha"));
-       }
-}
-#endif
diff --git a/qcsrc/menu/xonotic/crosshairbutton.qc b/qcsrc/menu/xonotic/crosshairbutton.qc
new file mode 100644 (file)
index 0000000..3b562cb
--- /dev/null
@@ -0,0 +1,128 @@
+#ifdef INTERFACE
+CLASS(XonoticCrosshairButton) EXTENDS(RadioButton)
+       METHOD(XonoticCrosshairButton, configureXonoticCrosshairButton, void(entity, float, float))
+       METHOD(XonoticCrosshairButton, setChecked, void(entity, float))
+       METHOD(XonoticCrosshairButton, draw, void(entity))
+       ATTRIB(XonoticCrosshairButton, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticCrosshairButton, image, string, SKINGFX_CROSSHAIRBUTTON)
+
+       ATTRIB(XonoticCrosshairButton, useDownAsChecked, float, 1)
+       ATTRIB(XonoticCrosshairButton, src3, string, string_null)
+       ATTRIB(XonoticCrosshairButton, src4, string, string_null)
+
+       ATTRIB(XonoticCrosshairButton, cvarName, string, string_null)
+       ATTRIB(XonoticCrosshairButton, cvarValueFloat, float, 0)
+       METHOD(XonoticCrosshairButton, loadCvars, void(entity))
+       METHOD(XonoticCrosshairButton, saveCvars, void(entity))
+ENDCLASS(XonoticCrosshairButton)
+entity makeXonoticCrosshairButton(float, float);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticCrosshairButton(float theGroup, float theCrosshair)
+{
+       entity me;
+       me = spawnXonoticCrosshairButton();
+       me.configureXonoticCrosshairButton(me, theGroup, theCrosshair);
+       return me;
+}
+void XonoticCrosshairButton_configureXonoticCrosshairButton(entity me, float theGroup, float theCrosshair)
+{
+       me.cvarName = "crosshair";
+       me.cvarValueFloat = theCrosshair;
+       me.loadCvars(me);
+       me.configureRadioButton(me, string_null, me.fontSize, me.image, theGroup, 0);
+       me.srcMulti = 1;
+       if(me.cvarValueFloat == -1)
+               me.src3 = strzone(strcat("/gfx/crosshair", cvar_string("crosshair")));
+       else
+               me.src3 = strzone(strcat("/gfx/crosshair", ftos(me.cvarValueFloat)));
+       me.src4 = "/gfx/crosshairdot";
+}
+void XonoticCrosshairButton_setChecked(entity me, float val)
+{
+       if(me.cvarValueFloat != -1) // preview shouldn't work as a button
+       if(val != me.checked)
+       {
+               me.checked = val;
+               me.saveCvars(me);
+       }
+}
+void XonoticCrosshairButton_loadCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       me.checked = (cvar(me.cvarName) == me.cvarValueFloat);
+}
+void XonoticCrosshairButton_saveCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       if(me.checked)
+               cvar_set(me.cvarName, ftos(me.cvarValueFloat));
+       // TODO on an apply button, read _cl_color and execute the color command for it
+}
+void XonoticCrosshairButton_draw(entity me)
+{
+       vector sz, rgb;
+       float a;
+
+
+       if(me.cvarValueFloat == -1)
+       {
+               rgb = stov(cvar_string("crosshair_color"));
+               a = cvar("crosshair_alpha");
+       }
+       else if(me.checked || me.focused)
+       {
+               a = 1;
+               rgb = '1 1 1';
+       }
+       else
+       {
+               a = me.disabledAlpha;
+               rgb = '1 1 1';
+       }
+
+       if(me.cvarValueFloat == -1) // update the preview if this is the preview button
+       {
+               if(me.src3)
+                       strunzone(me.src3);
+               me.src3 = strzone(strcat("/gfx/crosshair", cvar_string("crosshair")));
+               me.focused = 1;
+               me.checked = 0;
+       }
+
+       SUPER(XonoticCrosshairButton).draw(me);
+
+       sz = draw_PictureSize(me.src3);
+       sz = globalToBoxSize(sz, me.size);
+       if(me.cvarValueFloat == -1)
+       {
+               sz = sz * cvar("crosshair_size"); // (6 * '1 1 0' + ...) * 0.08 here to make visible size changes happen also at bigger sizes
+               /*
+               if(sz_x > 0.95)
+                       sz = sz * (0.95 / sz_x);
+               if(sz_y > 0.95)
+                       sz = sz * (0.95 / sz_y);
+               */
+       }
+       else // show the crosshair picker at full size
+       {
+               sz = sz * (0.95 / sz.x);
+               if(sz.y > 0.95)
+                       sz = sz * (0.95 / sz.y);
+       }
+
+       draw_Picture('0.5 0.5 0' - 0.5 * sz, me.src3, sz, rgb, a);
+       if(cvar("crosshair_dot"))
+       {
+               if(cvar("crosshair_dot_color_custom") && (cvar_string("crosshair_dot_color") != "0"))
+                       rgb = stov(cvar_string("crosshair_dot_color"));
+
+               draw_Picture('0.5 0.5 0' - 0.5 * sz * cvar("crosshair_dot_size"), me.src4, sz * cvar("crosshair_dot_size"), rgb, a * cvar("crosshair_dot_alpha"));
+       }
+}
+#endif
diff --git a/qcsrc/menu/xonotic/cvarlist.c b/qcsrc/menu/xonotic/cvarlist.c
deleted file mode 100644 (file)
index 913a03e..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticCvarList) EXTENDS(XonoticListBox)
-       METHOD(XonoticCvarList, configureXonoticCvarList, void(entity))
-       ATTRIB(XonoticCvarList, rowsPerItem, float, 1)
-       METHOD(XonoticCvarList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticCvarList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticCvarList, keyDown, float(entity, float, float, float))
-
-       METHOD(XonoticCvarList, destroy, void(entity))
-
-       ATTRIB(XonoticCvarList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticCvarList, realUpperMargin, float, 0)
-       ATTRIB(XonoticCvarList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticCvarList, columnNameSize, float, 0)
-       ATTRIB(XonoticCvarList, columnValueOrigin, float, 0)
-       ATTRIB(XonoticCvarList, columnValueSize, float, 0)
-
-       METHOD(XonoticCvarList, mouseRelease, float(entity, vector))
-       METHOD(XonoticCvarList, setSelected, void(entity, float))
-       METHOD(XonoticCvarList, updateCvarType, float(entity))
-
-       ATTRIB(XonoticCvarList, controlledTextbox, entity, NULL)
-       ATTRIB(XonoticCvarList, cvarNameBox, entity, NULL)
-       ATTRIB(XonoticCvarList, cvarDescriptionBox, entity, NULL)
-       ATTRIB(XonoticCvarList, cvarTypeBox, entity, NULL)
-       ATTRIB(XonoticCvarList, cvarValueBox, entity, NULL)
-       ATTRIB(XonoticCvarList, cvarDefaultBox, entity, NULL)
-       ATTRIB(XonoticCvarList, cvarNeedsForcing, float, 0)
-
-       ATTRIB(XonoticCvarList, handle, float, -1)
-       ATTRIB(XonoticCvarList, cvarName, string, string_null)
-       ATTRIB(XonoticCvarList, cvarDescription, string, string_null)
-       ATTRIB(XonoticCvarList, cvarType, string, string_null)
-       ATTRIB(XonoticCvarList, cvarDefault, string, string_null)
-ENDCLASS(XonoticCvarList)
-entity makeXonoticCvarList();
-void CvarList_Filter_Change(entity box, entity me);
-void CvarList_Value_Change(entity box, entity me);
-void CvarList_Revert_Click(entity btn, entity me);
-void CvarList_End_Editing(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticCvarList()
-{
-       entity me;
-       me = spawnXonoticCvarList();
-       me.configureXonoticCvarList(me);
-       return me;
-}
-void XonoticCvarList_configureXonoticCvarList(entity me)
-{
-       me.configureXonoticListBox(me);
-
-       me.handle = buf_create();
-       buf_cvarlist(me.handle, "", "_");
-       me.nItems = buf_getsize(me.handle);
-}
-void XonoticCvarList_destroy(entity me)
-{
-       buf_del(me.handle);
-}
-string autocvar_menu_forced_saved_cvars;
-string autocvar_menu_reverted_nonsaved_cvars;
-float XonoticCvarList_updateCvarType(entity me)
-{
-       float t;
-       t = cvar_type(me.cvarName);
-       me.cvarType = "";
-       float needsForcing;
-       if(strstrofs(strcat(" ", autocvar_menu_forced_saved_cvars, " "), strcat(" ", me.cvarName, " "), 0) >= 0)
-       {
-               me.cvarType = strcat(me.cvarType, ", ", _("forced to be saved to config.cfg"));
-               needsForcing = 0;
-       }
-       else if(strstrofs(strcat(" ", autocvar_menu_reverted_nonsaved_cvars, " "), strcat(" ", me.cvarName, " "), 0) >= 0)
-       {
-               // Currently claims to be saved, but won't be on next startup.
-               me.cvarType = strcat(me.cvarType, ", ", _("will not be saved"));
-               needsForcing = 1;
-       }
-       else if(t & CVAR_TYPEFLAG_SAVED)
-       {
-               me.cvarType = strcat(me.cvarType, ", ", _("will be saved to config.cfg"));
-               needsForcing = 0;
-       }
-       else
-       {
-               me.cvarType = strcat(me.cvarType, ", ", _("will not be saved"));
-               needsForcing = 1;
-       }
-       if(t & CVAR_TYPEFLAG_PRIVATE)
-               me.cvarType = strcat(me.cvarType, ", ", _("private"));
-       if(t & CVAR_TYPEFLAG_ENGINE)
-               me.cvarType = strcat(me.cvarType, ", ", _("engine setting"));
-       if(t & CVAR_TYPEFLAG_READONLY)
-               me.cvarType = strcat(me.cvarType, ", ", _("read only"));
-       me.cvarType = strzone(substring(me.cvarType, 2, strlen(me.cvarType) - 2));
-       me.cvarTypeBox.setText(me.cvarTypeBox, me.cvarType);
-       return needsForcing;
-}
-void XonoticCvarList_setSelected(entity me, float i)
-{
-       string s;
-
-       SUPER(XonoticCvarList).setSelected(me, i);
-       if(me.nItems == 0)
-               return;
-
-       if(me.cvarName)
-               strunzone(me.cvarName);
-       if(me.cvarDescription)
-               strunzone(me.cvarDescription);
-       if(me.cvarType)
-               strunzone(me.cvarType);
-       if(me.cvarDefault)
-               strunzone(me.cvarDefault);
-       me.cvarName = strzone(bufstr_get(me.handle, me.selectedItem));
-       me.cvarDescription = strzone(cvar_description(me.cvarName));
-       me.cvarDefault = strzone(cvar_defstring(me.cvarName));
-       me.cvarNameBox.setText(me.cvarNameBox, me.cvarName);
-       me.cvarDescriptionBox.setText(me.cvarDescriptionBox, me.cvarDescription);
-       float needsForcing = me.updateCvarType(me);
-       me.cvarDefaultBox.setText(me.cvarDefaultBox, me.cvarDefault);
-
-       // this one can handle tempstrings
-       s = cvar_string(me.cvarName);
-       me.cvarNeedsForcing = 0;
-       me.cvarValueBox.setText(me.cvarValueBox, s);
-       me.cvarNeedsForcing = needsForcing;
-       me.cvarValueBox.cursorPos = strlen(s);
-}
-void CvarList_Filter_Change(entity box, entity me)
-{
-       buf_cvarlist(me.handle, box.text, "_");
-       me.nItems = buf_getsize(me.handle);
-
-       me.setSelected(me, 0);
-}
-void XonoticCvarList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(XonoticCvarList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight);
-       me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-
-       me.columnNameOrigin = 0;
-       me.columnValueSize = me.realFontSize_x * 20;
-       me.columnNameSize = 1 - me.columnValueSize - me.realFontSize_x;
-       me.columnValueOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize_x;
-
-       me.setSelected(me, me.selectedItem);
-}
-void XonoticCvarList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       string k, v, d;
-       float t;
-
-       vector theColor;
-       float theAlpha;
-
-       string s;
-
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
-       k = bufstr_get(me.handle, i);
-
-       v = cvar_string(k);
-       d = cvar_defstring(k);
-       t = cvar_type(k);
-       if(strstrofs(strcat(" ", autocvar_menu_forced_saved_cvars, " "), strcat(" ", k, " "), 0) >= 0)
-               theAlpha = SKINALPHA_CVARLIST_SAVED;
-       else if(strstrofs(strcat(" ", autocvar_menu_reverted_nonsaved_cvars, " "), strcat(" ", k, " "), 0) >= 0)
-               theAlpha = SKINALPHA_CVARLIST_TEMPORARY;
-       else if(t & CVAR_TYPEFLAG_SAVED)
-               theAlpha = SKINALPHA_CVARLIST_SAVED;
-       else
-               theAlpha = SKINALPHA_CVARLIST_TEMPORARY;
-       if(v == d)
-               theColor = SKINCOLOR_CVARLIST_UNCHANGED;
-       else
-               theColor = SKINCOLOR_CVARLIST_CHANGED;
-
-       s = draw_TextShortenToWidth(k, me.columnNameSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, me.realFontSize, theColor, theAlpha, 0);
-       s = draw_TextShortenToWidth(v, me.columnValueSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin * eY + me.columnValueOrigin * eX, s, me.realFontSize, theColor, theAlpha, 0);
-}
-
-float XonoticCvarList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       if (scan == K_MOUSE3 || ((shift & S_CTRL) && scan == K_SPACE))
-       {
-               CvarList_Revert_Click(world, me);
-               return 1;
-       }
-       else if(scan == K_ENTER)
-       {
-               me.cvarValueBox.parent.setFocus(me.cvarValueBox.parent, me.cvarValueBox);
-               return 1;
-       }
-       else if(SUPER(XonoticCvarList).keyDown(me, scan, ascii, shift))
-               return 1;
-       else if(!me.controlledTextbox)
-               return 0;
-       else
-               return me.controlledTextbox.keyDown(me.controlledTextbox, scan, ascii, shift);
-}
-
-float XonoticCvarList_mouseRelease(entity me, vector pos)
-{
-       if(me.pressed == 2)
-               me.cvarValueBox.parent.setFocus(me.cvarValueBox.parent, me.cvarValueBox);
-       return SUPER(XonoticCvarList).mouseRelease(me, pos);
-}
-
-void CvarList_Value_Change(entity box, entity me)
-{
-       cvar_set(me.cvarNameBox.text, box.text);
-       if(me.cvarNeedsForcing)
-       {
-               localcmd(sprintf("\nseta %1$s \"$%1$s\"\n", me.cvarName));
-               cvar_set("menu_reverted_nonsaved_cvars", substring(strreplace(strcat(" ", me.cvarName, " "), " ", strcat(" ", autocvar_menu_reverted_nonsaved_cvars, " ")), 1, -2));
-               if (autocvar_menu_forced_saved_cvars == "")
-                       cvar_set("menu_forced_saved_cvars", me.cvarName);
-               else
-                       cvar_set("menu_forced_saved_cvars", strcat(autocvar_menu_forced_saved_cvars, " ", me.cvarName));
-               me.cvarNeedsForcing = 0;
-               me.updateCvarType(me);
-       }
-}
-
-void CvarList_Revert_Click(entity btn, entity me)
-{
-       me.cvarValueBox.setText(me.cvarValueBox, me.cvarDefault);
-       me.cvarValueBox.cursorPos = strlen(me.cvarDefault);
-       if(strstrofs(strcat(" ", autocvar_menu_forced_saved_cvars, " "), strcat(" ", me.cvarName, " "), 0) >= 0)
-       {
-               cvar_set("menu_forced_saved_cvars", substring(strreplace(strcat(" ", me.cvarName, " "), " ", strcat(" ", autocvar_menu_forced_saved_cvars, " ")), 1, -2));
-               if (autocvar_menu_reverted_nonsaved_cvars == "")
-                       cvar_set("menu_reverted_nonsaved_cvars", me.cvarName);
-               else
-                       cvar_set("menu_reverted_nonsaved_cvars", strcat(autocvar_menu_reverted_nonsaved_cvars, " ", me.cvarName));
-       }
-       me.cvarNeedsForcing = me.updateCvarType(me);
-}
-
-void CvarList_End_Editing(entity box, entity me)
-{
-       box.parent.setFocus(box.parent, me);
-}
-
-#endif
diff --git a/qcsrc/menu/xonotic/cvarlist.qc b/qcsrc/menu/xonotic/cvarlist.qc
new file mode 100644 (file)
index 0000000..421142a
--- /dev/null
@@ -0,0 +1,255 @@
+#ifdef INTERFACE
+CLASS(XonoticCvarList) EXTENDS(XonoticListBox)
+       METHOD(XonoticCvarList, configureXonoticCvarList, void(entity))
+       ATTRIB(XonoticCvarList, rowsPerItem, float, 1)
+       METHOD(XonoticCvarList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticCvarList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticCvarList, keyDown, float(entity, float, float, float))
+
+       METHOD(XonoticCvarList, destroy, void(entity))
+
+       ATTRIB(XonoticCvarList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticCvarList, realUpperMargin, float, 0)
+       ATTRIB(XonoticCvarList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticCvarList, columnNameSize, float, 0)
+       ATTRIB(XonoticCvarList, columnValueOrigin, float, 0)
+       ATTRIB(XonoticCvarList, columnValueSize, float, 0)
+
+       METHOD(XonoticCvarList, mouseRelease, float(entity, vector))
+       METHOD(XonoticCvarList, setSelected, void(entity, float))
+       METHOD(XonoticCvarList, updateCvarType, float(entity))
+
+       ATTRIB(XonoticCvarList, controlledTextbox, entity, NULL)
+       ATTRIB(XonoticCvarList, cvarNameBox, entity, NULL)
+       ATTRIB(XonoticCvarList, cvarDescriptionBox, entity, NULL)
+       ATTRIB(XonoticCvarList, cvarTypeBox, entity, NULL)
+       ATTRIB(XonoticCvarList, cvarValueBox, entity, NULL)
+       ATTRIB(XonoticCvarList, cvarDefaultBox, entity, NULL)
+       ATTRIB(XonoticCvarList, cvarNeedsForcing, float, 0)
+
+       ATTRIB(XonoticCvarList, handle, float, -1)
+       ATTRIB(XonoticCvarList, cvarName, string, string_null)
+       ATTRIB(XonoticCvarList, cvarDescription, string, string_null)
+       ATTRIB(XonoticCvarList, cvarType, string, string_null)
+       ATTRIB(XonoticCvarList, cvarDefault, string, string_null)
+ENDCLASS(XonoticCvarList)
+entity makeXonoticCvarList();
+void CvarList_Filter_Change(entity box, entity me);
+void CvarList_Value_Change(entity box, entity me);
+void CvarList_Revert_Click(entity btn, entity me);
+void CvarList_End_Editing(entity box, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticCvarList()
+{
+       entity me;
+       me = spawnXonoticCvarList();
+       me.configureXonoticCvarList(me);
+       return me;
+}
+void XonoticCvarList_configureXonoticCvarList(entity me)
+{
+       me.configureXonoticListBox(me);
+
+       me.handle = buf_create();
+       buf_cvarlist(me.handle, "", "_");
+       me.nItems = buf_getsize(me.handle);
+}
+void XonoticCvarList_destroy(entity me)
+{
+       buf_del(me.handle);
+}
+string autocvar_menu_forced_saved_cvars;
+string autocvar_menu_reverted_nonsaved_cvars;
+float XonoticCvarList_updateCvarType(entity me)
+{
+       float t;
+       t = cvar_type(me.cvarName);
+       me.cvarType = "";
+       float needsForcing;
+       if(strstrofs(strcat(" ", autocvar_menu_forced_saved_cvars, " "), strcat(" ", me.cvarName, " "), 0) >= 0)
+       {
+               me.cvarType = strcat(me.cvarType, ", ", _("forced to be saved to config.cfg"));
+               needsForcing = 0;
+       }
+       else if(strstrofs(strcat(" ", autocvar_menu_reverted_nonsaved_cvars, " "), strcat(" ", me.cvarName, " "), 0) >= 0)
+       {
+               // Currently claims to be saved, but won't be on next startup.
+               me.cvarType = strcat(me.cvarType, ", ", _("will not be saved"));
+               needsForcing = 1;
+       }
+       else if(t & CVAR_TYPEFLAG_SAVED)
+       {
+               me.cvarType = strcat(me.cvarType, ", ", _("will be saved to config.cfg"));
+               needsForcing = 0;
+       }
+       else
+       {
+               me.cvarType = strcat(me.cvarType, ", ", _("will not be saved"));
+               needsForcing = 1;
+       }
+       if(t & CVAR_TYPEFLAG_PRIVATE)
+               me.cvarType = strcat(me.cvarType, ", ", _("private"));
+       if(t & CVAR_TYPEFLAG_ENGINE)
+               me.cvarType = strcat(me.cvarType, ", ", _("engine setting"));
+       if(t & CVAR_TYPEFLAG_READONLY)
+               me.cvarType = strcat(me.cvarType, ", ", _("read only"));
+       me.cvarType = strzone(substring(me.cvarType, 2, strlen(me.cvarType) - 2));
+       me.cvarTypeBox.setText(me.cvarTypeBox, me.cvarType);
+       return needsForcing;
+}
+void XonoticCvarList_setSelected(entity me, float i)
+{
+       string s;
+
+       SUPER(XonoticCvarList).setSelected(me, i);
+       if(me.nItems == 0)
+               return;
+
+       if(me.cvarName)
+               strunzone(me.cvarName);
+       if(me.cvarDescription)
+               strunzone(me.cvarDescription);
+       if(me.cvarType)
+               strunzone(me.cvarType);
+       if(me.cvarDefault)
+               strunzone(me.cvarDefault);
+       me.cvarName = strzone(bufstr_get(me.handle, me.selectedItem));
+       me.cvarDescription = strzone(cvar_description(me.cvarName));
+       me.cvarDefault = strzone(cvar_defstring(me.cvarName));
+       me.cvarNameBox.setText(me.cvarNameBox, me.cvarName);
+       me.cvarDescriptionBox.setText(me.cvarDescriptionBox, me.cvarDescription);
+       float needsForcing = me.updateCvarType(me);
+       me.cvarDefaultBox.setText(me.cvarDefaultBox, me.cvarDefault);
+
+       // this one can handle tempstrings
+       s = cvar_string(me.cvarName);
+       me.cvarNeedsForcing = 0;
+       me.cvarValueBox.setText(me.cvarValueBox, s);
+       me.cvarNeedsForcing = needsForcing;
+       me.cvarValueBox.cursorPos = strlen(s);
+}
+void CvarList_Filter_Change(entity box, entity me)
+{
+       buf_cvarlist(me.handle, box.text, "_");
+       me.nItems = buf_getsize(me.handle);
+
+       me.setSelected(me, 0);
+}
+void XonoticCvarList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(XonoticCvarList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight);
+       me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+
+       me.columnNameOrigin = 0;
+       me.columnValueSize = me.realFontSize.x * 20;
+       me.columnNameSize = 1 - me.columnValueSize - me.realFontSize.x;
+       me.columnValueOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize.x;
+
+       me.setSelected(me, me.selectedItem);
+}
+void XonoticCvarList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       string k, v, d;
+       float t;
+
+       vector theColor;
+       float theAlpha;
+
+       string s;
+
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+
+       k = bufstr_get(me.handle, i);
+
+       v = cvar_string(k);
+       d = cvar_defstring(k);
+       t = cvar_type(k);
+       if(strstrofs(strcat(" ", autocvar_menu_forced_saved_cvars, " "), strcat(" ", k, " "), 0) >= 0)
+               theAlpha = SKINALPHA_CVARLIST_SAVED;
+       else if(strstrofs(strcat(" ", autocvar_menu_reverted_nonsaved_cvars, " "), strcat(" ", k, " "), 0) >= 0)
+               theAlpha = SKINALPHA_CVARLIST_TEMPORARY;
+       else if(t & CVAR_TYPEFLAG_SAVED)
+               theAlpha = SKINALPHA_CVARLIST_SAVED;
+       else
+               theAlpha = SKINALPHA_CVARLIST_TEMPORARY;
+       if(v == d)
+               theColor = SKINCOLOR_CVARLIST_UNCHANGED;
+       else
+               theColor = SKINCOLOR_CVARLIST_CHANGED;
+
+       s = draw_TextShortenToWidth(k, me.columnNameSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, me.realFontSize, theColor, theAlpha, 0);
+       s = draw_TextShortenToWidth(v, me.columnValueSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin * eY + me.columnValueOrigin * eX, s, me.realFontSize, theColor, theAlpha, 0);
+}
+
+float XonoticCvarList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       if (scan == K_MOUSE3 || ((shift & S_CTRL) && scan == K_SPACE))
+       {
+               CvarList_Revert_Click(world, me);
+               return 1;
+       }
+       else if(scan == K_ENTER)
+       {
+               me.cvarValueBox.parent.setFocus(me.cvarValueBox.parent, me.cvarValueBox);
+               return 1;
+       }
+       else if(SUPER(XonoticCvarList).keyDown(me, scan, ascii, shift))
+               return 1;
+       else if(!me.controlledTextbox)
+               return 0;
+       else
+               return me.controlledTextbox.keyDown(me.controlledTextbox, scan, ascii, shift);
+}
+
+float XonoticCvarList_mouseRelease(entity me, vector pos)
+{
+       if(me.pressed == 2)
+               me.cvarValueBox.parent.setFocus(me.cvarValueBox.parent, me.cvarValueBox);
+       return SUPER(XonoticCvarList).mouseRelease(me, pos);
+}
+
+void CvarList_Value_Change(entity box, entity me)
+{
+       cvar_set(me.cvarNameBox.text, box.text);
+       if(me.cvarNeedsForcing)
+       {
+               localcmd(sprintf("\nseta %1$s \"$%1$s\"\n", me.cvarName));
+               cvar_set("menu_reverted_nonsaved_cvars", substring(strreplace(strcat(" ", me.cvarName, " "), " ", strcat(" ", autocvar_menu_reverted_nonsaved_cvars, " ")), 1, -2));
+               if (autocvar_menu_forced_saved_cvars == "")
+                       cvar_set("menu_forced_saved_cvars", me.cvarName);
+               else
+                       cvar_set("menu_forced_saved_cvars", strcat(autocvar_menu_forced_saved_cvars, " ", me.cvarName));
+               me.cvarNeedsForcing = 0;
+               me.updateCvarType(me);
+       }
+}
+
+void CvarList_Revert_Click(entity btn, entity me)
+{
+       me.cvarValueBox.setText(me.cvarValueBox, me.cvarDefault);
+       me.cvarValueBox.cursorPos = strlen(me.cvarDefault);
+       if(strstrofs(strcat(" ", autocvar_menu_forced_saved_cvars, " "), strcat(" ", me.cvarName, " "), 0) >= 0)
+       {
+               cvar_set("menu_forced_saved_cvars", substring(strreplace(strcat(" ", me.cvarName, " "), " ", strcat(" ", autocvar_menu_forced_saved_cvars, " ")), 1, -2));
+               if (autocvar_menu_reverted_nonsaved_cvars == "")
+                       cvar_set("menu_reverted_nonsaved_cvars", me.cvarName);
+               else
+                       cvar_set("menu_reverted_nonsaved_cvars", strcat(autocvar_menu_reverted_nonsaved_cvars, " ", me.cvarName));
+       }
+       me.cvarNeedsForcing = me.updateCvarType(me);
+}
+
+void CvarList_End_Editing(entity box, entity me)
+{
+       box.parent.setFocus(box.parent, me);
+}
+
+#endif
diff --git a/qcsrc/menu/xonotic/demolist.c b/qcsrc/menu/xonotic/demolist.c
deleted file mode 100644 (file)
index f2e209c..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticDemoList) EXTENDS(XonoticListBox)
-       METHOD(XonoticDemoList, configureXonoticDemoList, void(entity))
-       ATTRIB(XonoticDemoList, rowsPerItem, float, 1)
-       METHOD(XonoticDemoList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticDemoList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticDemoList, getDemos, void(entity))
-       METHOD(XonoticDemoList, startDemo, void(entity))
-       METHOD(XonoticDemoList, timeDemo, void(entity))
-       METHOD(XonoticDemoList, demoName, string(entity, float))
-       METHOD(XonoticDemoList, clickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticDemoList, keyDown, float(entity, float, float, float))
-       METHOD(XonoticDemoList, destroy, void(entity))
-       METHOD(XonoticDemoList, showNotify, void(entity))
-
-       ATTRIB(XonoticDemoList, listDemo, float, -1)
-       ATTRIB(XonoticDemoList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticDemoList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticDemoList, columnNameSize, float, 0)
-       ATTRIB(XonoticDemoList, realUpperMargin, float, 0)
-       ATTRIB(XonoticDemoList, origin, vector, '0 0 0')
-       ATTRIB(XonoticDemoList, itemAbsSize, vector, '0 0 0')
-
-       ATTRIB(XonoticDemoList, lastClickedDemo, float, -1)
-       ATTRIB(XonoticDemoList, lastClickedTime, float, 0)
-       ATTRIB(XonoticDemoList, filterString, string, string_null)
-ENDCLASS(XonoticDemoList)
-
-entity demolist; // for reference elsewhere
-entity makeXonoticDemoList();
-void DemoList_Refresh_Click(entity btn, entity me);
-void DemoList_Filter_Change(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-
-entity makeXonoticDemoList()
-{
-       entity me;
-       me = spawnXonoticDemoList();
-       me.configureXonoticDemoList(me);
-       return me;
-}
-
-void XonoticDemoList_configureXonoticDemoList(entity me)
-{
-       me.configureXonoticListBox(me);
-       me.getDemos(me);
-}
-
-string XonoticDemoList_demoName(entity me, float i)
-{
-       string s;
-       s = bufstr_get(me.listDemo, i);
-
-       if(substring(s, 0, 1) == "/")
-               s = substring(s, 1, strlen(s) - 1);  // remove the first forward slash
-
-       return s;
-}
-
-// if subdir is TRUE look in subdirectories too (1 level)
-void getDemos_for_ext(entity me, string ext, float subdir)
-{
-       string s;
-       if (subdir)
-               s="demos/*/";
-       else
-               s="demos/";
-       if(me.filterString)
-               s=strcat(s, me.filterString, ext);
-       else
-               s=strcat(s, "*", ext);
-
-       float list, i, n;
-       list = search_begin(s, FALSE, TRUE);
-       if(list >= 0)
-       {
-               n = search_getsize(list);
-               for(i = 0; i < n; ++i)
-               {
-                       s = search_getfilename(list, i); // get initial full file name
-                       s = substring(s, 6, (strlen(s) - 6 - 4)); // remove "demos/" prefix and ".dem" suffix
-                       s = strdecolorize(s); // remove any pre-existing colors
-                       if(subdir)
-                       {
-                               s = strreplace("/", "^7/", s); // clear colors at the forward slash
-                               s = strcat("/", rgb_to_hexcolor(SKINCOLOR_DEMOLIST_SUBDIR), s); // add a forward slash for sorting, then color
-                               bufstr_add(me.listDemo, s, TRUE);
-                       }
-                       else { bufstr_add(me.listDemo, s, TRUE); }
-               }
-               search_end(list);
-       }
-
-       if (subdir)
-               getDemos_for_ext(me, ext, FALSE);
-}
-
-void XonoticDemoList_getDemos(entity me)
-{
-       if (me.listDemo >= 0)
-               buf_del(me.listDemo);
-       me.listDemo = buf_create();
-       if (me.listDemo < 0)
-       {
-               me.nItems = 0;
-               return;
-       }
-       getDemos_for_ext(me, ".dem", TRUE);
-       me.nItems = buf_getsize(me.listDemo);
-       if(me.nItems > 0)
-               buf_sort(me.listDemo, 128, FALSE);
-}
-
-void XonoticDemoList_destroy(entity me)
-{
-       if(me.nItems > 0)
-               buf_del(me.listDemo);
-}
-
-void XonoticDemoList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.itemAbsSize = '0 0 0';
-       SUPER(XonoticDemoList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight));
-       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth)));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-
-       me.columnNameOrigin = me.realFontSize_x;
-       me.columnNameSize = 1 - 2 * me.realFontSize_x;
-}
-
-void XonoticDemoList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       string s;
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
-       s = me.demoName(me,i);
-       s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_TEXT, SKINALPHA_TEXT, 1);
-}
-
-void XonoticDemoList_showNotify(entity me)
-{
-       me.getDemos(me);
-}
-
-void DemoList_Refresh_Click(entity btn, entity me)
-{
-       me.getDemos(me);
-       me.setSelected(me, 0); //always select the first element after a list update
-}
-
-void DemoList_Filter_Change(entity box, entity me)
-{
-       if(me.filterString)
-               strunzone(me.filterString);
-
-       if(box.text != "")
-       {
-               if (strstrofs(box.text, "*", 0) >= 0 || strstrofs(box.text, "?", 0) >= 0)
-                       me.filterString = strzone(box.text);
-               else
-                       me.filterString = strzone(strcat("*", box.text, "*"));
-       }
-       else
-               me.filterString = string_null;
-
-       me.getDemos(me);
-}
-
-void XonoticDemoList_startDemo(entity me)
-{
-       string s;
-       s = me.demoName(me, me.selectedItem);
-       s = strdecolorize(s);
-
-       localcmd("playdemo \"demos/", s, ".dem\" \nwait \ntogglemenu\n");
-}
-
-void XonoticDemoList_timeDemo(entity me)
-{
-       string s;
-       s = me.demoName(me, me.selectedItem);
-       s = strdecolorize(s);
-
-       localcmd("timedemo \"demos/", s, ".dem\" \nwait \ntogglemenu\n");
-}
-
-void DemoConfirm_ListClick_Check_Gamestatus(entity me)
-{
-       if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, lets watch the demo
-       {
-               me.startDemo(me);
-       }
-       else // already in a match, player has to confirm
-       {
-               DialogOpenButton_Click_withCoords(
-                       me,
-                       main.demostartconfirmDialog,
-                       boxToGlobal(eY * (me.selectedItem * me.itemHeight - me.scrollPos), me.origin, me.size),
-                       boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), me.size)
-               );
-       }
-}
-
-void XonoticDemoList_clickListBoxItem(entity me, float i, vector where)
-{
-       if(i == me.lastClickedDemo)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       me.setSelected(me, i);
-                       DemoConfirm_ListClick_Check_Gamestatus(me);
-               }
-       me.lastClickedDemo = i;
-       me.lastClickedTime = time;
-}
-
-float XonoticDemoList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       if(scan == K_ENTER || scan == K_KP_ENTER)
-       {
-               DemoConfirm_ListClick_Check_Gamestatus(me);
-               return 1;
-       }
-       else
-       {
-               return SUPER(XonoticDemoList).keyDown(me, scan, ascii, shift);
-       }
-}
-#endif
-
diff --git a/qcsrc/menu/xonotic/demolist.qc b/qcsrc/menu/xonotic/demolist.qc
new file mode 100644 (file)
index 0000000..6882fcc
--- /dev/null
@@ -0,0 +1,229 @@
+#ifdef INTERFACE
+CLASS(XonoticDemoList) EXTENDS(XonoticListBox)
+       METHOD(XonoticDemoList, configureXonoticDemoList, void(entity))
+       ATTRIB(XonoticDemoList, rowsPerItem, float, 1)
+       METHOD(XonoticDemoList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticDemoList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticDemoList, getDemos, void(entity))
+       METHOD(XonoticDemoList, startDemo, void(entity))
+       METHOD(XonoticDemoList, timeDemo, void(entity))
+       METHOD(XonoticDemoList, demoName, string(entity, float))
+       METHOD(XonoticDemoList, doubleClickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticDemoList, keyDown, float(entity, float, float, float))
+       METHOD(XonoticDemoList, destroy, void(entity))
+       METHOD(XonoticDemoList, showNotify, void(entity))
+
+       ATTRIB(XonoticDemoList, listDemo, float, -1)
+       ATTRIB(XonoticDemoList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticDemoList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticDemoList, columnNameSize, float, 0)
+       ATTRIB(XonoticDemoList, realUpperMargin, float, 0)
+       ATTRIB(XonoticDemoList, origin, vector, '0 0 0')
+       ATTRIB(XonoticDemoList, itemAbsSize, vector, '0 0 0')
+
+       ATTRIB(XonoticDemoList, filterString, string, string_null)
+ENDCLASS(XonoticDemoList)
+
+#ifndef IMPLEMENTATION
+// public:
+entity demolist; // for reference elsewhere
+entity makeXonoticDemoList();
+#endif
+void DemoList_Refresh_Click(entity btn, entity me);
+void DemoList_Filter_Change(entity box, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+
+entity makeXonoticDemoList()
+{
+       entity me;
+       me = spawnXonoticDemoList();
+       me.configureXonoticDemoList(me);
+       return me;
+}
+
+void XonoticDemoList_configureXonoticDemoList(entity me)
+{
+       me.configureXonoticListBox(me);
+       me.getDemos(me);
+}
+
+string XonoticDemoList_demoName(entity me, float i)
+{
+       string s;
+       s = bufstr_get(me.listDemo, i);
+
+       if(substring(s, 0, 1) == "/")
+               s = substring(s, 1, strlen(s) - 1);  // remove the first forward slash
+
+       return s;
+}
+
+// if subdir is true look in subdirectories too (1 level)
+void getDemos_for_ext(entity me, string ext, float subdir)
+{
+       string s;
+       if (subdir)
+               s="demos/*/";
+       else
+               s="demos/";
+       if(me.filterString)
+               s=strcat(s, me.filterString, ext);
+       else
+               s=strcat(s, "*", ext);
+
+       float list, i, n;
+       list = search_begin(s, false, true);
+       if(list >= 0)
+       {
+               n = search_getsize(list);
+               for(i = 0; i < n; ++i)
+               {
+                       s = search_getfilename(list, i); // get initial full file name
+                       s = substring(s, 6, (strlen(s) - 6 - 4)); // remove "demos/" prefix and ".dem" suffix
+                       s = strdecolorize(s); // remove any pre-existing colors
+                       if(subdir)
+                       {
+                               s = strreplace("/", "^7/", s); // clear colors at the forward slash
+                               s = strcat("/", rgb_to_hexcolor(SKINCOLOR_DEMOLIST_SUBDIR), s); // add a forward slash for sorting, then color
+                               bufstr_add(me.listDemo, s, true);
+                       }
+                       else { bufstr_add(me.listDemo, s, true); }
+               }
+               search_end(list);
+       }
+
+       if (subdir)
+               getDemos_for_ext(me, ext, false);
+}
+
+void XonoticDemoList_getDemos(entity me)
+{
+       if (me.listDemo >= 0)
+               buf_del(me.listDemo);
+       me.listDemo = buf_create();
+       if (me.listDemo < 0)
+       {
+               me.nItems = 0;
+               return;
+       }
+       getDemos_for_ext(me, ".dem", true);
+       me.nItems = buf_getsize(me.listDemo);
+       if(me.nItems > 0)
+               buf_sort(me.listDemo, 128, false);
+}
+
+void XonoticDemoList_destroy(entity me)
+{
+       if(me.nItems > 0)
+               buf_del(me.listDemo);
+}
+
+void XonoticDemoList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.itemAbsSize = '0 0 0';
+       SUPER(XonoticDemoList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
+       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+
+       me.columnNameOrigin = me.realFontSize.x;
+       me.columnNameSize = 1 - 2 * me.realFontSize.x;
+}
+
+void XonoticDemoList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       string s;
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+
+       s = me.demoName(me,i);
+       s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_TEXT, SKINALPHA_TEXT, 1);
+}
+
+void XonoticDemoList_showNotify(entity me)
+{
+       me.getDemos(me);
+}
+
+void DemoList_Refresh_Click(entity btn, entity me)
+{
+       me.getDemos(me);
+       me.setSelected(me, 0); //always select the first element after a list update
+}
+
+void DemoList_Filter_Change(entity box, entity me)
+{
+       if(me.filterString)
+               strunzone(me.filterString);
+
+       if(box.text != "")
+       {
+               if (strstrofs(box.text, "*", 0) >= 0 || strstrofs(box.text, "?", 0) >= 0)
+                       me.filterString = strzone(box.text);
+               else
+                       me.filterString = strzone(strcat("*", box.text, "*"));
+       }
+       else
+               me.filterString = string_null;
+
+       me.getDemos(me);
+}
+
+void XonoticDemoList_startDemo(entity me)
+{
+       string s;
+       s = me.demoName(me, me.selectedItem);
+       s = strdecolorize(s);
+
+       localcmd("playdemo \"demos/", s, ".dem\" \nwait \ntogglemenu\n");
+}
+
+void XonoticDemoList_timeDemo(entity me)
+{
+       string s;
+       s = me.demoName(me, me.selectedItem);
+       s = strdecolorize(s);
+
+       localcmd("timedemo \"demos/", s, ".dem\" \nwait \ntogglemenu\n");
+}
+
+void DemoConfirm_ListClick_Check_Gamestatus(entity me)
+{
+       if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, lets watch the demo
+       {
+               me.startDemo(me);
+       }
+       else // already in a match, player has to confirm
+       {
+               DialogOpenButton_Click_withCoords(
+                       me,
+                       main.demostartconfirmDialog,
+                       boxToGlobal(eY * (me.selectedItem * me.itemHeight - me.scrollPos), me.origin, me.size),
+                       boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), me.size)
+               );
+       }
+}
+
+void XonoticDemoList_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       DemoConfirm_ListClick_Check_Gamestatus(me);
+}
+
+float XonoticDemoList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       if(scan == K_ENTER || scan == K_KP_ENTER)
+       {
+               DemoConfirm_ListClick_Check_Gamestatus(me);
+               return 1;
+       }
+       else
+       {
+               return SUPER(XonoticDemoList).keyDown(me, scan, ascii, shift);
+       }
+}
+#endif
+
diff --git a/qcsrc/menu/xonotic/dialog.c b/qcsrc/menu/xonotic/dialog.c
deleted file mode 100644 (file)
index 6ca9025..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticDialog) EXTENDS(Dialog)
-       // still to be customized by user
-       /*
-       ATTRIB(XonoticDialog, closable, float, 1)
-       ATTRIB(XonoticDialog, title, string, _("Form1")) // ;)
-       ATTRIB(XonoticDialog, color, vector, '1 0.5 1')
-       ATTRIB(XonoticDialog, intendedWidth, float, 0)
-       ATTRIB(XonoticDialog, rows, float, 3)
-       ATTRIB(XonoticDialog, columns, float, 2)
-       */
-       ATTRIB(XonoticDialog, marginTop, float, SKINMARGIN_TOP) // pixels
-       ATTRIB(XonoticDialog, marginBottom, float, SKINMARGIN_BOTTOM) // pixels
-       ATTRIB(XonoticDialog, marginLeft, float, SKINMARGIN_LEFT) // pixels
-       ATTRIB(XonoticDialog, marginRight, float, SKINMARGIN_RIGHT) // pixels
-       ATTRIB(XonoticDialog, columnSpacing, float, SKINMARGIN_COLUMNS) // pixels
-       ATTRIB(XonoticDialog, rowSpacing, float, SKINMARGIN_ROWS) // pixels
-       ATTRIB(XonoticDialog, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
-       ATTRIB(XonoticDialog, titleHeight, float, SKINFONTSIZE_TITLE * SKINHEIGHT_TITLE) // pixels
-       ATTRIB(XonoticDialog, titleFontSize, float, SKINFONTSIZE_TITLE) // pixels
-
-       ATTRIB(XonoticDialog, backgroundImage, string, SKINGFX_DIALOGBORDER)
-       ATTRIB(XonoticDialog, borderLines, float, SKINHEIGHT_DIALOGBORDER)
-       ATTRIB(XonoticDialog, closeButtonImage, string, SKINGFX_CLOSEBUTTON)
-       ATTRIB(XonoticDialog, zoomedOutTitleBarPosition, float, SKINHEIGHT_ZOOMEDTITLE * 0.5 - 0.5)
-       ATTRIB(XonoticDialog, zoomedOutTitleBar, float, SKINHEIGHT_ZOOMEDTITLE != 0)
-
-       ATTRIB(XonoticDialog, alpha, float, SKINALPHA_TEXT)
-
-       METHOD(XonoticDialog, configureDialog, void(entity))
-ENDCLASS(XonoticDialog)
-#ifndef IMPLEMENTATION
-entity currentDialog;
-#endif
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticDialog_configureDialog(entity me)
-{
-       currentDialog = me;
-       SUPER(XonoticDialog).configureDialog(me);
-       me.tooltip = getZonedTooltipForIdentifier(me.classname);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog.qc b/qcsrc/menu/xonotic/dialog.qc
new file mode 100644 (file)
index 0000000..6ca9025
--- /dev/null
@@ -0,0 +1,44 @@
+#ifdef INTERFACE
+CLASS(XonoticDialog) EXTENDS(Dialog)
+       // still to be customized by user
+       /*
+       ATTRIB(XonoticDialog, closable, float, 1)
+       ATTRIB(XonoticDialog, title, string, _("Form1")) // ;)
+       ATTRIB(XonoticDialog, color, vector, '1 0.5 1')
+       ATTRIB(XonoticDialog, intendedWidth, float, 0)
+       ATTRIB(XonoticDialog, rows, float, 3)
+       ATTRIB(XonoticDialog, columns, float, 2)
+       */
+       ATTRIB(XonoticDialog, marginTop, float, SKINMARGIN_TOP) // pixels
+       ATTRIB(XonoticDialog, marginBottom, float, SKINMARGIN_BOTTOM) // pixels
+       ATTRIB(XonoticDialog, marginLeft, float, SKINMARGIN_LEFT) // pixels
+       ATTRIB(XonoticDialog, marginRight, float, SKINMARGIN_RIGHT) // pixels
+       ATTRIB(XonoticDialog, columnSpacing, float, SKINMARGIN_COLUMNS) // pixels
+       ATTRIB(XonoticDialog, rowSpacing, float, SKINMARGIN_ROWS) // pixels
+       ATTRIB(XonoticDialog, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
+       ATTRIB(XonoticDialog, titleHeight, float, SKINFONTSIZE_TITLE * SKINHEIGHT_TITLE) // pixels
+       ATTRIB(XonoticDialog, titleFontSize, float, SKINFONTSIZE_TITLE) // pixels
+
+       ATTRIB(XonoticDialog, backgroundImage, string, SKINGFX_DIALOGBORDER)
+       ATTRIB(XonoticDialog, borderLines, float, SKINHEIGHT_DIALOGBORDER)
+       ATTRIB(XonoticDialog, closeButtonImage, string, SKINGFX_CLOSEBUTTON)
+       ATTRIB(XonoticDialog, zoomedOutTitleBarPosition, float, SKINHEIGHT_ZOOMEDTITLE * 0.5 - 0.5)
+       ATTRIB(XonoticDialog, zoomedOutTitleBar, float, SKINHEIGHT_ZOOMEDTITLE != 0)
+
+       ATTRIB(XonoticDialog, alpha, float, SKINALPHA_TEXT)
+
+       METHOD(XonoticDialog, configureDialog, void(entity))
+ENDCLASS(XonoticDialog)
+#ifndef IMPLEMENTATION
+entity currentDialog;
+#endif
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticDialog_configureDialog(entity me)
+{
+       currentDialog = me;
+       SUPER(XonoticDialog).configureDialog(me);
+       me.tooltip = getZonedTooltipForIdentifier(me.classname);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_credits.c b/qcsrc/menu/xonotic/dialog_credits.c
deleted file mode 100644 (file)
index e90ae4b..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticCreditsDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticCreditsDialog, fill, void(entity))
-       METHOD(XonoticCreditsDialog, focusEnter, void(entity))
-       ATTRIB(XonoticCreditsDialog, title, string, _("Credits"))
-       ATTRIB(XonoticCreditsDialog, color, vector, SKINCOLOR_DIALOG_CREDITS)
-       ATTRIB(XonoticCreditsDialog, intendedWidth, float, SKINWIDTH_CREDITS)
-       ATTRIB(XonoticCreditsDialog, rows, float, SKINROWS_CREDITS)
-       ATTRIB(XonoticCreditsDialog, columns, float, 2)
-       ATTRIB(XonoticCreditsDialog, creditsList, entity, NULL)
-ENDCLASS(XonoticCreditsDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticCreditsDialog_fill(entity me)
-{
-       entity e;
-       me.TR(me);
-               me.TD(me, me.rows - 1, me.columns, me.creditsList = makeXonoticCreditsList());
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-}
-void XonoticCreditsDialog_focusEnter(entity me)
-{
-       me.creditsList.scrolling = time + 1;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_credits.qc b/qcsrc/menu/xonotic/dialog_credits.qc
new file mode 100644 (file)
index 0000000..e90ae4b
--- /dev/null
@@ -0,0 +1,29 @@
+#ifdef INTERFACE
+CLASS(XonoticCreditsDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticCreditsDialog, fill, void(entity))
+       METHOD(XonoticCreditsDialog, focusEnter, void(entity))
+       ATTRIB(XonoticCreditsDialog, title, string, _("Credits"))
+       ATTRIB(XonoticCreditsDialog, color, vector, SKINCOLOR_DIALOG_CREDITS)
+       ATTRIB(XonoticCreditsDialog, intendedWidth, float, SKINWIDTH_CREDITS)
+       ATTRIB(XonoticCreditsDialog, rows, float, SKINROWS_CREDITS)
+       ATTRIB(XonoticCreditsDialog, columns, float, 2)
+       ATTRIB(XonoticCreditsDialog, creditsList, entity, NULL)
+ENDCLASS(XonoticCreditsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticCreditsDialog_fill(entity me)
+{
+       entity e;
+       me.TR(me);
+               me.TD(me, me.rows - 1, me.columns, me.creditsList = makeXonoticCreditsList());
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+void XonoticCreditsDialog_focusEnter(entity me)
+{
+       me.creditsList.scrolling = time + 1;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_firstrun.c b/qcsrc/menu/xonotic/dialog_firstrun.c
deleted file mode 100644 (file)
index 9098870..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticFirstRunDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticFirstRunDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
-       ATTRIB(XonoticFirstRunDialog, title, string, _("Welcome"))
-       ATTRIB(XonoticFirstRunDialog, color, vector, SKINCOLOR_DIALOG_FIRSTRUN)
-       ATTRIB(XonoticFirstRunDialog, intendedWidth, float, 0.7)
-       ATTRIB(XonoticFirstRunDialog, rows, float, 16)
-       ATTRIB(XonoticFirstRunDialog, columns, float, 6)
-       ATTRIB(XonoticFirstRunDialog, name, string, "FirstRun")
-       ATTRIB(XonoticFirstRunDialog, playerNameLabel, entity, NULL)
-       ATTRIB(XonoticFirstRunDialog, playerNameLabelAlpha, float, 0)
-
-       ATTRIB(XonoticFirstRunDialog, closable, float, 0)
-ENDCLASS(XonoticFirstRunDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-float CheckFirstRunButton(entity me)
-{
-       if(cvar_string("_cl_name") != cvar_defstring("_cl_name"))
-               return 1;
-
-       if(cvar_string("_menu_prvm_language") != prvm_language)
-               return 1; // OK will then reopen the dialog in another language
-
-       if(cvar_string("cl_allow_uid2name") != "-1")
-               return 1;
-
-       return 0;
-}
-
-void firstRun_setLanguage(entity me)
-{
-       if(prvm_language != cvar_string("_menu_prvm_language"))
-               localcmd("\nprvm_language \"$_menu_prvm_language\"; saveconfig; menu_restart\n");
-}
-
-void XonoticFirstRunDialog_fill(entity me)
-{
-       entity e;
-       entity label, box;
-
-       me.TR(me);
-       me.TR(me);
-               me.TDempty(me, 1);
-               me.TD(me, 2, 4, e = makeXonoticTextLabel(0, _("Welcome to Xonotic, please select your language preference and enter your player name to get started.  You can change these options later through the menu system.")));
-               e.allowWrap = 1;
-       me.TR(me);
-
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 0.5, me.playerNameLabel = makeXonoticTextLabel(0, _("Name:")));
-                       me.playerNameLabelAlpha = me.playerNameLabel.alpha;
-               me.TD(me, 1, 3.25, label = makeXonoticTextLabel(0, string_null));
-                       label.allowCut = 1;
-                       label.allowColors = 1;
-                       label.alpha = 1;
-       me.TR(me);
-               me.TD(me, 1, 3.75, box = makeXonoticInputBox(1, "_cl_name"));
-                       box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
-                       box.maxLength = -127; // negative means encoded length in bytes
-                       box.saveImmediately = 1;
-                       label.textEntity = box;
-       me.TR(me);
-               me.TD(me, 5, 1.25, e = makeXonoticColorpicker(box));
-               me.TD(me, 5, 2.5, e = makeXonoticCharmap(box));
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-
-       me.gotoRC(me, 3, 4); me.setFirstColumn(me, me.currentColumn);
-       me.TR(me);
-               me.TD(me, 1, 2, e = makeXonoticTextLabel(0, _("Text language:")));
-       me.TR(me);
-               me.TD(me, 6, 2, e = makeXonoticLanguageList());
-                       e.name = "languageselector_firstrun";
-                       e.setLanguage = firstRun_setLanguage;
-       me.TR(me);
-       me.TR(me);
-
-       me.gotoRC(me, me.rows - 4, 0);
-       me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, _("Allow player statistics to use your nickname at stats.xonotic.org?")));
-
-       me.gotoRC(me, me.rows - 3, 0);
-       me.TDempty(me, 1.5);
-       me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "1", ZCTX(_("ALWU2N^Yes"))));
-       me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "0", ZCTX(_("ALWU2N^No"))));
-       me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "-1", ZCTX(_("ALWU2N^Undecided"))));
-
-       // because of the language selector, this is a menu_restart!
-       me.gotoRC(me, me.rows - 1, 0);
-       me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Save settings"), '0 0 0', "prvm_language \"$_menu_prvm_language\"; saveconfig; menu_restart", COMMANDBUTTON_APPLY));
-               setDependentWeird(e, CheckFirstRunButton);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_firstrun.qc b/qcsrc/menu/xonotic/dialog_firstrun.qc
new file mode 100644 (file)
index 0000000..c9238a9
--- /dev/null
@@ -0,0 +1,97 @@
+#ifdef INTERFACE
+CLASS(XonoticFirstRunDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticFirstRunDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
+       ATTRIB(XonoticFirstRunDialog, title, string, _("Welcome"))
+       ATTRIB(XonoticFirstRunDialog, color, vector, SKINCOLOR_DIALOG_FIRSTRUN)
+       ATTRIB(XonoticFirstRunDialog, intendedWidth, float, 0.7)
+       ATTRIB(XonoticFirstRunDialog, rows, float, 16)
+       ATTRIB(XonoticFirstRunDialog, columns, float, 6)
+       ATTRIB(XonoticFirstRunDialog, name, string, "FirstRun")
+       ATTRIB(XonoticFirstRunDialog, playerNameLabel, entity, NULL)
+       ATTRIB(XonoticFirstRunDialog, playerNameLabelAlpha, float, 0)
+
+       ATTRIB(XonoticFirstRunDialog, closable, float, 0)
+ENDCLASS(XonoticFirstRunDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+float CheckFirstRunButton(entity me)
+{
+       if(cvar_string("_cl_name") != cvar_defstring("_cl_name"))
+               return 1;
+
+       if(cvar_string("_menu_prvm_language") != prvm_language)
+               return 1; // OK will then reopen the dialog in another language
+
+       if(cvar_string("cl_allow_uid2name") != "-1")
+               return 1;
+
+       return 0;
+}
+
+void firstRun_setLanguage(entity me)
+{
+       if(prvm_language != cvar_string("_menu_prvm_language"))
+               localcmd("\nprvm_language \"$_menu_prvm_language\"; saveconfig; menu_restart\n");
+}
+
+void XonoticFirstRunDialog_fill(entity me)
+{
+       entity e;
+       entity label, box;
+
+       me.TR(me);
+       me.TR(me);
+               me.TDempty(me, 1);
+               me.TD(me, 2, 4, e = makeXonoticTextLabel(0, _("Welcome to Xonotic, please select your language preference and enter your player name to get started.  You can change these options later through the menu system.")));
+               e.allowWrap = 1;
+       me.TR(me);
+
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 0.5, me.playerNameLabel = makeXonoticTextLabel(0, _("Name:")));
+                       me.playerNameLabelAlpha = me.playerNameLabel.alpha;
+               me.TD(me, 1, 3.25, label = makeXonoticTextLabel(0, string_null));
+                       label.allowCut = 1;
+                       label.allowColors = 1;
+                       label.alpha = 1;
+       me.TR(me);
+               me.TD(me, 1, 3.75, box = makeXonoticInputBox(1, "_cl_name"));
+                       box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
+                       box.maxLength = -127; // negative means encoded length in bytes
+                       box.saveImmediately = 0;  // Sorry, can't do this, it spams "name" commands.
+                       box.enableClearButton = 0;
+                       label.textEntity = box;
+       me.TR(me);
+               me.TD(me, 5, 1.25, e = makeXonoticColorpicker(box));
+               me.TD(me, 5, 2.5, e = makeXonoticCharmap(box));
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+
+       me.gotoRC(me, 3, 4); me.setFirstColumn(me, me.currentColumn);
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0, _("Text language:")));
+       me.TR(me);
+               me.TD(me, 6, 2, e = makeXonoticLanguageList());
+                       e.name = "languageselector_firstrun";
+                       e.setLanguage = firstRun_setLanguage;
+       me.TR(me);
+       me.TR(me);
+
+       me.gotoRC(me, me.rows - 4, 0);
+       me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, _("Allow player statistics to use your nickname at stats.xonotic.org?")));
+
+       me.gotoRC(me, me.rows - 3, 0);
+       me.TDempty(me, 1.5);
+       me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "1", _("Yes")));
+       me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "0", _("No")));
+       me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "-1", _("Undecided")));
+
+       // because of the language selector, this is a menu_restart!
+       me.gotoRC(me, me.rows - 1, 0);
+       me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Save settings"), '0 0 0', "prvm_language \"$_menu_prvm_language\"; saveconfig; menu_restart", COMMANDBUTTON_APPLY));
+               setDependentWeird(e, CheckFirstRunButton);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_ammo.c b/qcsrc/menu/xonotic/dialog_hudpanel_ammo.c
deleted file mode 100644 (file)
index 15095b2..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDAmmoDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDAmmoDialog, fill, void(entity))
-       ATTRIB(XonoticHUDAmmoDialog, title, string, _("Ammo Panel"))
-       ATTRIB(XonoticHUDAmmoDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDAmmoDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDAmmoDialog, rows, float, 15)
-       ATTRIB(XonoticHUDAmmoDialog, columns, float, 4)
-       ATTRIB(XonoticHUDAmmoDialog, name, string, "HUDammo")
-       ATTRIB(XonoticHUDAmmoDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDAmmoDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDAmmoDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "ammo";
-
-       DIALOG_HUDPANEL_COMMON();
-
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Ammunition display:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_ammo_onlycurrent", _("Show only current ammo type")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Noncurrent alpha:")));
-               me.TD(me, 1, 2.6, e = makeXonoticSlider(0, 1, 0.1, "hud_panel_ammo_noncurrent_alpha"));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Noncurrent scale:")));
-               me.TD(me, 1, 2.6, e = makeXonoticSlider(0, 1, 0.1, "hud_panel_ammo_noncurrent_scale"));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Align icon:")));
-                       me.TD(me, 1, 2.6/2, e = makeXonoticRadioButton(2, "hud_panel_ammo_iconalign", "0", _("Left")));
-                       me.TD(me, 1, 2.6/2, e = makeXonoticRadioButton(2, "hud_panel_ammo_iconalign", "1", _("Right")));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_ammo.qc b/qcsrc/menu/xonotic/dialog_hudpanel_ammo.qc
new file mode 100644 (file)
index 0000000..307efde
--- /dev/null
@@ -0,0 +1,41 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDAmmoDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDAmmoDialog, fill, void(entity))
+       ATTRIB(XonoticHUDAmmoDialog, title, string, _("Ammo Panel"))
+       ATTRIB(XonoticHUDAmmoDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDAmmoDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDAmmoDialog, rows, float, 15)
+       ATTRIB(XonoticHUDAmmoDialog, columns, float, 4)
+       ATTRIB(XonoticHUDAmmoDialog, name, string, "HUDammo")
+       ATTRIB(XonoticHUDAmmoDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDAmmoDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDAmmoDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "ammo";
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Ammunition display:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_ammo_onlycurrent", _("Show only current ammo type")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Noncurrent alpha:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(0, 1, 0.1, "hud_panel_ammo_noncurrent_alpha"));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Noncurrent scale:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(0, 1, 0.1, "hud_panel_ammo_noncurrent_scale"));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Align icon:")));
+                       me.TD(me, 1, 2.6/2, e = makeXonoticRadioButton(2, "hud_panel_ammo_iconalign", "0", _("Left")));
+                       me.TD(me, 1, 2.6/2, e = makeXonoticRadioButton(2, "hud_panel_ammo_iconalign", "1", _("Right")));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_buffs.c b/qcsrc/menu/xonotic/dialog_hudpanel_buffs.c
deleted file mode 100644 (file)
index ac1033c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDBuffsDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDBuffsDialog, fill, void(entity))
-       ATTRIB(XonoticHUDBuffsDialog, title, string, _("Buffs Panel"))
-       ATTRIB(XonoticHUDBuffsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDBuffsDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDBuffsDialog, rows, float, 15)
-       ATTRIB(XonoticHUDBuffsDialog, columns, float, 4)
-       ATTRIB(XonoticHUDBuffsDialog, name, string, "HUDbuffs")
-       ATTRIB(XonoticHUDBuffsDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDBuffsDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDBuffsDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "buffs";
-
-       DIALOG_HUDPANEL_COMMON();
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_buffs.qc b/qcsrc/menu/xonotic/dialog_hudpanel_buffs.qc
new file mode 100644 (file)
index 0000000..226bd97
--- /dev/null
@@ -0,0 +1,22 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDBuffsDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDBuffsDialog, fill, void(entity))
+       ATTRIB(XonoticHUDBuffsDialog, title, string, _("Buffs Panel"))
+       ATTRIB(XonoticHUDBuffsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDBuffsDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDBuffsDialog, rows, float, 15)
+       ATTRIB(XonoticHUDBuffsDialog, columns, float, 4)
+       ATTRIB(XonoticHUDBuffsDialog, name, string, "HUDbuffs")
+       ATTRIB(XonoticHUDBuffsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDBuffsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDBuffsDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "buffs";
+
+       DIALOG_HUDPANEL_COMMON();
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.c b/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.c
deleted file mode 100644 (file)
index dce687a..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDCenterprintDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDCenterprintDialog, fill, void(entity))
-       ATTRIB(XonoticHUDCenterprintDialog, title, string, _("Centerprint Panel"))
-       ATTRIB(XonoticHUDCenterprintDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDCenterprintDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDCenterprintDialog, rows, float, 15)
-       ATTRIB(XonoticHUDCenterprintDialog, columns, float, 4)
-       ATTRIB(XonoticHUDCenterprintDialog, name, string, "HUDcenterprint")
-       ATTRIB(XonoticHUDCenterprintDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDCenterprintDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDCenterprintDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "centerprint";
-
-       DIALOG_HUDPANEL_COMMON();
-
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Message duration:")));
-               me.TD(me, 1, 2.6, e = makeXonoticSlider(1, 10, 1, "hud_panel_centerprint_time"));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Fade time:")));
-               me.TD(me, 1, 2.6, e = makeXonoticSlider(0, 1, 0.05, "hud_panel_centerprint_fade_out"));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_centerprint_flip", _("Flip messages order")));
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Text alignment:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-                       me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_centerprint_align", "0", _("Left")));
-                       me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_centerprint_align", "0.5", _("Center")));
-                       me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_centerprint_align", "1", _("Right")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Font scale:")));
-               me.TD(me, 1, 2.6, e = makeXonoticSlider(0.5, 2, 0.1, "hud_panel_centerprint_fontscale"));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qc b/qcsrc/menu/xonotic/dialog_hudpanel_centerprint.qc
new file mode 100644 (file)
index 0000000..bb7312f
--- /dev/null
@@ -0,0 +1,45 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDCenterprintDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDCenterprintDialog, fill, void(entity))
+       ATTRIB(XonoticHUDCenterprintDialog, title, string, _("Centerprint Panel"))
+       ATTRIB(XonoticHUDCenterprintDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDCenterprintDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDCenterprintDialog, rows, float, 15)
+       ATTRIB(XonoticHUDCenterprintDialog, columns, float, 4)
+       ATTRIB(XonoticHUDCenterprintDialog, name, string, "HUDcenterprint")
+       ATTRIB(XonoticHUDCenterprintDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDCenterprintDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDCenterprintDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "centerprint";
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Message duration:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(1, 10, 1, "hud_panel_centerprint_time"));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Fade time:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(0, 1, 0.05, "hud_panel_centerprint_fade_out"));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_centerprint_flip", _("Flip messages order")));
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Text alignment:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+                       me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_centerprint_align", "0", _("Left")));
+                       me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_centerprint_align", "0.5", _("Center")));
+                       me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_centerprint_align", "1", _("Right")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Font scale:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(0.5, 2, 0.1, "hud_panel_centerprint_fontscale"));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_chat.c b/qcsrc/menu/xonotic/dialog_hudpanel_chat.c
deleted file mode 100644 (file)
index eb6ced2..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDChatDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDChatDialog, fill, void(entity))
-       ATTRIB(XonoticHUDChatDialog, title, string, _("Chat Panel"))
-       ATTRIB(XonoticHUDChatDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDChatDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDChatDialog, rows, float, 15)
-       ATTRIB(XonoticHUDChatDialog, columns, float, 4)
-       ATTRIB(XonoticHUDChatDialog, name, string, "HUDchat")
-       ATTRIB(XonoticHUDChatDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDChatDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDChatDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "chat";
-
-       DIALOG_HUDPANEL_COMMON();
-
-       me.TR(me);
-               me.TD(me, 1, 2, e = makeXonoticTextLabel(0, _("Chat entries:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Chat size:")));
-               me.TD(me, 1, 2.6, e = makeXonoticSlider(6, 20, 1, "con_chatsize"));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Chat lifetime:")));
-               me.TD(me, 1, 2.6, e = makeXonoticSlider(5, 60, 5, "con_chattime"));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "con_chatsound", _("Chat beep sound")));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_chat.qc b/qcsrc/menu/xonotic/dialog_hudpanel_chat.qc
new file mode 100644 (file)
index 0000000..e16f76a
--- /dev/null
@@ -0,0 +1,36 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDChatDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDChatDialog, fill, void(entity))
+       ATTRIB(XonoticHUDChatDialog, title, string, _("Chat Panel"))
+       ATTRIB(XonoticHUDChatDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDChatDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDChatDialog, rows, float, 15)
+       ATTRIB(XonoticHUDChatDialog, columns, float, 4)
+       ATTRIB(XonoticHUDChatDialog, name, string, "HUDchat")
+       ATTRIB(XonoticHUDChatDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDChatDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDChatDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "chat";
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0, _("Chat entries:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Chat size:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(6, 20, 1, "con_chatsize"));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Chat lifetime:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(5, 60, 5, "con_chattime"));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "con_chatsound", _("Chat beep sound")));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.c b/qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.c
deleted file mode 100644 (file)
index bbc3f8c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDEngineInfoDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDEngineInfoDialog, fill, void(entity))
-       ATTRIB(XonoticHUDEngineInfoDialog, title, string, _("Engine Info Panel"))
-       ATTRIB(XonoticHUDEngineInfoDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDEngineInfoDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDEngineInfoDialog, rows, float, 15)
-       ATTRIB(XonoticHUDEngineInfoDialog, columns, float, 4)
-       ATTRIB(XonoticHUDEngineInfoDialog, name, string, "HUDengineinfo")
-       ATTRIB(XonoticHUDEngineInfoDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDEngineInfoDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDEngineInfoDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "engineinfo";
-
-       DIALOG_HUDPANEL_COMMON();
-
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Engine info:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_engineinfo_framecounter_exponentialmovingaverage", _("Use an averaging algorithm for fps")));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.qc b/qcsrc/menu/xonotic/dialog_hudpanel_engineinfo.qc
new file mode 100644 (file)
index 0000000..534f1eb
--- /dev/null
@@ -0,0 +1,28 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDEngineInfoDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDEngineInfoDialog, fill, void(entity))
+       ATTRIB(XonoticHUDEngineInfoDialog, title, string, _("Engine Info Panel"))
+       ATTRIB(XonoticHUDEngineInfoDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDEngineInfoDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDEngineInfoDialog, rows, float, 15)
+       ATTRIB(XonoticHUDEngineInfoDialog, columns, float, 4)
+       ATTRIB(XonoticHUDEngineInfoDialog, name, string, "HUDengineinfo")
+       ATTRIB(XonoticHUDEngineInfoDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDEngineInfoDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDEngineInfoDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "engineinfo";
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Engine info:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_engineinfo_framecounter_exponentialmovingaverage", _("Use an averaging algorithm for fps")));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.c b/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.c
deleted file mode 100644 (file)
index 976139c..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDHealthArmorDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDHealthArmorDialog, fill, void(entity))
-       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, columns, float, 4)
-       ATTRIB(XonoticHUDHealthArmorDialog, name, string, "HUDhealtharmor")
-       ATTRIB(XonoticHUDHealthArmorDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDHealthArmorDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDHealthArmorDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "healtharmor";
-
-       DIALOG_HUDPANEL_COMMON();
-
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_healtharmor_progressbar", _("Enable status bar")));
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Status bar alignment:")));
-                       setDependent(e, "hud_panel_healtharmor_progressbar", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_healtharmor_baralign", "0", _("Left")));
-                       setDependent(e, "hud_panel_healtharmor_progressbar", 1, 1);
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_healtharmor_baralign", "1", _("Right")));
-                       setDependent(e, "hud_panel_healtharmor_progressbar", 1, 1);
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_healtharmor_baralign", "2", _("Inward")));
-                       setDependent(e, "hud_panel_healtharmor_progressbar", 1, 1);
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_healtharmor_baralign", "3", _("Outward")));
-                       setDependent(e, "hud_panel_healtharmor_progressbar", 1, 1);
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Icon alignment:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_healtharmor_iconalign", "0", _("Left")));
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_healtharmor_iconalign", "1", _("Right")));
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_healtharmor_iconalign", "2", _("Inward")));
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_healtharmor_iconalign", "3", _("Outward")));
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_healtharmor_flip", _("Flip health and armor positions")));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.qc b/qcsrc/menu/xonotic/dialog_hudpanel_healtharmor.qc
new file mode 100644 (file)
index 0000000..dc86420
--- /dev/null
@@ -0,0 +1,48 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDHealthArmorDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDHealthArmorDialog, fill, void(entity))
+       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, columns, float, 4)
+       ATTRIB(XonoticHUDHealthArmorDialog, name, string, "HUDhealtharmor")
+       ATTRIB(XonoticHUDHealthArmorDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDHealthArmorDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDHealthArmorDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "healtharmor";
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_healtharmor_progressbar", _("Enable status bar")));
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Status bar alignment:")));
+                       setDependent(e, "hud_panel_healtharmor_progressbar", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_healtharmor_baralign", "0", _("Left")));
+                       setDependent(e, "hud_panel_healtharmor_progressbar", 1, 1);
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_healtharmor_baralign", "1", _("Right")));
+                       setDependent(e, "hud_panel_healtharmor_progressbar", 1, 1);
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_healtharmor_baralign", "2", _("Inward")));
+                       setDependent(e, "hud_panel_healtharmor_progressbar", 1, 1);
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_healtharmor_baralign", "3", _("Outward")));
+                       setDependent(e, "hud_panel_healtharmor_progressbar", 1, 1);
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Icon alignment:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_healtharmor_iconalign", "0", _("Left")));
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_healtharmor_iconalign", "1", _("Right")));
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_healtharmor_iconalign", "2", _("Inward")));
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_healtharmor_iconalign", "3", _("Outward")));
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_healtharmor_flip", _("Flip health and armor positions")));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_infomessages.c b/qcsrc/menu/xonotic/dialog_hudpanel_infomessages.c
deleted file mode 100644 (file)
index 5bd8846..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDInfoMessagesDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDInfoMessagesDialog, fill, void(entity))
-       ATTRIB(XonoticHUDInfoMessagesDialog, title, string, _("Info Messages Panel"))
-       ATTRIB(XonoticHUDInfoMessagesDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDInfoMessagesDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDInfoMessagesDialog, rows, float, 15)
-       ATTRIB(XonoticHUDInfoMessagesDialog, columns, float, 4)
-       ATTRIB(XonoticHUDInfoMessagesDialog, name, string, "HUDinfomessages")
-       ATTRIB(XonoticHUDInfoMessagesDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDInfoMessagesDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDInfoMessagesDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "infomessages";
-
-       DIALOG_HUDPANEL_COMMON();
-
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Info messages:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_infomessages_flip", _("Flip align")));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_infomessages.qc b/qcsrc/menu/xonotic/dialog_hudpanel_infomessages.qc
new file mode 100644 (file)
index 0000000..b705531
--- /dev/null
@@ -0,0 +1,28 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDInfoMessagesDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDInfoMessagesDialog, fill, void(entity))
+       ATTRIB(XonoticHUDInfoMessagesDialog, title, string, _("Info Messages Panel"))
+       ATTRIB(XonoticHUDInfoMessagesDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDInfoMessagesDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDInfoMessagesDialog, rows, float, 15)
+       ATTRIB(XonoticHUDInfoMessagesDialog, columns, float, 4)
+       ATTRIB(XonoticHUDInfoMessagesDialog, name, string, "HUDinfomessages")
+       ATTRIB(XonoticHUDInfoMessagesDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDInfoMessagesDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDInfoMessagesDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "infomessages";
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Info messages:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_infomessages_flip", _("Flip align")));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_modicons.c b/qcsrc/menu/xonotic/dialog_hudpanel_modicons.c
deleted file mode 100644 (file)
index 4c9e64c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDModIconsDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDModIconsDialog, fill, void(entity))
-       ATTRIB(XonoticHUDModIconsDialog, title, string, _("Mod Icons Panel"))
-       ATTRIB(XonoticHUDModIconsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDModIconsDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDModIconsDialog, rows, float, 15)
-       ATTRIB(XonoticHUDModIconsDialog, columns, float, 4)
-       ATTRIB(XonoticHUDModIconsDialog, name, string, "HUDmodicons")
-       ATTRIB(XonoticHUDModIconsDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDModIconsDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDModIconsDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "modicons";
-
-       DIALOG_HUDPANEL_COMMON();
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_modicons.qc b/qcsrc/menu/xonotic/dialog_hudpanel_modicons.qc
new file mode 100644 (file)
index 0000000..3133a7e
--- /dev/null
@@ -0,0 +1,22 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDModIconsDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDModIconsDialog, fill, void(entity))
+       ATTRIB(XonoticHUDModIconsDialog, title, string, _("Mod Icons Panel"))
+       ATTRIB(XonoticHUDModIconsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDModIconsDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDModIconsDialog, rows, float, 15)
+       ATTRIB(XonoticHUDModIconsDialog, columns, float, 4)
+       ATTRIB(XonoticHUDModIconsDialog, name, string, "HUDmodicons")
+       ATTRIB(XonoticHUDModIconsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDModIconsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDModIconsDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "modicons";
+
+       DIALOG_HUDPANEL_COMMON();
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_notification.c b/qcsrc/menu/xonotic/dialog_hudpanel_notification.c
deleted file mode 100644 (file)
index 1239bd3..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDNotificationDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDNotificationDialog, fill, void(entity))
-       ATTRIB(XonoticHUDNotificationDialog, title, string, _("Notification Panel"))
-       ATTRIB(XonoticHUDNotificationDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDNotificationDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDNotificationDialog, rows, float, 15)
-       ATTRIB(XonoticHUDNotificationDialog, columns, float, 4)
-       ATTRIB(XonoticHUDNotificationDialog, name, string, "HUDnotify")
-       ATTRIB(XonoticHUDNotificationDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDNotificationDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDNotificationDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "notify";
-
-       DIALOG_HUDPANEL_COMMON();
-
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Notifications:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_notify_print", _("Also print notifications to the console")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_notify_flip", _("Flip notify order")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Entry lifetime:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticSlider(3, 15, 1, "hud_panel_notify_time"));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Entry fadetime:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticSlider(0.5, 5, 0.5, "hud_panel_notify_fadetime"));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_notification.qc b/qcsrc/menu/xonotic/dialog_hudpanel_notification.qc
new file mode 100644 (file)
index 0000000..722b5d5
--- /dev/null
@@ -0,0 +1,39 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDNotificationDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDNotificationDialog, fill, void(entity))
+       ATTRIB(XonoticHUDNotificationDialog, title, string, _("Notification Panel"))
+       ATTRIB(XonoticHUDNotificationDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDNotificationDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDNotificationDialog, rows, float, 15)
+       ATTRIB(XonoticHUDNotificationDialog, columns, float, 4)
+       ATTRIB(XonoticHUDNotificationDialog, name, string, "HUDnotify")
+       ATTRIB(XonoticHUDNotificationDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDNotificationDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDNotificationDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "notify";
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Notifications:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_notify_print", _("Also print notifications to the console")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_notify_flip", _("Flip notify order")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Entry lifetime:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticSlider(3, 15, 1, "hud_panel_notify_time"));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Entry fadetime:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticSlider(0.5, 5, 0.5, "hud_panel_notify_fadetime"));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_physics.c b/qcsrc/menu/xonotic/dialog_hudpanel_physics.c
deleted file mode 100644 (file)
index 0144d66..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDPhysicsDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDPhysicsDialog, fill, void(entity))
-       ATTRIB(XonoticHUDPhysicsDialog, title, string, _("Physics Panel"))
-       ATTRIB(XonoticHUDPhysicsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDPhysicsDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDPhysicsDialog, rows, float, 15)
-       ATTRIB(XonoticHUDPhysicsDialog, columns, float, 4)
-       ATTRIB(XonoticHUDPhysicsDialog, name, string, "HUDphysics")
-       ATTRIB(XonoticHUDPhysicsDialog, sliderTopspeedTime, entity, NULL)
-       ATTRIB(XonoticHUDPhysicsDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDPhysicsDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDPhysicsDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "physics";
-
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_physics"));
-                       e.addValue(e, _("Panel disabled"), "0");
-                       e.addValue(e, _("Panel enabled"), "1");
-                       e.addValue(e, _("Panel enabled even observing"), "2");
-                       e.addValue(e, _("Panel enabled only in Race/CTS"), "3");
-                       e.configureXonoticTextSliderValues(e);
-
-       DIALOG_HUDPANEL_COMMON_NOTOGGLE();
-
-       me.TR(me);
-               me.TD(me, 1, 1.4, e = makeXonoticCheckBox(0, "hud_panel_physics_progressbar", _("Status bar")));
-               me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_physics_baralign"));
-                       e.addValue(e, _("Left align")   , "0");
-                       e.addValue(e, _("Right align")  , "1");
-                       e.addValue(e, _("Inward align") , "2");
-                       e.addValue(e, _("Outward align"), "3");
-                       e.configureXonoticTextSliderValues(e);
-                       setDependent(e, "hud_panel_physics_progressbar", 1, 3);
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_physics_flip", _("Flip speed/acceleration positions")));
-
-//speed
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Speed:")));
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_panel_physics_speed_vertical", _("Include vertical speed")));
-       // me.TR(me);
-               // me.TDempty(me, 0.2);
-               // me.TD(me, 1, 1.8, e = makeXonoticTextLabel(0, _("Full status bar at:")));
-                       // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
-               // me.TD(me, 1, 1, e = makeXonoticInputBox(1, "hud_panel_physics_speed_max"));
-                       // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
-               // me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("qu/s")));
-                       // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Speed unit:")));
-               me.TD(me, 1, 2.6/3*2, e = makeXonoticTextSlider("hud_panel_physics_speed_unit"));
-                       e.addValue(e, _("qu/s") , "1");
-                       e.addValue(e, _("m/s")  , "2");
-                       e.addValue(e, _("km/h") , "3");
-                       e.addValue(e, _("mph")  , "4");
-                       e.addValue(e, _("knots"), "5");
-                       e.configureXonoticTextSliderValues(e);
-               me.TD(me, 1, 2.6/3, e = makeXonoticCheckBox(0, "hud_panel_physics_speed_unit_show", _("Show")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 3.8/2, e = makeXonoticCheckBox(0, "hud_panel_physics_topspeed", _("Top speed")));
-               me.TD(me, 1, 3.8/2, e = makeXonoticSlider(1, 10, 1, "hud_panel_physics_topspeed_time"));
-                       setDependent(e, "hud_panel_physics_topspeed", 1, 1);
-
-//acceleration
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Acceleration:")));
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_panel_physics_acceleration_vertical", _("Include vertical acceleration")));
-       // me.TR(me);
-               // me.TDempty(me, 0.2);
-               // me.TD(me, 1, 1.8, e = makeXonoticTextLabel(0, _("Full status bar at:")));
-                       // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
-               // me.TD(me, 1, 0.6, e = makeXonoticInputBox(1, "hud_panel_physics_acceleration_max"));
-                       // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_physics.qc b/qcsrc/menu/xonotic/dialog_hudpanel_physics.qc
new file mode 100644 (file)
index 0000000..6e4917d
--- /dev/null
@@ -0,0 +1,83 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDPhysicsDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDPhysicsDialog, fill, void(entity))
+       ATTRIB(XonoticHUDPhysicsDialog, title, string, _("Physics Panel"))
+       ATTRIB(XonoticHUDPhysicsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDPhysicsDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDPhysicsDialog, rows, float, 15)
+       ATTRIB(XonoticHUDPhysicsDialog, columns, float, 4)
+       ATTRIB(XonoticHUDPhysicsDialog, name, string, "HUDphysics")
+       ATTRIB(XonoticHUDPhysicsDialog, sliderTopspeedTime, entity, NULL)
+       ATTRIB(XonoticHUDPhysicsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDPhysicsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDPhysicsDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "physics";
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_physics"));
+                       e.addValue(e, _("Panel disabled"), "0");
+                       e.addValue(e, _("Panel enabled"), "1");
+                       e.addValue(e, _("Panel enabled even observing"), "2");
+                       e.addValue(e, _("Panel enabled only in Race/CTS"), "3");
+                       e.configureXonoticTextSliderValues(e);
+
+       DIALOG_HUDPANEL_COMMON_NOTOGGLE();
+
+       me.TR(me);
+               me.TD(me, 1, 1.4, e = makeXonoticCheckBox(0, "hud_panel_physics_progressbar", _("Status bar")));
+               me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_physics_baralign"));
+                       e.addValue(e, _("Left align")   , "0");
+                       e.addValue(e, _("Right align")  , "1");
+                       e.addValue(e, _("Inward align") , "2");
+                       e.addValue(e, _("Outward align"), "3");
+                       e.configureXonoticTextSliderValues(e);
+                       setDependent(e, "hud_panel_physics_progressbar", 1, 3);
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_physics_flip", _("Flip speed/acceleration positions")));
+
+//speed
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Speed:")));
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_panel_physics_speed_vertical", _("Include vertical speed")));
+       // me.TR(me);
+               // me.TDempty(me, 0.2);
+               // me.TD(me, 1, 1.8, e = makeXonoticTextLabel(0, _("Full status bar at:")));
+                       // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
+               // me.TD(me, 1, 1, e = makeXonoticInputBox(1, "hud_panel_physics_speed_max"));
+                       // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
+               // me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("qu/s")));
+                       // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Speed unit:")));
+               me.TD(me, 1, 2.6/3*2, e = makeXonoticTextSlider("hud_panel_physics_speed_unit"));
+                       e.addValue(e, _("qu/s") , "1");
+                       e.addValue(e, _("m/s")  , "2");
+                       e.addValue(e, _("km/h") , "3");
+                       e.addValue(e, _("mph")  , "4");
+                       e.addValue(e, _("knots"), "5");
+                       e.configureXonoticTextSliderValues(e);
+               me.TD(me, 1, 2.6/3, e = makeXonoticCheckBox(0, "hud_panel_physics_speed_unit_show", _("Show")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 3.8/2, e = makeXonoticCheckBox(0, "hud_panel_physics_topspeed", _("Top speed")));
+               me.TD(me, 1, 3.8/2, e = makeXonoticSlider(1, 10, 1, "hud_panel_physics_topspeed_time"));
+                       setDependent(e, "hud_panel_physics_topspeed", 1, 1);
+
+//acceleration
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Acceleration:")));
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_panel_physics_acceleration_vertical", _("Include vertical acceleration")));
+       // me.TR(me);
+               // me.TDempty(me, 0.2);
+               // me.TD(me, 1, 1.8, e = makeXonoticTextLabel(0, _("Full status bar at:")));
+                       // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
+               // me.TD(me, 1, 0.6, e = makeXonoticInputBox(1, "hud_panel_physics_acceleration_max"));
+                       // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_powerups.c b/qcsrc/menu/xonotic/dialog_hudpanel_powerups.c
deleted file mode 100644 (file)
index 17bfe04..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDPowerupsDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDPowerupsDialog, fill, void(entity))
-       ATTRIB(XonoticHUDPowerupsDialog, title, string, _("Powerups Panel"))
-       ATTRIB(XonoticHUDPowerupsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDPowerupsDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDPowerupsDialog, rows, float, 15)
-       ATTRIB(XonoticHUDPowerupsDialog, columns, float, 4)
-       ATTRIB(XonoticHUDPowerupsDialog, name, string, "HUDpowerups")
-       ATTRIB(XonoticHUDPowerupsDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDPowerupsDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDPowerupsDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "powerups";
-
-       DIALOG_HUDPANEL_COMMON();
-
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_powerups_progressbar", _("Enable status bar")));
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Status bar alignment:")));
-                       setDependent(e, "hud_panel_powerups_progressbar", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_powerups_baralign", "0", _("Left")));
-                       setDependent(e, "hud_panel_powerups_progressbar", 1, 1);
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_powerups_baralign", "1", _("Right")));
-                       setDependent(e, "hud_panel_powerups_progressbar", 1, 1);
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_powerups_baralign", "2", _("Inward")));
-                       setDependent(e, "hud_panel_powerups_progressbar", 1, 1);
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_powerups_baralign", "3", _("Outward")));
-                       setDependent(e, "hud_panel_powerups_progressbar", 1, 1);
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Icon alignment:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_powerups_iconalign", "0", _("Left")));
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_powerups_iconalign", "1", _("Right")));
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_powerups_iconalign", "2", _("Inward")));
-                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_powerups_iconalign", "3", _("Outward")));
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_powerups_flip", _("Flip strength and shield positions")));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_powerups.qc b/qcsrc/menu/xonotic/dialog_hudpanel_powerups.qc
new file mode 100644 (file)
index 0000000..3449e06
--- /dev/null
@@ -0,0 +1,48 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDPowerupsDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDPowerupsDialog, fill, void(entity))
+       ATTRIB(XonoticHUDPowerupsDialog, title, string, _("Powerups Panel"))
+       ATTRIB(XonoticHUDPowerupsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDPowerupsDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDPowerupsDialog, rows, float, 15)
+       ATTRIB(XonoticHUDPowerupsDialog, columns, float, 4)
+       ATTRIB(XonoticHUDPowerupsDialog, name, string, "HUDpowerups")
+       ATTRIB(XonoticHUDPowerupsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDPowerupsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDPowerupsDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "powerups";
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_powerups_progressbar", _("Enable status bar")));
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Status bar alignment:")));
+                       setDependent(e, "hud_panel_powerups_progressbar", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_powerups_baralign", "0", _("Left")));
+                       setDependent(e, "hud_panel_powerups_progressbar", 1, 1);
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_powerups_baralign", "1", _("Right")));
+                       setDependent(e, "hud_panel_powerups_progressbar", 1, 1);
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_powerups_baralign", "2", _("Inward")));
+                       setDependent(e, "hud_panel_powerups_progressbar", 1, 1);
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(2, "hud_panel_powerups_baralign", "3", _("Outward")));
+                       setDependent(e, "hud_panel_powerups_progressbar", 1, 1);
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Icon alignment:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_powerups_iconalign", "0", _("Left")));
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_powerups_iconalign", "1", _("Right")));
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_powerups_iconalign", "2", _("Inward")));
+                       me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_powerups_iconalign", "3", _("Outward")));
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_powerups_flip", _("Flip strength and shield positions")));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.c b/qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.c
deleted file mode 100644 (file)
index 2e301cc..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDPressedKeysDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDPressedKeysDialog, fill, void(entity))
-       ATTRIB(XonoticHUDPressedKeysDialog, title, string, _("Pressed Keys Panel"))
-       ATTRIB(XonoticHUDPressedKeysDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDPressedKeysDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDPressedKeysDialog, rows, float, 15)
-       ATTRIB(XonoticHUDPressedKeysDialog, columns, float, 4)
-       ATTRIB(XonoticHUDPressedKeysDialog, name, string, "HUDpressedkeys")
-       ATTRIB(XonoticHUDPressedKeysDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDPressedKeysDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDPressedKeysDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "pressedkeys";
-
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_pressedkeys"));
-                       e.addValue(e, _("Panel disabled"), "0");
-                       e.addValue(e, _("Panel enabled when spectating"), "1");
-                       e.addValue(e, _("Panel always enabled"), "2");
-                       e.configureXonoticTextSliderValues(e);
-
-       DIALOG_HUDPANEL_COMMON_NOTOGGLE();
-
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Forced aspect:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticSlider(0.2, 4, 0.1, "hud_panel_pressedkeys_aspect"));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.qc b/qcsrc/menu/xonotic/dialog_hudpanel_pressedkeys.qc
new file mode 100644 (file)
index 0000000..79f581d
--- /dev/null
@@ -0,0 +1,34 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDPressedKeysDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDPressedKeysDialog, fill, void(entity))
+       ATTRIB(XonoticHUDPressedKeysDialog, title, string, _("Pressed Keys Panel"))
+       ATTRIB(XonoticHUDPressedKeysDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDPressedKeysDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDPressedKeysDialog, rows, float, 15)
+       ATTRIB(XonoticHUDPressedKeysDialog, columns, float, 4)
+       ATTRIB(XonoticHUDPressedKeysDialog, name, string, "HUDpressedkeys")
+       ATTRIB(XonoticHUDPressedKeysDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDPressedKeysDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDPressedKeysDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "pressedkeys";
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_pressedkeys"));
+                       e.addValue(e, _("Panel disabled"), "0");
+                       e.addValue(e, _("Panel enabled when spectating"), "1");
+                       e.addValue(e, _("Panel always enabled"), "2");
+                       e.configureXonoticTextSliderValues(e);
+
+       DIALOG_HUDPANEL_COMMON_NOTOGGLE();
+
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Forced aspect:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticSlider(0.2, 4, 0.1, "hud_panel_pressedkeys_aspect"));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_racetimer.c b/qcsrc/menu/xonotic/dialog_hudpanel_racetimer.c
deleted file mode 100644 (file)
index 6b2badf..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDRaceTimerDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDRaceTimerDialog, fill, void(entity))
-       ATTRIB(XonoticHUDRaceTimerDialog, title, string, _("Race Timer Panel"))
-       ATTRIB(XonoticHUDRaceTimerDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDRaceTimerDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDRaceTimerDialog, rows, float, 15)
-       ATTRIB(XonoticHUDRaceTimerDialog, columns, float, 4)
-       ATTRIB(XonoticHUDRaceTimerDialog, name, string, "HUDracetimer")
-       ATTRIB(XonoticHUDRaceTimerDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDRaceTimerDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDRaceTimerDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "racetimer";
-
-       DIALOG_HUDPANEL_COMMON();
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_racetimer.qc b/qcsrc/menu/xonotic/dialog_hudpanel_racetimer.qc
new file mode 100644 (file)
index 0000000..b8ecbee
--- /dev/null
@@ -0,0 +1,22 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDRaceTimerDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDRaceTimerDialog, fill, void(entity))
+       ATTRIB(XonoticHUDRaceTimerDialog, title, string, _("Race Timer Panel"))
+       ATTRIB(XonoticHUDRaceTimerDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDRaceTimerDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDRaceTimerDialog, rows, float, 15)
+       ATTRIB(XonoticHUDRaceTimerDialog, columns, float, 4)
+       ATTRIB(XonoticHUDRaceTimerDialog, name, string, "HUDracetimer")
+       ATTRIB(XonoticHUDRaceTimerDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDRaceTimerDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDRaceTimerDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "racetimer";
+
+       DIALOG_HUDPANEL_COMMON();
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_radar.c b/qcsrc/menu/xonotic/dialog_hudpanel_radar.c
deleted file mode 100644 (file)
index 6ad57fa..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDRadarDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDRadarDialog, fill, void(entity))
-       ATTRIB(XonoticHUDRadarDialog, title, string, _("Radar Panel"))
-       ATTRIB(XonoticHUDRadarDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDRadarDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDRadarDialog, rows, float, 15)
-       ATTRIB(XonoticHUDRadarDialog, columns, float, 4)
-       ATTRIB(XonoticHUDRadarDialog, name, string, "HUDradar")
-       ATTRIB(XonoticHUDRadarDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDRadarDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDRadarDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "radar";
-
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_radar"));
-                       e.addValue(e, _("Panel disabled"), "0");
-                       e.addValue(e, _("Panel enabled in teamgames"), "1");
-                       e.addValue(e, _("Panel always enabled"), "2");
-                       e.configureXonoticTextSliderValues(e);
-
-       DIALOG_HUDPANEL_COMMON_NOTOGGLE();
-
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Radar:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:")));
-               me.TD(me, 1, 2.6, e = makeXonoticSlider(0.1, 1, 0.1, "hud_panel_radar_foreground_alpha"));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Rotation:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_radar_rotation"));
-                               e.addValue(e, _("Forward"), "0");
-                               e.addValue(e, _("West"), "1");
-                               e.addValue(e, _("South"), "2");
-                               e.addValue(e, _("East"), "3");
-                               e.addValue(e, _("North"), "4");
-                               e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Scale:")));
-               me.TD(me, 1, 2.6, e = makeXonoticSlider(1024, 8192, 512, "hud_panel_radar_scale"));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Zoom mode:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_radar_zoommode"));
-                               e.addValue(e, _("Zoomed in"), "0");
-                               e.addValue(e, _("Zoomed out"), "1");
-                               e.addValue(e, _("Always zoomed"), "2");
-                               e.addValue(e, _("Never zoomed"), "3");
-                               e.configureXonoticTextSliderValues(e);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_radar.qc b/qcsrc/menu/xonotic/dialog_hudpanel_radar.qc
new file mode 100644 (file)
index 0000000..bdff50c
--- /dev/null
@@ -0,0 +1,59 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDRadarDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDRadarDialog, fill, void(entity))
+       ATTRIB(XonoticHUDRadarDialog, title, string, _("Radar Panel"))
+       ATTRIB(XonoticHUDRadarDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDRadarDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDRadarDialog, rows, float, 15)
+       ATTRIB(XonoticHUDRadarDialog, columns, float, 4)
+       ATTRIB(XonoticHUDRadarDialog, name, string, "HUDradar")
+       ATTRIB(XonoticHUDRadarDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDRadarDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDRadarDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "radar";
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextSlider("hud_panel_radar"));
+                       e.addValue(e, _("Panel disabled"), "0");
+                       e.addValue(e, _("Panel enabled in teamgames"), "1");
+                       e.addValue(e, _("Panel always enabled"), "2");
+                       e.configureXonoticTextSliderValues(e);
+
+       DIALOG_HUDPANEL_COMMON_NOTOGGLE();
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Radar:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(0.1, 1, 0.1, "hud_panel_radar_foreground_alpha"));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Rotation:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_radar_rotation"));
+                               e.addValue(e, _("Forward"), "0");
+                               e.addValue(e, _("West"), "1");
+                               e.addValue(e, _("South"), "2");
+                               e.addValue(e, _("East"), "3");
+                               e.addValue(e, _("North"), "4");
+                               e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Scale:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(1024, 8192, 512, "hud_panel_radar_scale"));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Zoom mode:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_radar_zoommode"));
+                               e.addValue(e, _("Zoomed in"), "0");
+                               e.addValue(e, _("Zoomed out"), "1");
+                               e.addValue(e, _("Always zoomed"), "2");
+                               e.addValue(e, _("Never zoomed"), "3");
+                               e.configureXonoticTextSliderValues(e);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_score.c b/qcsrc/menu/xonotic/dialog_hudpanel_score.c
deleted file mode 100644 (file)
index 676830f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDScoreDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDScoreDialog, fill, void(entity))
-       ATTRIB(XonoticHUDScoreDialog, title, string, _("Score Panel"))
-       ATTRIB(XonoticHUDScoreDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDScoreDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDScoreDialog, rows, float, 15)
-       ATTRIB(XonoticHUDScoreDialog, columns, float, 4)
-       ATTRIB(XonoticHUDScoreDialog, name, string, "HUDscore")
-       ATTRIB(XonoticHUDScoreDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDScoreDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDScoreDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "score";
-
-       DIALOG_HUDPANEL_COMMON();
-
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Score:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Rankings:")));
-               me.TD(me, 1, 2.6/3, e = makeXonoticRadioButton(1, "hud_panel_score_rankings", "0", _("Off")));
-               me.TD(me, 1, 2.6/3, e = makeXonoticRadioButton(1, "hud_panel_score_rankings", "1", _("And me")));
-               me.TD(me, 1, 2.6/3, e = makeXonoticRadioButton(1, "hud_panel_score_rankings", "2", _("Pure")));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_score.qc b/qcsrc/menu/xonotic/dialog_hudpanel_score.qc
new file mode 100644 (file)
index 0000000..edd4da6
--- /dev/null
@@ -0,0 +1,31 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDScoreDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDScoreDialog, fill, void(entity))
+       ATTRIB(XonoticHUDScoreDialog, title, string, _("Score Panel"))
+       ATTRIB(XonoticHUDScoreDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDScoreDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDScoreDialog, rows, float, 15)
+       ATTRIB(XonoticHUDScoreDialog, columns, float, 4)
+       ATTRIB(XonoticHUDScoreDialog, name, string, "HUDscore")
+       ATTRIB(XonoticHUDScoreDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDScoreDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDScoreDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "score";
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Score:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Rankings:")));
+               me.TD(me, 1, 2.6/3, e = makeXonoticRadioButton(1, "hud_panel_score_rankings", "0", _("Off")));
+               me.TD(me, 1, 2.6/3, e = makeXonoticRadioButton(1, "hud_panel_score_rankings", "1", _("And me")));
+               me.TD(me, 1, 2.6/3, e = makeXonoticRadioButton(1, "hud_panel_score_rankings", "2", _("Pure")));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_timer.c b/qcsrc/menu/xonotic/dialog_hudpanel_timer.c
deleted file mode 100644 (file)
index 2624a7e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDTimerDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDTimerDialog, fill, void(entity))
-       ATTRIB(XonoticHUDTimerDialog, title, string, _("Timer Panel"))
-       ATTRIB(XonoticHUDTimerDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDTimerDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDTimerDialog, rows, float, 15)
-       ATTRIB(XonoticHUDTimerDialog, columns, float, 4)
-       ATTRIB(XonoticHUDTimerDialog, name, string, "HUDtimer")
-       ATTRIB(XonoticHUDTimerDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDTimerDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDTimerDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "timer";
-
-       DIALOG_HUDPANEL_COMMON();
-
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Timer:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_timer_increment", _("Show elapsed time")));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_timer.qc b/qcsrc/menu/xonotic/dialog_hudpanel_timer.qc
new file mode 100644 (file)
index 0000000..754a5f1
--- /dev/null
@@ -0,0 +1,28 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDTimerDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDTimerDialog, fill, void(entity))
+       ATTRIB(XonoticHUDTimerDialog, title, string, _("Timer Panel"))
+       ATTRIB(XonoticHUDTimerDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDTimerDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDTimerDialog, rows, float, 15)
+       ATTRIB(XonoticHUDTimerDialog, columns, float, 4)
+       ATTRIB(XonoticHUDTimerDialog, name, string, "HUDtimer")
+       ATTRIB(XonoticHUDTimerDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDTimerDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDTimerDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "timer";
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Timer:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_timer_increment", _("Show elapsed time")));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_vote.c b/qcsrc/menu/xonotic/dialog_hudpanel_vote.c
deleted file mode 100644 (file)
index 4e4931e..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDVoteDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDVoteDialog, fill, void(entity))
-       ATTRIB(XonoticHUDVoteDialog, title, string, _("Vote Panel"))
-       ATTRIB(XonoticHUDVoteDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDVoteDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDVoteDialog, rows, float, 15)
-       ATTRIB(XonoticHUDVoteDialog, columns, float, 4)
-       ATTRIB(XonoticHUDVoteDialog, name, string, "HUDvote")
-       ATTRIB(XonoticHUDVoteDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDVoteDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDVoteDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "vote";
-
-       DIALOG_HUDPANEL_COMMON();
-
-       me.TR(me);
-               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Alpha after voting:")));
-               me.TD(me, 1, 2.6, e = makeXonoticSlider(0.1, 1, 0.1, "hud_panel_vote_alreadyvoted_alpha"));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_vote.qc b/qcsrc/menu/xonotic/dialog_hudpanel_vote.qc
new file mode 100644 (file)
index 0000000..e2b398e
--- /dev/null
@@ -0,0 +1,26 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDVoteDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDVoteDialog, fill, void(entity))
+       ATTRIB(XonoticHUDVoteDialog, title, string, _("Vote Panel"))
+       ATTRIB(XonoticHUDVoteDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDVoteDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDVoteDialog, rows, float, 15)
+       ATTRIB(XonoticHUDVoteDialog, columns, float, 4)
+       ATTRIB(XonoticHUDVoteDialog, name, string, "HUDvote")
+       ATTRIB(XonoticHUDVoteDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDVoteDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDVoteDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "vote";
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Alpha after voting:")));
+               me.TD(me, 1, 2.6, e = makeXonoticSlider(0.1, 1, 0.1, "hud_panel_vote_alreadyvoted_alpha"));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_weapons.c b/qcsrc/menu/xonotic/dialog_hudpanel_weapons.c
deleted file mode 100644 (file)
index 07026be..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDWeaponsDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDWeaponsDialog, fill, void(entity))
-       ATTRIB(XonoticHUDWeaponsDialog, title, string, _("Weapons Panel"))
-       ATTRIB(XonoticHUDWeaponsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDWeaponsDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDWeaponsDialog, rows, float, 18)
-       ATTRIB(XonoticHUDWeaponsDialog, columns, float, 4)
-       ATTRIB(XonoticHUDWeaponsDialog, name, string, "HUDweapons")
-       ATTRIB(XonoticHUDWeaponsDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDWeaponsDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDWeaponsDialog_fill(entity me)
-{
-       entity e;
-       string panelname = "weapons";
-       float i;
-
-       DIALOG_HUDPANEL_COMMON();
-
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Fade out after:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_timeout"))));
-                               e.addValue(e, _("Never"), "0");
-                               for(i = 1; i <= 10; ++i)
-                                       e.addValue(e, strzone(sprintf(_("%ds"), i)), strzone(ftos(i)));
-                               e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Fade effect:")));
-               setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_timeout")), "0");
-                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_timeout_effect"))));
-                               e.addValue(e, ZCTX(_("EF^None")),  "0");
-                               e.addValue(e, _("Alpha"), "1");
-                               e.addValue(e, _("Slide"), "2");
-                               e.addValue(e, ZCTX(_("EF^Both")),  "3");
-                               e.configureXonoticTextSliderValues(e);
-                       setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_timeout")), "0");
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Weapon icons:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_weapons_onlyowned", _("Show only owned weapons")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Show weapon ID as:")));
-                       me.TD(me, 1, 0.8, e = makeXonoticRadioButton(2, "hud_panel_weapons_label", "0", ZCTX(_("SHOWAS^None"))));
-                       me.TD(me, 1, 0.8, e = makeXonoticRadioButton(2, "hud_panel_weapons_label", "1", _("Number")));
-                       me.TD(me, 1, 0.8, e = makeXonoticRadioButton(2, "hud_panel_weapons_label", "2", _("Bind")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 3.8/2, e = makeXonoticCheckBox(0, "hud_panel_weapons_accuracy", _("Show Accuracy")));
-               me.TD(me, 1, 3.8/2, e = makeXonoticCheckBox(0, "hud_panel_weapons_ammo", _("Show Ammo")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Ammo bar color:")));
-               me.TD(me, 2, 2.4, e = makeXonoticColorpickerString("hud_panel_weapons_ammo_color", "hud_panel_weapons_ammo_color"));
-                       setDependent(e, "hud_panel_weapons_ammo", 1, 1);
-               me.TR(me);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Ammo bar alpha:")));
-                       me.TD(me, 1, 2.4, e = makeXonoticSlider(0.1, 1, 0.1, "hud_panel_weapons_ammo_alpha"));
-                       setDependent(e, "hud_panel_weapons_ammo", 1, 1);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_weapons.qc b/qcsrc/menu/xonotic/dialog_hudpanel_weapons.qc
new file mode 100644 (file)
index 0000000..ce1479c
--- /dev/null
@@ -0,0 +1,74 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDWeaponsDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDWeaponsDialog, fill, void(entity))
+       ATTRIB(XonoticHUDWeaponsDialog, title, string, _("Weapons Panel"))
+       ATTRIB(XonoticHUDWeaponsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDWeaponsDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDWeaponsDialog, rows, float, 19)
+       ATTRIB(XonoticHUDWeaponsDialog, columns, float, 4)
+       ATTRIB(XonoticHUDWeaponsDialog, name, string, "HUDweapons")
+       ATTRIB(XonoticHUDWeaponsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDWeaponsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDWeaponsDialog_fill(entity me)
+{
+       entity e;
+       string panelname = "weapons";
+       float i;
+
+       DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Fade out after:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_timeout"))));
+                               e.addValue(e, _("Never"), "0");
+                               for(i = 1; i <= 10; ++i)
+                                       e.addValue(e, strzone(sprintf(_("%ds"), i)), strzone(ftos(i)));
+                               e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Fade effect:")));
+               setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_timeout")), "0");
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_timeout_effect"))));
+                               e.addValue(e, ZCTX(_("EF^None")),  "0");
+                               e.addValue(e, _("Alpha"), "1");
+                               e.addValue(e, _("Slide"), "2");
+                               e.addValue(e, ZCTX(_("EF^Both")),  "3");
+                               e.configureXonoticTextSliderValues(e);
+                       setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_timeout")), "0");
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Weapon icons:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_weapons_onlyowned", _("Show only owned weapons")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Show weapon ID as:")));
+                       me.TD(me, 1, 0.8, e = makeXonoticRadioButton(2, "hud_panel_weapons_label", "0", ZCTX(_("SHOWAS^None"))));
+                       me.TD(me, 1, 0.8, e = makeXonoticRadioButton(2, "hud_panel_weapons_label", "1", _("Number")));
+                       me.TD(me, 1, 0.8, e = makeXonoticRadioButton(2, "hud_panel_weapons_label", "2", _("Bind")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Weapon ID scale:")));
+                       me.TD(me, 1, 2.4, e = makeXonoticSlider(0.1, 1, 0.05, "hud_panel_weapons_label_scale"));
+                       setDependent(e, "hud_panel_weapons_label", 1, 2);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 3.8/2, e = makeXonoticCheckBox(0, "hud_panel_weapons_accuracy", _("Show Accuracy")));
+               me.TD(me, 1, 3.8/2, e = makeXonoticCheckBox(0, "hud_panel_weapons_ammo", _("Show Ammo")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Ammo bar alpha:")));
+                       me.TD(me, 1, 2.4, e = makeXonoticSlider(0.1, 1, 0.1, "hud_panel_weapons_ammo_alpha"));
+                       setDependent(e, "hud_panel_weapons_ammo", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Ammo bar color:")));
+               me.TD(me, 2, 2.4, e = makeXonoticColorpickerString("hud_panel_weapons_ammo_color", "hud_panel_weapons_ammo_color"));
+                       setDependent(e, "hud_panel_weapons_ammo", 1, 1);
+               me.TR(me);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudsetup_exit.c b/qcsrc/menu/xonotic/dialog_hudsetup_exit.c
deleted file mode 100644 (file)
index 09e6c53..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDExitDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticHUDExitDialog, fill, void(entity))
-       ATTRIB(XonoticHUDExitDialog, title, string, _("Panel HUD Setup"))
-       ATTRIB(XonoticHUDExitDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticHUDExitDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticHUDExitDialog, rows, float, 18)
-       ATTRIB(XonoticHUDExitDialog, columns, float, 4)
-       ATTRIB(XonoticHUDExitDialog, name, string, "HUDExit")
-       ATTRIB(XonoticHUDExitDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticHUDExitDialog)
-
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticHUDExitDialog_fill(entity me)
-{
-       entity e;
-       float i;
-
-       me.TR(me);
-               me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Panel background defaults:")));
-       me.TR(me);
-               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Background:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg"));
-                               e.addValue(e, _("Disable"), "0");
-                               e.addValue(e, "border_default", "border_default"); // this is a file name!
-                               e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Color:")));
-               me.TD(me, 2, 2.6, e = makeXonoticColorpickerString("hud_panel_bg_color", "hud_panel_bg_color"));
-       me.TR(me);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Border size:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg_border"));
-                               e.addValue(e, _("Disable"), "0");
-                               for(i = 1; i <= 10; ++i)
-                                       e.addValue(e, strzone(ftos_decimals(i * 2, 0)), strzone(ftos(i * 2)));
-                               e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg_alpha"));
-                               for(i = 1; i <= 10; ++i)
-                                       e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
-                               e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Team color:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg_color_team"));
-                               e.addValue(e, _("Disable"), "0");
-                               for(i = 1; i <= 10; ++i)
-                                       e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
-                               e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TDempty(me, 0.4);
-               me.TD(me, 1, 3.6, e = makeXonoticCheckBox(0, "hud_configure_teamcolorforced", _("Test team color in configure mode")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Padding:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg_padding"));
-                               for(i = 0; i <= 10; ++i)
-                                       e.addValue(e, strzone(ftos_decimals(i - 5, 0)), strzone(ftos(i - 5)));
-                               e.configureXonoticTextSliderValues(e);
-
-       me.TR(me);
-               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("HUD Dock:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_dock"));
-                               e.addValue(e, ZCTX(_("DOCK^Disabled")), "0");
-                               e.addValue(e, ZCTX(_("DOCK^Small")), "dock_small");
-                               e.addValue(e, ZCTX(_("DOCK^Medium")), "dock_medium");
-                               e.addValue(e, ZCTX(_("DOCK^Large")), "dock_large");
-                               e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Color:")));
-               me.TD(me, 2, 2.6, e = makeXonoticColorpickerString("hud_dock_color", "hud_dock_color"));
-       me.TR(me);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_dock_alpha"));
-                               for(i = 1; i <= 10; ++i)
-                                       e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
-                               e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Team color:")));
-                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_dock_color_team"));
-                               e.addValue(e, _("Disable"), "0");
-                               for(i = 1; i <= 10; ++i)
-                                       e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
-                               e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Grid settings:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_configure_grid", _("Snap panels to grid")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Grid size:")));
-               me.TD(me, 1, 0.2, e = makeXonoticTextLabel(0, _("X:")));
-                       me.TD(me, 1, 1.1, e = makeXonoticTextSlider("hud_configure_grid_xsize"));
-                               for(i = 1; i <= 14; ++i)
-                                       e.addValue(e, strzone(ftos_decimals(i/200, 3)), strzone(ftos(i/200)));
-                               e.configureXonoticTextSliderValues(e);
-                       setDependent(e, "hud_configure_grid", 1, 1);
-               me.TD(me, 1, 0.2, e = makeXonoticTextLabel(0, _("Y:")));
-                       me.TD(me, 1, 1.1, e = makeXonoticTextSlider("hud_configure_grid_ysize"));
-                               for(i = 1; i <= 14; ++i)
-                                       e.addValue(e, strzone(ftos_decimals(i/200, 3)), strzone(ftos(i/200)));
-                               e.configureXonoticTextSliderValues(e);
-                       setDependent(e, "hud_configure_grid", 1, 1);
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Exit setup"), '0 0 0', "_hud_configure 0", 1));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_hudsetup_exit.qc b/qcsrc/menu/xonotic/dialog_hudsetup_exit.qc
new file mode 100644 (file)
index 0000000..7cf0ea6
--- /dev/null
@@ -0,0 +1,120 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDExitDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticHUDExitDialog, fill, void(entity))
+       ATTRIB(XonoticHUDExitDialog, title, string, _("Panel HUD Setup"))
+       ATTRIB(XonoticHUDExitDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticHUDExitDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticHUDExitDialog, rows, float, 18)
+       ATTRIB(XonoticHUDExitDialog, columns, float, 4)
+       ATTRIB(XonoticHUDExitDialog, name, string, "HUDExit")
+       ATTRIB(XonoticHUDExitDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDExitDialog)
+
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDExitDialog_fill(entity me)
+{
+       entity e;
+       float i;
+
+       me.TR(me);
+               me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Panel background defaults:")));
+       me.TR(me);
+               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Background:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg"));
+                               e.addValue(e, _("Disable"), "0");
+                               e.addValue(e, "border_default", "border_default"); // this is a file name!
+                               e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Color:")));
+               me.TD(me, 2, 2.6, e = makeXonoticColorpickerString("hud_panel_bg_color", "hud_panel_bg_color"));
+       me.TR(me);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Border size:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg_border"));
+                               e.addValue(e, _("Disable"), "0");
+                               for(i = 1; i <= 10; ++i)
+                                       e.addValue(e, strzone(ftos_decimals(i * 2, 0)), strzone(ftos(i * 2)));
+                               e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg_alpha"));
+                               for(i = 1; i <= 10; ++i)
+                                       e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
+                               e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Team color:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg_color_team"));
+                               e.addValue(e, _("Disable"), "0");
+                               for(i = 1; i <= 10; ++i)
+                                       e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
+                               e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TDempty(me, 0.4);
+               me.TD(me, 1, 3.6, e = makeXonoticCheckBox(0, "hud_configure_teamcolorforced", _("Test team color in configure mode")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Padding:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_panel_bg_padding"));
+                               for(i = 0; i <= 10; ++i)
+                                       e.addValue(e, strzone(ftos_decimals(i - 5, 0)), strzone(ftos(i - 5)));
+                               e.configureXonoticTextSliderValues(e);
+
+       me.TR(me);
+               me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("HUD Dock:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_dock"));
+                               e.addValue(e, ZCTX(_("DOCK^Disabled")), "0");
+                               e.addValue(e, ZCTX(_("DOCK^Small")), "dock_small");
+                               e.addValue(e, ZCTX(_("DOCK^Medium")), "dock_medium");
+                               e.addValue(e, ZCTX(_("DOCK^Large")), "dock_large");
+                               e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Color:")));
+               me.TD(me, 2, 2.6, e = makeXonoticColorpickerString("hud_dock_color", "hud_dock_color"));
+       me.TR(me);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_dock_alpha"));
+                               for(i = 1; i <= 10; ++i)
+                                       e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
+                               e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Team color:")));
+                       me.TD(me, 1, 2.6, e = makeXonoticTextSlider("hud_dock_color_team"));
+                               e.addValue(e, _("Disable"), "0");
+                               for(i = 1; i <= 10; ++i)
+                                       e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
+                               e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Grid settings:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_configure_grid", _("Snap panels to grid")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Grid size:")));
+               me.TD(me, 1, 0.2, e = makeXonoticTextLabel(0, _("X:")));
+                       me.TD(me, 1, 1.1, e = makeXonoticTextSlider("hud_configure_grid_xsize"));
+                               for(i = 1; i <= 14; ++i)
+                                       e.addValue(e, strzone(ftos_decimals(i/200, 3)), strzone(ftos(i/200)));
+                               e.configureXonoticTextSliderValues(e);
+                       setDependent(e, "hud_configure_grid", 1, 1);
+               me.TD(me, 1, 0.2, e = makeXonoticTextLabel(0, _("Y:")));
+                       me.TD(me, 1, 1.1, e = makeXonoticTextSlider("hud_configure_grid_ysize"));
+                               for(i = 1; i <= 14; ++i)
+                                       e.addValue(e, strzone(ftos_decimals(i/200, 3)), strzone(ftos(i/200)));
+                               e.configureXonoticTextSliderValues(e);
+                       setDependent(e, "hud_configure_grid", 1, 1);
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Exit setup"), '0 0 0', "_hud_configure 0", 1));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_monstertools.c b/qcsrc/menu/xonotic/dialog_monstertools.c
deleted file mode 100644 (file)
index 8b67094..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticMonsterToolsDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticMonsterToolsDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
-       ATTRIB(XonoticMonsterToolsDialog, title, string, _("Monster Tools"))
-       ATTRIB(XonoticMonsterToolsDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
-       ATTRIB(XonoticMonsterToolsDialog, intendedWidth, float, 0.8)
-       ATTRIB(XonoticMonsterToolsDialog, rows, float, 16)
-       ATTRIB(XonoticMonsterToolsDialog, columns, float, 4)
-       ATTRIB(XonoticMonsterToolsDialog, name, string, "MonsterTools")
-ENDCLASS(XonoticMonsterToolsDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticMonsterToolsDialog_fill(entity me)
-{
-       entity e;
-
-       me.TR(me);
-               me.TD(me, 1, 0.25, e = makeXonoticTextLabel(0, _("Monster:")));
-       me.TR(me);
-               me.TD(me, 1, 0.4, e = makeXonoticRadioButton(2, "menu_monsters_edit_spawn", "zombie", _("Zombie")));
-               me.TD(me, 1, 0.4, e = makeXonoticRadioButton(2, "menu_monsters_edit_spawn", "spider", _("Spider")));
-               me.TD(me, 1, 0.4, e = makeXonoticRadioButton(2, "menu_monsters_edit_spawn", "shambler", _("Shambler")));
-               me.TD(me, 1, 0.4, e = makeXonoticRadioButton(2, "menu_monsters_edit_spawn", "mage", _("Mage")));
-               me.TD(me, 1, 0.4, e = makeXonoticRadioButton(2, "menu_monsters_edit_spawn", "wyvern", _("Wyvern")));
-       me.TR(me);
-               me.TDempty(me, 0.1);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Spawn"), '0 0 0', "cmd mobspawn $menu_monsters_edit_spawn $menu_monsters_edit_movetarget", 0));
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Remove"), '0 0 0', "cmd mobkill", 0));
-       me.TR(me);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Move target:"), '0 0 0', "editmob movetarget $menu_monsters_edit_movetarget", 0));
-               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_monsters_edit_movetarget", "1", _("Follow")));
-               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_monsters_edit_movetarget", "2", _("Wander")));
-               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_monsters_edit_movetarget", "3", _("Spawnpoint")));
-               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_monsters_edit_movetarget", "4", _("No moving")));
-       me.TR(me);
-       me.TD(me, 1, 1.5, e = makeXonoticTextLabel(0, _("Colors:")));
-       me.TR(me);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set skin:"), '0 0 0', "editmob skin $menu_monsters_edit_skin", 0));
-               me.TD(me, 1, 1.5, e = makeXonoticSlider(0, 99, 1, "menu_monsters_edit_skin"));
-       me.TR(me);
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-}
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
diff --git a/qcsrc/menu/xonotic/dialog_monstertools.qc b/qcsrc/menu/xonotic/dialog_monstertools.qc
new file mode 100644 (file)
index 0000000..8b67094
--- /dev/null
@@ -0,0 +1,50 @@
+#ifdef INTERFACE
+CLASS(XonoticMonsterToolsDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticMonsterToolsDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
+       ATTRIB(XonoticMonsterToolsDialog, title, string, _("Monster Tools"))
+       ATTRIB(XonoticMonsterToolsDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
+       ATTRIB(XonoticMonsterToolsDialog, intendedWidth, float, 0.8)
+       ATTRIB(XonoticMonsterToolsDialog, rows, float, 16)
+       ATTRIB(XonoticMonsterToolsDialog, columns, float, 4)
+       ATTRIB(XonoticMonsterToolsDialog, name, string, "MonsterTools")
+ENDCLASS(XonoticMonsterToolsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticMonsterToolsDialog_fill(entity me)
+{
+       entity e;
+
+       me.TR(me);
+               me.TD(me, 1, 0.25, e = makeXonoticTextLabel(0, _("Monster:")));
+       me.TR(me);
+               me.TD(me, 1, 0.4, e = makeXonoticRadioButton(2, "menu_monsters_edit_spawn", "zombie", _("Zombie")));
+               me.TD(me, 1, 0.4, e = makeXonoticRadioButton(2, "menu_monsters_edit_spawn", "spider", _("Spider")));
+               me.TD(me, 1, 0.4, e = makeXonoticRadioButton(2, "menu_monsters_edit_spawn", "shambler", _("Shambler")));
+               me.TD(me, 1, 0.4, e = makeXonoticRadioButton(2, "menu_monsters_edit_spawn", "mage", _("Mage")));
+               me.TD(me, 1, 0.4, e = makeXonoticRadioButton(2, "menu_monsters_edit_spawn", "wyvern", _("Wyvern")));
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Spawn"), '0 0 0', "cmd mobspawn $menu_monsters_edit_spawn $menu_monsters_edit_movetarget", 0));
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Remove"), '0 0 0', "cmd mobkill", 0));
+       me.TR(me);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Move target:"), '0 0 0', "editmob movetarget $menu_monsters_edit_movetarget", 0));
+               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_monsters_edit_movetarget", "1", _("Follow")));
+               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_monsters_edit_movetarget", "2", _("Wander")));
+               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_monsters_edit_movetarget", "3", _("Spawnpoint")));
+               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_monsters_edit_movetarget", "4", _("No moving")));
+       me.TR(me);
+       me.TD(me, 1, 1.5, e = makeXonoticTextLabel(0, _("Colors:")));
+       me.TR(me);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set skin:"), '0 0 0', "editmob skin $menu_monsters_edit_skin", 0));
+               me.TD(me, 1, 1.5, e = makeXonoticSlider(0, 99, 1, "menu_monsters_edit_skin"));
+       me.TR(me);
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+#endif
+
+/* Click. The c-word is here so you can grep for it :-) */
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer.c b/qcsrc/menu/xonotic/dialog_multiplayer.c
deleted file mode 100644 (file)
index 7d234c7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticMultiplayerDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticMultiplayerDialog, fill, void(entity))
-       ATTRIB(XonoticMultiplayerDialog, title, string, _("Multiplayer"))
-       ATTRIB(XonoticMultiplayerDialog, color, vector, SKINCOLOR_DIALOG_MULTIPLAYER)
-       ATTRIB(XonoticMultiplayerDialog, intendedWidth, float, 0.96)
-       ATTRIB(XonoticMultiplayerDialog, rows, float, 24)
-       ATTRIB(XonoticMultiplayerDialog, columns, float, 4)
-ENDCLASS(XonoticMultiplayerDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticMultiplayerDialog_fill(entity me)
-{
-       entity mc, e;
-       mc = makeXonoticTabController(me.rows - 1);
-       me.TR(me);
-               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Servers"), makeXonoticServerListTab()));
-               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Create"), makeXonoticServerCreateTab()));
-               //me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Demos"), makeXonoticDemoBrowserTab()));
-               //me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Screenshots"), makeXonoticScreenshotBrowserTab()));
-               //me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Players"), makeXonoticDemoBrowserTab()));
-               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Media"), makeXonoticMediaTab()));
-               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Profile"), makeXonoticProfileTab()));
-
-       me.TR(me);
-               me.TD(me, me.rows - 1, me.columns, mc);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer.qc b/qcsrc/menu/xonotic/dialog_multiplayer.qc
new file mode 100644 (file)
index 0000000..7d234c7
--- /dev/null
@@ -0,0 +1,29 @@
+#ifdef INTERFACE
+CLASS(XonoticMultiplayerDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticMultiplayerDialog, fill, void(entity))
+       ATTRIB(XonoticMultiplayerDialog, title, string, _("Multiplayer"))
+       ATTRIB(XonoticMultiplayerDialog, color, vector, SKINCOLOR_DIALOG_MULTIPLAYER)
+       ATTRIB(XonoticMultiplayerDialog, intendedWidth, float, 0.96)
+       ATTRIB(XonoticMultiplayerDialog, rows, float, 24)
+       ATTRIB(XonoticMultiplayerDialog, columns, float, 4)
+ENDCLASS(XonoticMultiplayerDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticMultiplayerDialog_fill(entity me)
+{
+       entity mc, e;
+       mc = makeXonoticTabController(me.rows - 1);
+       me.TR(me);
+               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Servers"), makeXonoticServerListTab()));
+               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Create"), makeXonoticServerCreateTab()));
+               //me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Demos"), makeXonoticDemoBrowserTab()));
+               //me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Screenshots"), makeXonoticScreenshotBrowserTab()));
+               //me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Players"), makeXonoticDemoBrowserTab()));
+               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Media"), makeXonoticMediaTab()));
+               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Profile"), makeXonoticProfileTab()));
+
+       me.TR(me);
+               me.TD(me, me.rows - 1, me.columns, mc);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create.c b/qcsrc/menu/xonotic/dialog_multiplayer_create.c
deleted file mode 100644 (file)
index bbffb52..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticServerCreateTab) EXTENDS(XonoticTab)
-       METHOD(XonoticServerCreateTab, fill, void(entity))
-       METHOD(XonoticServerCreateTab, gameTypeChangeNotify, void(entity))
-       METHOD(XonoticServerCreateTab, gameTypeSelectNotify, void(entity))
-       ATTRIB(XonoticServerCreateTab, title, string, _("Create"))
-       ATTRIB(XonoticServerCreateTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticServerCreateTab, rows, float, 23)
-       ATTRIB(XonoticServerCreateTab, columns, float, 6.2) // added extra .2 for center space
-
-       ATTRIB(XonoticServerCreateTab, mapListBox, entity, NULL)
-       ATTRIB(XonoticServerCreateTab, sliderFraglimit, entity, NULL)
-       ATTRIB(XonoticServerCreateTab, sliderTeams, entity, NULL)
-       ATTRIB(XonoticServerCreateTab, sliderTimelimit, entity, NULL)
-       ATTRIB(XonoticServerCreateTab, labelFraglimit, entity, NULL)
-       ATTRIB(XonoticServerCreateTab, labelTeams, entity, NULL)
-ENDCLASS(XonoticServerCreateTab)
-entity makeXonoticServerCreateTab();
-#endif
-
-#ifdef IMPLEMENTATION
-
-void GameType_ConfigureSliders(entity e, entity l, string pLabel, float pMin, float pMax, float pStep, string pCvar)
-{
-       if(pCvar == "")
-       {
-               e.configureXonoticTextSlider(e, string_null);
-               l.setText(l, pLabel);
-               e.disabled = l.disabled = TRUE;
-       }
-       else
-       {
-               e.configureXonoticTextSlider(e, pCvar);
-               
-               // clear old values
-               float i;
-               for(i = 0; i <= e.nValues; ++i);
-               {
-                       if(e.(valueStrings[i])) { strunzone(e.(valueStrings[i])); }
-                       if(e.(valueIdentifiers[i])) { strunzone(e.(valueIdentifiers[i])); }
-               }
-               e.clearValues(e);
-
-               // set new values
-               e.addValue(e, strzone(_("Default")), strzone("-1"));
-               for(i = pMin; i <= pMax; i += pStep) { e.addValue(e, strzone(ftos(i)), strzone(ftos(i))); }
-               e.addValue(e, strzone(_("Unlimited")), strzone("0"));
-               e.configureXonoticTextSliderValues(e);
-
-               // set text field
-               l.setText(l, pLabel);
-               e.disabled = l.disabled = FALSE;
-       }
-}
-
-entity makeXonoticServerCreateTab()
-{
-       entity me;
-       me = spawnXonoticServerCreateTab();
-       me.configureDialog(me);
-       return me;
-}
-
-void XonoticServerCreateTab_fill(entity me)
-{
-       entity e, e0;
-
-       me.gotoRC(me, 0.5, 0);
-               me.TD(me, 1, 3, makeXonoticHeaderLabel(_("Gametype")));
-       me.TR(me);
-               me.TD(me, 10.5, 3, e = makeXonoticGametypeList());
-
-       me.gotoRC(me, 12.5, 0);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Time limit:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("timelimit_override"));
-                       e.addValue(e, ZCTX(_("TIMLIM^Default")), "-1");
-                       e.addValue(e, ZCTX(_("TIMLIM^1 minute")), "1");
-                       e.addValue(e, ZCTX(_("TIMLIM^2 minutes")), "2");
-                       e.addValue(e, ZCTX(_("TIMLIM^3 minutes")), "3");
-                       e.addValue(e, ZCTX(_("TIMLIM^4 minutes")), "4");
-                       e.addValue(e, ZCTX(_("TIMLIM^5 minutes")), "5");
-                       e.addValue(e, ZCTX(_("TIMLIM^6 minutes")), "6");
-                       e.addValue(e, ZCTX(_("TIMLIM^7 minutes")), "7");
-                       e.addValue(e, ZCTX(_("TIMLIM^8 minutes")), "8");
-                       e.addValue(e, ZCTX(_("TIMLIM^9 minutes")), "9");
-                       e.addValue(e, ZCTX(_("TIMLIM^10 minutes")), "10");
-                       e.addValue(e, ZCTX(_("TIMLIM^15 minutes")), "15");
-                       e.addValue(e, ZCTX(_("TIMLIM^20 minutes")), "20");
-                       e.addValue(e, ZCTX(_("TIMLIM^25 minutes")), "25");
-                       e.addValue(e, ZCTX(_("TIMLIM^30 minutes")), "30");
-                       e.addValue(e, ZCTX(_("TIMLIM^40 minutes")), "40");
-                       e.addValue(e, ZCTX(_("TIMLIM^50 minutes")), "50");
-                       e.addValue(e, ZCTX(_("TIMLIM^60 minutes")), "60");
-                       e.addValue(e, ZCTX(_("TIMLIM^Infinite")), "0");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 1, me.labelFraglimit = makeXonoticTextLabel(0, _("Frag limit:")));
-               me.TD(me, 1, 2, me.sliderFraglimit = makeXonoticTextSlider("fraglimit_override"));
-                       GameType_ConfigureSliders(me.sliderFraglimit, me.labelFraglimit, _("Frag limit:"), 5, 100, 5, "fraglimit_override");
-
-       me.gotoRC(me, 15, 0);
-               me.TD(me, 1, 1, me.labelTeams = makeXonoticTextLabel(0, _("Teams:")));
-               me.TD(me, 1, 2, e = me.sliderTeams = makeXonoticTextSlider(string_null));
-                       e.addValue(e, _("Default"), "0");
-                       e.addValue(e, _("2 teams"), "2");
-                       e.addValue(e, _("3 teams"), "3");
-                       e.addValue(e, _("4 teams"), "4");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Player slots:")));
-               me.TD(me, 1, 2, makeXonoticSlider(1, 32, 1, "menu_maxplayers"));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Number of bots:")));
-               me.TD(me, 1, 2, makeXonoticSlider(0, 9, 1, "bot_number"));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Bot skill:")));
-                       setDependent(e, "bot_number", 0, -1);
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("skill"));
-                       e.addValue(e, _("Botlike"), "0");
-                       e.addValue(e, _("Beginner"), "1");
-                       e.addValue(e, _("You will win"), "2");
-                       e.addValue(e, _("You can win"), "3");
-                       e.addValue(e, _("You might win"), "4");
-                       e.addValue(e, _("Advanced"), "5");
-                       e.addValue(e, _("Expert"), "6");
-                       e.addValue(e, _("Pro"), "7");
-                       e.addValue(e, _("Assassin"), "8");
-                       e.addValue(e, _("Unhuman"), "9");
-                       e.addValue(e, _("Godlike"), "10");
-                       e.configureXonoticTextSliderValues(e);
-                       setDependent(e, "bot_number", 0, -1);
-
-       me.gotoRC(me, me.rows - 3.5, 0);
-               me.TD(me, 1, 3, e0 = makeXonoticTextLabel(0.5, string_null));
-                       e0.textEntity = main.mutatorsDialog;
-                       e0.allowCut = 1;
-                       //e0.allowWrap = 1;
-       me.TR(me);
-               me.TDempty(me, 0.5);
-               me.TD(me, 1, 2, e = makeXonoticButton(_("Mutators"), '0 0 0'));
-                       e.onClick = DialogOpenButton_Click;
-                       e.onClickEntity = main.mutatorsDialog;
-                       main.mutatorsDialog.refilterEntity = me.mapListBox;
-
-       me.gotoRC(me, 0.5, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.mapListBox = makeXonoticMapList();
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Maplist")));
-                       makeCallback(e, me.mapListBox, me.mapListBox.refilterCallback);
-       me.TR(me);
-               me.TD(me, me.rows - 4, 3, me.mapListBox);
-       me.gotoRC(me, me.rows - 2.5, 3.2);
-               me.TDempty(me, 0.375);
-               me.TD(me, 1, 1.125, e = makeXonoticButton(_("Select all"), '0 0 0'));
-                       e.onClick = MapList_All;
-                       e.onClickEntity = me.mapListBox;
-               me.TD(me, 1, 1.125, e = makeXonoticButton(_("Select none"), '0 0 0'));
-                       e.onClick = MapList_None;
-                       e.onClickEntity = me.mapListBox;
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, e = makeXonoticButton(_("Start Multiplayer!"), '0 0 0'));
-                       e.onClick = MapList_LoadMap;
-                       e.onClickEntity = me.mapListBox;
-                       me.mapListBox.startButton = e;
-
-       me.gameTypeChangeNotify(me);
-}
-
-void XonoticServerCreateTab_gameTypeChangeNotify(entity me)
-{
-       // tell the map list to update
-       float gt;
-       entity e, l;
-       gt = MapInfo_CurrentGametype();
-       e = me.sliderFraglimit;
-       l = me.labelFraglimit;
-
-       switch(gt)
-       {
-               case MAPINFO_TYPE_CTF:        GameType_ConfigureSliders(e, l, _("Capture limit:"),   1,   20, 1, "capturelimit_override");     break;
-               case MAPINFO_TYPE_DOMINATION: GameType_ConfigureSliders(e, l, _("Point limit:"),    50,  500, 10, "g_domination_point_limit"); break;
-               case MAPINFO_TYPE_KEYHUNT:    GameType_ConfigureSliders(e, l, _("Point limit:"),   200, 1500, 50, "g_keyhunt_point_limit");    break;
-               case MAPINFO_TYPE_LMS:        GameType_ConfigureSliders(e, l, _("Lives:"),           3,   50,  1, "g_lms_lives_override");     break;
-               case MAPINFO_TYPE_RACE:       GameType_ConfigureSliders(e, l, _("Laps:"),            1,   25,  1, "g_race_laps_limit");        break;
-               case MAPINFO_TYPE_NEXBALL:    GameType_ConfigureSliders(e, l, _("Goals:"),           1,   50,  1, "g_nexball_goallimit");      break;
-               case MAPINFO_TYPE_ASSAULT:    GameType_ConfigureSliders(e, l, _("Point limit:"),    50,  500, 10, "");                         break;
-               case MAPINFO_TYPE_ONSLAUGHT:  GameType_ConfigureSliders(e, l, _("Point limit:"),    50,  500, 10, "");                         break;
-               case MAPINFO_TYPE_CTS:        GameType_ConfigureSliders(e, l, _("Point limit:"),    50,  500, 10, "");                         break;
-               case MAPINFO_TYPE_INVASION:   GameType_ConfigureSliders(e, l, _("Point limit:"),     5,    0,  5, "");                         break;
-               default:                      GameType_ConfigureSliders(e, l, _("Frag limit:"),      5,  100,  5, "fraglimit_override");       break;
-       }
-
-       string x = string_null;
-       e = me.sliderTeams;
-       switch(gt)
-       {
-               case MAPINFO_TYPE_CA:               x = "g_ca_teams_override";          break;
-               case MAPINFO_TYPE_DOMINATION:       x = "g_domination_teams_override";  break;
-               case MAPINFO_TYPE_FREEZETAG:        x = "g_freezetag_teams_override";   break;
-               case MAPINFO_TYPE_KEYHUNT:          x = "g_keyhunt_teams_override";     break;
-               case MAPINFO_TYPE_TEAM_DEATHMATCH:  x = "g_tdm_teams_override";         break;
-       }
-       e.configureXonoticTextSlider(e, x);
-       e.configureXonoticTextSliderValues(e);
-       if(!x)
-               e.value = 0;
-       me.sliderTeams.disabled = me.labelTeams.disabled = !x;
-
-       me.mapListBox.refilter(me.mapListBox);
-}
-
-void XonoticServerCreateTab_gameTypeSelectNotify(entity me)
-{
-       me.setFocus(me, me.mapListBox);
-}
-
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create.qc b/qcsrc/menu/xonotic/dialog_multiplayer_create.qc
new file mode 100644 (file)
index 0000000..4e76cbc
--- /dev/null
@@ -0,0 +1,218 @@
+#ifdef INTERFACE
+CLASS(XonoticServerCreateTab) EXTENDS(XonoticTab)
+       METHOD(XonoticServerCreateTab, fill, void(entity))
+       METHOD(XonoticServerCreateTab, gameTypeChangeNotify, void(entity))
+       METHOD(XonoticServerCreateTab, gameTypeSelectNotify, void(entity))
+       ATTRIB(XonoticServerCreateTab, title, string, _("Create"))
+       ATTRIB(XonoticServerCreateTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticServerCreateTab, rows, float, 23)
+       ATTRIB(XonoticServerCreateTab, columns, float, 6.2) // added extra .2 for center space
+
+       ATTRIB(XonoticServerCreateTab, mapListBox, entity, NULL)
+       ATTRIB(XonoticServerCreateTab, sliderFraglimit, entity, NULL)
+       ATTRIB(XonoticServerCreateTab, sliderTeams, entity, NULL)
+       ATTRIB(XonoticServerCreateTab, sliderTimelimit, entity, NULL)
+       ATTRIB(XonoticServerCreateTab, labelFraglimit, entity, NULL)
+       ATTRIB(XonoticServerCreateTab, labelTeams, entity, NULL)
+ENDCLASS(XonoticServerCreateTab)
+entity makeXonoticServerCreateTab();
+#endif
+
+#ifdef IMPLEMENTATION
+
+void GameType_ConfigureSliders(entity e, entity l, string pLabel, float pMin, float pMax, float pStep, string pCvar)
+{
+       if(pCvar == "")
+       {
+               e.configureXonoticTextSlider(e, string_null);
+               l.setText(l, pLabel);
+               e.disabled = l.disabled = true;
+       }
+       else
+       {
+               e.configureXonoticTextSlider(e, pCvar);
+
+               // clear old values
+               float i;
+               for(i = 0; i <= e.nValues; ++i);
+               {
+                       if(e.(valueStrings[i])) { strunzone(e.(valueStrings[i])); }
+                       if(e.(valueIdentifiers[i])) { strunzone(e.(valueIdentifiers[i])); }
+               }
+               e.clearValues(e);
+
+               // set new values
+               e.addValue(e, strzone(_("Default")), strzone("-1"));
+               for(i = pMin; i <= pMax; i += pStep) { e.addValue(e, strzone(ftos(i)), strzone(ftos(i))); }
+               e.addValue(e, strzone(_("Unlimited")), strzone("0"));
+               e.configureXonoticTextSliderValues(e);
+
+               // set text field
+               l.setText(l, pLabel);
+               e.disabled = l.disabled = false;
+       }
+}
+
+entity makeXonoticServerCreateTab()
+{
+       entity me;
+       me = spawnXonoticServerCreateTab();
+       me.configureDialog(me);
+       return me;
+}
+
+void XonoticServerCreateTab_fill(entity me)
+{
+       entity e, e0;
+
+       me.gotoRC(me, 0.5, 0);
+               me.TD(me, 1, 3, makeXonoticHeaderLabel(_("Gametype")));
+       me.TR(me);
+               me.TD(me, 10.5, 3, e = makeXonoticGametypeList());
+
+       me.gotoRC(me, 12.5, 0);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Time limit:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("timelimit_override"));
+                       e.addValue(e, ZCTX(_("TIMLIM^Default")), "-1");
+                       e.addValue(e, ZCTX(_("TIMLIM^1 minute")), "1");
+                       e.addValue(e, ZCTX(_("TIMLIM^2 minutes")), "2");
+                       e.addValue(e, ZCTX(_("TIMLIM^3 minutes")), "3");
+                       e.addValue(e, ZCTX(_("TIMLIM^4 minutes")), "4");
+                       e.addValue(e, ZCTX(_("TIMLIM^5 minutes")), "5");
+                       e.addValue(e, ZCTX(_("TIMLIM^6 minutes")), "6");
+                       e.addValue(e, ZCTX(_("TIMLIM^7 minutes")), "7");
+                       e.addValue(e, ZCTX(_("TIMLIM^8 minutes")), "8");
+                       e.addValue(e, ZCTX(_("TIMLIM^9 minutes")), "9");
+                       e.addValue(e, ZCTX(_("TIMLIM^10 minutes")), "10");
+                       e.addValue(e, ZCTX(_("TIMLIM^15 minutes")), "15");
+                       e.addValue(e, ZCTX(_("TIMLIM^20 minutes")), "20");
+                       e.addValue(e, ZCTX(_("TIMLIM^25 minutes")), "25");
+                       e.addValue(e, ZCTX(_("TIMLIM^30 minutes")), "30");
+                       e.addValue(e, ZCTX(_("TIMLIM^40 minutes")), "40");
+                       e.addValue(e, ZCTX(_("TIMLIM^50 minutes")), "50");
+                       e.addValue(e, ZCTX(_("TIMLIM^60 minutes")), "60");
+                       e.addValue(e, ZCTX(_("TIMLIM^Infinite")), "0");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 1, me.labelFraglimit = makeXonoticTextLabel(0, _("Frag limit:")));
+               me.TD(me, 1, 2, me.sliderFraglimit = makeXonoticTextSlider("fraglimit_override"));
+                       GameType_ConfigureSliders(me.sliderFraglimit, me.labelFraglimit, _("Frag limit:"), 5, 100, 5, "fraglimit_override");
+
+       me.gotoRC(me, 15, 0);
+               me.TD(me, 1, 1, me.labelTeams = makeXonoticTextLabel(0, _("Teams:")));
+               me.TD(me, 1, 2, e = me.sliderTeams = makeXonoticTextSlider(string_null));
+                       e.addValue(e, _("Default"), "0");
+                       e.addValue(e, _("2 teams"), "2");
+                       e.addValue(e, _("3 teams"), "3");
+                       e.addValue(e, _("4 teams"), "4");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Player slots:")));
+               me.TD(me, 1, 2, makeXonoticSlider(1, 32, 1, "menu_maxplayers"));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Number of bots:")));
+               me.TD(me, 1, 2, makeXonoticSlider(0, 9, 1, "bot_number"));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Bot skill:")));
+                       setDependent(e, "bot_number", 0, -1);
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("skill"));
+                       e.addValue(e, _("Botlike"), "0");
+                       e.addValue(e, _("Beginner"), "1");
+                       e.addValue(e, _("You will win"), "2");
+                       e.addValue(e, _("You can win"), "3");
+                       e.addValue(e, _("You might win"), "4");
+                       e.addValue(e, _("Advanced"), "5");
+                       e.addValue(e, _("Expert"), "6");
+                       e.addValue(e, _("Pro"), "7");
+                       e.addValue(e, _("Assassin"), "8");
+                       e.addValue(e, _("Unhuman"), "9");
+                       e.addValue(e, _("Godlike"), "10");
+                       e.configureXonoticTextSliderValues(e);
+                       setDependent(e, "bot_number", 0, -1);
+
+       me.gotoRC(me, me.rows - 3.5, 0);
+               me.TD(me, 1, 3, e0 = makeXonoticTextLabel(0.5, string_null));
+                       e0.textEntity = main.mutatorsDialog;
+                       e0.allowCut = 1;
+                       //e0.allowWrap = 1;
+       me.TR(me);
+               me.TDempty(me, 0.5);
+               me.TD(me, 1, 2, e = makeXonoticButton(_("Mutators"), '0 0 0'));
+                       e.onClick = DialogOpenButton_Click;
+                       e.onClickEntity = main.mutatorsDialog;
+                       main.mutatorsDialog.refilterEntity = me.mapListBox;
+
+       me.gotoRC(me, 0.5, 3.2); me.setFirstColumn(me, me.currentColumn);
+               me.mapListBox = makeXonoticMapList();
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Maplist")));
+                       makeCallback(e, me.mapListBox, me.mapListBox.refilterCallback);
+       me.TR(me);
+               me.TD(me, me.rows - 4, 3, me.mapListBox);
+       me.gotoRC(me, me.rows - 2.5, 3.2);
+               me.TDempty(me, 0.375);
+               me.TD(me, 1, 1.125, e = makeXonoticButton(_("Select all"), '0 0 0'));
+                       e.onClick = MapList_All;
+                       e.onClickEntity = me.mapListBox;
+               me.TD(me, 1, 1.125, e = makeXonoticButton(_("Select none"), '0 0 0'));
+                       e.onClick = MapList_None;
+                       e.onClickEntity = me.mapListBox;
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, e = makeXonoticButton(_("Start Multiplayer!"), '0 0 0'));
+                       e.onClick = MapList_LoadMap;
+                       e.onClickEntity = me.mapListBox;
+                       me.mapListBox.startButton = e;
+
+       me.gameTypeChangeNotify(me);
+}
+
+void XonoticServerCreateTab_gameTypeChangeNotify(entity me)
+{
+       // tell the map list to update
+       float gt;
+       entity e, l;
+       gt = MapInfo_CurrentGametype();
+       e = me.sliderFraglimit;
+       l = me.labelFraglimit;
+
+       switch(gt)
+       {
+               case MAPINFO_TYPE_CTF:        GameType_ConfigureSliders(e, l, _("Capture limit:"),   1,   20, 1, "capturelimit_override");     break;
+               case MAPINFO_TYPE_DOMINATION: GameType_ConfigureSliders(e, l, _("Point limit:"),    50,  500, 10, "g_domination_point_limit"); break;
+               case MAPINFO_TYPE_KEYHUNT:    GameType_ConfigureSliders(e, l, _("Point limit:"),   200, 1500, 50, "g_keyhunt_point_limit");    break;
+               case MAPINFO_TYPE_LMS:        GameType_ConfigureSliders(e, l, _("Lives:"),           3,   50,  1, "g_lms_lives_override");     break;
+               case MAPINFO_TYPE_RACE:       GameType_ConfigureSliders(e, l, _("Laps:"),            1,   25,  1, "g_race_laps_limit");        break;
+               case MAPINFO_TYPE_NEXBALL:    GameType_ConfigureSliders(e, l, _("Goals:"),           1,   50,  1, "g_nexball_goallimit");      break;
+               case MAPINFO_TYPE_ASSAULT:    GameType_ConfigureSliders(e, l, _("Point limit:"),    50,  500, 10, "");                         break;
+               case MAPINFO_TYPE_ONSLAUGHT:  GameType_ConfigureSliders(e, l, _("Point limit:"),    50,  500, 10, "");                         break;
+               case MAPINFO_TYPE_CTS:        GameType_ConfigureSliders(e, l, _("Point limit:"),    50,  500, 10, "");                         break;
+               case MAPINFO_TYPE_INVASION:   GameType_ConfigureSliders(e, l, _("Point limit:"),     5,    0,  5, "");                         break;
+       case MAPINFO_TYPE_TEAM_DEATHMATCH:GameType_ConfigureSliders(e, l, _("Point limit:"),     5,  100,  5, "g_tdm_point_limit");        break;
+               default:                      GameType_ConfigureSliders(e, l, _("Frag limit:"),      5,  100,  5, "fraglimit_override");       break;
+       }
+
+       string x = string_null;
+       e = me.sliderTeams;
+       switch(gt)
+       {
+               case MAPINFO_TYPE_CA:               x = "g_ca_teams_override";          break;
+               case MAPINFO_TYPE_DOMINATION:       x = "g_domination_teams_override";  break;
+               case MAPINFO_TYPE_FREEZETAG:        x = "g_freezetag_teams_override";   break;
+               case MAPINFO_TYPE_KEYHUNT:          x = "g_keyhunt_teams_override";     break;
+               case MAPINFO_TYPE_TEAM_DEATHMATCH:  x = "g_tdm_teams_override";         break;
+       }
+       e.configureXonoticTextSlider(e, x);
+       e.configureXonoticTextSliderValues(e);
+       if(!x)
+               e.value = 0;
+       me.sliderTeams.disabled = me.labelTeams.disabled = !x;
+
+       me.mapListBox.refilter(me.mapListBox);
+}
+
+void XonoticServerCreateTab_gameTypeSelectNotify(entity me)
+{
+       me.setFocus(me, me.mapListBox);
+}
+
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c b/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c
deleted file mode 100644 (file)
index 9baf361..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticMapInfoDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticMapInfoDialog, fill, void(entity))
-       METHOD(XonoticMapInfoDialog, loadMapInfo, void(entity, float, entity))
-       ATTRIB(XonoticMapInfoDialog, title, string, _("Map Information"))
-       ATTRIB(XonoticMapInfoDialog, color, vector, SKINCOLOR_DIALOG_MAPINFO)
-       ATTRIB(XonoticMapInfoDialog, intendedWidth, float, 1.0)
-       ATTRIB(XonoticMapInfoDialog, rows, float, 11)
-       ATTRIB(XonoticMapInfoDialog, columns, float, 10)
-
-       ATTRIB(XonoticMapInfoDialog, previewImage, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, titleLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, authorLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, descriptionLabel, entity, NULL)
-       ATTRIB(XonoticMapInfoDialog, featuresLabel, entity, NULL)
-
-       ATTRIBARRAY(XonoticMapInfoDialog, typeLabels, entity, 24)
-
-       ATTRIB(XonoticMapInfoDialog, currentMapIndex, float, 0)
-       ATTRIB(XonoticMapInfoDialog, currentMapBSPName, string, string_null)
-       ATTRIB(XonoticMapInfoDialog, currentMapTitle, string, string_null)
-       ATTRIB(XonoticMapInfoDialog, currentMapAuthor, string, string_null)
-       ATTRIB(XonoticMapInfoDialog, currentMapDescription, string, string_null)
-       ATTRIB(XonoticMapInfoDialog, currentMapPreviewImage, string, string_null)
-ENDCLASS(XonoticMapInfoDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticMapInfoDialog_loadMapInfo(entity me, float i, entity mlb)
-{
-       me.currentMapIndex = i;
-       me.startButton.onClickEntity = mlb;
-       MapInfo_Get_ByID(i);
-
-       if(me.currentMapBSPName)
-       {
-               strunzone(me.currentMapBSPName);
-               strunzone(me.currentMapTitle);
-               strunzone(me.currentMapAuthor);
-               strunzone(me.currentMapDescription);
-               strunzone(me.currentMapPreviewImage);
-       }
-       me.currentMapBSPName = strzone(MapInfo_Map_bspname);
-       me.currentMapTitle = strzone(strdecolorize(MapInfo_Map_title));
-       me.currentMapAuthor = strzone(strdecolorize(MapInfo_Map_author));
-       me.currentMapDescription = strzone(MapInfo_Map_description);
-       me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname));
-
-       me.frame.setText(me.frame, me.currentMapBSPName);
-       me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
-       me.authorLabel.setText(me.authorLabel, me.currentMapAuthor);
-       me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription);
-       if(draw_PictureSize(me.currentMapPreviewImage) == '0 0 0')
-               me.previewImage.src = "nopreview_map";
-       else
-               me.previewImage.src = me.currentMapPreviewImage;
-
-       for(i = 0; i < GameType_GetCount(); ++i)
-       {
-               entity e;
-               e = me.(typeLabels[i]);
-               e.disabled = !(MapInfo_Map_supportedGametypes & GameType_GetID(i));
-       }
-
-       MapInfo_ClearTemps();
-}
-void XonoticMapInfoDialog_fill(entity me)
-{
-       entity e;
-       float w, wgt, i, n;
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, me.rows - 2, 3, e = makeXonoticImage(string_null, 4.0/3.0));
-               me.previewImage = e;
-       me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
-       w = me.columns - me.currentColumn;
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Title:")));
-               me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
-                       e.colorL = SKINCOLOR_MAPLIST_TITLE;
-                       e.allowCut = 1;
-                       me.titleLabel = e;
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Author:")));
-               me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
-                       e.colorL = SKINCOLOR_MAPLIST_AUTHOR;
-                       e.allowCut = 1;
-                       me.authorLabel = e;
-       me.TR(me);
-               me.TD(me, 1, w, e = makeXonoticTextLabel(0, _("Game types:")));
-
-       n = ceil(GameType_GetCount() / (me.rows - 6));
-       wgt = (w - 0.2) / n;
-       for(i = 0; i < GameType_GetCount(); ++i)
-       {
-               if(mod(i, n) == 0)
-               {
-                       me.TR(me);
-                       me.TDempty(me, 0.2);
-               }
-               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, MapInfo_Type_ToText(GameType_GetID(i))));
-                       me.(typeLabels[i]) = e;
-       }
-
-       me.gotoRC(me, me.rows - 2, 0);
-               me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, ""));
-                       e.allowCut = 1;
-                       me.descriptionLabel = e;
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TDempty(me, 0.5);
-
-               me.TD(me, 1, me.columns - 5.5, e = makeXonoticButton(_("Close"), '0 0 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-               me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeXonoticButton(ZCTX(_("MAP^Play")), '0 0 0'));
-                       me.startButton.onClick = MapList_LoadMap;
-                       me.startButton.onClickEntity = NULL; // filled later
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.qc b/qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.qc
new file mode 100644 (file)
index 0000000..9baf361
--- /dev/null
@@ -0,0 +1,119 @@
+#ifdef INTERFACE
+CLASS(XonoticMapInfoDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticMapInfoDialog, fill, void(entity))
+       METHOD(XonoticMapInfoDialog, loadMapInfo, void(entity, float, entity))
+       ATTRIB(XonoticMapInfoDialog, title, string, _("Map Information"))
+       ATTRIB(XonoticMapInfoDialog, color, vector, SKINCOLOR_DIALOG_MAPINFO)
+       ATTRIB(XonoticMapInfoDialog, intendedWidth, float, 1.0)
+       ATTRIB(XonoticMapInfoDialog, rows, float, 11)
+       ATTRIB(XonoticMapInfoDialog, columns, float, 10)
+
+       ATTRIB(XonoticMapInfoDialog, previewImage, entity, NULL)
+       ATTRIB(XonoticMapInfoDialog, titleLabel, entity, NULL)
+       ATTRIB(XonoticMapInfoDialog, authorLabel, entity, NULL)
+       ATTRIB(XonoticMapInfoDialog, descriptionLabel, entity, NULL)
+       ATTRIB(XonoticMapInfoDialog, featuresLabel, entity, NULL)
+
+       ATTRIBARRAY(XonoticMapInfoDialog, typeLabels, entity, 24)
+
+       ATTRIB(XonoticMapInfoDialog, currentMapIndex, float, 0)
+       ATTRIB(XonoticMapInfoDialog, currentMapBSPName, string, string_null)
+       ATTRIB(XonoticMapInfoDialog, currentMapTitle, string, string_null)
+       ATTRIB(XonoticMapInfoDialog, currentMapAuthor, string, string_null)
+       ATTRIB(XonoticMapInfoDialog, currentMapDescription, string, string_null)
+       ATTRIB(XonoticMapInfoDialog, currentMapPreviewImage, string, string_null)
+ENDCLASS(XonoticMapInfoDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticMapInfoDialog_loadMapInfo(entity me, float i, entity mlb)
+{
+       me.currentMapIndex = i;
+       me.startButton.onClickEntity = mlb;
+       MapInfo_Get_ByID(i);
+
+       if(me.currentMapBSPName)
+       {
+               strunzone(me.currentMapBSPName);
+               strunzone(me.currentMapTitle);
+               strunzone(me.currentMapAuthor);
+               strunzone(me.currentMapDescription);
+               strunzone(me.currentMapPreviewImage);
+       }
+       me.currentMapBSPName = strzone(MapInfo_Map_bspname);
+       me.currentMapTitle = strzone(strdecolorize(MapInfo_Map_title));
+       me.currentMapAuthor = strzone(strdecolorize(MapInfo_Map_author));
+       me.currentMapDescription = strzone(MapInfo_Map_description);
+       me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname));
+
+       me.frame.setText(me.frame, me.currentMapBSPName);
+       me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
+       me.authorLabel.setText(me.authorLabel, me.currentMapAuthor);
+       me.descriptionLabel.setText(me.descriptionLabel, me.currentMapDescription);
+       if(draw_PictureSize(me.currentMapPreviewImage) == '0 0 0')
+               me.previewImage.src = "nopreview_map";
+       else
+               me.previewImage.src = me.currentMapPreviewImage;
+
+       for(i = 0; i < GameType_GetCount(); ++i)
+       {
+               entity e;
+               e = me.(typeLabels[i]);
+               e.disabled = !(MapInfo_Map_supportedGametypes & GameType_GetID(i));
+       }
+
+       MapInfo_ClearTemps();
+}
+void XonoticMapInfoDialog_fill(entity me)
+{
+       entity e;
+       float w, wgt, i, n;
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, me.rows - 2, 3, e = makeXonoticImage(string_null, 4.0/3.0));
+               me.previewImage = e;
+       me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
+       w = me.columns - me.currentColumn;
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Title:")));
+               me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
+                       e.colorL = SKINCOLOR_MAPLIST_TITLE;
+                       e.allowCut = 1;
+                       me.titleLabel = e;
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Author:")));
+               me.TD(me, 1, w-1, e = makeXonoticTextLabel(0, ""));
+                       e.colorL = SKINCOLOR_MAPLIST_AUTHOR;
+                       e.allowCut = 1;
+                       me.authorLabel = e;
+       me.TR(me);
+               me.TD(me, 1, w, e = makeXonoticTextLabel(0, _("Game types:")));
+
+       n = ceil(GameType_GetCount() / (me.rows - 6));
+       wgt = (w - 0.2) / n;
+       for(i = 0; i < GameType_GetCount(); ++i)
+       {
+               if(mod(i, n) == 0)
+               {
+                       me.TR(me);
+                       me.TDempty(me, 0.2);
+               }
+               me.TD(me, 1, wgt, e = makeXonoticTextLabel(0, MapInfo_Type_ToText(GameType_GetID(i))));
+                       me.(typeLabels[i]) = e;
+       }
+
+       me.gotoRC(me, me.rows - 2, 0);
+               me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, ""));
+                       e.allowCut = 1;
+                       me.descriptionLabel = e;
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TDempty(me, 0.5);
+
+               me.TD(me, 1, me.columns - 5.5, e = makeXonoticButton(_("Close"), '0 0 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+               me.TD(me, 1, me.columns - 5.5, me.startButton = e = makeXonoticButton(ZCTX(_("MAP^Play")), '0 0 0'));
+                       me.startButton.onClick = MapList_LoadMap;
+                       me.startButton.onClickEntity = NULL; // filled later
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.c b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.c
deleted file mode 100644 (file)
index a4e052f..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticMutatorsDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticMutatorsDialog, toString, string(entity))
-       METHOD(XonoticMutatorsDialog, fill, void(entity))
-       METHOD(XonoticMutatorsDialog, showNotify, void(entity))
-       METHOD(XonoticMutatorsDialog, close, void(entity))
-       ATTRIB(XonoticMutatorsDialog, title, string, _("Mutators"))
-       ATTRIB(XonoticMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
-       ATTRIB(XonoticMutatorsDialog, intendedWidth, float, 0.9)
-       ATTRIB(XonoticMutatorsDialog, rows, float, 20)
-       ATTRIB(XonoticMutatorsDialog, columns, float, 6)
-       ATTRIB(XonoticMutatorsDialog, refilterEntity, entity, NULL)
-ENDCLASS(XonoticMutatorsDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticMutatorsDialog_showNotify(entity me)
-{
-       loadAllCvars(me);
-}
-
-string weaponarenastring;
-string weaponarenastring_cvar;
-string WeaponArenaString()
-{
-       string s;
-       float n, i, j;
-       entity e;
-       s = cvar_string("g_weaponarena");
-       if(s == "0")
-               return "";
-       if(s == "all" || s == "1")
-               return _("All Weapons Arena");
-       if(s == "most")
-               return _("Most Weapons Arena");
-       if(s == weaponarenastring_cvar)
-               return weaponarenastring;
-       if(weaponarenastring)
-               strunzone(weaponarenastring);
-       if(weaponarenastring_cvar)
-               strunzone(weaponarenastring_cvar);
-
-       weaponarenastring_cvar = strzone(s);
-
-       n = tokenize_console(s);
-       s = "";
-       for(i = 0; i < n; ++i)
-       {
-               for(j = WEP_FIRST; j <= WEP_LAST; ++j)
-               {
-                       e = get_weaponinfo(j);
-                       if(argv(i) == e.netname)
-                               s = strcat(s, " & ", e.message);
-               }
-       }
-       s = sprintf(_("%s Arena"), substring(s, 3, strlen(s) - 3));
-
-       weaponarenastring = strzone(s);
-
-       return weaponarenastring;
-}
-
-string XonoticMutatorsDialog_toString(entity me)
-{
-       string s;
-       s = "";
-       if(cvar("g_dodging"))
-               s = strcat(s, ", ", _("Dodging"));
-       if(cvar("g_instagib"))
-               s = strcat(s, ", ", _("InstaGib"));
-       if(cvar("g_new_toys"))
-               s = strcat(s, ", ", _("New Toys"));
-       if(cvar("g_nix"))
-               s = strcat(s, ", ", _("NIX"));
-       if(cvar("g_rocket_flying"))
-               s = strcat(s, ", ", _("Rocket Flying"));
-       if(cvar("g_invincible_projectiles"))
-               s = strcat(s, ", ", _("Invincible Projectiles"));
-       if(cvar_string("g_weaponarena") != "0")
-               s = strcat(s, ", ", WeaponArenaString());
-       if(cvar("g_balance_blaster_weaponstart") == 0)
-               s = strcat(s, ", ", _("No start weapons"));
-       if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
-               s = strcat(s, ", ", _("Low gravity"));
-       if(cvar("g_cloaked"))
-               s = strcat(s, ", ", _("Cloaked"));
-       if(cvar("g_grappling_hook"))
-               s = strcat(s, ", ", _("Hook"));
-       if(cvar("g_midair"))
-               s = strcat(s, ", ", _("Midair"));
-       if(cvar("g_vampire"))
-               s = strcat(s, ", ", _("Vampire"));
-       if(cvar("g_pinata"))
-               s = strcat(s, ", ", _("Piñata"));
-       if(cvar("g_weapon_stay"))
-               s = strcat(s, ", ", _("Weapons stay"));
-       if(cvar("g_bloodloss") > 0)
-               s = strcat(s, ", ", _("Blood loss"));
-       if(cvar("g_jetpack"))
-               s = strcat(s, ", ", _("Jet pack"));
-       if(cvar("g_buffs"))
-               s = strcat(s, ", ", _("Buffs"));
-       if(cvar("g_overkill"))
-               s = strcat(s, ", ", _("Overkill"));
-       if(cvar("g_powerups") == 0)
-               s = strcat(s, ", ", _("No powerups"));
-       if(cvar("g_powerups") > 0)
-               s = strcat(s, ", ", _("Powerups"));
-       if(cvar("g_touchexplode") > 0)
-               s = strcat(s, ", ", _("Touch explode"));
-       if(s == "")
-               return ZCTX(_("MUT^None"));
-       else
-               return substring(s, 2, strlen(s) - 2);
-}
-
-float checkCompatibility_pinata(entity me)
-{
-       if(cvar("g_instagib"))
-               return 0;
-       if(cvar("g_nix"))
-               return 0;
-       if(cvar_string("g_weaponarena") != "0")
-               return 0;
-       return 1;
-}
-float checkCompatibility_weaponstay(entity me)
-{
-       return checkCompatibility_pinata(me);
-}
-float checkCompatibility_newtoys(entity me)
-{
-       if(cvar("g_instagib"))
-               return 0;
-       if(cvar_string("g_weaponarena") == "most")
-               return 1;
-       if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
-               return 1;
-       if(cvar_string("g_weaponarena") != "0")
-               return 0;
-       return 1;
-}
-float checkCompatibility_weaponarena_weapon(entity me)
-{
-       if(cvar("g_instagib"))
-               return 0;
-       if(cvar_string("g_weaponarena") == "most")
-               return 0;
-       if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
-               return 0;
-       if(cvar_string("g_weaponarena") == "0")
-               return 0;
-       if(cvar_string("g_balance_blaster_weaponstart") == "0")
-               return 0;
-       return 1;
-}
-
-void XonoticMutatorsDialog_fill(entity me)
-{
-       entity e, s, w;
-       float i, j;
-       me.TR(me);
-               me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_dodging", _("Dodging")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_touchexplode", _("Touch explode")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_cloaked", _("Cloaked")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_buffs", _("Buffs")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_midair", _("Midair")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_vampire", _("Vampire")));
-                       setDependent(e, "g_instagib", 0, 0);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               s = makeXonoticSlider(10, 50, 1, "g_bloodloss");
-               me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
-                       setDependent(e, "g_instagib", 0, 0);
-       me.TR(me);
-               me.TDempty(me, 0.4);
-               me.TD(me, 1, 1.6, s);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               s = makeXonoticSlider(80, 400, 8, "sv_gravity");
-                       s.valueDigits = 0;
-                       s.valueDisplayMultiplier = 0.125; // show gravity in percent
-               me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
-                       e.savedValue = 200; // good on silvercity
-       me.TR(me);
-               me.TDempty(me, 0.4);
-               me.TD(me, 1, 1.6, s);
-       me.TR(me);
-               me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_grappling_hook", _("Grappling hook")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_jetpack", _("Jet pack")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
-                       setDependent(e, "g_instagib", 0, 0);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
-                       setDependentWeird(e, checkCompatibility_newtoys);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
-                       setDependent(e, "g_instagib", 0, 0);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_pinata", _("Piñata")));
-                       setDependentWeird(e, checkCompatibility_pinata);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_weapon_stay", _("Weapons stay")));
-                       setDependentWeird(e, checkCompatibility_weaponstay);
-       me.TR(me);
-
-       me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
-       me.TR(me);
-               me.TD(me, 1, 2, e = makeXonoticRadioButton(1, "g_weaponarena", "menu_weaponarena", _("Weapon arenas:")));
-                       e.getCvarValueFromCvar = TRUE;
-                       e.cvarOffValue = "0";
-       for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
-       {
-               w = get_weaponinfo(i);
-               if(w.spawnflags & WEP_FLAG_HIDDEN)
-                       continue;
-               if((j & 1) == 0)
-                       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.message)));
-                       setDependentWeird(e, checkCompatibility_weaponarena_weapon);
-               ++j;
-       }
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "most", _("Most weapons")));
-                       e.cvarOffValue = "0";
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "all", _("All weapons")));
-                       e.cvarOffValue = "0";
-       me.TR(me);
-               me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_instagib", "1", _("InstaGib")));
-                       e.cvarOffValue = "0";
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_nix", "1", _("NIX")));
-                       e.cvarOffValue = "0";
-       me.TR(me);
-               me.TDempty(me, 0.4);
-               me.TD(me, 1, 1.6, e = makeXonoticCheckBox(0, "g_nix_with_blaster", _("with blaster")));
-                       setDependent(e, "g_nix", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_balance_blaster_weaponstart", "0", _("No start weapons")));
-                       e.cvarOffValue = "-1";
-                       makeMulti(e, "g_balance_shotgun_weaponstart g_balance_machinegun_weaponstart g_balance_devastator_weaponstart g_balance_minelayer_weaponstart g_balance_electro_weaponstart g_balance_crylink_weaponstart g_balance_hagar_weaponstart g_balance_porto_weaponstart g_balance_vaporizer_weaponstart g_balance_hook_weaponstart g_balance_rifle_weaponstart g_balance_fireball_weaponstart g_balance_seeker_weaponstart g_balance_tuba_weaponstart g_balance_arc_weaponstart g_balance_vortex_weaponstart g_balance_mortar_weaponstart");
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-}
-
-void XonoticMutatorsDialog_close(entity me)
-{
-       if(me.refilterEntity)
-               me.refilterEntity.refilter(me.refilterEntity);
-       SUPER(XonoticMutatorsDialog).close(me);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc
new file mode 100644 (file)
index 0000000..d7825e0
--- /dev/null
@@ -0,0 +1,291 @@
+#include "../../common/weapons/weapons.qh"
+
+#ifdef INTERFACE
+CLASS(XonoticMutatorsDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticMutatorsDialog, toString, string(entity))
+       METHOD(XonoticMutatorsDialog, fill, void(entity))
+       METHOD(XonoticMutatorsDialog, showNotify, void(entity))
+       METHOD(XonoticMutatorsDialog, close, void(entity))
+       ATTRIB(XonoticMutatorsDialog, title, string, _("Mutators"))
+       ATTRIB(XonoticMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
+       ATTRIB(XonoticMutatorsDialog, intendedWidth, float, 0.9)
+       ATTRIB(XonoticMutatorsDialog, rows, float, 20)
+       ATTRIB(XonoticMutatorsDialog, columns, float, 6)
+       ATTRIB(XonoticMutatorsDialog, refilterEntity, entity, NULL)
+ENDCLASS(XonoticMutatorsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticMutatorsDialog_showNotify(entity me)
+{
+       loadAllCvars(me);
+}
+
+string weaponarenastring;
+string weaponarenastring_cvar;
+string WeaponArenaString()
+{
+       string s;
+       float n, i, j;
+       entity e;
+       s = cvar_string("g_weaponarena");
+       if(s == "0")
+               return "";
+       if(s == "all" || s == "1")
+               return _("All Weapons Arena");
+       if(s == "most")
+               return _("Most Weapons Arena");
+       if(s == weaponarenastring_cvar)
+               return weaponarenastring;
+       if(weaponarenastring)
+               strunzone(weaponarenastring);
+       if(weaponarenastring_cvar)
+               strunzone(weaponarenastring_cvar);
+
+       weaponarenastring_cvar = strzone(s);
+
+       n = tokenize_console(s);
+       s = "";
+       for(i = 0; i < n; ++i)
+       {
+               for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+               {
+                       e = get_weaponinfo(j);
+                       if(argv(i) == e.netname)
+                               s = strcat(s, " & ", e.message);
+               }
+       }
+       s = sprintf(_("%s Arena"), substring(s, 3, strlen(s) - 3));
+
+       weaponarenastring = strzone(s);
+
+       return weaponarenastring;
+}
+
+string XonoticMutatorsDialog_toString(entity me)
+{
+       string s;
+       s = "";
+       if(cvar("g_dodging"))
+               s = strcat(s, ", ", _("Dodging"));
+       if(cvar("g_instagib"))
+               s = strcat(s, ", ", _("InstaGib"));
+       if(cvar("g_new_toys"))
+               s = strcat(s, ", ", _("New Toys"));
+       if(cvar("g_nix"))
+               s = strcat(s, ", ", _("NIX"));
+       if(cvar("g_rocket_flying"))
+               s = strcat(s, ", ", _("Rocket Flying"));
+       if(cvar("g_invincible_projectiles"))
+               s = strcat(s, ", ", _("Invincible Projectiles"));
+       if(cvar_string("g_weaponarena") != "0")
+               s = strcat(s, ", ", WeaponArenaString());
+       if(cvar("g_balance_blaster_weaponstart") == 0)
+               s = strcat(s, ", ", _("No start weapons"));
+       if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
+               s = strcat(s, ", ", _("Low gravity"));
+       if(cvar("g_cloaked"))
+               s = strcat(s, ", ", _("Cloaked"));
+       if(cvar("g_grappling_hook"))
+               s = strcat(s, ", ", _("Hook"));
+       if(cvar("g_midair"))
+               s = strcat(s, ", ", _("Midair"));
+       if(cvar("g_vampire"))
+               s = strcat(s, ", ", _("Vampire"));
+       if(cvar("g_pinata"))
+               s = strcat(s, ", ", _("Piñata"));
+       if(cvar("g_weapon_stay"))
+               s = strcat(s, ", ", _("Weapons stay"));
+       if(cvar("g_bloodloss") > 0)
+               s = strcat(s, ", ", _("Blood loss"));
+       if(cvar("g_jetpack"))
+               s = strcat(s, ", ", _("Jet pack"));
+       if(cvar("g_buffs"))
+               s = strcat(s, ", ", _("Buffs"));
+       if(cvar("g_overkill"))
+               s = strcat(s, ", ", _("Overkill"));
+       if(cvar("g_powerups") == 0)
+               s = strcat(s, ", ", _("No powerups"));
+       if(cvar("g_powerups") > 0)
+               s = strcat(s, ", ", _("Powerups"));
+       if(cvar("g_touchexplode") > 0)
+               s = strcat(s, ", ", _("Touch explode"));
+       if(s == "")
+               return ZCTX(_("MUT^None"));
+       else
+               return substring(s, 2, strlen(s) - 2);
+}
+
+float checkCompatibility_pinata(entity me)
+{
+       if(cvar("g_instagib"))
+               return 0;
+       if(cvar("g_nix"))
+               return 0;
+       if(cvar_string("g_weaponarena") != "0")
+               return 0;
+       return 1;
+}
+float checkCompatibility_weaponstay(entity me)
+{
+       return checkCompatibility_pinata(me);
+}
+float checkCompatibility_newtoys(entity me)
+{
+       if(cvar("g_instagib"))
+               return 0;
+       if(cvar_string("g_weaponarena") == "most")
+               return 1;
+       if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
+               return 1;
+       if(cvar_string("g_weaponarena") != "0")
+               return 0;
+       return 1;
+}
+float checkCompatibility_weaponarena_weapon(entity me)
+{
+       if(cvar("g_instagib"))
+               return 0;
+       if(cvar_string("g_weaponarena") == "most")
+               return 0;
+       if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
+               return 0;
+       if(cvar_string("g_weaponarena") == "0")
+               return 0;
+       if(cvar_string("g_balance_blaster_weaponstart") == "0")
+               return 0;
+       return 1;
+}
+
+void XonoticMutatorsDialog_fill(entity me)
+{
+       entity e, s, w;
+       float i, j;
+       me.TR(me);
+               me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_dodging", _("Dodging")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_touchexplode", _("Touch explode")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_cloaked", _("Cloaked")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_buffs", _("Buffs")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_midair", _("Midair")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_vampire", _("Vampire")));
+                       setDependent(e, "g_instagib", 0, 0);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               s = makeXonoticSlider(10, 50, 1, "g_bloodloss");
+               me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
+                       setDependent(e, "g_instagib", 0, 0);
+       me.TR(me);
+               me.TDempty(me, 0.4);
+               me.TD(me, 1, 1.6, s);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               s = makeXonoticSlider(80, 400, 8, "sv_gravity");
+                       s.valueDigits = 0;
+                       s.valueDisplayMultiplier = 0.125; // show gravity in percent
+               me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
+                       e.savedValue = 200; // good on silvercity
+       me.TR(me);
+               me.TDempty(me, 0.4);
+               me.TD(me, 1, 1.6, s);
+       me.TR(me);
+               me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_grappling_hook", _("Grappling hook")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_jetpack", _("Jet pack")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
+                       setDependent(e, "g_instagib", 0, 0);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
+                       setDependentWeird(e, checkCompatibility_newtoys);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
+                       setDependent(e, "g_instagib", 0, 0);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_pinata", _("Piñata")));
+                       setDependentWeird(e, checkCompatibility_pinata);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_weapon_stay", _("Weapons stay")));
+                       setDependentWeird(e, checkCompatibility_weaponstay);
+       me.TR(me);
+
+       me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticRadioButton(1, "g_weaponarena", "menu_weaponarena", _("Weapon arenas:")));
+                       e.getCvarValueFromCvar = true;
+                       e.cvarOffValue = "0";
+       for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
+       {
+               w = get_weaponinfo(i);
+               if(w.spawnflags & WEP_FLAG_HIDDEN)
+                       continue;
+               if((j & 1) == 0)
+                       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.message)));
+                       setDependentWeird(e, checkCompatibility_weaponarena_weapon);
+               ++j;
+       }
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "most", _("Most weapons")));
+                       e.cvarOffValue = "0";
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "all", _("All weapons")));
+                       e.cvarOffValue = "0";
+       me.TR(me);
+               me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_instagib", "1", _("InstaGib")));
+                       e.cvarOffValue = "0";
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_nix", "1", _("NIX")));
+                       e.cvarOffValue = "0";
+       me.TR(me);
+               me.TDempty(me, 0.4);
+               me.TD(me, 1, 1.6, e = makeXonoticCheckBox(0, "g_nix_with_blaster", _("with blaster")));
+                       setDependent(e, "g_nix", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_balance_blaster_weaponstart", "0", _("No start weapons")));
+                       e.cvarOffValue = "-1";
+                       makeMulti(e, "g_balance_shotgun_weaponstart g_balance_machinegun_weaponstart g_balance_devastator_weaponstart g_balance_minelayer_weaponstart g_balance_electro_weaponstart g_balance_crylink_weaponstart g_balance_hagar_weaponstart g_balance_porto_weaponstart g_balance_vaporizer_weaponstart g_balance_hook_weaponstart g_balance_rifle_weaponstart g_balance_fireball_weaponstart g_balance_seeker_weaponstart g_balance_tuba_weaponstart g_balance_arc_weaponstart g_balance_vortex_weaponstart g_balance_mortar_weaponstart");
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+
+void XonoticMutatorsDialog_close(entity me)
+{
+       if(me.refilterEntity)
+               me.refilterEntity.refilter(me.refilterEntity);
+       SUPER(XonoticMutatorsDialog).close(me);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_join.c b/qcsrc/menu/xonotic/dialog_multiplayer_join.c
deleted file mode 100644 (file)
index 4636ebb..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticServerListTab) EXTENDS(XonoticTab)
-       METHOD(XonoticServerListTab, fill, void(entity))
-       ATTRIB(XonoticServerListTab, title, string, _("Join"))
-       ATTRIB(XonoticServerListTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticServerListTab, rows, float, 23)
-       ATTRIB(XonoticServerListTab, columns, float, 6.5)
-ENDCLASS(XonoticServerListTab)
-entity makeXonoticServerListTab();
-#endif
-
-#ifdef IMPLEMENTATION
-
-entity makeXonoticServerListTab()
-{
-       entity me;
-       me = spawnXonoticServerListTab();
-       me.configureDialog(me);
-       return me;
-}
-void XonoticServerListTab_fill(entity me)
-{
-       entity e, slist;
-
-       slist  = makeXonoticServerList();
-
-       me.gotoRC(me, 0.5, 0);
-               me.TD(me, 1, 0.6, e = makeXonoticTextLabel(1, _("Filter:")));
-               me.TD(me, 1, 2.8, e = makeXonoticInputBox(0, string_null));
-                       e.onChange = ServerList_Filter_Change;
-                       e.onChangeEntity = slist;
-                       slist.controlledTextbox = e;
-
-       me.gotoRC(me, 0.5, 3.6);
-               me.TD(me, 1, 0.9, e = makeXonoticCheckBox(0, "menu_slist_categories", ZCTX(_("SRVS^Categories"))));
-                       e.onClickEntity = slist;
-                       e.onClick = ServerList_Categories_Click;
-               me.TD(me, 1, 0.6, e = makeXonoticCheckBox(0, "menu_slist_showempty", ZCTX(_("SRVS^Empty"))));
-                       slist.filterShowEmpty = e.checked;
-                       e.onClickEntity = slist;
-                       e.onClick = ServerList_ShowEmpty_Click;
-               me.TD(me, 1, 0.6, e = makeXonoticCheckBox(0, "menu_slist_showfull", ZCTX(_("SRVS^Full"))));
-                       slist.filterShowFull = e.checked;
-                       e.onClickEntity = slist;
-                       e.onClick = ServerList_ShowFull_Click;
-               me.TD(me, 1, 0.6, e = makeXonoticCheckBox(0, "net_slist_pause", _("Pause")));
-
-       me.gotoRC(me, 2, 0);
-               me.TD(me, 1, 1, slist.sortButton1 = makeXonoticButton(string_null, '0 0 0'));
-               me.TD(me, 1, 1, slist.sortButton2 = makeXonoticButton(string_null, '0 0 0'));
-               me.TD(me, 1, 1, slist.sortButton3 = makeXonoticButton(string_null, '0 0 0'));
-               me.TD(me, 1, 1, slist.sortButton4 = makeXonoticButton(string_null, '0 0 0'));
-               me.TD(me, 1, 1, slist.sortButton5 = makeXonoticButton(string_null, '0 0 0'));
-       me.TR(me);
-               me.TD(me, me.rows - 5, me.columns, slist);
-
-       me.gotoRC(me, me.rows - 2, 0);
-               me.TD(me, 1, 0.6, e = makeXonoticTextLabel(0, _("Address:")));
-               me.TD(me, 1, 2.9, e = makeXonoticInputBox(0, string_null));
-                       e.onEnter = ServerList_Connect_Click;
-                       e.onEnterEntity = slist;
-                       e.onChange = ServerList_Update_favoriteButton;
-                       e.onChangeEntity = slist;
-                       slist.ipAddressBox = e;
-               me.TD(me, 1, 1.5, e = makeXonoticButton("", '0 0 0'));
-                       e.onClick = ServerList_Favorite_Click;
-                       e.onClickEntity = slist;
-                       slist.favoriteButton = e;
-               me.TD(me, 1, 1.5, e = makeXonoticButton(_("Info..."), '0 0 0'));
-                       e.onClick = ServerList_Info_Click;
-                       e.onClickEntity = slist;
-                       slist.infoButton = e;
-       me.TR(me);
-               me.TD(me, 1, me.columns, e = makeXonoticButton(_("Join!"), '0 0 0'));
-                       e.onClick = ServerList_Connect_Click;
-                       e.onClickEntity = slist;
-                       slist.connectButton = e;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_join.qc b/qcsrc/menu/xonotic/dialog_multiplayer_join.qc
new file mode 100644 (file)
index 0000000..4636ebb
--- /dev/null
@@ -0,0 +1,79 @@
+#ifdef INTERFACE
+CLASS(XonoticServerListTab) EXTENDS(XonoticTab)
+       METHOD(XonoticServerListTab, fill, void(entity))
+       ATTRIB(XonoticServerListTab, title, string, _("Join"))
+       ATTRIB(XonoticServerListTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticServerListTab, rows, float, 23)
+       ATTRIB(XonoticServerListTab, columns, float, 6.5)
+ENDCLASS(XonoticServerListTab)
+entity makeXonoticServerListTab();
+#endif
+
+#ifdef IMPLEMENTATION
+
+entity makeXonoticServerListTab()
+{
+       entity me;
+       me = spawnXonoticServerListTab();
+       me.configureDialog(me);
+       return me;
+}
+void XonoticServerListTab_fill(entity me)
+{
+       entity e, slist;
+
+       slist  = makeXonoticServerList();
+
+       me.gotoRC(me, 0.5, 0);
+               me.TD(me, 1, 0.6, e = makeXonoticTextLabel(1, _("Filter:")));
+               me.TD(me, 1, 2.8, e = makeXonoticInputBox(0, string_null));
+                       e.onChange = ServerList_Filter_Change;
+                       e.onChangeEntity = slist;
+                       slist.controlledTextbox = e;
+
+       me.gotoRC(me, 0.5, 3.6);
+               me.TD(me, 1, 0.9, e = makeXonoticCheckBox(0, "menu_slist_categories", ZCTX(_("SRVS^Categories"))));
+                       e.onClickEntity = slist;
+                       e.onClick = ServerList_Categories_Click;
+               me.TD(me, 1, 0.6, e = makeXonoticCheckBox(0, "menu_slist_showempty", ZCTX(_("SRVS^Empty"))));
+                       slist.filterShowEmpty = e.checked;
+                       e.onClickEntity = slist;
+                       e.onClick = ServerList_ShowEmpty_Click;
+               me.TD(me, 1, 0.6, e = makeXonoticCheckBox(0, "menu_slist_showfull", ZCTX(_("SRVS^Full"))));
+                       slist.filterShowFull = e.checked;
+                       e.onClickEntity = slist;
+                       e.onClick = ServerList_ShowFull_Click;
+               me.TD(me, 1, 0.6, e = makeXonoticCheckBox(0, "net_slist_pause", _("Pause")));
+
+       me.gotoRC(me, 2, 0);
+               me.TD(me, 1, 1, slist.sortButton1 = makeXonoticButton(string_null, '0 0 0'));
+               me.TD(me, 1, 1, slist.sortButton2 = makeXonoticButton(string_null, '0 0 0'));
+               me.TD(me, 1, 1, slist.sortButton3 = makeXonoticButton(string_null, '0 0 0'));
+               me.TD(me, 1, 1, slist.sortButton4 = makeXonoticButton(string_null, '0 0 0'));
+               me.TD(me, 1, 1, slist.sortButton5 = makeXonoticButton(string_null, '0 0 0'));
+       me.TR(me);
+               me.TD(me, me.rows - 5, me.columns, slist);
+
+       me.gotoRC(me, me.rows - 2, 0);
+               me.TD(me, 1, 0.6, e = makeXonoticTextLabel(0, _("Address:")));
+               me.TD(me, 1, 2.9, e = makeXonoticInputBox(0, string_null));
+                       e.onEnter = ServerList_Connect_Click;
+                       e.onEnterEntity = slist;
+                       e.onChange = ServerList_Update_favoriteButton;
+                       e.onChangeEntity = slist;
+                       slist.ipAddressBox = e;
+               me.TD(me, 1, 1.5, e = makeXonoticButton("", '0 0 0'));
+                       e.onClick = ServerList_Favorite_Click;
+                       e.onClickEntity = slist;
+                       slist.favoriteButton = e;
+               me.TD(me, 1, 1.5, e = makeXonoticButton(_("Info..."), '0 0 0'));
+                       e.onClick = ServerList_Info_Click;
+                       e.onClickEntity = slist;
+                       slist.infoButton = e;
+       me.TR(me);
+               me.TD(me, 1, me.columns, e = makeXonoticButton(_("Join!"), '0 0 0'));
+                       e.onClick = ServerList_Connect_Click;
+                       e.onClickEntity = slist;
+                       slist.connectButton = e;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.c b/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.c
deleted file mode 100644 (file)
index fa5e306..0000000
+++ /dev/null
@@ -1,345 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticServerInfoDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticServerInfoDialog, fill, void(entity))
-       METHOD(XonoticServerInfoDialog, loadServerInfo, void(entity, float))
-       ATTRIB(XonoticServerInfoDialog, title, string, _("Server Information"))
-       ATTRIB(XonoticServerInfoDialog, color, vector, SKINCOLOR_DIALOG_SERVERINFO)
-       ATTRIB(XonoticServerInfoDialog, intendedWidth, float, 0.8)
-       ATTRIB(XonoticServerInfoDialog, rows, float, 18)
-       ATTRIB(XonoticServerInfoDialog, columns, float, 6.2)
-
-       ATTRIB(XonoticServerInfoDialog, currentServerName, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerCName, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerType, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerMap, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerPlayers, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerNumPlayers, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerNumBots, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerNumFreeSlots, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerMod, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerVersion, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerKey, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerID, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerEncrypt, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerPure, string, string_null)
-
-       ATTRIB(XonoticServerInfoDialog, nameLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, cnameLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, typeLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, mapLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, rawPlayerList, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, numPlayersLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, numBotsLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, numFreeSlotsLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, modLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, versionLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, keyLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, idLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, encryptLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, canConnectLabel, entity, NULL)
-       ATTRIB(XonoticServerInfoDialog, pureLabel, entity, NULL)
-ENDCLASS(XonoticServerInfoDialog)
-
-void Join_Click(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
-{
-       float m, pure, freeslots, j, numh, maxp, numb, sflags;
-       string s, typestr, versionstr, k, v, modname;
-
-       // ====================================
-       //  First clear and unzone the strings
-       // ====================================
-       if(me.currentServerName)
-               strunzone(me.currentServerName);
-       me.currentServerName = string_null;
-
-       if(me.currentServerCName)
-               strunzone(me.currentServerCName);
-       me.currentServerCName = string_null;
-
-       if(me.currentServerType)
-               strunzone(me.currentServerType);
-       me.currentServerType = string_null;
-
-       if(me.currentServerMap)
-               strunzone(me.currentServerMap);
-       me.currentServerMap = string_null;
-
-       if(me.currentServerPlayers)
-               strunzone(me.currentServerPlayers);
-       me.currentServerPlayers = string_null;
-
-       if(me.currentServerNumPlayers)
-               strunzone(me.currentServerNumPlayers);
-       me.currentServerNumPlayers = string_null;
-
-       if(me.currentServerNumBots)
-               strunzone(me.currentServerNumBots);
-       me.currentServerNumBots = string_null;
-
-       if(me.currentServerNumFreeSlots)
-               strunzone(me.currentServerNumFreeSlots);
-       me.currentServerNumFreeSlots = string_null;
-
-       if(me.currentServerMod)
-               strunzone(me.currentServerMod);
-       me.currentServerMod = string_null;
-
-       if(me.currentServerVersion)
-               strunzone(me.currentServerVersion);
-       me.currentServerVersion = string_null;
-
-       // not zoned!
-       //if(me.currentServerEncrypt)
-       //      strunzone(me.currentServerEncrypt);
-       //me.currentServerEncrypt = string_null;
-       if(me.currentServerPure)
-               strunzone(me.currentServerPure);
-       me.currentServerPure = string_null;
-
-       if(me.currentServerKey)
-               strunzone(me.currentServerKey);
-       me.currentServerKey = string_null;
-
-       if(me.currentServerID)
-               strunzone(me.currentServerID);
-       me.currentServerID = string_null;
-
-       // ==========================
-       //  Now, fill in the strings
-       // ==========================
-       me.currentServerName = strzone(gethostcachestring(SLIST_FIELD_NAME, i));
-       me.nameLabel.setText(me.nameLabel, me.currentServerName);
-
-       me.currentServerCName = strzone(gethostcachestring(SLIST_FIELD_CNAME, i));
-       me.cnameLabel.setText(me.cnameLabel, me.currentServerCName);
-
-       pure = -1;
-       typestr = _("N/A");
-       versionstr = _("N/A");
-
-       s = gethostcachestring(SLIST_FIELD_QCSTATUS, i);
-       m = tokenizebyseparator(s, ":");
-       if(m >= 2)
-       {
-               typestr = argv(0);
-               versionstr = argv(1);
-       }
-       freeslots = -1;
-       sflags = -1;
-       modname = "";
-       for(j = 2; j < m; ++j)
-       {
-               if(argv(j) == "")
-                       break;
-               k = substring(argv(j), 0, 1);
-               v = substring(argv(j), 1, -1);
-               if(k == "P")
-                       pure = stof(v);
-               else if(k == "S")
-                       freeslots = stof(v);
-               else if(k == "F")
-                       sflags = stof(v);
-               else if(k == "M")
-                       modname = v;
-       }
-
-#ifdef COMPAT_NO_MOD_IS_XONOTIC
-       if(modname == "")
-               modname = "Xonotic";
-#endif
-
-       s = gethostcachestring(SLIST_FIELD_MOD, i);
-       if(s != "data")
-               modname = sprintf("%s (%s)", modname, s);
-
-       j = MapInfo_Type_FromString(typestr); // try and get the real name of the game type
-       if(j) { typestr = MapInfo_Type_ToText(j); } // only set it if we actually found it
-
-       me.currentServerType = strzone(typestr);
-       me.typeLabel.setText(me.typeLabel, me.currentServerType);
-
-       me.currentServerMap = strzone(gethostcachestring(SLIST_FIELD_MAP, i));
-       me.mapLabel.setText(me.mapLabel, me.currentServerMap);
-
-       me.currentServerPlayers = strzone(gethostcachestring(SLIST_FIELD_PLAYERS, i));
-       me.rawPlayerList.setPlayerList(me.rawPlayerList, me.currentServerPlayers);
-
-       numh = gethostcachenumber(SLIST_FIELD_NUMHUMANS, i);
-       maxp = gethostcachenumber(SLIST_FIELD_MAXPLAYERS, i);
-       numb = gethostcachenumber(SLIST_FIELD_NUMBOTS, i);
-       me.currentServerNumPlayers = strzone(sprintf("%d/%d", numh, maxp));
-       me.numPlayersLabel.setText(me.numPlayersLabel, me.currentServerNumPlayers);
-
-       s = ftos(numb);
-       me.currentServerNumBots = strzone(s);
-       me.numBotsLabel.setText(me.numBotsLabel, me.currentServerNumBots);
-
-       if(freeslots < 0) { freeslots = maxp - numh - numb; }
-       s = ftos(freeslots);
-       me.currentServerNumFreeSlots = strzone(s);
-       me.numFreeSlotsLabel.setText(me.numFreeSlotsLabel, me.currentServerNumFreeSlots);
-
-       me.currentServerMod = ((modname == "Xonotic") ? _("Default") : modname);
-       me.currentServerMod = strzone(me.currentServerMod);
-       me.modLabel.setText(me.modLabel, me.currentServerMod);
-
-       me.currentServerVersion = strzone(versionstr);
-       me.versionLabel.setText(me.versionLabel, me.currentServerVersion);
-
-       me.currentServerPure = ((pure < 0) ? _("N/A") : (pure == 0) ? _("Official") : sprintf(_("%d modified"), pure));
-       me.currentServerPure = strzone(me.currentServerPure);
-       me.pureLabel.setText(me.pureLabel, me.currentServerPure);
-
-       s = crypto_getencryptlevel(me.currentServerCName);
-       if(s == "")
-       {
-               if(cvar("crypto_aeslevel") >= 3)
-                       me.currentServerEncrypt = _("N/A (auth library missing, can't connect)");
-               else
-                       me.currentServerEncrypt = _("N/A (auth library missing)");
-       }
-       else switch(stof(substring(s, 0, 1)))
-       {
-               case 0:
-                       if(cvar("crypto_aeslevel") >= 3)
-                               me.currentServerEncrypt = _("Not supported (can't connect)");
-                       else
-                               me.currentServerEncrypt = _("Not supported (won't encrypt)");
-                       break;
-               case 1:
-                       if(cvar("crypto_aeslevel") >= 2)
-                               me.currentServerEncrypt = _("Supported (will encrypt)");
-                       else
-                               me.currentServerEncrypt = _("Supported (won't encrypt)");
-                       break;
-               case 2:
-                       if(cvar("crypto_aeslevel") >= 1)
-                               me.currentServerEncrypt = _("Requested (will encrypt)");
-                       else
-                               me.currentServerEncrypt = _("Requested (won't encrypt)");
-                       break;
-               case 3:
-                       if(cvar("crypto_aeslevel") <= 0)
-                               me.currentServerEncrypt = _("Required (can't connect)");
-                       else
-                               me.currentServerEncrypt = _("Required (will encrypt)");
-                       break;
-       }
-       me.encryptLabel.setText(me.encryptLabel, me.currentServerEncrypt);
-
-       s = crypto_getidfp(me.currentServerCName);
-       if (!s) { s = _("N/A"); }
-       me.currentServerID = strzone(s);
-       me.idLabel.setText(me.idLabel, me.currentServerID);
-
-       s = crypto_getkeyfp(me.currentServerCName);
-       if (!s) { s = _("N/A"); }
-       me.currentServerKey = strzone(s);
-       me.keyLabel.setText(me.keyLabel, me.currentServerKey);
-}
-
-void XonoticServerInfoDialog_fill(entity me)
-{
-       entity e;
-       me.TR(me);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Hostname:")));
-               me.TD(me, 1, 4.6, e = makeXonoticTextLabel(0.5, ""));
-               e.colorL = SKINCOLOR_SERVERINFO_NAME;
-               e.allowCut = 1;
-               me.nameLabel = e;
-       me.TR(me);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Address:")));
-               me.TD(me, 1, 4.6, e = makeXonoticTextLabel(0.5, ""));
-               e.colorL = SKINCOLOR_SERVERINFO_IP;
-               e.allowCut = 1;
-               me.cnameLabel = e;
-
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Gametype:")));
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
-               e.allowCut = 1;
-               me.typeLabel = e;
-       me.TR(me);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Map:")));
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
-               e.allowCut = 1;
-               me.mapLabel = e;
-       me.TR(me);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Mod:")));
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
-               e.allowCut = 1;
-               me.modLabel = e;
-       me.TR(me);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Version:")));
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
-               e.allowCut = 1;
-               me.versionLabel = e;
-       me.TR(me);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Settings:")));
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
-               e.allowCut = 1;
-               me.pureLabel = e;
-
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Players:")));
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
-               e.allowCut = 1;
-               me.numPlayersLabel = e;
-       me.TR(me);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Bots:")));
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
-               e.allowCut = 1;
-               me.numBotsLabel = e;
-       me.TR(me);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Free slots:")));
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
-               e.allowCut = 1;
-               me.numFreeSlotsLabel = e;
-
-       me.gotoRC(me, me.rows - 5, 0);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Encryption:")));
-               me.TD(me, 1, 5.4, e = makeXonoticTextLabel(0, ""));
-                       e.allowCut = 1;
-                       me.encryptLabel = e;
-       me.TR(me);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("ID:")));
-               me.TD(me, 1, 5.4, e = makeXonoticTextLabel(0, ""));
-                       e.allowCut = 1;
-                       me.keyLabel = e;
-       me.TR(me);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Key:")));
-               me.TD(me, 1, 5.4, e = makeXonoticTextLabel(0, ""));
-                       e.allowCut = 1;
-                       me.idLabel = e;
-
-       me.gotoRC(me, 2, 2.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Players:")));
-       me.TR(me);
-               me.TD(me, me.rows - 8, 4, e = makeXonoticPlayerList());
-                       me.rawPlayerList = e;
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Close"), '0 0 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-               //me.TD(me, 1, me.columns/3, e = makeXonoticButton("", '0 0 0')); // TODO: Add bookmark button here
-               //      e.onClick = ServerList_Favorite_Click;
-               //      e.onClickEntity = slist;
-               //      slist.favoriteButton = e;
-               me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Join!"), '0 0 0'));
-                       e.onClick = Join_Click;
-                       e.onClickEntity = me;
-}
-
-void Join_Click(entity btn, entity me)
-{
-       localcmd("connect ", me.currentServerCName, "\n");
-}
-
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qc b/qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.qc
new file mode 100644 (file)
index 0000000..dabb1be
--- /dev/null
@@ -0,0 +1,347 @@
+#include "../../common/mapinfo.qh"
+
+#ifdef INTERFACE
+CLASS(XonoticServerInfoDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticServerInfoDialog, fill, void(entity))
+       METHOD(XonoticServerInfoDialog, loadServerInfo, void(entity, float))
+       ATTRIB(XonoticServerInfoDialog, title, string, _("Server Information"))
+       ATTRIB(XonoticServerInfoDialog, color, vector, SKINCOLOR_DIALOG_SERVERINFO)
+       ATTRIB(XonoticServerInfoDialog, intendedWidth, float, 0.8)
+       ATTRIB(XonoticServerInfoDialog, rows, float, 18)
+       ATTRIB(XonoticServerInfoDialog, columns, float, 6.2)
+
+       ATTRIB(XonoticServerInfoDialog, currentServerName, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerCName, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerType, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerMap, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerPlayers, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerNumPlayers, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerNumBots, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerNumFreeSlots, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerMod, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerVersion, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerKey, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerID, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerEncrypt, string, string_null)
+       ATTRIB(XonoticServerInfoDialog, currentServerPure, string, string_null)
+
+       ATTRIB(XonoticServerInfoDialog, nameLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, cnameLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, typeLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, mapLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, rawPlayerList, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, numPlayersLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, numBotsLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, numFreeSlotsLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, modLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, versionLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, keyLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, idLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, encryptLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, canConnectLabel, entity, NULL)
+       ATTRIB(XonoticServerInfoDialog, pureLabel, entity, NULL)
+ENDCLASS(XonoticServerInfoDialog)
+
+void Join_Click(entity btn, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
+{
+       float m, pure, freeslots, j, numh, maxp, numb, sflags;
+       string s, typestr, versionstr, k, v, modname;
+
+       // ====================================
+       //  First clear and unzone the strings
+       // ====================================
+       if(me.currentServerName)
+               strunzone(me.currentServerName);
+       me.currentServerName = string_null;
+
+       if(me.currentServerCName)
+               strunzone(me.currentServerCName);
+       me.currentServerCName = string_null;
+
+       if(me.currentServerType)
+               strunzone(me.currentServerType);
+       me.currentServerType = string_null;
+
+       if(me.currentServerMap)
+               strunzone(me.currentServerMap);
+       me.currentServerMap = string_null;
+
+       if(me.currentServerPlayers)
+               strunzone(me.currentServerPlayers);
+       me.currentServerPlayers = string_null;
+
+       if(me.currentServerNumPlayers)
+               strunzone(me.currentServerNumPlayers);
+       me.currentServerNumPlayers = string_null;
+
+       if(me.currentServerNumBots)
+               strunzone(me.currentServerNumBots);
+       me.currentServerNumBots = string_null;
+
+       if(me.currentServerNumFreeSlots)
+               strunzone(me.currentServerNumFreeSlots);
+       me.currentServerNumFreeSlots = string_null;
+
+       if(me.currentServerMod)
+               strunzone(me.currentServerMod);
+       me.currentServerMod = string_null;
+
+       if(me.currentServerVersion)
+               strunzone(me.currentServerVersion);
+       me.currentServerVersion = string_null;
+
+       // not zoned!
+       //if(me.currentServerEncrypt)
+       //      strunzone(me.currentServerEncrypt);
+       //me.currentServerEncrypt = string_null;
+       if(me.currentServerPure)
+               strunzone(me.currentServerPure);
+       me.currentServerPure = string_null;
+
+       if(me.currentServerKey)
+               strunzone(me.currentServerKey);
+       me.currentServerKey = string_null;
+
+       if(me.currentServerID)
+               strunzone(me.currentServerID);
+       me.currentServerID = string_null;
+
+       // ==========================
+       //  Now, fill in the strings
+       // ==========================
+       me.currentServerName = strzone(gethostcachestring(SLIST_FIELD_NAME, i));
+       me.nameLabel.setText(me.nameLabel, me.currentServerName);
+
+       me.currentServerCName = strzone(gethostcachestring(SLIST_FIELD_CNAME, i));
+       me.cnameLabel.setText(me.cnameLabel, me.currentServerCName);
+
+       pure = -1;
+       typestr = _("N/A");
+       versionstr = _("N/A");
+
+       s = gethostcachestring(SLIST_FIELD_QCSTATUS, i);
+       m = tokenizebyseparator(s, ":");
+       if(m >= 2)
+       {
+               typestr = argv(0);
+               versionstr = argv(1);
+       }
+       freeslots = -1;
+       sflags = -1;
+       modname = "";
+       for(j = 2; j < m; ++j)
+       {
+               if(argv(j) == "")
+                       break;
+               k = substring(argv(j), 0, 1);
+               v = substring(argv(j), 1, -1);
+               if(k == "P")
+                       pure = stof(v);
+               else if(k == "S")
+                       freeslots = stof(v);
+               else if(k == "F")
+                       sflags = stof(v);
+               else if(k == "M")
+                       modname = v;
+       }
+
+#ifdef COMPAT_NO_MOD_IS_XONOTIC
+       if(modname == "")
+               modname = "Xonotic";
+#endif
+
+       s = gethostcachestring(SLIST_FIELD_MOD, i);
+       if(s != "data")
+               modname = sprintf("%s (%s)", modname, s);
+
+       j = MapInfo_Type_FromString(typestr); // try and get the real name of the game type
+       if(j) { typestr = MapInfo_Type_ToText(j); } // only set it if we actually found it
+
+       me.currentServerType = strzone(typestr);
+       me.typeLabel.setText(me.typeLabel, me.currentServerType);
+
+       me.currentServerMap = strzone(gethostcachestring(SLIST_FIELD_MAP, i));
+       me.mapLabel.setText(me.mapLabel, me.currentServerMap);
+
+       me.currentServerPlayers = strzone(gethostcachestring(SLIST_FIELD_PLAYERS, i));
+       me.rawPlayerList.setPlayerList(me.rawPlayerList, me.currentServerPlayers);
+
+       numh = gethostcachenumber(SLIST_FIELD_NUMHUMANS, i);
+       maxp = gethostcachenumber(SLIST_FIELD_MAXPLAYERS, i);
+       numb = gethostcachenumber(SLIST_FIELD_NUMBOTS, i);
+       me.currentServerNumPlayers = strzone(sprintf("%d/%d", numh, maxp));
+       me.numPlayersLabel.setText(me.numPlayersLabel, me.currentServerNumPlayers);
+
+       s = ftos(numb);
+       me.currentServerNumBots = strzone(s);
+       me.numBotsLabel.setText(me.numBotsLabel, me.currentServerNumBots);
+
+       if(freeslots < 0) { freeslots = maxp - numh - numb; }
+       s = ftos(freeslots);
+       me.currentServerNumFreeSlots = strzone(s);
+       me.numFreeSlotsLabel.setText(me.numFreeSlotsLabel, me.currentServerNumFreeSlots);
+
+       me.currentServerMod = ((modname == "Xonotic") ? _("Default") : modname);
+       me.currentServerMod = strzone(me.currentServerMod);
+       me.modLabel.setText(me.modLabel, me.currentServerMod);
+
+       me.currentServerVersion = strzone(versionstr);
+       me.versionLabel.setText(me.versionLabel, me.currentServerVersion);
+
+       me.currentServerPure = ((pure < 0) ? _("N/A") : (pure == 0) ? _("Official") : sprintf(_("%d modified"), pure));
+       me.currentServerPure = strzone(me.currentServerPure);
+       me.pureLabel.setText(me.pureLabel, me.currentServerPure);
+
+       s = crypto_getencryptlevel(me.currentServerCName);
+       if(s == "")
+       {
+               if(cvar("crypto_aeslevel") >= 3)
+                       me.currentServerEncrypt = _("N/A (auth library missing, can't connect)");
+               else
+                       me.currentServerEncrypt = _("N/A (auth library missing)");
+       }
+       else switch(stof(substring(s, 0, 1)))
+       {
+               case 0:
+                       if(cvar("crypto_aeslevel") >= 3)
+                               me.currentServerEncrypt = _("Not supported (can't connect)");
+                       else
+                               me.currentServerEncrypt = _("Not supported (won't encrypt)");
+                       break;
+               case 1:
+                       if(cvar("crypto_aeslevel") >= 2)
+                               me.currentServerEncrypt = _("Supported (will encrypt)");
+                       else
+                               me.currentServerEncrypt = _("Supported (won't encrypt)");
+                       break;
+               case 2:
+                       if(cvar("crypto_aeslevel") >= 1)
+                               me.currentServerEncrypt = _("Requested (will encrypt)");
+                       else
+                               me.currentServerEncrypt = _("Requested (won't encrypt)");
+                       break;
+               case 3:
+                       if(cvar("crypto_aeslevel") <= 0)
+                               me.currentServerEncrypt = _("Required (can't connect)");
+                       else
+                               me.currentServerEncrypt = _("Required (will encrypt)");
+                       break;
+       }
+       me.encryptLabel.setText(me.encryptLabel, me.currentServerEncrypt);
+
+       s = crypto_getidfp(me.currentServerCName);
+       if (!s) { s = _("N/A"); }
+       me.currentServerID = strzone(s);
+       me.idLabel.setText(me.idLabel, me.currentServerID);
+
+       s = crypto_getkeyfp(me.currentServerCName);
+       if (!s) { s = _("N/A"); }
+       me.currentServerKey = strzone(s);
+       me.keyLabel.setText(me.keyLabel, me.currentServerKey);
+}
+
+void XonoticServerInfoDialog_fill(entity me)
+{
+       entity e;
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Hostname:")));
+               me.TD(me, 1, 4.6, e = makeXonoticTextLabel(0.5, ""));
+               e.colorL = SKINCOLOR_SERVERINFO_NAME;
+               e.allowCut = 1;
+               me.nameLabel = e;
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Address:")));
+               me.TD(me, 1, 4.6, e = makeXonoticTextLabel(0.5, ""));
+               e.colorL = SKINCOLOR_SERVERINFO_IP;
+               e.allowCut = 1;
+               me.cnameLabel = e;
+
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Gametype:")));
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
+               e.allowCut = 1;
+               me.typeLabel = e;
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Map:")));
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
+               e.allowCut = 1;
+               me.mapLabel = e;
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Mod:")));
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
+               e.allowCut = 1;
+               me.modLabel = e;
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Version:")));
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
+               e.allowCut = 1;
+               me.versionLabel = e;
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Settings:")));
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
+               e.allowCut = 1;
+               me.pureLabel = e;
+
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Players:")));
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
+               e.allowCut = 1;
+               me.numPlayersLabel = e;
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Bots:")));
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
+               e.allowCut = 1;
+               me.numBotsLabel = e;
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Free slots:")));
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, ""));
+               e.allowCut = 1;
+               me.numFreeSlotsLabel = e;
+
+       me.gotoRC(me, me.rows - 5, 0);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Encryption:")));
+               me.TD(me, 1, 5.4, e = makeXonoticTextLabel(0, ""));
+                       e.allowCut = 1;
+                       me.encryptLabel = e;
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("ID:")));
+               me.TD(me, 1, 5.4, e = makeXonoticTextLabel(0, ""));
+                       e.allowCut = 1;
+                       me.keyLabel = e;
+       me.TR(me);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Key:")));
+               me.TD(me, 1, 5.4, e = makeXonoticTextLabel(0, ""));
+                       e.allowCut = 1;
+                       me.idLabel = e;
+
+       me.gotoRC(me, 2, 2.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Players:")));
+       me.TR(me);
+               me.TD(me, me.rows - 8, 4, e = makeXonoticPlayerList());
+                       me.rawPlayerList = e;
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Close"), '0 0 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+               //me.TD(me, 1, me.columns/3, e = makeXonoticButton("", '0 0 0')); // TODO: Add bookmark button here
+               //      e.onClick = ServerList_Favorite_Click;
+               //      e.onClickEntity = slist;
+               //      slist.favoriteButton = e;
+               me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Join!"), '0 0 0'));
+                       e.onClick = Join_Click;
+                       e.onClickEntity = me;
+}
+
+void Join_Click(entity btn, entity me)
+{
+       localcmd("connect ", me.currentServerCName, "\n");
+}
+
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media.c b/qcsrc/menu/xonotic/dialog_multiplayer_media.c
deleted file mode 100644 (file)
index a0b49b1..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticMediaTab) EXTENDS(XonoticTab)
-       METHOD(XonoticMediaTab, fill, void(entity))
-       ATTRIB(XonoticMediaTab, title, string, _("Media"))
-       ATTRIB(XonoticMediaTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticMediaTab, rows, float, 23)
-       ATTRIB(XonoticMediaTab, columns, float, 3)
-       ATTRIB(XonoticMediaTab, name, string, "Media")  
-ENDCLASS(XonoticMediaTab)
-entity makeXonoticMediaTab();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticMediaTab()
-{
-       entity me;
-       me = spawnXonoticMediaTab();
-       me.configureDialog(me);
-       return me;
-}
-void XonoticMediaTab_fill(entity me)
-{
-       entity mc, e;
-       mc = makeXonoticTabController(me.rows - 2);
-
-       me.gotoRC(me, 0.5, 0);
-               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Demos"), makeXonoticDemoBrowserTab()));
-               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Screenshots"), makeXonoticScreenshotBrowserTab()));
-               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Music Player"), makeXonoticMusicPlayerTab()));
-
-       me.gotoRC(me, 3, 0);
-               me.TD(me, me.rows - 2, me.columns, mc);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media.qc b/qcsrc/menu/xonotic/dialog_multiplayer_media.qc
new file mode 100644 (file)
index 0000000..1ec0c76
--- /dev/null
@@ -0,0 +1,34 @@
+#ifdef INTERFACE
+CLASS(XonoticMediaTab) EXTENDS(XonoticTab)
+       METHOD(XonoticMediaTab, fill, void(entity))
+       ATTRIB(XonoticMediaTab, title, string, _("Media"))
+       ATTRIB(XonoticMediaTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticMediaTab, rows, float, 23)
+       ATTRIB(XonoticMediaTab, columns, float, 3)
+       ATTRIB(XonoticMediaTab, name, string, "Media")
+ENDCLASS(XonoticMediaTab)
+entity makeXonoticMediaTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticMediaTab()
+{
+       entity me;
+       me = spawnXonoticMediaTab();
+       me.configureDialog(me);
+       return me;
+}
+void XonoticMediaTab_fill(entity me)
+{
+       entity mc, e;
+       mc = makeXonoticTabController(me.rows - 2);
+
+       me.gotoRC(me, 0.5, 0);
+               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Demos"), makeXonoticDemoBrowserTab()));
+               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Screenshots"), makeXonoticScreenshotBrowserTab()));
+               me.TD(me, 1, 1, e = mc.makeTabButton(mc, _("Music Player"), makeXonoticMusicPlayerTab()));
+
+       me.gotoRC(me, 3, 0);
+               me.TD(me, me.rows - 2, me.columns, mc);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_demo.c b/qcsrc/menu/xonotic/dialog_multiplayer_media_demo.c
deleted file mode 100644 (file)
index 0923551..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticDemoBrowserTab) EXTENDS(XonoticTab)
-       METHOD(XonoticDemoBrowserTab, fill, void(entity))
-       ATTRIB(XonoticDemoBrowserTab, title, string, _("Demo"))
-       ATTRIB(XonoticDemoBrowserTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticDemoBrowserTab, rows, float, 21)
-       ATTRIB(XonoticDemoBrowserTab, columns, float, 6.5)
-       ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
-       ATTRIB(XonoticDemoBrowserTab, democlicktype, float, 0)
-ENDCLASS(XonoticDemoBrowserTab)
-entity makeXonoticDemoBrowserTab();
-const float DMO_PLAY = 1;
-const float DMO_TIME = 2;
-#endif
-
-#ifdef IMPLEMENTATION
-void DemoConfirm_Check_Gamestatus(entity btn, entity me)
-{
-       if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, lets watch the demo
-       {
-               if(btn.democlicktype == DMO_PLAY)
-                       { demolist.startDemo(demolist); }
-               else if(btn.democlicktype == DMO_TIME)
-                       { demolist.timeDemo(demolist); }
-       }
-       else // already in a match, player has to confirm
-       {
-               if(btn.democlicktype == DMO_PLAY)
-                       { DialogOpenButton_Click(btn, main.demostartconfirmDialog); }
-               else if(btn.democlicktype == DMO_TIME)
-                       { DialogOpenButton_Click(btn, main.demotimeconfirmDialog); }
-       }
-}
-
-entity makeXonoticDemoBrowserTab()
-{
-       entity me;
-       me = spawnXonoticDemoBrowserTab();
-       me.configureDialog(me);
-       return me;
-}
-void XonoticDemoBrowserTab_fill(entity me)
-{
-       entity e;
-       demolist = makeXonoticDemoList();
-
-       me.TR(me);
-               me.TD(me, 1, 0.6, e = makeXonoticTextLabel(1, _("Filter:")));
-               me.TD(me, 1, 2.9, e = makeXonoticInputBox(0, string_null));
-                       e.onChange = DemoList_Filter_Change;
-                       e.onChangeEntity = demolist;
-                       demolist.controlledTextbox = e;
-
-       me.gotoRC(me, 0, 3.7);
-               me.TD(me, 1, 1.5, e = makeXonoticCheckBox(0, "cl_autodemo", _("Auto record demos")));
-               me.TD(me, 1, 1, e = makeXonoticButton(_("Refresh"), '0 0 0'));
-                       e.onClick = DemoList_Refresh_Click;
-                       e.onClickEntity = demolist;
-
-       me.gotoRC(me, 1.5, 0);
-               me.TD(me, me.rows - 2.5, me.columns, demolist);
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Timedemo"), '0 0 0'));
-                       e.democlicktype = DMO_TIME;
-                       e.onClick = DemoConfirm_Check_Gamestatus;
-                       e.onClickEntity = me; // demolist is global anyway
-               me.TD(me, 1, me.columns / 2, e = makeXonoticButton(ZCTX(_("DEMO^Play")), '0 0 0'));
-                       e.democlicktype = DMO_PLAY;
-                       e.onClick = DemoConfirm_Check_Gamestatus;
-                       e.onClickEntity = me; // demolist is global anyway
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_demo.qc b/qcsrc/menu/xonotic/dialog_multiplayer_media_demo.qc
new file mode 100644 (file)
index 0000000..ab2886a
--- /dev/null
@@ -0,0 +1,76 @@
+#ifdef INTERFACE
+CLASS(XonoticDemoBrowserTab) EXTENDS(XonoticTab)
+       METHOD(XonoticDemoBrowserTab, fill, void(entity))
+       ATTRIB(XonoticDemoBrowserTab, title, string, _("Demo"))
+       ATTRIB(XonoticDemoBrowserTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticDemoBrowserTab, rows, float, 21)
+       ATTRIB(XonoticDemoBrowserTab, columns, float, 6.5)
+       ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
+       ATTRIB(XonoticDemoBrowserTab, democlicktype, float, 0)
+ENDCLASS(XonoticDemoBrowserTab)
+entity makeXonoticDemoBrowserTab();
+#ifdef IMPLEMENTATION
+// private:
+const float DMO_PLAY = 1;
+const float DMO_TIME = 2;
+#endif
+#endif
+
+#ifdef IMPLEMENTATION
+void DemoConfirm_Check_Gamestatus(entity btn, entity me)
+{
+       if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, lets watch the demo
+       {
+               if(btn.democlicktype == DMO_PLAY)
+                       { demolist.startDemo(demolist); }
+               else if(btn.democlicktype == DMO_TIME)
+                       { demolist.timeDemo(demolist); }
+       }
+       else // already in a match, player has to confirm
+       {
+               if(btn.democlicktype == DMO_PLAY)
+                       { DialogOpenButton_Click(btn, main.demostartconfirmDialog); }
+               else if(btn.democlicktype == DMO_TIME)
+                       { DialogOpenButton_Click(btn, main.demotimeconfirmDialog); }
+       }
+}
+
+entity makeXonoticDemoBrowserTab()
+{
+       entity me;
+       me = spawnXonoticDemoBrowserTab();
+       me.configureDialog(me);
+       return me;
+}
+void XonoticDemoBrowserTab_fill(entity me)
+{
+       entity e;
+       demolist = makeXonoticDemoList();
+
+       me.TR(me);
+               me.TD(me, 1, 0.6, e = makeXonoticTextLabel(1, _("Filter:")));
+               me.TD(me, 1, 2.9, e = makeXonoticInputBox(0, string_null));
+                       e.onChange = DemoList_Filter_Change;
+                       e.onChangeEntity = demolist;
+                       demolist.controlledTextbox = e;
+
+       me.gotoRC(me, 0, 3.7);
+               me.TD(me, 1, 1.5, e = makeXonoticCheckBox(0, "cl_autodemo", _("Auto record demos")));
+               me.TD(me, 1, 1, e = makeXonoticButton(_("Refresh"), '0 0 0'));
+                       e.onClick = DemoList_Refresh_Click;
+                       e.onClickEntity = demolist;
+
+       me.gotoRC(me, 1.5, 0);
+               me.TD(me, me.rows - 2.5, me.columns, demolist);
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Timedemo"), '0 0 0'));
+                       e.democlicktype = DMO_TIME;
+                       e.onClick = DemoConfirm_Check_Gamestatus;
+                       e.onClickEntity = me; // demolist is global anyway
+               me.TD(me, 1, me.columns / 2, e = makeXonoticButton(ZCTX(_("DEMO^Play")), '0 0 0'));
+                       e.democlicktype = DMO_PLAY;
+                       e.onClick = DemoConfirm_Check_Gamestatus;
+                       e.onClickEntity = me; // demolist is global anyway
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_demo_startconfirm.c b/qcsrc/menu/xonotic/dialog_multiplayer_media_demo_startconfirm.c
deleted file mode 100644 (file)
index a5a97c5..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticDemoStartConfirmDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticDemoStartConfirmDialog, fill, void(entity))
-       ATTRIB(XonoticDemoStartConfirmDialog, title, string, _("Disconnect"))
-       ATTRIB(XonoticDemoStartConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
-       ATTRIB(XonoticDemoStartConfirmDialog, intendedWidth, float, 0.5)
-       ATTRIB(XonoticDemoStartConfirmDialog, rows, float, 4)
-       ATTRIB(XonoticDemoStartConfirmDialog, columns, float, 2)
-ENDCLASS(XonoticDemoStartConfirmDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void Handle_StartDemo_Click(entity unused, entity me) { demolist.startDemo(demolist); }
-void XonoticDemoStartConfirmDialog_fill(entity me)
-{
-       entity e;
-
-       me.TR(me);
-               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Playing a demo will disconnect you from the current match.")));
-       me.TR(me);
-               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Do you really wish to disconnect now?")));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticButton(ZCTX(_("DMCNFRM^Yes")), '1 0 0'));
-                       e.onClick = Handle_StartDemo_Click;
-                       e.onClickEntity = demolist;
-               me.TD(me, 1, 1, e = makeXonoticButton(ZCTX(_("DMCNFRM^No")), '0 1 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_demo_startconfirm.qc b/qcsrc/menu/xonotic/dialog_multiplayer_media_demo_startconfirm.qc
new file mode 100644 (file)
index 0000000..136997e
--- /dev/null
@@ -0,0 +1,31 @@
+#ifdef INTERFACE
+CLASS(XonoticDemoStartConfirmDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticDemoStartConfirmDialog, fill, void(entity))
+       ATTRIB(XonoticDemoStartConfirmDialog, title, string, _("Disconnect"))
+       ATTRIB(XonoticDemoStartConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+       ATTRIB(XonoticDemoStartConfirmDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticDemoStartConfirmDialog, rows, float, 4)
+       ATTRIB(XonoticDemoStartConfirmDialog, columns, float, 2)
+ENDCLASS(XonoticDemoStartConfirmDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void Handle_StartDemo_Click(entity unused, entity me) { demolist.startDemo(demolist); }
+void XonoticDemoStartConfirmDialog_fill(entity me)
+{
+       entity e;
+
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Playing a demo will disconnect you from the current match.")));
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Do you really wish to disconnect now?")));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticButton(_("Yes"), '1 0 0'));
+                       e.onClick = Handle_StartDemo_Click;
+                       e.onClickEntity = demolist;
+               me.TD(me, 1, 1, e = makeXonoticButton(_("No"), '0 1 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_demo_timeconfirm.c b/qcsrc/menu/xonotic/dialog_multiplayer_media_demo_timeconfirm.c
deleted file mode 100644 (file)
index 5510710..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticDemoTimeConfirmDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticDemoTimeConfirmDialog, fill, void(entity))
-       ATTRIB(XonoticDemoTimeConfirmDialog, title, string, _("Disconnect"))
-       ATTRIB(XonoticDemoTimeConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
-       ATTRIB(XonoticDemoTimeConfirmDialog, intendedWidth, float, 0.5)
-       ATTRIB(XonoticDemoTimeConfirmDialog, rows, float, 4)
-       ATTRIB(XonoticDemoTimeConfirmDialog, columns, float, 2)
-ENDCLASS(XonoticDemoTimeConfirmDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void Handle_TimeDemo_Click(entity unused, entity unused) { demolist.timeDemo(demolist); }
-void XonoticDemoTimeConfirmDialog_fill(entity me)
-{
-       entity e;
-
-       me.TR(me);
-               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Timing a demo will disconnect you from the current match.")));
-       me.TR(me);
-               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Do you really wish to disconnect now?")));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticButton(ZCTX(_("DMCNFRM^Yes")), '1 0 0'));
-                       e.onClick = Handle_TimeDemo_Click;
-                       e.onClickEntity = demolist;
-               me.TD(me, 1, 1, e = makeXonoticButton(ZCTX(_("DMCNFRM^No")), '0 1 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_demo_timeconfirm.qc b/qcsrc/menu/xonotic/dialog_multiplayer_media_demo_timeconfirm.qc
new file mode 100644 (file)
index 0000000..5c9bf8c
--- /dev/null
@@ -0,0 +1,31 @@
+#ifdef INTERFACE
+CLASS(XonoticDemoTimeConfirmDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticDemoTimeConfirmDialog, fill, void(entity))
+       ATTRIB(XonoticDemoTimeConfirmDialog, title, string, _("Disconnect"))
+       ATTRIB(XonoticDemoTimeConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+       ATTRIB(XonoticDemoTimeConfirmDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticDemoTimeConfirmDialog, rows, float, 4)
+       ATTRIB(XonoticDemoTimeConfirmDialog, columns, float, 2)
+ENDCLASS(XonoticDemoTimeConfirmDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void Handle_TimeDemo_Click(entity unused, entity unused) { demolist.timeDemo(demolist); }
+void XonoticDemoTimeConfirmDialog_fill(entity me)
+{
+       entity e;
+
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Timing a demo will disconnect you from the current match.")));
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Do you really wish to disconnect now?")));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticButton(_("Yes"), '1 0 0'));
+                       e.onClick = Handle_TimeDemo_Click;
+                       e.onClickEntity = demolist;
+               me.TD(me, 1, 1, e = makeXonoticButton(_("No"), '0 1 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_musicplayer.c b/qcsrc/menu/xonotic/dialog_multiplayer_media_musicplayer.c
deleted file mode 100644 (file)
index 0b7e423..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticMusicPlayerTab) EXTENDS(XonoticTab)
-       METHOD(XonoticMusicPlayerTab, fill, void(entity))
-       ATTRIB(XonoticMusicPlayerTab, title, string, _("Music"))
-       ATTRIB(XonoticMusicPlayerTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticMusicPlayerTab, rows, float, 21)
-       ATTRIB(XonoticMusicPlayerTab, columns, float, 6.5)
-       ATTRIB(XonoticMusicPlayerTab, name, string, "MusicPlayer")
-ENDCLASS(XonoticMusicPlayerTab)
-entity makeXonoticMusicPlayerTab();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticMusicPlayerTab()
-{
-       entity me;
-       me = spawnXonoticMusicPlayerTab();
-       me.configureDialog(me);
-       return me;
-}
-void XonoticMusicPlayerTab_fill(entity me)
-{
-       entity e;
-       entity soundList, playList;
-       float columns_nospacing = (me.columns - 0.2);
-
-       me.TR(me);
-               me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, _("Filter:")));
-               me.TD(me, 1, 2.5, e = makeXonoticInputBox(0, string_null));
-                       soundList = makeXonoticSoundList();
-                       e.onChange = SoundList_Filter_Change;
-                       e.onChangeEntity = soundList;
-                       soundList.controlledTextbox = e;
-                       playList = makeXonoticPlayList();
-                       soundList.playlist = playList;
-
-       me.TR(me);
-               me.TD(me, me.rows - 4, columns_nospacing / 2, soundList);
-
-       me.gotoRC(me, me.rows - 3, 0);
-               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Add")), '0 0 0'));
-                       e.onClick = SoundList_Add;
-                       e.onClickEntity = soundList;
-               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Add all")), '0 0 0'));
-                       e.onClick = SoundList_Add_All;
-                       e.onClickEntity = soundList;
-       me.TR(me);
-               me.TD(me, 1, columns_nospacing / 2, e = makeXonoticButton(_("Set as menu track"), '0 0 0'));
-                       e.onClick = SoundList_Menu_Track_Change;
-                       e.onClickEntity = soundList;
-       me.TR(me);
-               me.TD(me, 1, columns_nospacing / 2, e = makeXonoticButton(_("Reset default menu track"), '0 0 0'));
-                       e.onClick = SoundList_Menu_Track_Reset;
-                       e.onClickEntity = soundList;
-       me.TR(me);
-       me.TR(me);
-       me.gotoRC(me, 0, columns_nospacing / 2 + 0.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticTextLabel(0, _("Playlist:")));
-               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticCheckBox(0, "music_playlist_random0", _("Random order")));
-       me.TR(me);
-               me.TD(me, me.rows - 3, columns_nospacing / 2, playList);
-
-       me.gotoRC(me, me.rows - 2, columns_nospacing / 2 + 0.2);
-               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Stop")), '0 0 0'));
-                       e.onClick = StopSound_Click;
-                       e.onClickEntity = playList;
-               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Play")), '0 0 0'));
-                       e.onClick = StartSound_Click;
-                       e.onClickEntity = playList;
-               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Pause")), '0 0 0'));
-                       e.onClick = PauseSound_Click;
-                       e.onClickEntity = playList;
-               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Prev")), '0 0 0'));
-                       e.onClick = PrevSound_Click;
-                       e.onClickEntity = playList;
-               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Next")), '0 0 0'));
-                       e.onClick = NextSound_Click;
-                       e.onClickEntity = playList;
-       me.TR(me);
-               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Remove")), '0 0 0'));
-                       e.onClick = PlayList_Remove;
-                       e.onClickEntity = playList;
-               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Remove all")), '0 0 0'));
-                       e.onClick = PlayList_Remove_All;
-                       e.onClickEntity = playList;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_musicplayer.qc b/qcsrc/menu/xonotic/dialog_multiplayer_media_musicplayer.qc
new file mode 100644 (file)
index 0000000..0b7e423
--- /dev/null
@@ -0,0 +1,87 @@
+#ifdef INTERFACE
+CLASS(XonoticMusicPlayerTab) EXTENDS(XonoticTab)
+       METHOD(XonoticMusicPlayerTab, fill, void(entity))
+       ATTRIB(XonoticMusicPlayerTab, title, string, _("Music"))
+       ATTRIB(XonoticMusicPlayerTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticMusicPlayerTab, rows, float, 21)
+       ATTRIB(XonoticMusicPlayerTab, columns, float, 6.5)
+       ATTRIB(XonoticMusicPlayerTab, name, string, "MusicPlayer")
+ENDCLASS(XonoticMusicPlayerTab)
+entity makeXonoticMusicPlayerTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticMusicPlayerTab()
+{
+       entity me;
+       me = spawnXonoticMusicPlayerTab();
+       me.configureDialog(me);
+       return me;
+}
+void XonoticMusicPlayerTab_fill(entity me)
+{
+       entity e;
+       entity soundList, playList;
+       float columns_nospacing = (me.columns - 0.2);
+
+       me.TR(me);
+               me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, _("Filter:")));
+               me.TD(me, 1, 2.5, e = makeXonoticInputBox(0, string_null));
+                       soundList = makeXonoticSoundList();
+                       e.onChange = SoundList_Filter_Change;
+                       e.onChangeEntity = soundList;
+                       soundList.controlledTextbox = e;
+                       playList = makeXonoticPlayList();
+                       soundList.playlist = playList;
+
+       me.TR(me);
+               me.TD(me, me.rows - 4, columns_nospacing / 2, soundList);
+
+       me.gotoRC(me, me.rows - 3, 0);
+               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Add")), '0 0 0'));
+                       e.onClick = SoundList_Add;
+                       e.onClickEntity = soundList;
+               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Add all")), '0 0 0'));
+                       e.onClick = SoundList_Add_All;
+                       e.onClickEntity = soundList;
+       me.TR(me);
+               me.TD(me, 1, columns_nospacing / 2, e = makeXonoticButton(_("Set as menu track"), '0 0 0'));
+                       e.onClick = SoundList_Menu_Track_Change;
+                       e.onClickEntity = soundList;
+       me.TR(me);
+               me.TD(me, 1, columns_nospacing / 2, e = makeXonoticButton(_("Reset default menu track"), '0 0 0'));
+                       e.onClick = SoundList_Menu_Track_Reset;
+                       e.onClickEntity = soundList;
+       me.TR(me);
+       me.TR(me);
+       me.gotoRC(me, 0, columns_nospacing / 2 + 0.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticTextLabel(0, _("Playlist:")));
+               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticCheckBox(0, "music_playlist_random0", _("Random order")));
+       me.TR(me);
+               me.TD(me, me.rows - 3, columns_nospacing / 2, playList);
+
+       me.gotoRC(me, me.rows - 2, columns_nospacing / 2 + 0.2);
+               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Stop")), '0 0 0'));
+                       e.onClick = StopSound_Click;
+                       e.onClickEntity = playList;
+               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Play")), '0 0 0'));
+                       e.onClick = StartSound_Click;
+                       e.onClickEntity = playList;
+               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Pause")), '0 0 0'));
+                       e.onClick = PauseSound_Click;
+                       e.onClickEntity = playList;
+               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Prev")), '0 0 0'));
+                       e.onClick = PrevSound_Click;
+                       e.onClickEntity = playList;
+               me.TD(me, 1, columns_nospacing / 10, e = makeXonoticButton(ZCTX(_("MUSICPL^Next")), '0 0 0'));
+                       e.onClick = NextSound_Click;
+                       e.onClickEntity = playList;
+       me.TR(me);
+               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Remove")), '0 0 0'));
+                       e.onClick = PlayList_Remove;
+                       e.onClickEntity = playList;
+               me.TD(me, 1, columns_nospacing / 4, e = makeXonoticButton(ZCTX(_("MUSICPL^Remove all")), '0 0 0'));
+                       e.onClick = PlayList_Remove_All;
+                       e.onClickEntity = playList;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot.c b/qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot.c
deleted file mode 100644 (file)
index 6132719..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticScreenshotBrowserTab) EXTENDS(XonoticTab)
-       METHOD(XonoticScreenshotBrowserTab, fill, void(entity))
-       ATTRIB(XonoticScreenshotBrowserTab, title, string, "Screenshot")
-       ATTRIB(XonoticScreenshotBrowserTab, intendedWidth, float, 1)
-       ATTRIB(XonoticScreenshotBrowserTab, rows, float, 21)
-       ATTRIB(XonoticScreenshotBrowserTab, columns, float, 6.5)
-       ATTRIB(XonoticScreenshotBrowserTab, name, string, "ScreenshotBrowser")
-       
-       METHOD(XonoticScreenshotBrowserTab, loadPreviewScreenshot, void(entity, string))
-       ATTRIB(XonoticScreenshotBrowserTab, screenshotImage, entity, NULL)
-       ATTRIB(XonoticScreenshotBrowserTab, currentScrPath, string, string_null)
-ENDCLASS(XonoticScreenshotBrowserTab)
-entity makeXonoticScreenshotBrowserTab();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticScreenshotBrowserTab()
-{
-       entity me;
-       me = spawnXonoticScreenshotBrowserTab();
-       me.configureDialog(me);
-       return me;
-}
-void XonoticScreenshotBrowserTab_loadPreviewScreenshot(entity me, string scrImage)
-{
-       if (me.currentScrPath == scrImage)
-               return;
-       if (me.currentScrPath)
-               strunzone(me.currentScrPath);
-       me.currentScrPath = strzone(scrImage);
-       me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
-}
-void XonoticScreenshotBrowserTab_fill(entity me)
-{
-       entity e, slist;
-       slist = makeXonoticScreenshotList();
-       float slist_height = me.rows - 2;
-
-
-       me.TR(me);
-               me.TD(me, 1, 0.6, e = makeXonoticTextLabel(1, _("Filter:")));
-               me.TD(me, 1, 2.4, e = makeXonoticInputBox(0, string_null));
-                       e.onChange = ScreenshotList_Filter_Would_Change;
-                       e.onChangeEntity = slist;
-                       slist.screenshotViewerDialog = main.screenshotViewerDialog;
-                       main.screenshotViewerDialog.scrList = slist;
-
-       me.gotoRC(me, 0, 3.1);
-               me.TD(me, 1, 1.9, e = makeXonoticCheckBoxEx(2, 1, "cl_autoscreenshot", _("Auto screenshot scoreboard")));
-               me.TD(me, 1, 1, e = makeXonoticButton(_("Refresh"), '0 0 0'));
-                       e.onClick = ScreenshotList_Refresh_Click;
-                       e.onClickEntity = slist;
-                       
-       /*me.TR(me);
-               me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, "Filter:"));
-               me.TD(me, 1, me.columns - 1.5, e = makeXonoticInputBox(0, string_null));
-                       e.onChange = ScreenshotList_Filter_Would_Change;
-                       e.onChangeEntity = slist;
-                       slist.screenshotViewerDialog = main.screenshotViewerDialog;
-                       main.screenshotViewerDialog.scrList = slist;
-               me.TD(me, 1, 1, e = makeXonoticButton(_("Refresh"), '0 0 0'));
-                       e.onClick = ScreenshotList_Refresh_Click;
-                       e.onClickEntity = slist;*/
-                       
-       me.gotoRC(me, 1.5, 0);
-               me.TD(me, me.rows - 2.5, me.columns, slist);
-
-       me.gotoRC(me, slist_height + 1, 0);
-               me.TD(me, 1, me.columns, e = makeXonoticButton(_("Open in the viewer"), '0 0 0'));
-                       e.onClick = StartScreenshot_Click;
-                       e.onClickEntity = slist;
-/*
-       me.TR(me);
-               me.TD(me, me.rows - me.currentRow, me.columns, e = makeXonoticScreenshotImage());
-                       e.showTitle = 0;
-                       me.screenshotImage = e;
-                       slist.screenshotPreview = e;
-                       slist.screenshotBrowserDialog = me;
-*/
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot.qc b/qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot.qc
new file mode 100644 (file)
index 0000000..89a76b6
--- /dev/null
@@ -0,0 +1,82 @@
+#ifdef INTERFACE
+CLASS(XonoticScreenshotBrowserTab) EXTENDS(XonoticTab)
+       METHOD(XonoticScreenshotBrowserTab, fill, void(entity))
+       ATTRIB(XonoticScreenshotBrowserTab, title, string, "Screenshot")
+       ATTRIB(XonoticScreenshotBrowserTab, intendedWidth, float, 1)
+       ATTRIB(XonoticScreenshotBrowserTab, rows, float, 21)
+       ATTRIB(XonoticScreenshotBrowserTab, columns, float, 6.5)
+       ATTRIB(XonoticScreenshotBrowserTab, name, string, "ScreenshotBrowser")
+
+       METHOD(XonoticScreenshotBrowserTab, loadPreviewScreenshot, void(entity, string))
+       ATTRIB(XonoticScreenshotBrowserTab, screenshotImage, entity, NULL)
+       ATTRIB(XonoticScreenshotBrowserTab, currentScrPath, string, string_null)
+ENDCLASS(XonoticScreenshotBrowserTab)
+entity makeXonoticScreenshotBrowserTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticScreenshotBrowserTab()
+{
+       entity me;
+       me = spawnXonoticScreenshotBrowserTab();
+       me.configureDialog(me);
+       return me;
+}
+void XonoticScreenshotBrowserTab_loadPreviewScreenshot(entity me, string scrImage)
+{
+       if (me.currentScrPath == scrImage)
+               return;
+       if (me.currentScrPath)
+               strunzone(me.currentScrPath);
+       me.currentScrPath = strzone(scrImage);
+       me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
+}
+void XonoticScreenshotBrowserTab_fill(entity me)
+{
+       entity e, slist;
+       slist = makeXonoticScreenshotList();
+       float slist_height = me.rows - 2;
+
+
+       me.TR(me);
+               me.TD(me, 1, 0.6, e = makeXonoticTextLabel(1, _("Filter:")));
+               me.TD(me, 1, 2.4, e = makeXonoticInputBox(0, string_null));
+                       e.onChange = ScreenshotList_Filter_Would_Change;
+                       e.onChangeEntity = slist;
+                       slist.screenshotViewerDialog = main.screenshotViewerDialog;
+                       main.screenshotViewerDialog.scrList = slist;
+
+       me.gotoRC(me, 0, 3.1);
+               me.TD(me, 1, 1.9, e = makeXonoticCheckBoxEx(2, 1, "cl_autoscreenshot", _("Auto screenshot scoreboard")));
+               me.TD(me, 1, 1, e = makeXonoticButton(_("Refresh"), '0 0 0'));
+                       e.onClick = ScreenshotList_Refresh_Click;
+                       e.onClickEntity = slist;
+
+       /*me.TR(me);
+               me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, "Filter:"));
+               me.TD(me, 1, me.columns - 1.5, e = makeXonoticInputBox(0, string_null));
+                       e.onChange = ScreenshotList_Filter_Would_Change;
+                       e.onChangeEntity = slist;
+                       slist.screenshotViewerDialog = main.screenshotViewerDialog;
+                       main.screenshotViewerDialog.scrList = slist;
+               me.TD(me, 1, 1, e = makeXonoticButton(_("Refresh"), '0 0 0'));
+                       e.onClick = ScreenshotList_Refresh_Click;
+                       e.onClickEntity = slist;*/
+
+       me.gotoRC(me, 1.5, 0);
+               me.TD(me, me.rows - 2.5, me.columns, slist);
+
+       me.gotoRC(me, slist_height + 1, 0);
+               me.TD(me, 1, me.columns, e = makeXonoticButton(_("Open in the viewer"), '0 0 0'));
+                       e.onClick = StartScreenshot_Click;
+                       e.onClickEntity = slist;
+/*
+       me.TR(me);
+               me.TD(me, me.rows - me.currentRow, me.columns, e = makeXonoticScreenshotImage());
+                       e.showTitle = 0;
+                       me.screenshotImage = e;
+                       slist.screenshotPreview = e;
+                       slist.screenshotBrowserDialog = me;
+*/
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot_viewer.c b/qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot_viewer.c
deleted file mode 100644 (file)
index 146f496..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticScreenshotViewerDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticScreenshotViewerDialog, fill, void(entity))
-       METHOD(XonoticScreenshotViewerDialog, keyDown, float(entity, float, float, float))
-       METHOD(XonoticScreenshotViewerDialog, loadScreenshot, void(entity, string))
-       METHOD(XonoticScreenshotViewerDialog, close, void(entity))
-       ATTRIB(XonoticScreenshotViewerDialog, title, string, "Screenshot Viewer")
-       ATTRIB(XonoticScreenshotViewerDialog, name, string, "ScreenshotViewer")
-       ATTRIB(XonoticScreenshotViewerDialog, intendedWidth, float, 1)
-       ATTRIB(XonoticScreenshotViewerDialog, rows, float, 25)
-       ATTRIB(XonoticScreenshotViewerDialog, columns, float, 4)
-       ATTRIB(XonoticScreenshotViewerDialog, color, vector, SKINCOLOR_DIALOG_SCREENSHOTVIEWER)
-       ATTRIB(XonoticScreenshotViewerDialog, scrList, entity, NULL)
-       ATTRIB(XonoticScreenshotViewerDialog, screenshotImage, entity, NULL)
-       ATTRIB(XonoticScreenshotViewerDialog, slideShowButton, entity, NULL)
-       ATTRIB(XonoticScreenshotViewerDialog, currentScrPath, string, string_null)
-ENDCLASS(XonoticScreenshotViewerDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-float music_playlist_index_backup;
-void XonoticScreenshotViewerDialog_loadScreenshot(entity me, string scrImage)
-{
-       // disable music as it can lag depending on image loading time
-       if(!cvar("menu_screenshotviewer_enablemusic"))
-       if(cvar("music_playlist_index") != 999) // if the playlist isn't paused
-       {
-               // pause music
-               if(cvar("music_playlist_index") != -1)
-               {
-                       music_playlist_index_backup = cvar("music_playlist_index");
-                       cvar_set("music_playlist_sampleposition0", "0");
-                       cvar_set("music_playlist_index", "999");
-               }
-               else
-                       localcmd("\ncd pause\n");
-       }
-
-       if (me.currentScrPath == scrImage)
-               return;
-       if (me.currentScrPath)
-               strunzone(me.currentScrPath);
-       me.currentScrPath = strzone(scrImage);
-       me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
-       me.frame.setText(me.frame, me.screenshotImage.screenshotTitle);
-}
-void prevScreenshot_Click(entity btn, entity me)
-{
-       me.scrList.goScreenshot(me.scrList, -1);
-}
-void nextScreenshot_Click(entity btn, entity me)
-{
-       me.scrList.goScreenshot(me.scrList, +1);
-}
-void increaseZoom_Click(entity btn, entity me)
-{
-       me.screenshotImage.setZoom(me.screenshotImage, -2, FALSE);
-}
-void decreaseZoom_Click(entity btn, entity me)
-{
-       me.screenshotImage.setZoom(me.screenshotImage, -1/2, FALSE);
-}
-void resetZoom_Click(entity btn, entity me)
-{
-       me.screenshotImage.setZoom(me.screenshotImage, 0, FALSE);
-}
-void toggleSlideShow_Click(entity btn, entity me)
-{
-       if (me.slideShowButton.forcePressed)
-       {
-               me.scrList.stopSlideShow(me.scrList);
-               me.slideShowButton.forcePressed = 0;
-       }
-       else
-       {
-               me.scrList.startSlideShow(me.scrList);
-               me.slideShowButton.forcePressed = 1;
-       }
-}
-float XonoticScreenshotViewerDialog_keyDown(entity me, float key, float ascii, float shift)
-{
-       switch(key)
-       {
-               case K_KP_LEFTARROW:
-               case K_LEFTARROW:
-                       me.scrList.goScreenshot(me.scrList, -1);
-                       return 1;
-               case K_KP_RIGHTARROW:
-               case K_RIGHTARROW:
-                       me.scrList.goScreenshot(me.scrList, +1);
-                       return 1;
-               case K_KP_ENTER:
-               case K_ENTER:
-               case K_SPACE:
-                       // we cannot use SPACE/ENTER directly, as in a dialog they are needed
-                       // to press buttons while browsing with only the keyboard
-                       if (shift & S_CTRL)
-                       {
-                               toggleSlideShow_Click(world, me);
-                               return 1;
-                       }
-                       return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
-               default:
-                       if (key == K_MWHEELUP || ascii == '+')
-                       {
-                               me.screenshotImage.setZoom(me.screenshotImage, -2, (key == K_MWHEELUP));
-                               return 1;
-                       }
-                       else if (key == K_MWHEELDOWN || ascii == '-')
-                       {
-                               me.screenshotImage.setZoom(me.screenshotImage, -1/2, (key == K_MWHEELDOWN));
-                               return 1;
-                       }
-                       if (me.scrList.keyDown(me.scrList, key, ascii, shift))
-                       {
-                               // keyDown has already changed the selected item
-                               me.scrList.goScreenshot(me.scrList, 0);
-                               return 1;
-                       }
-                       return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
-       }
-}
-void XonoticScreenshotViewerDialog_close(entity me)
-{
-       // resume music
-       if(!cvar("menu_screenshotviewer_enablemusic"))
-       if(cvar("music_playlist_index") == 999)
-       {
-               cvar_set("music_playlist_index", ftos(music_playlist_index_backup));
-       }
-       else
-               localcmd("\ncd resume\n");
-
-       me.scrList.stopSlideShow(me.scrList);
-       me.slideShowButton.forcePressed = 0;
-       SUPER(XonoticScreenshotViewerDialog).close(me);
-}
-void XonoticScreenshotViewerDialog_fill(entity me)
-{
-       entity e;
-       me.TR(me);
-               me.TD(me, me.rows - 1, me.columns, e = makeXonoticScreenshotImage());
-                       e.showTitle = 0; // dialog title is enough
-                       me.screenshotImage = e;
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TDempty(me, 1/20 * me.columns);
-               me.TD(me, 1, 1/20 * me.columns, e = makeXonoticButton("-", '0 0 0'));
-                       e.onClick = decreaseZoom_Click;
-                       e.onClickEntity = me;
-               me.TD(me, 1, 1/20 * me.columns, e = makeXonoticButton("+", '0 0 0'));
-                       e.onClick = increaseZoom_Click;
-                       e.onClickEntity = me;
-               me.TD(me, 1, 2/20 * me.columns, e = makeXonoticButton(_("Reset"), '0 0 0'));
-                       e.onClick = resetZoom_Click;
-                       e.onClickEntity = me;
-
-               me.TDempty(me, 2/20 * me.columns);
-               me.TD(me, 1, 3/20 * me.columns, e = makeXonoticButton(_("Previous"), '0 0 0'));
-                       e.onClick = prevScreenshot_Click;
-                       e.onClickEntity = me;
-               me.TD(me, 1, 3/20 * me.columns, e = makeXonoticButton(_("Next"), '0 0 0'));
-                       e.onClick = nextScreenshot_Click;
-                       e.onClickEntity = me;
-
-               me.TDempty(me, 2/20 * me.columns);
-               me.TD(me, 1, 4/20 * me.columns, e = makeXonoticButton(_("Slide show"), '0 0 0'));
-                       e.onClick = toggleSlideShow_Click;
-                       e.onClickEntity = me;
-                       me.slideShowButton = e;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot_viewer.qc b/qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot_viewer.qc
new file mode 100644 (file)
index 0000000..bcf168a
--- /dev/null
@@ -0,0 +1,171 @@
+#ifdef INTERFACE
+CLASS(XonoticScreenshotViewerDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticScreenshotViewerDialog, fill, void(entity))
+       METHOD(XonoticScreenshotViewerDialog, keyDown, float(entity, float, float, float))
+       METHOD(XonoticScreenshotViewerDialog, loadScreenshot, void(entity, string))
+       METHOD(XonoticScreenshotViewerDialog, close, void(entity))
+       ATTRIB(XonoticScreenshotViewerDialog, title, string, "Screenshot Viewer")
+       ATTRIB(XonoticScreenshotViewerDialog, name, string, "ScreenshotViewer")
+       ATTRIB(XonoticScreenshotViewerDialog, intendedWidth, float, 1)
+       ATTRIB(XonoticScreenshotViewerDialog, rows, float, 25)
+       ATTRIB(XonoticScreenshotViewerDialog, columns, float, 4)
+       ATTRIB(XonoticScreenshotViewerDialog, color, vector, SKINCOLOR_DIALOG_SCREENSHOTVIEWER)
+       ATTRIB(XonoticScreenshotViewerDialog, scrList, entity, NULL)
+       ATTRIB(XonoticScreenshotViewerDialog, screenshotImage, entity, NULL)
+       ATTRIB(XonoticScreenshotViewerDialog, slideShowButton, entity, NULL)
+       ATTRIB(XonoticScreenshotViewerDialog, currentScrPath, string, string_null)
+ENDCLASS(XonoticScreenshotViewerDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+float music_playlist_index_backup;
+void XonoticScreenshotViewerDialog_loadScreenshot(entity me, string scrImage)
+{
+       // disable music as it can lag depending on image loading time
+       if(!cvar("menu_screenshotviewer_enablemusic"))
+       if(cvar("music_playlist_index") != 999) // if the playlist isn't paused
+       {
+               // pause music
+               if(cvar("music_playlist_index") != -1)
+               {
+                       music_playlist_index_backup = cvar("music_playlist_index");
+                       cvar_set("music_playlist_sampleposition0", "0");
+                       cvar_set("music_playlist_index", "999");
+               }
+               else
+                       localcmd("\ncd pause\n");
+       }
+
+       if (me.currentScrPath == scrImage)
+               return;
+       if (me.currentScrPath)
+               strunzone(me.currentScrPath);
+       me.currentScrPath = strzone(scrImage);
+       me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
+       me.frame.setText(me.frame, me.screenshotImage.screenshotTitle);
+}
+void prevScreenshot_Click(entity btn, entity me)
+{
+       me.scrList.goScreenshot(me.scrList, -1);
+}
+void nextScreenshot_Click(entity btn, entity me)
+{
+       me.scrList.goScreenshot(me.scrList, +1);
+}
+void increaseZoom_Click(entity btn, entity me)
+{
+       me.screenshotImage.setZoom(me.screenshotImage, -2, false);
+}
+void decreaseZoom_Click(entity btn, entity me)
+{
+       me.screenshotImage.setZoom(me.screenshotImage, -1/2, false);
+}
+void resetZoom_Click(entity btn, entity me)
+{
+       me.screenshotImage.setZoom(me.screenshotImage, 0, false);
+}
+void toggleSlideShow_Click(entity btn, entity me)
+{
+       if (me.slideShowButton.forcePressed)
+       {
+               me.scrList.stopSlideShow(me.scrList);
+               me.slideShowButton.forcePressed = 0;
+       }
+       else
+       {
+               me.scrList.startSlideShow(me.scrList);
+               me.slideShowButton.forcePressed = 1;
+       }
+}
+float XonoticScreenshotViewerDialog_keyDown(entity me, float key, float ascii, float shift)
+{
+       switch(key)
+       {
+               case K_KP_LEFTARROW:
+               case K_LEFTARROW:
+                       me.scrList.goScreenshot(me.scrList, -1);
+                       return 1;
+               case K_KP_RIGHTARROW:
+               case K_RIGHTARROW:
+                       me.scrList.goScreenshot(me.scrList, +1);
+                       return 1;
+               case K_KP_ENTER:
+               case K_ENTER:
+               case K_SPACE:
+                       // we cannot use SPACE/ENTER directly, as in a dialog they are needed
+                       // to press buttons while browsing with only the keyboard
+                       if (shift & S_CTRL)
+                       {
+                               toggleSlideShow_Click(world, me);
+                               return 1;
+                       }
+                       return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
+               default:
+                       if (key == K_MWHEELUP || ascii == '+')
+                       {
+                               me.screenshotImage.setZoom(me.screenshotImage, -2, (key == K_MWHEELUP));
+                               return 1;
+                       }
+                       else if (key == K_MWHEELDOWN || ascii == '-')
+                       {
+                               me.screenshotImage.setZoom(me.screenshotImage, -1/2, (key == K_MWHEELDOWN));
+                               return 1;
+                       }
+                       if (me.scrList.keyDown(me.scrList, key, ascii, shift))
+                       {
+                               // keyDown has already changed the selected item
+                               me.scrList.goScreenshot(me.scrList, 0);
+                               return 1;
+                       }
+                       return SUPER(XonoticScreenshotViewerDialog).keyDown(me, key, ascii, shift);
+       }
+}
+void XonoticScreenshotViewerDialog_close(entity me)
+{
+       // resume music
+       if(!cvar("menu_screenshotviewer_enablemusic"))
+       if(cvar("music_playlist_index") == 999)
+       {
+               cvar_set("music_playlist_index", ftos(music_playlist_index_backup));
+       }
+       else
+               localcmd("\ncd resume\n");
+
+       me.scrList.stopSlideShow(me.scrList);
+       me.slideShowButton.forcePressed = 0;
+       SUPER(XonoticScreenshotViewerDialog).close(me);
+}
+void XonoticScreenshotViewerDialog_fill(entity me)
+{
+       entity e;
+       me.TR(me);
+               me.TD(me, me.rows - 1, me.columns, e = makeXonoticScreenshotImage());
+                       e.showTitle = 0; // dialog title is enough
+                       me.screenshotImage = e;
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TDempty(me, 1/20 * me.columns);
+               me.TD(me, 1, 1/20 * me.columns, e = makeXonoticButton("-", '0 0 0'));
+                       e.onClick = decreaseZoom_Click;
+                       e.onClickEntity = me;
+               me.TD(me, 1, 1/20 * me.columns, e = makeXonoticButton("+", '0 0 0'));
+                       e.onClick = increaseZoom_Click;
+                       e.onClickEntity = me;
+               me.TD(me, 1, 2/20 * me.columns, e = makeXonoticButton(_("Reset"), '0 0 0'));
+                       e.onClick = resetZoom_Click;
+                       e.onClickEntity = me;
+
+               me.TDempty(me, 2/20 * me.columns);
+               me.TD(me, 1, 3/20 * me.columns, e = makeXonoticButton(_("Previous"), '0 0 0'));
+                       e.onClick = prevScreenshot_Click;
+                       e.onClickEntity = me;
+               me.TD(me, 1, 3/20 * me.columns, e = makeXonoticButton(_("Next"), '0 0 0'));
+                       e.onClick = nextScreenshot_Click;
+                       e.onClickEntity = me;
+
+               me.TDempty(me, 2/20 * me.columns);
+               me.TD(me, 1, 4/20 * me.columns, e = makeXonoticButton(_("Slide show"), '0 0 0'));
+                       e.onClick = toggleSlideShow_Click;
+                       e.onClickEntity = me;
+                       me.slideShowButton = e;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_profile.c b/qcsrc/menu/xonotic/dialog_multiplayer_profile.c
deleted file mode 100644 (file)
index a316be7..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticProfileTab) EXTENDS(XonoticTab)
-       METHOD(XonoticProfileTab, fill, void(entity))
-       METHOD(XonoticProfileTab, draw, void(entity))
-       ATTRIB(XonoticProfileTab, title, string, _("Profile"))
-       ATTRIB(XonoticProfileTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticProfileTab, rows, float, 23)
-       ATTRIB(XonoticProfileTab, columns, float, 6.1) // added extra .2 for center space
-       ATTRIB(XonoticProfileTab, playerNameLabel, entity, NULL)
-       ATTRIB(XonoticProfileTab, playerNameLabelAlpha, float, SKINALPHA_HEADER)
-ENDCLASS(XonoticProfileTab)
-entity makeXonoticProfileTab();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticProfileTab()
-{
-       entity me;
-       me = spawnXonoticProfileTab();
-       me.configureDialog(me);
-       return me;
-}
-void XonoticProfileTab_draw(entity me)
-{
-       if(cvar_string("_cl_name") == "Player")
-               me.playerNameLabel.alpha = ((mod(time * 2, 2) < 1) ? 1 : 0);
-       else
-               me.playerNameLabel.alpha = me.playerNameLabelAlpha;
-       SUPER(XonoticProfileTab).draw(me);
-}
-void XonoticProfileTab_fill(entity me)
-{
-       entity e, pms, label, box;
-       float i;
-
-       // ==============
-       //  NAME SECTION
-       // ==============
-       me.gotoRC(me, 0.5, 0);
-               me.TD(me, 1, 3, me.playerNameLabel = makeXonoticHeaderLabel(_("Name")));
-
-       me.gotoRC(me, 1.5, 0);
-               me.TD(me, 1, 3, label = makeXonoticTextLabel(0.5, string_null));
-                       label.allowCut = 1;
-                       label.allowColors = 1;
-                       label.alpha = 1;
-                       label.isBold = TRUE;
-                       label.fontSize = SKINFONTSIZE_TITLE;
-
-       me.gotoRC(me, 2.5, 0);
-               me.TD(me, 1, 3.0, box = makeXonoticInputBox(1, "_cl_name"));
-                       box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
-                       box.maxLength = -127; // negative means encoded length in bytes
-                       box.saveImmediately = 1;
-                       box.enableClearButton = 0;
-                       label.textEntity = box;
-       me.TR(me);
-               me.TD(me, 5, 1, e = makeXonoticColorpicker(box));
-               me.TD(me, 5, 2, e = makeXonoticCharmap(box));
-
-       // ===============
-       //  MODEL SECTION
-       // ===============
-       //me.gotoRC(me, 0.5, 3.1); me.setFirstColumn(me, me.currentColumn); // TOP RIGHT
-       //me.gotoRC(me, 9, 3.1); me.setFirstColumn(me, me.currentColumn); // BOTTOM RIGHT
-       me.gotoRC(me, 9, 0); me.setFirstColumn(me, me.currentColumn); // BOTTOM LEFT
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Model")));
-
-       me.TR(me);
-               //me.TDempty(me, 0); // MODEL LEFT, COLOR RIGHT
-               me.TDempty(me, 1); // MODEL RIGHT, COLOR LEFT
-               pms = makeXonoticPlayerModelSelector();
-               me.TD(me, 1, 0.3, e = makeXonoticButton("<<", '0 0 0'));
-                       e.onClick = PlayerModelSelector_Prev_Click;
-                       e.onClickEntity = pms;
-               me.TD(me, 11.5, 1.4, pms);
-               me.TD(me, 1, 0.3, e = makeXonoticButton(">>", '0 0 0'));
-                       e.onClick = PlayerModelSelector_Next_Click;
-                       e.onClickEntity = pms;
-
-       //me.setFirstColumn(me, me.currentColumn + 2); // MODEL LEFT, COLOR RIGHT
-       me.gotoRC(me, me.currentRow, 0); me.setFirstColumn(me, me.currentColumn); // MODEL RIGHT, COLOR LEFT
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticHeaderLabel(_("Glowing color")));
-               for(i = 0; i < 15; ++i)
-               {
-                       if(mod(i, 5) == 0)
-                               me.TR(me);
-                       me.TDNoMargin(me, 1, 0.2, e = makeXonoticColorButton(1, 0, i), '0 1 0');
-               }
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticHeaderLabel(_("Detail color")));
-               for(i = 0; i < 15; ++i)
-               {
-                       if(mod(i, 5) == 0)
-                               me.TR(me);
-                       me.TDNoMargin(me, 1, 0.2, e = makeXonoticColorButton(2, 1, i), '0 1 0');
-               }
-
-       // ====================
-       //  STATISTICS SECTION
-       // ====================
-       me.gotoRC(me, 0.5, 3.1); me.setFirstColumn(me, me.currentColumn); // TOP RIGHT
-       //me.gotoRC(me, 9, 3.1); me.setFirstColumn(me, me.currentColumn); // BOTTOM RIGHT
-       //me.gotoRC(me, 9, 0); me.setFirstColumn(me, me.currentColumn); // BOTTOM LEFT
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Statistics")));
-
-       me.TR(me);
-               me.TDempty(me, 0.25);
-               me.TD(me, 1, 2.5, e = makeXonoticCheckBox(0, "cl_allow_uidtracking", _("Allow player statistics to track your client")));
-       me.TR(me);
-               me.TDempty(me, 0.25);
-               me.TD(me, 1, 2.5, e = makeXonoticCheckBox(0, "cl_allow_uid2name", _("Allow player statistics to use your nickname")));
-               setDependent(e, "cl_allow_uidtracking", 1, 1);
-       me.gotoRC(me, 4, 3.1); // TOP RIGHT
-       //me.gotoRC(me, 12.5, 3.1); // BOTTOM RIGHT 
-       //me.gotoRC(me, 12.5, 0); // BOTTOM LEFT
-               me.TDempty(me, 0.25);
-               me.TD(me, 9, 2.5, statslist = makeXonoticStatsList());
-               //setDependent(statslist, "cl_allow_uidtracking", 1, 1);
-
-       // =================
-       //  COUNTRY SECTION
-       // =================
-       me.gotoRC(me, 16, 3.1); me.setFirstColumn(me, me.currentColumn); // BOTTOM SECTION, TOP POS
-       //me.gotoRC(me, 13.5, 3.1); me.setFirstColumn(me, me.currentColumn); // BOTTOM SECTION, TOP POS
-       //me.gotoRC(me, 0.5, 3.1); me.setFirstColumn(me, me.currentColumn); // TOP SECTION, TOP POS
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Country")));
-
-       me.TR(me);
-               me.TDempty(me, 0.5);
-               me.TD(me, 4.5, 2, e = makeXonoticLanguageList()); // todo: cl_country: create proper country list
-
-
-       // ================
-       //  GENDER SECTION
-       // ================
-       me.gotoRC(me, 13.5, 3.1); me.setFirstColumn(me, me.currentColumn); // BOTTOM SECTION, TOP POS
-       //me.gotoRC(me, 19.5, 3.1); me.setFirstColumn(me, me.currentColumn); // BOTTOM SECTION, BOTTOM POS
-       //me.gotoRC(me, 6.5, 3.1); me.setFirstColumn(me, me.currentColumn); // TOP SECTION, BOTTOM POS
-       #if 0
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Gender:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_gender"));
-                       e.addValue(e, ZCTX(_("GENDER^Undisclosed")), "0");
-                       e.addValue(e, ZCTX(_("GENDER^Female")), "1");
-                       e.addValue(e, ZCTX(_("GENDER^Male")), "2");
-                       e.configureXonoticTextSliderValues(e);
-       #else
-                       me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Gender")));
-               me.TR(me);
-                       #define GENDERWIDTH_OFFSET 0.25
-                       #define GENDERWIDTH_LENGTH 2.5
-                       #define GENDERWIDTH_ITEM (GENDERWIDTH_LENGTH / 3)
-                       me.TDempty(me, GENDERWIDTH_OFFSET);
-                       me.TD(me, 1, GENDERWIDTH_ITEM, e = makeXonoticRadioButton(3, "cl_gender", "2", _("Female")));
-                       me.TD(me, 1, GENDERWIDTH_ITEM, e = makeXonoticRadioButton(3, "cl_gender", "1", _("Male")));
-                       me.TD(me, 1, GENDERWIDTH_ITEM, e = makeXonoticRadioButton(3, "cl_gender", "0", _("Undisclosed")));
-       #endif
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "color -1 -1;name \"$_cl_name\";sendcvar cl_weaponpriority;sendcvar cl_autoswitch;sendcvar cl_forceplayermodels;sendcvar cl_forceplayermodelsfromxonotic;playermodel $_cl_playermodel;playerskin $_cl_playerskin", COMMANDBUTTON_APPLY));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_profile.qc b/qcsrc/menu/xonotic/dialog_multiplayer_profile.qc
new file mode 100644 (file)
index 0000000..8c24885
--- /dev/null
@@ -0,0 +1,164 @@
+#ifdef INTERFACE
+CLASS(XonoticProfileTab) EXTENDS(XonoticTab)
+       METHOD(XonoticProfileTab, fill, void(entity))
+       METHOD(XonoticProfileTab, draw, void(entity))
+       ATTRIB(XonoticProfileTab, title, string, _("Profile"))
+       ATTRIB(XonoticProfileTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticProfileTab, rows, float, 23)
+       ATTRIB(XonoticProfileTab, columns, float, 6.1) // added extra .2 for center space
+       ATTRIB(XonoticProfileTab, playerNameLabel, entity, NULL)
+       ATTRIB(XonoticProfileTab, playerNameLabelAlpha, float, SKINALPHA_HEADER)
+ENDCLASS(XonoticProfileTab)
+entity makeXonoticProfileTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticProfileTab()
+{
+       entity me;
+       me = spawnXonoticProfileTab();
+       me.configureDialog(me);
+       return me;
+}
+void XonoticProfileTab_draw(entity me)
+{
+       if(cvar_string("_cl_name") == "Player")
+               me.playerNameLabel.alpha = ((mod(time * 2, 2) < 1) ? 1 : 0);
+       else
+               me.playerNameLabel.alpha = me.playerNameLabelAlpha;
+       SUPER(XonoticProfileTab).draw(me);
+}
+void XonoticProfileTab_fill(entity me)
+{
+       entity e, pms, label, box;
+       float i;
+
+       // ==============
+       //  NAME SECTION
+       // ==============
+       me.gotoRC(me, 0.5, 0);
+               me.TD(me, 1, 3, me.playerNameLabel = makeXonoticHeaderLabel(_("Name")));
+
+       me.gotoRC(me, 1.5, 0);
+               me.TD(me, 1, 3, label = makeXonoticTextLabel(0.5, string_null));
+                       label.allowCut = 1;
+                       label.allowColors = 1;
+                       label.alpha = 1;
+                       label.isBold = true;
+                       label.fontSize = SKINFONTSIZE_TITLE;
+
+       me.gotoRC(me, 2.5, 0);
+               me.TD(me, 1, 3.0, box = makeXonoticInputBox(1, "_cl_name"));
+                       box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
+                       box.maxLength = -127; // negative means encoded length in bytes
+                       box.saveImmediately = 0;  // Sorry, can't do this, it spams "name" commands.
+                       box.enableClearButton = 0;
+                       label.textEntity = box;
+       me.TR(me);
+               me.TD(me, 5, 1, e = makeXonoticColorpicker(box));
+               me.TD(me, 5, 2, e = makeXonoticCharmap(box));
+
+       // ===============
+       //  MODEL SECTION
+       // ===============
+       //me.gotoRC(me, 0.5, 3.1); me.setFirstColumn(me, me.currentColumn); // TOP RIGHT
+       //me.gotoRC(me, 9, 3.1); me.setFirstColumn(me, me.currentColumn); // BOTTOM RIGHT
+       me.gotoRC(me, 9, 0); me.setFirstColumn(me, me.currentColumn); // BOTTOM LEFT
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Model")));
+
+       me.TR(me);
+               //me.TDempty(me, 0); // MODEL LEFT, COLOR RIGHT
+               me.TDempty(me, 1); // MODEL RIGHT, COLOR LEFT
+               pms = makeXonoticPlayerModelSelector();
+               me.TD(me, 1, 0.3, e = makeXonoticButton("<<", '0 0 0'));
+                       e.onClick = PlayerModelSelector_Prev_Click;
+                       e.onClickEntity = pms;
+               me.TD(me, 11.5, 1.4, pms);
+               me.TD(me, 1, 0.3, e = makeXonoticButton(">>", '0 0 0'));
+                       e.onClick = PlayerModelSelector_Next_Click;
+                       e.onClickEntity = pms;
+
+       //me.setFirstColumn(me, me.currentColumn + 2); // MODEL LEFT, COLOR RIGHT
+       me.gotoRC(me, me.currentRow, 0); me.setFirstColumn(me, me.currentColumn); // MODEL RIGHT, COLOR LEFT
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticHeaderLabel(_("Glowing color")));
+               for(i = 0; i < 15; ++i)
+               {
+                       if(mod(i, 5) == 0)
+                               me.TR(me);
+                       me.TDNoMargin(me, 1, 0.2, e = makeXonoticColorButton(1, 0, i), '0 1 0');
+               }
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticHeaderLabel(_("Detail color")));
+               for(i = 0; i < 15; ++i)
+               {
+                       if(mod(i, 5) == 0)
+                               me.TR(me);
+                       me.TDNoMargin(me, 1, 0.2, e = makeXonoticColorButton(2, 1, i), '0 1 0');
+               }
+
+       // ====================
+       //  STATISTICS SECTION
+       // ====================
+       me.gotoRC(me, 0.5, 3.1); me.setFirstColumn(me, me.currentColumn); // TOP RIGHT
+       //me.gotoRC(me, 9, 3.1); me.setFirstColumn(me, me.currentColumn); // BOTTOM RIGHT
+       //me.gotoRC(me, 9, 0); me.setFirstColumn(me, me.currentColumn); // BOTTOM LEFT
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Statistics")));
+
+       me.TR(me);
+               me.TDempty(me, 0.25);
+               me.TD(me, 1, 2.5, e = makeXonoticCheckBox(0, "cl_allow_uidtracking", _("Allow player statistics to track your client")));
+       me.TR(me);
+               me.TDempty(me, 0.25);
+               me.TD(me, 1, 2.5, e = makeXonoticCheckBox(0, "cl_allow_uid2name", _("Allow player statistics to use your nickname")));
+               setDependent(e, "cl_allow_uidtracking", 1, 1);
+       me.gotoRC(me, 4, 3.1); // TOP RIGHT
+       //me.gotoRC(me, 12.5, 3.1); // BOTTOM RIGHT
+       //me.gotoRC(me, 12.5, 0); // BOTTOM LEFT
+               me.TDempty(me, 0.25);
+               me.TD(me, 9, 2.5, statslist = makeXonoticStatsList());
+               //setDependent(statslist, "cl_allow_uidtracking", 1, 1);
+
+       // =================
+       //  COUNTRY SECTION
+       // =================
+       me.gotoRC(me, 16, 3.1); me.setFirstColumn(me, me.currentColumn); // BOTTOM SECTION, TOP POS
+       //me.gotoRC(me, 13.5, 3.1); me.setFirstColumn(me, me.currentColumn); // BOTTOM SECTION, TOP POS
+       //me.gotoRC(me, 0.5, 3.1); me.setFirstColumn(me, me.currentColumn); // TOP SECTION, TOP POS
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Country")));
+
+       me.TR(me);
+               me.TDempty(me, 0.5);
+               me.TD(me, 4.5, 2, e = makeXonoticLanguageList()); // todo: cl_country: create proper country list
+
+
+       // ================
+       //  GENDER SECTION
+       // ================
+       me.gotoRC(me, 13.5, 3.1); me.setFirstColumn(me, me.currentColumn); // BOTTOM SECTION, TOP POS
+       //me.gotoRC(me, 19.5, 3.1); me.setFirstColumn(me, me.currentColumn); // BOTTOM SECTION, BOTTOM POS
+       //me.gotoRC(me, 6.5, 3.1); me.setFirstColumn(me, me.currentColumn); // TOP SECTION, BOTTOM POS
+       #if 0
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Gender:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("_cl_gender"));
+                       e.addValue(e, _("Undisclosed"), "0");
+                       e.addValue(e, _("Female"), "1");
+                       e.addValue(e, _("Male"), "2");
+                       e.configureXonoticTextSliderValues(e);
+       #else
+                       me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Gender")));
+               me.TR(me);
+                       #define GENDERWIDTH_OFFSET 0.25
+                       #define GENDERWIDTH_LENGTH 2.5
+                       #define GENDERWIDTH_ITEM (GENDERWIDTH_LENGTH / 3)
+                       me.TDempty(me, GENDERWIDTH_OFFSET);
+                       me.TD(me, 1, GENDERWIDTH_ITEM, e = makeXonoticRadioButton(3, "_cl_gender", "2", _("Female")));
+                       me.TD(me, 1, GENDERWIDTH_ITEM, e = makeXonoticRadioButton(3, "_cl_gender", "1", _("Male")));
+                       me.TD(me, 1, GENDERWIDTH_ITEM, e = makeXonoticRadioButton(3, "_cl_gender", "0", _("Undisclosed")));
+       #endif
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "color -1 -1;name \"$_cl_name\";sendcvar cl_weaponpriority;sendcvar cl_autoswitch;sendcvar cl_forceplayermodels;sendcvar cl_forceplayermodelsfromxonotic;playermodel $_cl_playermodel;playerskin $_cl_playerskin", COMMANDBUTTON_APPLY));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_quit.c b/qcsrc/menu/xonotic/dialog_quit.c
deleted file mode 100644 (file)
index 71de59d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticQuitDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticQuitDialog, fill, void(entity))
-       ATTRIB(XonoticQuitDialog, title, string, _("Quit"))
-       ATTRIB(XonoticQuitDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
-       ATTRIB(XonoticQuitDialog, intendedWidth, float, 0.5)
-       ATTRIB(XonoticQuitDialog, rows, float, 3)
-       ATTRIB(XonoticQuitDialog, columns, float, 2)
-       ATTRIB(XonoticQuitDialog, name, string, "Quit")
-ENDCLASS(XonoticQuitDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticQuitDialog_fill(entity me)
-{
-       entity e;
-       me.TR(me);
-               me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("Are you sure you want to quit?")));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Yes"), '1 0 0', "echo ]quit\nquit", 0));
-               me.TD(me, 1, 1, e = makeXonoticButton(_("No"), '0 1 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_quit.qc b/qcsrc/menu/xonotic/dialog_quit.qc
new file mode 100644 (file)
index 0000000..71de59d
--- /dev/null
@@ -0,0 +1,26 @@
+#ifdef INTERFACE
+CLASS(XonoticQuitDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticQuitDialog, fill, void(entity))
+       ATTRIB(XonoticQuitDialog, title, string, _("Quit"))
+       ATTRIB(XonoticQuitDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
+       ATTRIB(XonoticQuitDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticQuitDialog, rows, float, 3)
+       ATTRIB(XonoticQuitDialog, columns, float, 2)
+       ATTRIB(XonoticQuitDialog, name, string, "Quit")
+ENDCLASS(XonoticQuitDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticQuitDialog_fill(entity me)
+{
+       entity e;
+       me.TR(me);
+               me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("Are you sure you want to quit?")));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Yes"), '1 0 0', "echo ]quit\nquit", 0));
+               me.TD(me, 1, 1, e = makeXonoticButton(_("No"), '0 1 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_sandboxtools.c b/qcsrc/menu/xonotic/dialog_sandboxtools.c
deleted file mode 100644 (file)
index 033336d..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticSandboxToolsDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticSandboxToolsDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
-       ATTRIB(XonoticSandboxToolsDialog, title, string, _("Sandbox Tools")) // ;)
-       ATTRIB(XonoticSandboxToolsDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
-       ATTRIB(XonoticSandboxToolsDialog, intendedWidth, float, 0.8)
-       ATTRIB(XonoticSandboxToolsDialog, rows, float, 16)
-       ATTRIB(XonoticSandboxToolsDialog, columns, float, 4)
-       ATTRIB(XonoticSandboxToolsDialog, name, string, "SandboxTools")
-       ATTRIB(XonoticSandboxToolsDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticSandboxToolsDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticSandboxToolsDialog_fill(entity me)
-{
-       entity e, box;
-
-       me.TR(me);
-               me.TD(me, 1, 0.25, e = makeXonoticTextLabel(0, _("Model:")));
-               me.TD(me, 1, 1.5, box = makeXonoticInputBox(1, "menu_sandbox_spawn_model"));
-                       box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
-                       box.maxLength = -127; // negative means encoded length in bytes
-                       box.saveImmediately = 1;
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Spawn"), '0 0 0', "sandbox object_spawn \"$menu_sandbox_spawn_model\"", 0));
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Remove *"), '0 0 0', "sandbox object_remove", 0));
-       me.TDempty(me, 0.1);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Copy *"), '0 0 0', "sandbox object_duplicate copy cl_sandbox_clipboard", 0));
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Paste"), '0 0 0', "sandbox object_duplicate paste \"$cl_sandbox_clipboard\"", 0));
-       me.TR(me);
-               me.TD(me, 1, 0.25, e = makeXonoticTextLabel(0, _("Bone:")));
-               me.TD(me, 1, 1.5, box = makeXonoticInputBox(1, "menu_sandbox_attach_bone"));
-                       box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
-                       box.maxLength = -127; // negative means encoded length in bytes
-                       box.saveImmediately = 1;
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set * as child"), '0 0 0', "sandbox object_attach get", 0));
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Attach to *"), '0 0 0', "sandbox object_attach set \"$menu_sandbox_attach_bone\"", 0));
-       me.TDempty(me, 0.1);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Detach from *"), '0 0 0', "sandbox object_attach remove", 0));
-       me.TR(me);
-       me.TR(me);
-       me.TD(me, 1, 1.5, e = makeXonoticTextLabel(0, _("Visual object properties for *:")));
-       me.TR(me);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set skin:"), '0 0 0', "sandbox object_edit skin $menu_sandbox_edit_skin", 0));
-               me.TD(me, 1, 1.5, e = makeXonoticSlider(0, 99, 1, "menu_sandbox_edit_skin"));
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set alpha:"), '0 0 0', "sandbox object_edit alpha $menu_sandbox_edit_alpha", 0));
-               me.TD(me, 1, 1.5, e = makeXonoticSlider(0.1, 1, 0.05, "menu_sandbox_edit_alpha"));
-       me.TR(me);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set color main:"), '0 0 0', "sandbox object_edit color_main \"$menu_sandbox_edit_color_main\"", 0));
-               me.TD(me, 2, 1.5, e = makeXonoticColorpickerString("menu_sandbox_edit_color_main", "menu_sandbox_edit_color_main"));
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set color glow:"), '0 0 0', "sandbox object_edit color_glow \"$menu_sandbox_edit_color_glow\"", 0));
-               me.TD(me, 2, 1.5, e = makeXonoticColorpickerString("menu_sandbox_edit_color_glow", "menu_sandbox_edit_color_glow"));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set frame:"), '0 0 0', "sandbox object_edit frame $menu_sandbox_edit_frame", 0));
-               me.TD(me, 1, 1.5, e = makeXonoticSlider(0, 99, 1, "menu_sandbox_edit_frame"));
-       me.TR(me);
-       me.TR(me);
-       me.TD(me, 1, 1.5, e = makeXonoticTextLabel(0, _("Physical object properties for *:")));
-       me.TR(me);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set material:"), '0 0 0', "sandbox object_edit material \"$menu_sandbox_edit_material\"", 0));
-               me.TD(me, 1, 1.5, box = makeXonoticInputBox(1, "menu_sandbox_edit_material"));
-                       box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
-                       box.maxLength = -127; // negative means encoded length in bytes
-                       box.saveImmediately = 1;
-       me.TR(me);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set solidity:"), '0 0 0', "sandbox object_edit solidity $menu_sandbox_edit_solidity", 0));
-               me.TD(me, 1, 0.75, e = makeXonoticRadioButton(1, "menu_sandbox_edit_solidity", "0", _("Non-solid")));
-               me.TD(me, 1, 0.75, e = makeXonoticRadioButton(1, "menu_sandbox_edit_solidity", "1", _("Solid")));
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set physics:"), '0 0 0', "sandbox object_edit physics $menu_sandbox_edit_physics", 0));
-               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_sandbox_edit_physics", "0", _("Static")));
-               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_sandbox_edit_physics", "1", _("Movable")));
-               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_sandbox_edit_physics", "2", _("Physical")));
-       me.TR(me);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set scale:"), '0 0 0', "sandbox object_edit scale $menu_sandbox_edit_scale", 0));
-               me.TD(me, 1, 1.5, e = makeXonoticSlider(0.25, 2, 0.05, "menu_sandbox_edit_scale"));
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set force:"), '0 0 0', "sandbox object_edit force $menu_sandbox_edit_force", 0));
-               me.TD(me, 1, 1.5, e = makeXonoticSlider(0, 10, 0.5, "menu_sandbox_edit_force"));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Claim *"), '0 0 0', "sandbox object_claim", 0));
-               me.TDempty(me, 0.5);
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("* object info"), '1 1 0.5', "sandbox object_info object; toggleconsole", 0));
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("* mesh info"), '1 1 0.5', "sandbox object_info mesh; toggleconsole", 0));
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("* attachment info"), '1 1 0.5', "sandbox object_info attachments; toggleconsole", 0));
-               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Show help"), '1 0.5 0.5', "sandbox help; toggleconsole", 0));
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("* is the object you are facing")));
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-}
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
diff --git a/qcsrc/menu/xonotic/dialog_sandboxtools.qc b/qcsrc/menu/xonotic/dialog_sandboxtools.qc
new file mode 100644 (file)
index 0000000..fa7f40a
--- /dev/null
@@ -0,0 +1,96 @@
+#ifdef INTERFACE
+CLASS(XonoticSandboxToolsDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticSandboxToolsDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
+       ATTRIB(XonoticSandboxToolsDialog, title, string, _("Sandbox Tools")) // ;)
+       ATTRIB(XonoticSandboxToolsDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
+       ATTRIB(XonoticSandboxToolsDialog, intendedWidth, float, 0.8)
+       ATTRIB(XonoticSandboxToolsDialog, rows, float, 16)
+       ATTRIB(XonoticSandboxToolsDialog, columns, float, 4)
+       ATTRIB(XonoticSandboxToolsDialog, name, string, "SandboxTools")
+       ATTRIB(XonoticSandboxToolsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticSandboxToolsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticSandboxToolsDialog_fill(entity me)
+{
+       entity e, box;
+
+       me.TR(me);
+               me.TD(me, 1, 0.25, e = makeXonoticTextLabel(0, _("Model:")));
+               me.TD(me, 1, 1.5, box = makeXonoticInputBox(1, "menu_sandbox_spawn_model"));
+                       box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
+                       box.maxLength = -127; // negative means encoded length in bytes
+                       box.saveImmediately = 1;
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Spawn"), '0 0 0', "sandbox object_spawn \"$menu_sandbox_spawn_model\"", 0));
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Remove *"), '0 0 0', "sandbox object_remove", 0));
+       me.TDempty(me, 0.1);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Copy *"), '0 0 0', "sandbox object_duplicate copy cl_sandbox_clipboard", 0));
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Paste"), '0 0 0', "sandbox object_duplicate paste \"$cl_sandbox_clipboard\"", 0));
+       me.TR(me);
+               me.TD(me, 1, 0.25, e = makeXonoticTextLabel(0, _("Bone:")));
+               me.TD(me, 1, 1.5, box = makeXonoticInputBox(1, "menu_sandbox_attach_bone"));
+                       box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
+                       box.maxLength = -127; // negative means encoded length in bytes
+                       box.saveImmediately = 1;
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set * as child"), '0 0 0', "sandbox object_attach get", 0));
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Attach to *"), '0 0 0', "sandbox object_attach set \"$menu_sandbox_attach_bone\"", 0));
+       me.TDempty(me, 0.1);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Detach from *"), '0 0 0', "sandbox object_attach remove", 0));
+       me.TR(me);
+       me.TR(me);
+       me.TD(me, 1, 1.5, e = makeXonoticTextLabel(0, _("Visual object properties for *:")));
+       me.TR(me);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set skin:"), '0 0 0', "sandbox object_edit skin $menu_sandbox_edit_skin", 0));
+               me.TD(me, 1, 1.5, e = makeXonoticSlider(0, 99, 1, "menu_sandbox_edit_skin"));
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set alpha:"), '0 0 0', "sandbox object_edit alpha $menu_sandbox_edit_alpha", 0));
+               me.TD(me, 1, 1.5, e = makeXonoticSlider(0.1, 1, 0.05, "menu_sandbox_edit_alpha"));
+       me.TR(me);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set color main:"), '0 0 0', "sandbox object_edit color_main \"$menu_sandbox_edit_color_main\"", 0));
+               me.TD(me, 2, 1.5, e = makeXonoticColorpickerString("menu_sandbox_edit_color_main", "menu_sandbox_edit_color_main"));
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set color glow:"), '0 0 0', "sandbox object_edit color_glow \"$menu_sandbox_edit_color_glow\"", 0));
+               me.TD(me, 2, 1.5, e = makeXonoticColorpickerString("menu_sandbox_edit_color_glow", "menu_sandbox_edit_color_glow"));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set frame:"), '0 0 0', "sandbox object_edit frame $menu_sandbox_edit_frame", 0));
+               me.TD(me, 1, 1.5, e = makeXonoticSlider(0, 99, 1, "menu_sandbox_edit_frame"));
+       me.TR(me);
+       me.TR(me);
+       me.TD(me, 1, 1.5, e = makeXonoticTextLabel(0, _("Physical object properties for *:")));
+       me.TR(me);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set material:"), '0 0 0', "sandbox object_edit material \"$menu_sandbox_edit_material\"", 0));
+               me.TD(me, 1, 1.5, box = makeXonoticInputBox(1, "menu_sandbox_edit_material"));
+                       box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
+                       box.maxLength = -127; // negative means encoded length in bytes
+                       box.saveImmediately = 1;
+       me.TR(me);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set solidity:"), '0 0 0', "sandbox object_edit solidity $menu_sandbox_edit_solidity", 0));
+               me.TD(me, 1, 0.75, e = makeXonoticRadioButton(1, "menu_sandbox_edit_solidity", "0", _("Non-solid")));
+               me.TD(me, 1, 0.75, e = makeXonoticRadioButton(1, "menu_sandbox_edit_solidity", "1", _("Solid")));
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set physics:"), '0 0 0', "sandbox object_edit physics $menu_sandbox_edit_physics", 0));
+               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_sandbox_edit_physics", "0", _("Static")));
+               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_sandbox_edit_physics", "1", _("Movable")));
+               me.TD(me, 1, 0.5, e = makeXonoticRadioButton(2, "menu_sandbox_edit_physics", "2", _("Physical")));
+       me.TR(me);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set scale:"), '0 0 0', "sandbox object_edit scale $menu_sandbox_edit_scale", 0));
+               me.TD(me, 1, 1.5, e = makeXonoticSlider(0.25, 2, 0.05, "menu_sandbox_edit_scale"));
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Set force:"), '0 0 0', "sandbox object_edit force $menu_sandbox_edit_force", 0));
+               me.TD(me, 1, 1.5, e = makeXonoticSlider(0, 10, 0.5, "menu_sandbox_edit_force"));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Claim *"), '0 0 0', "sandbox object_claim", 0));
+               me.TDempty(me, 0.5);
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("* object info"), '1 1 0.5', "sandbox object_info object; toggleconsole", 0));
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("* mesh info"), '1 1 0.5', "sandbox object_info mesh; toggleconsole", 0));
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("* attachment info"), '1 1 0.5', "sandbox object_info attachments; toggleconsole", 0));
+               me.TD(me, 1, 0.5, e = makeXonoticCommandButton(_("Show help"), '1 0.5 0.5', "sandbox help; toggleconsole", 0));
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("* is the object you are facing")));
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+#endif
+
+/* Click. The c-word is here so you can grep for it :-) */
diff --git a/qcsrc/menu/xonotic/dialog_settings.c b/qcsrc/menu/xonotic/dialog_settings.c
deleted file mode 100644 (file)
index a992e80..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticSettingsDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticSettingsDialog, fill, void(entity))
-       ATTRIB(XonoticSettingsDialog, title, string, _("Settings"))
-       ATTRIB(XonoticSettingsDialog, color, vector, SKINCOLOR_DIALOG_SETTINGS)
-       ATTRIB(XonoticSettingsDialog, intendedWidth, float, 0.96)
-       ATTRIB(XonoticSettingsDialog, rows, float, 18)
-       ATTRIB(XonoticSettingsDialog, columns, float, 6)
-ENDCLASS(XonoticSettingsDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticSettingsDialog_fill(entity me)
-{
-       entity mc;
-       mc = makeXonoticTabController(me.rows - 2.5);
-       me.TR(me);
-               me.TD(me, 1, 2, mc.makeTabButton(mc, _("Video"),   makeXonoticVideoSettingsTab()));
-               me.TD(me, 1, 2, mc.makeTabButton(mc, _("Effects"), makeXonoticEffectsSettingsTab()));
-               me.TD(me, 1, 2, mc.makeTabButton(mc, _("Audio"),   makeXonoticAudioSettingsTab()));
-       me.TR(me);
-               me.TD(me, 1, 1.5, mc.makeTabButton(mc, _("Game"),   makeXonoticGameSettingsTab()));
-               me.TD(me, 1, 1.5, mc.makeTabButton(mc, _("Input"),   makeXonoticInputSettingsTab()));
-               me.TD(me, 1, 1.5, mc.makeTabButton(mc, _("User"),    makeXonoticUserSettingsTab()));
-               me.TD(me, 1, 1.5, mc.makeTabButton(mc, _("Misc"),    makeXonoticMiscSettingsTab()));
-       me.gotoRC(me, 2.5, 0);
-               me.TD(me, me.rows - 2.5, me.columns, mc);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings.qc b/qcsrc/menu/xonotic/dialog_settings.qc
new file mode 100644 (file)
index 0000000..a992e80
--- /dev/null
@@ -0,0 +1,29 @@
+#ifdef INTERFACE
+CLASS(XonoticSettingsDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticSettingsDialog, fill, void(entity))
+       ATTRIB(XonoticSettingsDialog, title, string, _("Settings"))
+       ATTRIB(XonoticSettingsDialog, color, vector, SKINCOLOR_DIALOG_SETTINGS)
+       ATTRIB(XonoticSettingsDialog, intendedWidth, float, 0.96)
+       ATTRIB(XonoticSettingsDialog, rows, float, 18)
+       ATTRIB(XonoticSettingsDialog, columns, float, 6)
+ENDCLASS(XonoticSettingsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticSettingsDialog_fill(entity me)
+{
+       entity mc;
+       mc = makeXonoticTabController(me.rows - 2.5);
+       me.TR(me);
+               me.TD(me, 1, 2, mc.makeTabButton(mc, _("Video"),   makeXonoticVideoSettingsTab()));
+               me.TD(me, 1, 2, mc.makeTabButton(mc, _("Effects"), makeXonoticEffectsSettingsTab()));
+               me.TD(me, 1, 2, mc.makeTabButton(mc, _("Audio"),   makeXonoticAudioSettingsTab()));
+       me.TR(me);
+               me.TD(me, 1, 1.5, mc.makeTabButton(mc, _("Game"),   makeXonoticGameSettingsTab()));
+               me.TD(me, 1, 1.5, mc.makeTabButton(mc, _("Input"),   makeXonoticInputSettingsTab()));
+               me.TD(me, 1, 1.5, mc.makeTabButton(mc, _("User"),    makeXonoticUserSettingsTab()));
+               me.TD(me, 1, 1.5, mc.makeTabButton(mc, _("Misc"),    makeXonoticMiscSettingsTab()));
+       me.gotoRC(me, 2.5, 0);
+               me.TD(me, me.rows - 2.5, me.columns, mc);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_audio.c b/qcsrc/menu/xonotic/dialog_settings_audio.c
deleted file mode 100644 (file)
index 39bee32..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticAudioSettingsTab) EXTENDS(XonoticTab)
-       METHOD(XonoticAudioSettingsTab, fill, void(entity))
-       ATTRIB(XonoticAudioSettingsTab, title, string, _("Audio"))
-       ATTRIB(XonoticAudioSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticAudioSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticAudioSettingsTab, columns, float, 6.2) // added extra .2 for center space
-ENDCLASS(XonoticAudioSettingsTab)
-entity makeXonoticAudioSettingsTab();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticAudioSettingsTab()
-{
-       entity me;
-       me = spawnXonoticAudioSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-
-void XonoticAudioSettingsTab_fill(entity me)
-{
-       entity e, s;
-
-       me.TR(me);
-               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "mastervolume");
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Master:")));
-               me.TD(me, 1, 2, s);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "bgmvolume");
-               makeMulti(s, "snd_channel8volume");
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Music:")));
-               me.TD(me, 1, 2, s);
-               setDependentStringNotEqual(e, "mastervolume", "0");
-               setDependentStringNotEqual(s, "mastervolume", "0");
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_staticvolume");
-               makeMulti(s, "snd_channel9volume");
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, ZCTX(_("VOL^Ambient:"))));
-               me.TD(me, 1, 2, s);
-               setDependentStringNotEqual(e, "mastervolume", "0");
-               setDependentStringNotEqual(s, "mastervolume", "0");
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel0volume");
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Info:")));
-               me.TD(me, 1, 2, s);
-               setDependentStringNotEqual(e, "mastervolume", "0");
-               setDependentStringNotEqual(s, "mastervolume", "0");
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel3volume");
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Items:")));
-               me.TD(me, 1, 2, s);
-               setDependentStringNotEqual(e, "mastervolume", "0");
-               setDependentStringNotEqual(s, "mastervolume", "0");
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel6volume");
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Pain:")));
-               me.TD(me, 1, 2, s);
-               setDependentStringNotEqual(e, "mastervolume", "0");
-               setDependentStringNotEqual(s, "mastervolume", "0");
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel7volume");
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Player:")));
-               me.TD(me, 1, 2, s);
-               setDependentStringNotEqual(e, "mastervolume", "0");
-               setDependentStringNotEqual(s, "mastervolume", "0");
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel4volume");
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Shots:")));
-               me.TD(me, 1, 2, s);
-               setDependentStringNotEqual(e, "mastervolume", "0");
-               setDependentStringNotEqual(s, "mastervolume", "0");
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel2volume");
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Voice:")));
-               me.TD(me, 1, 2, s);
-               setDependentStringNotEqual(e, "mastervolume", "0");
-               setDependentStringNotEqual(s, "mastervolume", "0");
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel1volume");
-               makeMulti(s, "snd_channel5volume"); // @!#%'n Tuba
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Weapons:")));
-               me.TD(me, 1, 2, s);
-               setDependentStringNotEqual(e, "mastervolume", "0");
-               setDependentStringNotEqual(s, "mastervolume", "0");
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, makeXonoticCheckBox(0, "menu_snd_attenuation_method", _("New style sound attenuation")));
-       me.TR(me);
-               me.TD(me, 1, 3, makeXonoticCheckBox(0, "snd_mutewhenidle", _("Mute sounds when not active")));
-
-       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Frequency:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("snd_speed"));
-                       e.addValue(e, _("8 kHz"), "8000");
-                       e.addValue(e, _("11.025 kHz"), "11025");
-                       e.addValue(e, _("16 kHz"), "16000");
-                       e.addValue(e, _("22.05 kHz"), "22050");
-                       e.addValue(e, _("24 kHz"), "24000");
-                       e.addValue(e, _("32 kHz"), "32000");
-                       e.addValue(e, _("44.1 kHz"), "44100");
-                       e.addValue(e, _("48 kHz"), "48000");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Channels:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("snd_channels"));
-                       e.addValue(e, _("Mono"), "1");
-                       e.addValue(e, _("Stereo"), "2");
-                       e.addValue(e, _("2.1"), "3");
-                       e.addValue(e, _("4"), "4");
-                       e.addValue(e, _("5"), "5");
-                       e.addValue(e, _("5.1"), "6");
-                       e.addValue(e, _("6.1"), "7");
-                       e.addValue(e, _("7.1"), "8");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "snd_swapstereo", _("Swap stereo output channels")));
-               setDependent(e, "snd_channels", 1.5, 0.5);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "snd_spatialization_control", _("Headphone friendly mode")));
-               setDependent(e, "snd_channels", 1.5, 0.5);
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, makeXonoticCheckBox(0, "cl_hitsound", _("Hit indication sound")));
-               e.sendCvars = TRUE;
-       me.TR(me);
-               me.TD(me, 1, 3, makeXonoticCheckBox(0, "con_chatsound", _("Chat message sound")));
-       me.TR(me);
-               me.TD(me, 1, 3, makeXonoticCheckBoxEx(2, 0, "menu_sounds", _("Menu sounds")));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Time announcer:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_announcer_maptime"));
-                       e.addValue(e, ZCTX(_("WRN^Disabled")), "0");
-                       e.addValue(e, _("1 minute"), "1");
-                       e.addValue(e, _("5 minutes"), "2");
-                       e.addValue(e, ZCTX(_("WRN^Both")), "3");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Automatic taunts:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_autotaunt"));
-                       e.addValue(e, _("Never"), "0");
-                       e.addValue(e, _("Sometimes"), "0.35");
-                       e.addValue(e, _("Often"), "0.65");
-                       e.addValue(e, _("Always"), "1");
-                       e.configureXonoticTextSliderValues(e);
-                       e.sendCvars = TRUE;
-       me.TR(me);
-       me.TR(me);
-               if(cvar("developer"))
-                       me.TD(me, 1, 3, makeXonoticCheckBox(0, "showsound", _("Debug info about sounds")));
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "snd_restart; snd_attenuation_method_${menu_snd_attenuation_method}", COMMANDBUTTON_APPLY));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_audio.qc b/qcsrc/menu/xonotic/dialog_settings_audio.qc
new file mode 100644 (file)
index 0000000..cccaa26
--- /dev/null
@@ -0,0 +1,170 @@
+#ifdef INTERFACE
+CLASS(XonoticAudioSettingsTab) EXTENDS(XonoticTab)
+       METHOD(XonoticAudioSettingsTab, fill, void(entity))
+       ATTRIB(XonoticAudioSettingsTab, title, string, _("Audio"))
+       ATTRIB(XonoticAudioSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticAudioSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticAudioSettingsTab, columns, float, 6.2) // added extra .2 for center space
+       ATTRIB(XonoticAudioSettingsTab, hiddenMenuSoundsSlider, entity, NULL)
+ENDCLASS(XonoticAudioSettingsTab)
+entity makeXonoticAudioSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticAudioSettingsTab()
+{
+       entity me;
+       me = spawnXonoticAudioSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+
+void XonoticAudioSettingsTab_fill(entity me)
+{
+       entity e, s;
+
+       me.TR(me);
+               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "mastervolume");
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Master:")));
+               me.TD(me, 1, 2, s);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "bgmvolume");
+               makeMulti(s, "snd_channel8volume");
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Music:")));
+               me.TD(me, 1, 2, s);
+               setDependentStringNotEqual(e, "mastervolume", "0");
+               setDependentStringNotEqual(s, "mastervolume", "0");
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_staticvolume");
+               makeMulti(s, "snd_channel9volume");
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, ZCTX(_("VOL^Ambient:"))));
+               me.TD(me, 1, 2, s);
+               setDependentStringNotEqual(e, "mastervolume", "0");
+               setDependentStringNotEqual(s, "mastervolume", "0");
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel0volume");
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Info:")));
+               me.TD(me, 1, 2, s);
+               setDependentStringNotEqual(e, "mastervolume", "0");
+               setDependentStringNotEqual(s, "mastervolume", "0");
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel3volume");
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Items:")));
+               me.TD(me, 1, 2, s);
+               setDependentStringNotEqual(e, "mastervolume", "0");
+               setDependentStringNotEqual(s, "mastervolume", "0");
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel6volume");
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Pain:")));
+               me.TD(me, 1, 2, s);
+               setDependentStringNotEqual(e, "mastervolume", "0");
+               setDependentStringNotEqual(s, "mastervolume", "0");
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel7volume");
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Player:")));
+               me.TD(me, 1, 2, s);
+               setDependentStringNotEqual(e, "mastervolume", "0");
+               setDependentStringNotEqual(s, "mastervolume", "0");
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel4volume");
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Shots:")));
+               me.TD(me, 1, 2, s);
+               setDependentStringNotEqual(e, "mastervolume", "0");
+               setDependentStringNotEqual(s, "mastervolume", "0");
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel2volume");
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Voice:")));
+               me.TD(me, 1, 2, s);
+               setDependentStringNotEqual(e, "mastervolume", "0");
+               setDependentStringNotEqual(s, "mastervolume", "0");
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               s = makeXonoticDecibelsSlider(-40, 0, 0.4, "snd_channel1volume");
+               makeMulti(s, "snd_channel5volume"); // @!#%'n Tuba
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Weapons:")));
+               me.TD(me, 1, 2, s);
+               setDependentStringNotEqual(e, "mastervolume", "0");
+               setDependentStringNotEqual(s, "mastervolume", "0");
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, makeXonoticCheckBox(0, "menu_snd_attenuation_method", _("New style sound attenuation")));
+       me.TR(me);
+               me.TD(me, 1, 3, makeXonoticCheckBox(0, "snd_mutewhenidle", _("Mute sounds when not active")));
+
+       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Frequency:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("snd_speed"));
+                       e.addValue(e, _("8 kHz"), "8000");
+                       e.addValue(e, _("11.025 kHz"), "11025");
+                       e.addValue(e, _("16 kHz"), "16000");
+                       e.addValue(e, _("22.05 kHz"), "22050");
+                       e.addValue(e, _("24 kHz"), "24000");
+                       e.addValue(e, _("32 kHz"), "32000");
+                       e.addValue(e, _("44.1 kHz"), "44100");
+                       e.addValue(e, _("48 kHz"), "48000");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Channels:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("snd_channels"));
+                       e.addValue(e, _("Mono"), "1");
+                       e.addValue(e, _("Stereo"), "2");
+                       e.addValue(e, _("2.1"), "3");
+                       e.addValue(e, _("4"), "4");
+                       e.addValue(e, _("5"), "5");
+                       e.addValue(e, _("5.1"), "6");
+                       e.addValue(e, _("6.1"), "7");
+                       e.addValue(e, _("7.1"), "8");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "snd_swapstereo", _("Swap stereo output channels")));
+               setDependent(e, "snd_channels", 1.5, 0.5);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "snd_spatialization_control", _("Headphone friendly mode")));
+               setDependent(e, "snd_channels", 1.5, 0.5);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, makeXonoticCheckBox(0, "cl_hitsound", _("Hit indication sound")));
+               e.sendCvars = true;
+       me.TR(me);
+               me.TD(me, 1, 3, makeXonoticCheckBox(0, "con_chatsound", _("Chat message sound")));
+       me.TR(me);
+               me.hiddenMenuSoundsSlider = makeXonoticSlider(1, 1, 1, "menu_sounds");
+               me.TD(me, 1, 1.2, makeXonoticSliderCheckBox(0, 1, me.hiddenMenuSoundsSlider, _("Menu sounds")));
+               me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(2, 0, me.hiddenMenuSoundsSlider, _("Focus sounds")));
+               setDependent(e, "menu_sounds", 1, 2);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Time announcer:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_announcer_maptime"));
+                       e.addValue(e, ZCTX(_("WRN^Disabled")), "0");
+                       e.addValue(e, _("1 minute"), "1");
+                       e.addValue(e, _("5 minutes"), "2");
+                       e.addValue(e, ZCTX(_("WRN^Both")), "3");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Automatic taunts:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_autotaunt"));
+                       e.addValue(e, _("Never"), "0");
+                       e.addValue(e, _("Sometimes"), "0.35");
+                       e.addValue(e, _("Often"), "0.65");
+                       e.addValue(e, _("Always"), "1");
+                       e.configureXonoticTextSliderValues(e);
+                       e.sendCvars = true;
+       me.TR(me);
+       me.TR(me);
+               if(cvar("developer"))
+                       me.TD(me, 1, 3, makeXonoticCheckBox(0, "showsound", _("Debug info about sounds")));
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "snd_restart; snd_attenuation_method_${menu_snd_attenuation_method}", COMMANDBUTTON_APPLY));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_effects.c b/qcsrc/menu/xonotic/dialog_settings_effects.c
deleted file mode 100644 (file)
index 59b4860..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticEffectsSettingsTab) EXTENDS(XonoticTab)
-       METHOD(XonoticEffectsSettingsTab, fill, void(entity))
-       ATTRIB(XonoticEffectsSettingsTab, title, string, _("Effects"))
-       ATTRIB(XonoticEffectsSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticEffectsSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticEffectsSettingsTab, columns, float, 6.2) // added extra .2 for center space
-ENDCLASS(XonoticEffectsSettingsTab)
-entity makeXonoticEffectsSettingsTab();
-float updateCompression();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticEffectsSettingsTab()
-{
-       entity me;
-       me = spawnXonoticEffectsSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-
-float someShadowCvarIsEnabled(entity box)
-{
-       if(cvar("r_shadow_realtime_dlight"))
-               if(cvar("r_shadow_realtime_dlight_shadows"))
-                       return TRUE;
-       if(cvar("r_shadow_realtime_world"))
-               if(cvar("r_shadow_realtime_world_shadows"))
-                       return TRUE;
-       return FALSE;
-}
-
-void XonoticEffectsSettingsTab_fill(entity me)
-{
-       entity e, s;
-       float n;
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Quality preset:")));
-               n = 5 + 2 * !!cvar("developer");
-               if(cvar("developer"))
-                       me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^OMG!")), '1 0 1', "exec effects-omg.cfg", 0));
-               me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Low")), '0 0 0', "exec effects-low.cfg", 0));
-               me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Medium")), '0 0 0', "exec effects-med.cfg", 0));
-               me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Normal")), '0 0 0', "exec effects-normal.cfg", 0));
-               me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^High")), '0 0 0', "exec effects-high.cfg", 0));
-               me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Ultra")), '0 0 0', "exec effects-ultra.cfg", 0));
-               if(cvar("developer"))
-                       me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Ultimate")), '0.5 0 0', "exec effects-ultimate.cfg", 0));
-
-       me.gotoRC(me, 1.25, 0);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Geometry detail:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("r_subdivisions_tolerance"));
-                       e.addValue(e, ZCTX(_("DET^Lowest")), "16");
-                       e.addValue(e, ZCTX(_("DET^Low")), "8");
-                       e.addValue(e, ZCTX(_("DET^Normal")), "4");
-                       e.addValue(e, ZCTX(_("DET^Good")), "3");
-                       e.addValue(e, ZCTX(_("DET^Best")), "2");
-                       e.addValue(e, ZCTX(_("DET^Insane")), "1");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Player detail:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_playerdetailreduction"));
-                       e.addValue(e, ZCTX(_("PDET^Low")), "4");
-                       e.addValue(e, ZCTX(_("PDET^Medium")), "3");
-                       e.addValue(e, ZCTX(_("PDET^Normal")), "2");
-                       e.addValue(e, ZCTX(_("PDET^Good")), "1");
-                       e.addValue(e, ZCTX(_("PDET^Best")), "0");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Texture resolution:")));
-                       setDependent(e, "r_showsurfaces", 0, 0);
-               me.TD(me, 1, 2, e = makeXonoticPicmipSlider());
-                       if(cvar("developer"))
-                               e.addValue(e, ZCTX(_("RES^Leet")), "1337");
-                       e.addValue(e, ZCTX(_("RES^Lowest")), "3");
-                       e.addValue(e, ZCTX(_("RES^Very low")), "2");
-                       e.addValue(e, ZCTX(_("RES^Low")), "1");
-                       e.addValue(e, ZCTX(_("RES^Normal")), "0");
-                       e.addValue(e, ZCTX(_("RES^Good")), "-1");
-                       e.addValue(e, ZCTX(_("RES^Best")), "-2");
-                       e.configureXonoticTextSliderValues(e);
-                       setDependent(e, "r_showsurfaces", 0, 0);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               {
-                       // detect texture compression method
-                       float f;
-                       f = updateCompression();
-                       switch(f)
-                       {
-                               case 0:
-                                       me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1, "r_texture_dds_load", _("Avoid lossy texture compression")));
-                                               e.disabled = 1; // just show the checkbox anyway, but with no ability to control it
-                                       break;
-                               case 1:
-                                       me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1, "r_texture_dds_load", _("Avoid lossy texture compression")));
-                                               setDependent(e, "r_showsurfaces", 0, 0);
-                                       break;
-                               case 2:
-                                       me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1, "r_texture_dds_load", _("Avoid lossy texture compression")));
-                                               setDependent(e, "r_showsurfaces", 0, 0);
-                                               makeMulti(e, "gl_texturecompression");
-                                       break;
-                       }
-               }
-       me.TR(me);
-               if(cvar("developer"))
-               {
-                       me.TDempty(me, 0.2);
-                       me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(3, 0, "r_showsurfaces", _("Show surfaces")));
-               }
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(1, "mod_q3bsp_nolightmaps", _("Use lightmaps")));
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_glsl_deluxemapping", _("Deluxe mapping")));
-                       setDependentAND(e, "vid_gl20", 1, 1, "mod_q3bsp_nolightmaps", 0, 0);
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_shadow_gloss", _("Gloss")));
-                       setDependentAND3(e, "vid_gl20", 1, 1, "mod_q3bsp_nolightmaps", 0, 0, "r_glsl_deluxemapping", 1, 1);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_glsl_offsetmapping", _("Offset mapping")));
-                       setDependent(e, "vid_gl20", 1, 1);
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_glsl_offsetmapping_reliefmapping", _("Relief mapping")));
-                       setDependentAND(e, "vid_gl20", 1, 1, "r_glsl_offsetmapping", 1, 1);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_water", _("Reflections:")));
-                       setDependent(e, "vid_gl20", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("r_water_resolutionmultiplier"));
-                       e.addValue(e, _("Blurred"), "0.25");
-                       e.addValue(e, ZCTX(_("REFL^Good")), "0.5");
-                       e.addValue(e, _("Sharp"), "1");
-                       e.configureXonoticTextSliderValues(e);
-                       setDependentAND(e, "vid_gl20", 1, 1, "r_water", 1, 1);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "cl_decals", _("Decals")));
-               me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "cl_decals_models", _("Decals on models")));
-                       setDependent(e, "cl_decals", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Distance:")));
-                       setDependent(e, "cl_decals", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticSlider(200, 500, 20, "r_drawdecals_drawdistance"));
-                       setDependent(e, "cl_decals", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Time:")));
-                       setDependent(e, "cl_decals", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticSlider(1, 20, 1, "cl_decals_fadetime"));
-                       setDependent(e, "cl_decals", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Damage effects:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_damageeffect"));
-                       e.addValue(e, _("Disabled"), "0");
-                       e.addValue(e, _("Skeletal"), "1");
-                       e.addValue(e, _("All"), "2");
-                       e.configureXonoticTextSliderValues(e);
-
-       me.gotoRC(me, 1.25, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "r_coronas", "0", _("No dynamic lighting")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "gl_flashblend", string_null, _("Fake corona lighting")));
-               makeMulti(e, "r_coronas");
-       me.TR(me);
-               me.TD(me, 1, 2, e = makeXonoticRadioButton(1, "r_shadow_realtime_dlight", string_null, _("Realtime dynamic lighting")));
-               makeMulti(e, "r_coronas");
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_shadow_realtime_dlight_shadows", _("Shadows")));
-                       setDependent(e, "r_shadow_realtime_dlight", 1, 1);
-       me.TR(me);
-               me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "r_shadow_realtime_world", _("Realtime world lighting")));
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_shadow_realtime_world_shadows", _("Shadows")));
-                       setDependent(e, "r_shadow_realtime_world", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "r_shadow_usenormalmap", _("Use normal maps")));
-                       setDependentOR(e, "r_shadow_realtime_dlight", 1, 1, "r_shadow_realtime_world", 1, 1);
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_shadow_shadowmapping", _("Soft shadows")));
-                       setDependentWeird(e, someShadowCvarIsEnabled);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "r_coronas_occlusionquery", _("Fade corona according to visibility")));
-                       setDependent(e, "r_coronas", 1, 1);
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_bloom", _("Bloom")));
-               me.TD(me, 1, 2, e = makeXonoticCheckBoxEx(0.5, 0, "hud_postprocessing_maxbluralpha", _("Extra postprocessing effects")));
-                       makeMulti(e, "hud_powerup");
-                       setDependent(e, "vid_gl20", 1, 1);
-       me.TR(me);
-               s = makeXonoticSlider(0.1, 1, 0.1, "r_motionblur");
-               me.TD(me, 1, 1, e = makeXonoticSliderCheckBox(0, 1, s, _("Motion blur:")));
-               if(s.value != e.savedValue)
-                       e.savedValue = 0.4; // default
-               me.TD(me, 1, 2, s);
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "cl_particles", _("Particles")));
-               me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "cl_spawn_point_particles", _("Spawnpoint effects")));
-                       makeMulti(e, "cl_spawn_event_particles");
-                       setDependent(e, "cl_particles", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Quality:")));
-                       setDependent(e, "cl_particles", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticParticlesSlider());
-                       setDependent(e, "cl_particles", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Distance:")));
-                       setDependent(e, "cl_particles", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticSlider(200, 500, 20, "r_drawparticles_drawdistance"));
-                       setDependent(e, "cl_particles", 1, 1);
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "vid_restart", COMMANDBUTTON_APPLY));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_effects.qc b/qcsrc/menu/xonotic/dialog_settings_effects.qc
new file mode 100644 (file)
index 0000000..fcbbbbe
--- /dev/null
@@ -0,0 +1,214 @@
+#ifdef INTERFACE
+CLASS(XonoticEffectsSettingsTab) EXTENDS(XonoticTab)
+       METHOD(XonoticEffectsSettingsTab, fill, void(entity))
+       ATTRIB(XonoticEffectsSettingsTab, title, string, _("Effects"))
+       ATTRIB(XonoticEffectsSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticEffectsSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticEffectsSettingsTab, columns, float, 6.2) // added extra .2 for center space
+ENDCLASS(XonoticEffectsSettingsTab)
+entity makeXonoticEffectsSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticEffectsSettingsTab()
+{
+       entity me;
+       me = spawnXonoticEffectsSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+
+float someShadowCvarIsEnabled(entity box)
+{
+       if(cvar("r_shadow_realtime_dlight"))
+               if(cvar("r_shadow_realtime_dlight_shadows"))
+                       return true;
+       if(cvar("r_shadow_realtime_world"))
+               if(cvar("r_shadow_realtime_world_shadows"))
+                       return true;
+       return false;
+}
+
+void XonoticEffectsSettingsTab_fill(entity me)
+{
+       entity e, s;
+       float n;
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Quality preset:")));
+               n = 5 + 2 * !!cvar("developer");
+               if(cvar("developer"))
+                       me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^OMG!")), '1 0 1', "exec effects-omg.cfg", 0));
+               me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Low")), '0 0 0', "exec effects-low.cfg", 0));
+               me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Medium")), '0 0 0', "exec effects-med.cfg", 0));
+               me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Normal")), '0 0 0', "exec effects-normal.cfg", 0));
+               me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^High")), '0 0 0', "exec effects-high.cfg", 0));
+               me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Ultra")), '0 0 0', "exec effects-ultra.cfg", 0));
+               if(cvar("developer"))
+                       me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Ultimate")), '0.5 0 0', "exec effects-ultimate.cfg", 0));
+
+       me.gotoRC(me, 1.25, 0);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Geometry detail:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("r_subdivisions_tolerance"));
+                       e.addValue(e, ZCTX(_("DET^Lowest")), "16");
+                       e.addValue(e, ZCTX(_("DET^Low")), "8");
+                       e.addValue(e, ZCTX(_("DET^Normal")), "4");
+                       e.addValue(e, ZCTX(_("DET^Good")), "3");
+                       e.addValue(e, ZCTX(_("DET^Best")), "2");
+                       e.addValue(e, ZCTX(_("DET^Insane")), "1");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Player detail:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_playerdetailreduction"));
+                       e.addValue(e, ZCTX(_("PDET^Low")), "4");
+                       e.addValue(e, ZCTX(_("PDET^Medium")), "3");
+                       e.addValue(e, ZCTX(_("PDET^Normal")), "2");
+                       e.addValue(e, ZCTX(_("PDET^Good")), "1");
+                       e.addValue(e, ZCTX(_("PDET^Best")), "0");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Texture resolution:")));
+                       setDependent(e, "r_showsurfaces", 0, 0);
+               me.TD(me, 1, 2, e = makeXonoticPicmipSlider());
+                       if(cvar("developer"))
+                               e.addValue(e, ZCTX(_("RES^Leet")), "1337");
+                       e.addValue(e, ZCTX(_("RES^Lowest")), "3");
+                       e.addValue(e, ZCTX(_("RES^Very low")), "2");
+                       e.addValue(e, ZCTX(_("RES^Low")), "1");
+                       e.addValue(e, ZCTX(_("RES^Normal")), "0");
+                       e.addValue(e, ZCTX(_("RES^Good")), "-1");
+                       e.addValue(e, ZCTX(_("RES^Best")), "-2");
+                       e.configureXonoticTextSliderValues(e);
+                       setDependent(e, "r_showsurfaces", 0, 0);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               {
+                       // detect texture compression method
+                       float f;
+                       f = updateCompression();
+                       switch(f)
+                       {
+                               case 0:
+                                       me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1, "r_texture_dds_load", _("Avoid lossy texture compression")));
+                                               e.disabled = 1; // just show the checkbox anyway, but with no ability to control it
+                                       break;
+                               case 1:
+                                       me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1, "r_texture_dds_load", _("Avoid lossy texture compression")));
+                                               setDependent(e, "r_showsurfaces", 0, 0);
+                                       break;
+                               case 2:
+                                       me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1, "r_texture_dds_load", _("Avoid lossy texture compression")));
+                                               setDependent(e, "r_showsurfaces", 0, 0);
+                                               makeMulti(e, "gl_texturecompression");
+                                       break;
+                       }
+               }
+       me.TR(me);
+               if(cvar("developer"))
+               {
+                       me.TDempty(me, 0.2);
+                       me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(3, 0, "r_showsurfaces", _("Show surfaces")));
+               }
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(1, "mod_q3bsp_nolightmaps", _("Use lightmaps")));
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_glsl_deluxemapping", _("Deluxe mapping")));
+                       setDependentAND(e, "vid_gl20", 1, 1, "mod_q3bsp_nolightmaps", 0, 0);
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_shadow_gloss", _("Gloss")));
+                       setDependentAND3(e, "vid_gl20", 1, 1, "mod_q3bsp_nolightmaps", 0, 0, "r_glsl_deluxemapping", 1, 1);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_glsl_offsetmapping", _("Offset mapping")));
+                       setDependent(e, "vid_gl20", 1, 1);
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_glsl_offsetmapping_reliefmapping", _("Relief mapping")));
+                       setDependentAND(e, "vid_gl20", 1, 1, "r_glsl_offsetmapping", 1, 1);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_water", _("Reflections:")));
+                       setDependent(e, "vid_gl20", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("r_water_resolutionmultiplier"));
+                       e.addValue(e, _("Blurred"), "0.25");
+                       e.addValue(e, ZCTX(_("REFL^Good")), "0.5");
+                       e.addValue(e, _("Sharp"), "1");
+                       e.configureXonoticTextSliderValues(e);
+                       setDependentAND(e, "vid_gl20", 1, 1, "r_water", 1, 1);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "cl_decals", _("Decals")));
+               me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "cl_decals_models", _("Decals on models")));
+                       setDependent(e, "cl_decals", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Distance:")));
+                       setDependent(e, "cl_decals", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticSlider(200, 500, 20, "r_drawdecals_drawdistance"));
+                       setDependent(e, "cl_decals", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Time:")));
+                       setDependent(e, "cl_decals", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticSlider(1, 20, 1, "cl_decals_fadetime"));
+                       setDependent(e, "cl_decals", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Damage effects:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_damageeffect"));
+                       e.addValue(e, ZCTX(_("DMGFX^Disabled")), "0");
+                       e.addValue(e, _("Skeletal"), "1");
+                       e.addValue(e, ZCTX(_("DMGFX^All")), "2");
+                       e.configureXonoticTextSliderValues(e);
+
+       me.gotoRC(me, 1.25, 3.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "r_coronas", "0", _("No dynamic lighting")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "gl_flashblend", string_null, _("Fake corona lighting")));
+               makeMulti(e, "r_coronas");
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticRadioButton(1, "r_shadow_realtime_dlight", string_null, _("Realtime dynamic lighting")));
+               makeMulti(e, "r_coronas");
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_shadow_realtime_dlight_shadows", _("Shadows")));
+                       setDependent(e, "r_shadow_realtime_dlight", 1, 1);
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "r_shadow_realtime_world", _("Realtime world lighting")));
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_shadow_realtime_world_shadows", _("Shadows")));
+                       setDependent(e, "r_shadow_realtime_world", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "r_shadow_usenormalmap", _("Use normal maps")));
+                       setDependentOR(e, "r_shadow_realtime_dlight", 1, 1, "r_shadow_realtime_world", 1, 1);
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_shadow_shadowmapping", _("Soft shadows")));
+                       setDependentWeird(e, someShadowCvarIsEnabled);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "r_coronas_occlusionquery", _("Fade corona according to visibility")));
+                       setDependent(e, "r_coronas", 1, 1);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_bloom", _("Bloom")));
+               me.TD(me, 1, 2, e = makeXonoticCheckBoxEx(0.5, 0, "hud_postprocessing_maxbluralpha", _("Extra postprocessing effects")));
+                       makeMulti(e, "hud_powerup");
+                       setDependent(e, "vid_gl20", 1, 1);
+       me.TR(me);
+               s = makeXonoticSlider(0.1, 1, 0.1, "r_motionblur");
+               me.TD(me, 1, 1, e = makeXonoticSliderCheckBox(0, 1, s, _("Motion blur:")));
+               if(s.value != e.savedValue)
+                       e.savedValue = 0.4; // default
+               me.TD(me, 1, 2, s);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "cl_particles", _("Particles")));
+               me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "cl_spawn_point_particles", _("Spawnpoint effects")));
+                       makeMulti(e, "cl_spawn_event_particles");
+                       setDependent(e, "cl_particles", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Quality:")));
+                       setDependent(e, "cl_particles", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticParticlesSlider());
+                       setDependent(e, "cl_particles", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Distance:")));
+                       setDependent(e, "cl_particles", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticSlider(200, 500, 20, "r_drawparticles_drawdistance"));
+                       setDependent(e, "cl_particles", 1, 1);
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "vid_restart", COMMANDBUTTON_APPLY));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game.c b/qcsrc/menu/xonotic/dialog_settings_game.c
deleted file mode 100644 (file)
index 2f48c2a..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticGameSettingsTab) EXTENDS(XonoticTab)
-       METHOD(XonoticGameSettingsTab, fill, void(entity))
-       ATTRIB(XonoticGameSettingsTab, title, string, _("Game"))
-       ATTRIB(XonoticGameSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticGameSettingsTab, columns, float, 6.5)
-ENDCLASS(XonoticGameSettingsTab)
-entity makeXonoticGameSettingsTab();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticGameSettingsTab()
-{
-       entity me;
-       me = spawnXonoticGameSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-
-void XonoticGameSettingsTab_fill(entity me)
-{
-       entity mc;
-       mc = makeXonoticTabController(me.rows - 2.5);
-       
-       me.TR(me);
-               me.TDempty(me, 0.25);
-               me.TD(me, 1, 1, mc.makeTabButton(mc, _("View"),           makeXonoticGameViewSettingsTab()));
-               me.TD(me, 1, 1, mc.makeTabButton(mc, _("Crosshair"),      makeXonoticGameCrosshairSettingsTab()));
-               me.TD(me, 1, 1, mc.makeTabButton(mc, _("HUD"),            makeXonoticGameHUDSettingsTab()));
-               me.TD(me, 1, 1, mc.makeTabButton(mc, _("Messages"),       makeXonoticGameMessageSettingsTab()));
-               me.TD(me, 1, 1, mc.makeTabButton(mc, _("Weapons"),        makeXonoticGameWeaponsSettingsTab()));
-               me.TD(me, 1, 1, mc.makeTabButton(mc, _("Models"),         makeXonoticGameModelSettingsTab()));
-
-       me.gotoRC(me, 1.5, 0);
-               me.TD(me, me.rows - 1.5, me.columns, mc);
-               
-       /*
-
-         makeXonoticGameViewSettingsTab()));
-         makeXonoticGameGeneralSettingsTab()));
-       makeXonoticGameCrosshairSettingsTab()));
-       
-              makeXonoticGameWeaponSettingsTab()));
-       l"),   makeXonoticGamePlayermodelSettingsTab()));
-              makeXonoticGameHUDSettingsTab()));
-       on"),  makeXonoticGameNotificationSettingsTab()));
-
-
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_gentle", _("Disable gore effects and harsh language"))); // also set sv_gentle
-       */
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game.qc b/qcsrc/menu/xonotic/dialog_settings_game.qc
new file mode 100644 (file)
index 0000000..5fb563e
--- /dev/null
@@ -0,0 +1,54 @@
+#ifdef INTERFACE
+CLASS(XonoticGameSettingsTab) EXTENDS(XonoticTab)
+       METHOD(XonoticGameSettingsTab, fill, void(entity))
+       ATTRIB(XonoticGameSettingsTab, title, string, _("Game"))
+       ATTRIB(XonoticGameSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticGameSettingsTab, columns, float, 6.5)
+ENDCLASS(XonoticGameSettingsTab)
+entity makeXonoticGameSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticGameSettingsTab()
+{
+       entity me;
+       me = spawnXonoticGameSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+
+void XonoticGameSettingsTab_fill(entity me)
+{
+       entity mc;
+       mc = makeXonoticTabController(me.rows - 2.5);
+
+       me.TR(me);
+               me.TDempty(me, 0.25);
+               me.TD(me, 1, 1, mc.makeTabButton(mc, _("View"),           makeXonoticGameViewSettingsTab()));
+               me.TD(me, 1, 1, mc.makeTabButton(mc, _("Crosshair"),      makeXonoticGameCrosshairSettingsTab()));
+               me.TD(me, 1, 1, mc.makeTabButton(mc, _("HUD"),            makeXonoticGameHUDSettingsTab()));
+               me.TD(me, 1, 1, mc.makeTabButton(mc, _("Messages"),       makeXonoticGameMessageSettingsTab()));
+               me.TD(me, 1, 1, mc.makeTabButton(mc, _("Weapons"),        makeXonoticGameWeaponsSettingsTab()));
+               me.TD(me, 1, 1, mc.makeTabButton(mc, _("Models"),         makeXonoticGameModelSettingsTab()));
+
+       me.gotoRC(me, 1.5, 0);
+               me.TD(me, me.rows - 1.5, me.columns, mc);
+
+       /*
+
+         makeXonoticGameViewSettingsTab()));
+         makeXonoticGameGeneralSettingsTab()));
+       makeXonoticGameCrosshairSettingsTab()));
+
+              makeXonoticGameWeaponSettingsTab()));
+       l"),   makeXonoticGamePlayermodelSettingsTab()));
+              makeXonoticGameHUDSettingsTab()));
+       on"),  makeXonoticGameNotificationSettingsTab()));
+
+
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_gentle", _("Disable gore effects and harsh language"))); // also set sv_gentle
+       */
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_crosshair.c b/qcsrc/menu/xonotic/dialog_settings_game_crosshair.c
deleted file mode 100644 (file)
index 3e164c1..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticGameCrosshairSettingsTab) EXTENDS(XonoticTab)
-       //METHOD(XonoticGameCrosshairSettingsTab, toString, string(entity))
-       METHOD(XonoticGameCrosshairSettingsTab, fill, void(entity))
-       METHOD(XonoticGameCrosshairSettingsTab, showNotify, void(entity))
-       ATTRIB(XonoticGameCrosshairSettingsTab, title, string, _("Crosshair"))
-       ATTRIB(XonoticGameCrosshairSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameCrosshairSettingsTab, rows, float, 13)
-       ATTRIB(XonoticGameCrosshairSettingsTab, columns, float, 6.2)
-ENDCLASS(XonoticGameCrosshairSettingsTab)
-entity makeXonoticGameCrosshairSettingsTab();
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticGameCrosshairSettingsTab_showNotify(entity me)
-{
-       loadAllCvars(me);
-}
-entity makeXonoticGameCrosshairSettingsTab()
-{
-       entity me;
-       me = spawnXonoticGameCrosshairSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-
-void XonoticGameCrosshairSettingsTab_fill(entity me)
-{
-       entity e;
-       float i;
-
-       // crosshair_enabled: 0 = no crosshair options, 1 = no crosshair selection, but everything else enabled, 2 = all crosshair options enabled
-       // FIXME: In the future, perhaps make one global crosshair_type cvar which has 0 for disabled, 1 for custom, 2 for per weapon, etc?
-       me.TR(me); //me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 1, e = makeXonoticRadioButton(3, "crosshair_enabled", "0", _("No crosshair")));
-       //me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticRadioButton(3, "crosshair_per_weapon", string_null, _("Per weapon")));
-               makeMulti(e, "crosshair_enabled");
-       //me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticRadioButton(3, "crosshair_enabled", "2", _("Custom")));
-       me.TR(me);
-               me.TDempty(me, 0.1);
-               for(i = 1; i <= 14; ++i) {
-                       me.TDNoMargin(me, 1, 2 / 14, e = makeXonoticCrosshairButton(4, i), '1 1 0');
-                               setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
-               }
-               // show a larger preview of the selected crosshair
-               me.TDempty(me, 0.1);
-               me.TDNoMargin(me, 3, 0.8, e = makeXonoticCrosshairButton(7, -1), '1 1 0'); // crosshair -1 makes this a preview
-                       setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TDempty(me, 0.1);
-               for(i = 15; i <= 28; ++i) {
-                       me.TDNoMargin(me, 1, 2 / 14, e = makeXonoticCrosshairButton(4, i), '1 1 0');
-                               setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
-               }
-       me.TR(me);
-       me.TR(me);
-               me.TDempty(me, 0.1);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Crosshair size:")));
-                       setDependent(e, "crosshair_enabled", 1, 2);
-               me.TD(me, 1, 1.9, e = makeXonoticSlider(0.1, 1.0, 0.01, "crosshair_size"));
-                       setDependent(e, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TDempty(me, 0.1);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Crosshair alpha:")));
-                       setDependent(e, "crosshair_enabled", 1, 2);
-               me.TD(me, 1, 1.9, e = makeXonoticSlider(0, 1, 0.1, "crosshair_alpha"));
-                       setDependent(e, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TDempty(me, 0.1);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Crosshair color:")));
-                       setDependent(e, "crosshair_enabled", 1, 2);
-               me.TD(me, 1, 0.9, e = makeXonoticRadioButton(5, "crosshair_color_special", "1", _("Per weapon")));
-                       setDependent(e, "crosshair_enabled", 1, 2);
-               me.TD(me, 1, 1, e = makeXonoticRadioButton(5, "crosshair_color_special", "2", _("By health")));
-                       setDependent(e, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticRadioButton(5, "crosshair_color_special", "0", _("Custom")));
-                       setDependent(e, "crosshair_enabled", 1, 2);
-               me.TD(me, 2, 2, e = makeXonoticColorpickerString("crosshair_color", "crosshair_color"));
-                       setDependentAND(e, "crosshair_color_special", 0, 0, "crosshair_enabled", 1, 2);
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-               me.TDempty(me, 0.1);
-               me.TD(me, 1, 2.9, e = makeXonoticCheckBox(0, "crosshair_ring", _("Use rings to indicate weapon status")));
-                       makeMulti(e, "crosshair_ring_reload");
-                       setDependent(e, "crosshair_enabled", 1, 2);
-       //me.TR(me);
-       //      me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Ring size:")));
-       //              setDependentAND(e, "crosshair_ring", 1, 1, "crosshair_enabled", 1, 2);
-       //      me.TD(me, 1, 2, e = makeXonoticSlider(2, 4, 0.1, "crosshair_ring_size"));
-       //              setDependentAND(e, "crosshair_ring", 1, 1, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TDempty(me, 0.3);
-               me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Ring alpha:")));
-                       setDependentAND(e, "crosshair_ring", 1, 1, "crosshair_enabled", 1, 2);
-               me.TD(me, 1, 1.8, e = makeXonoticSlider(0.1, 1, 0.1, "crosshair_ring_alpha"));
-                       setDependentAND(e, "crosshair_ring", 1, 1, "crosshair_enabled", 1, 2);
-       
-       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_dot", _("Enable center crosshair dot")));
-               setDependent(e, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TDempty(me, 0.1);
-               me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Dot size:")));
-                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
-               me.TD(me, 1, 2, e = makeXonoticSlider(0.2, 2, 0.1, "crosshair_dot_size"));
-                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TDempty(me, 0.1);
-               me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Dot alpha:")));
-                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
-               me.TD(me, 1, 2, e = makeXonoticSlider(0.1, 1, 0.1, "crosshair_dot_alpha"));
-                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TDempty(me, 0.1);
-               me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Dot color:")));
-                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
-               me.TD(me, 1, 2, e = makeXonoticRadioButton(1, "crosshair_dot_color_custom", "0", _("Use normal crosshair color")));
-                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticRadioButton(1, "crosshair_dot_color_custom", "1", _("Custom")));
-                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
-               me.TD(me, 2, 2, e = makeXonoticColorpickerString("crosshair_dot_color", "crosshair_dot_color"));
-                       setDependentAND3(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2, "crosshair_dot_color_custom", 1, 1);
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_effect_scalefade", _("Smooth effects of crosshairs")));
-                       setDependent(e, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_hittest_blur", _("Blur crosshair if the shot is obstructed")));
-                       setDependentAND(e, "crosshair_hittest", 1, 100, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(1.25, 0, "crosshair_hittest_scale", _("Enlarge crosshair if targeting an enemy")));
-                       setDependentAND(e, "crosshair_hittest", 1, 100, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(0.5, 0, "crosshair_hitindication", _("Animate crosshair when hitting an enemy")));
-                       setDependent(e, "crosshair_enabled", 1, 2);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(0.25, 0, "crosshair_pickup", _("Animate crosshair when picking up an item")));
-                       setDependent(e, "crosshair_enabled", 1, 2);
-       /*me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Hit testing:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("crosshair_hittest"));
-                       e.addValue(e, ZCTX(_("HTTST^Disabled")), "0");
-                       e.addValue(e, ZCTX(_("HTTST^TrueAim")), "1");
-                       e.addValue(e, ZCTX(_("HTTST^Enemies")), "1.25");
-                       e.configureXonoticTextSliderValues(e);
-                       setDependent(e, "crosshair_enabled", 1, 2);*/
-                       
-       /*me.TR(me);
-                       
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;*/
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_crosshair.qc b/qcsrc/menu/xonotic/dialog_settings_game_crosshair.qc
new file mode 100644 (file)
index 0000000..28cf370
--- /dev/null
@@ -0,0 +1,168 @@
+#ifdef INTERFACE
+CLASS(XonoticGameCrosshairSettingsTab) EXTENDS(XonoticTab)
+       //METHOD(XonoticGameCrosshairSettingsTab, toString, string(entity))
+       METHOD(XonoticGameCrosshairSettingsTab, fill, void(entity))
+       METHOD(XonoticGameCrosshairSettingsTab, showNotify, void(entity))
+       ATTRIB(XonoticGameCrosshairSettingsTab, title, string, _("Crosshair"))
+       ATTRIB(XonoticGameCrosshairSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameCrosshairSettingsTab, rows, float, 13)
+       ATTRIB(XonoticGameCrosshairSettingsTab, columns, float, 6.2)
+ENDCLASS(XonoticGameCrosshairSettingsTab)
+entity makeXonoticGameCrosshairSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticGameCrosshairSettingsTab_showNotify(entity me)
+{
+       loadAllCvars(me);
+}
+entity makeXonoticGameCrosshairSettingsTab()
+{
+       entity me;
+       me = spawnXonoticGameCrosshairSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+
+void XonoticGameCrosshairSettingsTab_fill(entity me)
+{
+       entity e;
+       float i;
+
+       // crosshair_enabled: 0 = no crosshair options, 1 = no crosshair selection, but everything else enabled, 2 = all crosshair options enabled
+       // FIXME: In the future, perhaps make one global crosshair_type cvar which has 0 for disabled, 1 for custom, 2 for per weapon, etc?
+       me.TR(me); //me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 1, e = makeXonoticRadioButton(3, "crosshair_enabled", "0", _("No crosshair")));
+       //me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticRadioButton(3, "crosshair_per_weapon", string_null, _("Per weapon")));
+               makeMulti(e, "crosshair_enabled");
+       //me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticRadioButton(3, "crosshair_enabled", "2", _("Custom")));
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               for(i = 31; i <= 42; ++i) {
+                       me.TDNoMargin(me, 1, 2 / 12, e = makeXonoticCrosshairButton(4, i), '1 1 0');
+                               setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
+               }
+               // show a larger preview of the selected crosshair
+               me.TDempty(me, 0.1);
+               me.TDNoMargin(me, 3, 0.8, e = makeXonoticCrosshairButton(7, -1), '1 1 0'); // crosshair -1 makes this a preview
+                       setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               for(i = 43; i <= 54; ++i) {
+                       me.TDNoMargin(me, 1, 2 / 12, e = makeXonoticCrosshairButton(4, i), '1 1 0');
+                               setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
+               }
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               for(i = 55; i <= 66; ++i) {
+                       me.TDNoMargin(me, 1, 2 / 12, e = makeXonoticCrosshairButton(4, i), '1 1 0');
+                               setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
+               }
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Crosshair size:")));
+                       setDependent(e, "crosshair_enabled", 1, 2);
+               me.TD(me, 1, 1.9, e = makeXonoticSlider(0.1, 1.0, 0.01, "crosshair_size"));
+                       setDependent(e, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Crosshair alpha:")));
+                       setDependent(e, "crosshair_enabled", 1, 2);
+               me.TD(me, 1, 1.9, e = makeXonoticSlider(0, 1, 0.1, "crosshair_alpha"));
+                       setDependent(e, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Crosshair color:")));
+                       setDependent(e, "crosshair_enabled", 1, 2);
+               me.TD(me, 1, 0.9, e = makeXonoticRadioButton(5, "crosshair_color_special", "1", _("Per weapon")));
+                       setDependent(e, "crosshair_enabled", 1, 2);
+               me.TD(me, 1, 1, e = makeXonoticRadioButton(5, "crosshair_color_special", "2", _("By health")));
+                       setDependent(e, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticRadioButton(5, "crosshair_color_special", "0", _("Custom")));
+                       setDependent(e, "crosshair_enabled", 1, 2);
+               me.TD(me, 2, 2, e = makeXonoticColorpickerString("crosshair_color", "crosshair_color"));
+                       setDependentAND(e, "crosshair_color_special", 0, 0, "crosshair_enabled", 1, 2);
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 2.9, e = makeXonoticCheckBox(0, "crosshair_ring", _("Use rings to indicate weapon status")));
+                       makeMulti(e, "crosshair_ring_reload");
+                       setDependent(e, "crosshair_enabled", 1, 2);
+       //me.TR(me);
+       //      me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Ring size:")));
+       //              setDependentAND(e, "crosshair_ring", 1, 1, "crosshair_enabled", 1, 2);
+       //      me.TD(me, 1, 2, e = makeXonoticSlider(2, 4, 0.1, "crosshair_ring_size"));
+       //              setDependentAND(e, "crosshair_ring", 1, 1, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TDempty(me, 0.3);
+               me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Ring alpha:")));
+                       setDependentAND(e, "crosshair_ring", 1, 1, "crosshair_enabled", 1, 2);
+               me.TD(me, 1, 1.8, e = makeXonoticSlider(0.1, 1, 0.1, "crosshair_ring_alpha"));
+                       setDependentAND(e, "crosshair_ring", 1, 1, "crosshair_enabled", 1, 2);
+
+       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_dot", _("Enable center crosshair dot")));
+               setDependent(e, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Dot size:")));
+                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
+               me.TD(me, 1, 2, e = makeXonoticSlider(0.2, 2, 0.1, "crosshair_dot_size"));
+                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Dot alpha:")));
+                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
+               me.TD(me, 1, 2, e = makeXonoticSlider(0.1, 1, 0.1, "crosshair_dot_alpha"));
+                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Dot color:")));
+                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
+               me.TD(me, 1, 2, e = makeXonoticRadioButton(1, "crosshair_dot_color_custom", "0", _("Use normal crosshair color")));
+                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticRadioButton(1, "crosshair_dot_color_custom", "1", _("Custom")));
+                       setDependentAND(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2);
+               me.TD(me, 2, 2, e = makeXonoticColorpickerString("crosshair_dot_color", "crosshair_dot_color"));
+                       setDependentAND3(e, "crosshair_dot", 1, 1, "crosshair_enabled", 1, 2, "crosshair_dot_color_custom", 1, 1);
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_effect_scalefade", _("Smooth effects of crosshairs")));
+                       setDependent(e, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_hittest_blur", _("Blur crosshair if the shot is obstructed")));
+                       setDependentAND(e, "crosshair_hittest", 1, 100, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(1.25, 0, "crosshair_hittest_scale", _("Enlarge crosshair if targeting an enemy")));
+                       setDependentAND(e, "crosshair_hittest", 1, 100, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(0.5, 0, "crosshair_hitindication", _("Animate crosshair when hitting an enemy")));
+                       setDependent(e, "crosshair_enabled", 1, 2);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(0.25, 0, "crosshair_pickup", _("Animate crosshair when picking up an item")));
+                       setDependent(e, "crosshair_enabled", 1, 2);
+       /*me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Hit testing:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("crosshair_hittest"));
+                       e.addValue(e, ZCTX(_("HTTST^Disabled")), "0");
+                       e.addValue(e, ZCTX(_("HTTST^TrueAim")), "1");
+                       e.addValue(e, ZCTX(_("HTTST^Enemies")), "1.25");
+                       e.configureXonoticTextSliderValues(e);
+                       setDependent(e, "crosshair_enabled", 1, 2);*/
+
+       /*me.TR(me);
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;*/
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_hud.c b/qcsrc/menu/xonotic/dialog_settings_game_hud.c
deleted file mode 100644 (file)
index fc7e3a1..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticGameHUDSettingsTab) EXTENDS(XonoticTab)
-       //METHOD(XonoticGameHUDSettingsTab, toString, string(entity))
-       METHOD(XonoticGameHUDSettingsTab, fill, void(entity))
-       METHOD(XonoticGameHUDSettingsTab, showNotify, void(entity))
-       ATTRIB(XonoticGameHUDSettingsTab, title, string, _("HUD"))
-       ATTRIB(XonoticGameHUDSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameHUDSettingsTab, rows, float, 13)
-       ATTRIB(XonoticGameHUDSettingsTab, columns, float, 6.2)
-ENDCLASS(XonoticGameHUDSettingsTab)
-entity makeXonoticGameHUDSettingsTab();
-void HUDSetup_Start(entity me, entity btn);
-#endif
-
-#ifdef IMPLEMENTATION
-void HUDSetup_Check_Gamestatus(entity me, entity btn)
-{
-       if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, ask the player if they want to start one anyway
-       {
-               DialogOpenButton_Click(me, main.hudconfirmDialog);
-       }
-       else // already in a match, lets just cut to the point and open up the hud editor directly
-       {
-               HUDSetup_Start(me, btn);
-       }
-}
-void XonoticGameHUDSettingsTab_showNotify(entity me)
-{
-       loadAllCvars(me);
-}
-entity makeXonoticGameHUDSettingsTab()
-{
-       entity me;
-       me = spawnXonoticGameHUDSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-
-void XonoticGameHUDSettingsTab_fill(entity me)
-{
-       entity e;
-
-       // todo:
-       // threshold: hud_damage_pain_threshold_lower_health
-       // scoreboard_alpha*
-
-       //me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Scoreboard")));
-       //me.TR(me);
-       //      me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Alpha:")));
-       //      me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.05, "scoreboard_alpha_bg"));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Fading speed:")));
-               me.TD(me, 1, 2, e = makeXonoticScoreboardFadeTimeSlider());
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Side padding:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(0.05, 0.3, 0.01, "scoreboard_offset_left"));
-                       makeMulti(e, "scoreboard_offset_right");
-
-       me.TR(me);
-       //me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "scoreboard_respawntime_decimals", _("Show decimals in respawn countdown")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "scoreboard_accuracy", _("Show accuracy underneath scoreboard")));
-
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Waypoints")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_hidewaypoints", _("Display waypoint markers for objectives on the map")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Alpha:")));
-                       setDependent(e, "cl_hidewaypoints", 0, 0);
-               me.TD(me, 1, 2, e = makeXonoticSlider(0.1, 1, 0.05, "g_waypointsprite_alpha"));
-                       setDependent(e, "cl_hidewaypoints", 0, 0);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Fontsize:")));
-                       setDependent(e, "cl_hidewaypoints", 0, 0);
-               me.TD(me, 1, 2, e = makeXonoticSlider(5, 16, 1, "g_waypointsprite_fontsize"));
-                       setDependent(e, "cl_hidewaypoints", 0, 0);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Edge offset:")));
-                       setDependent(e, "cl_hidewaypoints", 0, 0);
-               me.TD(me, 1, 2, e = makeXonoticSlider(0, 0.3, 0.01, "g_waypointsprite_edgeoffset_bottom"));
-                       makeMulti(e, "g_waypointsprite_edgeoffset_top g_waypointsprite_edgeoffset_left g_waypointsprite_edgeoffset_right");
-                       setDependent(e, "cl_hidewaypoints", 0, 0);
-
-       me.TR(me);
-       //me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(0.25, 1, "g_waypointsprite_crosshairfadealpha", _("Fade when near the crosshair")));
-                       setDependent(e, "cl_hidewaypoints", 0, 0);
-
-       #if 0
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Damage")));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Overlay:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.05, "hud_damage"));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Factor:")));
-                       setDependent(e, "hud_damage", 0.001, 100);
-               me.TD(me, 1, 2, e = makeXonoticSlider(0.025, 0.1, 0.025, "hud_damage_factor"));
-                       setDependent(e, "hud_damage", 0.001, 100);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Fade rate:")));
-                       setDependent(e, "hud_damage", 0.001, 100);
-               me.TD(me, 1, 2, e = makeXonoticSlider(0.25, 1, 0.05, "hud_damage_fade_rate"));
-                       setDependent(e, "hud_damage", 0.001, 100);
-       me.TR(me);
-       #endif
-
-       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Player Names")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_shownames", _("Show names above players")));
-
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Alpha:")));
-                       setDependent(e, "hud_shownames", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticSlider(0.1, 1, 0.05, "hud_shownames_alpha"));
-                       setDependent(e, "hud_shownames", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Fontsize:")));
-                       setDependent(e, "hud_shownames", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticSlider(5, 16, 1, "hud_shownames_fontsize"));
-                       setDependent(e, "hud_shownames", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Max distance:")));
-                       setDependent(e, "hud_shownames", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticSlider(2000, 10000, 500, "hud_shownames_maxdistance"));
-                       setDependent(e, "hud_shownames", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Decolorize:")));
-                       setDependent(e, "hud_shownames", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("hud_shownames_decolorize"));
-                       e.addValue(e, ZCTX(_("Never")), "0");
-                       e.addValue(e, ZCTX(_("Teamplay")), "1");
-                       e.addValue(e, ZCTX(_("Always")), "2");
-                       e.configureXonoticTextSliderValues(e);
-                       setDependent(e, "hud_shownames", 1, 1);
-
-       me.TR(me);
-       //me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(25, 0, "hud_shownames_crosshairdistance", _("Only when near crosshair")));
-                       setDependent(e, "hud_shownames", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "hud_shownames_status", _("Display health and armor")));
-                       setDependent(e, "hud_shownames", 1, 1);
-
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Damage overlay:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.05, "hud_damage"));
-       me.TR(me);
-       me.TR(me);
-               me.TDempty(me, 0.5);
-               me.TD(me, 1, 2, e = makeXonoticButton(_("Enter HUD editor"), '0 0 0'));
-                       e.onClick = HUDSetup_Check_Gamestatus;
-                       e.onClickEntity = me;
-               // TODO: show hud config name with text here
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_hud.qc b/qcsrc/menu/xonotic/dialog_settings_game_hud.qc
new file mode 100644 (file)
index 0000000..bb05871
--- /dev/null
@@ -0,0 +1,173 @@
+#ifdef INTERFACE
+CLASS(XonoticGameHUDSettingsTab) EXTENDS(XonoticTab)
+       //METHOD(XonoticGameHUDSettingsTab, toString, string(entity))
+       METHOD(XonoticGameHUDSettingsTab, fill, void(entity))
+       METHOD(XonoticGameHUDSettingsTab, showNotify, void(entity))
+       ATTRIB(XonoticGameHUDSettingsTab, title, string, _("HUD"))
+       ATTRIB(XonoticGameHUDSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameHUDSettingsTab, rows, float, 13)
+       ATTRIB(XonoticGameHUDSettingsTab, columns, float, 6.2)
+ENDCLASS(XonoticGameHUDSettingsTab)
+entity makeXonoticGameHUDSettingsTab();
+void HUDSetup_Start(entity me, entity btn);
+#endif
+
+#ifdef IMPLEMENTATION
+void HUDSetup_Check_Gamestatus(entity me, entity btn)
+{
+       if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, ask the player if they want to start one anyway
+       {
+               DialogOpenButton_Click(me, main.hudconfirmDialog);
+       }
+       else // already in a match, lets just cut to the point and open up the hud editor directly
+       {
+               HUDSetup_Start(me, btn);
+       }
+}
+void XonoticGameHUDSettingsTab_showNotify(entity me)
+{
+       loadAllCvars(me);
+}
+entity makeXonoticGameHUDSettingsTab()
+{
+       entity me;
+       me = spawnXonoticGameHUDSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+
+void XonoticGameHUDSettingsTab_fill(entity me)
+{
+       entity e;
+
+       // todo:
+       // threshold: hud_damage_pain_threshold_lower_health
+       // scoreboard_alpha*
+
+       //me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Scoreboard")));
+       //me.TR(me);
+       //      me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Alpha:")));
+       //      me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.05, "scoreboard_alpha_bg"));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Fading speed:")));
+               me.TD(me, 1, 2, e = makeXonoticScoreboardFadeTimeSlider());
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Side padding:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(0.05, 0.3, 0.01, "scoreboard_offset_left"));
+                       makeMulti(e, "scoreboard_offset_right");
+
+       me.TR(me);
+       //me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "scoreboard_respawntime_decimals", _("Show decimals in respawn countdown")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "scoreboard_accuracy", _("Show accuracy underneath scoreboard")));
+
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Waypoints")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_hidewaypoints", _("Display waypoint markers for objectives on the map")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Alpha:")));
+                       setDependent(e, "cl_hidewaypoints", 0, 0);
+               me.TD(me, 1, 2, e = makeXonoticSlider(0.1, 1, 0.05, "g_waypointsprite_alpha"));
+                       setDependent(e, "cl_hidewaypoints", 0, 0);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Fontsize:")));
+                       setDependent(e, "cl_hidewaypoints", 0, 0);
+               me.TD(me, 1, 2, e = makeXonoticSlider(5, 16, 1, "g_waypointsprite_fontsize"));
+                       setDependent(e, "cl_hidewaypoints", 0, 0);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Edge offset:")));
+                       setDependent(e, "cl_hidewaypoints", 0, 0);
+               me.TD(me, 1, 2, e = makeXonoticSlider(0, 0.3, 0.01, "g_waypointsprite_edgeoffset_bottom"));
+                       makeMulti(e, "g_waypointsprite_edgeoffset_top g_waypointsprite_edgeoffset_left g_waypointsprite_edgeoffset_right");
+                       setDependent(e, "cl_hidewaypoints", 0, 0);
+
+       me.TR(me);
+       //me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(0.25, 1, "g_waypointsprite_crosshairfadealpha", _("Fade when near the crosshair")));
+                       setDependent(e, "cl_hidewaypoints", 0, 0);
+
+       #if 0
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Damage")));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Overlay:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.05, "hud_damage"));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Factor:")));
+                       setDependent(e, "hud_damage", 0.001, 100);
+               me.TD(me, 1, 2, e = makeXonoticSlider(0.025, 0.1, 0.025, "hud_damage_factor"));
+                       setDependent(e, "hud_damage", 0.001, 100);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Fade rate:")));
+                       setDependent(e, "hud_damage", 0.001, 100);
+               me.TD(me, 1, 2, e = makeXonoticSlider(0.25, 1, 0.05, "hud_damage_fade_rate"));
+                       setDependent(e, "hud_damage", 0.001, 100);
+       me.TR(me);
+       #endif
+
+       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Player Names")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_shownames", _("Show names above players")));
+
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Alpha:")));
+                       setDependent(e, "hud_shownames", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticSlider(0.1, 1, 0.05, "hud_shownames_alpha"));
+                       setDependent(e, "hud_shownames", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Fontsize:")));
+                       setDependent(e, "hud_shownames", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticSlider(5, 16, 1, "hud_shownames_fontsize"));
+                       setDependent(e, "hud_shownames", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Max distance:")));
+                       setDependent(e, "hud_shownames", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticSlider(2000, 10000, 500, "hud_shownames_maxdistance"));
+                       setDependent(e, "hud_shownames", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Decolorize:")));
+                       setDependent(e, "hud_shownames", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("hud_shownames_decolorize"));
+                       e.addValue(e, _("Never"), "0");
+                       e.addValue(e, _("Teamplay"), "1");
+                       e.addValue(e, _("Always"), "2");
+                       e.configureXonoticTextSliderValues(e);
+                       setDependent(e, "hud_shownames", 1, 1);
+
+       me.TR(me);
+       //me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(25, 0, "hud_shownames_crosshairdistance", _("Only when near crosshair")));
+                       setDependent(e, "hud_shownames", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "hud_shownames_status", _("Display health and armor")));
+                       setDependent(e, "hud_shownames", 1, 1);
+
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Damage overlay:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.05, "hud_damage"));
+       me.TR(me);
+       me.TR(me);
+               me.TDempty(me, 0.5);
+               me.TD(me, 1, 2, e = makeXonoticButton(_("Enter HUD editor"), '0 0 0'));
+                       e.onClick = HUDSetup_Check_Gamestatus;
+                       e.onClickEntity = me;
+               // TODO: show hud config name with text here
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_hudconfirm.c b/qcsrc/menu/xonotic/dialog_settings_game_hudconfirm.c
deleted file mode 100644 (file)
index 7749a14..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticHUDConfirmDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticHUDConfirmDialog, fill, void(entity))
-       ATTRIB(XonoticHUDConfirmDialog, title, string, _("Enter HUD editor"))
-       ATTRIB(XonoticHUDConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
-       ATTRIB(XonoticHUDConfirmDialog, intendedWidth, float, 0.5)
-       ATTRIB(XonoticHUDConfirmDialog, rows, float, 4)
-       ATTRIB(XonoticHUDConfirmDialog, columns, float, 2)
-ENDCLASS(XonoticHUDConfirmDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void HUDSetup_Start(entity me, entity btn)
-{
-       if (!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
-               localcmd("map hudsetup/hudsetup", "\n");
-       else
-               localcmd("togglemenu 0\n");
-
-       localcmd("_hud_configure 1", "\n");
-}
-
-void XonoticHUDConfirmDialog_fill(entity me)
-{
-       entity e;
-
-       me.TR(me);
-               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("In order for the HUD editor to show, you must first be in game.")));
-       me.TR(me);
-               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Do you wish to start a local game to set up the HUD?")));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticButton(ZCTX(_("HDCNFRM^Yes")), '1 0 0'));
-                       e.onClick = HUDSetup_Start;
-                       e.onClickEntity = me;
-               me.TD(me, 1, 1, e = makeXonoticButton(ZCTX(_("HDCNFRM^No")), '0 1 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_hudconfirm.qc b/qcsrc/menu/xonotic/dialog_settings_game_hudconfirm.qc
new file mode 100644 (file)
index 0000000..12312c3
--- /dev/null
@@ -0,0 +1,40 @@
+#ifdef INTERFACE
+CLASS(XonoticHUDConfirmDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticHUDConfirmDialog, fill, void(entity))
+       ATTRIB(XonoticHUDConfirmDialog, title, string, _("Enter HUD editor"))
+       ATTRIB(XonoticHUDConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+       ATTRIB(XonoticHUDConfirmDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticHUDConfirmDialog, rows, float, 4)
+       ATTRIB(XonoticHUDConfirmDialog, columns, float, 2)
+ENDCLASS(XonoticHUDConfirmDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void HUDSetup_Start(entity me, entity btn)
+{
+       if (!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
+               localcmd("map _hudsetup\n");
+       else
+               localcmd("togglemenu 0\n");
+
+       localcmd("_hud_configure 1\n");
+}
+
+void XonoticHUDConfirmDialog_fill(entity me)
+{
+       entity e;
+
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("In order for the HUD editor to show, you must first be in game.")));
+       me.TR(me);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Do you wish to start a local game to set up the HUD?")));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticButton(_("Yes"), '1 0 0'));
+                       e.onClick = HUDSetup_Start;
+                       e.onClickEntity = me;
+               me.TD(me, 1, 1, e = makeXonoticButton(_("No"), '0 1 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_messages.c b/qcsrc/menu/xonotic/dialog_settings_game_messages.c
deleted file mode 100644 (file)
index 6f605cc..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticGameMessageSettingsTab) EXTENDS(XonoticTab)
-       //METHOD(XonoticGameWeaponsSettingsTab, toString, string(entity))
-       METHOD(XonoticGameMessageSettingsTab, fill, void(entity))
-       METHOD(XonoticGameMessageSettingsTab, showNotify, void(entity))
-       ATTRIB(XonoticGameMessageSettingsTab, title, string, _("Messages"))
-       ATTRIB(XonoticGameMessageSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameMessageSettingsTab, rows, float, 13)
-       ATTRIB(XonoticGameMessageSettingsTab, columns, float, 6)
-       ATTRIB(XonoticGameMessageSettingsTab, weaponsList, entity, NULL)
-ENDCLASS(XonoticGameMessageSettingsTab)
-entity makeXonoticGameMessageSettingsTab();
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticGameMessageSettingsTab_showNotify(entity me)
-{
-       loadAllCvars(me);
-}
-entity makeXonoticGameMessageSettingsTab()
-{
-       entity me;
-       me = spawnXonoticGameMessageSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-
-void XonoticGameMessageSettingsTab_fill(entity me)
-{
-       entity e;
-
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Frag Information")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "notification_show_sprees", _("Display information about killing sprees")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "notification_show_sprees_info_specialonly", _("Only display sprees if they are achievements")));
-                       makeMulti(e, "notification_show_sprees_center_specialonly");
-                       setDependent(e, "notification_show_sprees", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "notification_show_sprees_center", _("Show spree information in centerprints")));
-                       setDependent(e, "notification_show_sprees", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(3, 0, "notification_show_sprees_info", _("Show spree information in death messages")));
-                       setDependent(e, "notification_show_sprees", 1, 1);
-       #if 0
-       me.TR(me);
-               me.TDempty(me, 0.1);
-               me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Sprees in info messages:")));
-                       setDependent(e, "notification_show_sprees", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("notification_show_sprees_info"));
-                       e.addValue(e, ZCTX(_("Disabled")), "0");
-                       e.addValue(e, ZCTX(_("Target")), "1");
-                       e.addValue(e, ZCTX(_("Attacker")), "2");
-                       e.addValue(e, ZCTX(_("Both")), "3");
-                       e.configureXonoticTextSliderValues(e);
-                       setDependent(e, "notification_show_sprees", 1, 1);
-       #endif
-       me.TR(me);
-               me.TDempty(me, 0.4);
-               me.TD(me, 1, 2.6, e = makeXonoticCheckBox(0, "notification_show_sprees_info_newline", _("Print on a seperate line")));
-                       setDependent(e, "notification_show_sprees", 1, 1);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "notification_CHOICE_FRAG", _("Add extra frag information to centerprint when available")));
-                       makeMulti(e, "notification_CHOICE_FRAGGED notification_CHOICE_TYPEFRAG notification_CHOICE_TYPEFRAGGED");
-                       e.sendCvars = TRUE;
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "notification_show_location", _("Add frag location to death messages when available")));
-
-       me.gotoRC(me, 9, 0); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Gamemode Settings")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "notification_CHOICE_CTF_CAPTURE_TIME_RED", _("Display capture times in Capture The Flag")));
-                       makeMulti(e, "notification_CHOICE_CTF_CAPTURE_TIME_BLUE notification_CHOICE_CTF_CAPTURE_BROKEN_RED notification_CHOICE_CTF_CAPTURE_BROKEN_BLUE notification_CHOICE_CTF_CAPTURE_UNBROKEN_RED notification_CHOICE_CTF_CAPTURE_UNBROKEN_BLUE ");
-                       e.sendCvars = TRUE;
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "notification_CHOICE_CTF_PICKUP_ENEMY", _("Display name of flag stealer in Capture The Flag")));
-                       makeMulti(e, "notification_CHOICE_CTF_PICKUP_TEAM");
-                       e.sendCvars = TRUE;
-
-       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Other")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(4, 1, "con_notify", _("Display console messages in the top left corner")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "notification_allow_chatboxprint", _("Display all info messages in the chatbox")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "notification_INFO_QUIT_DISCONNECT", _("Display player statuses in the chatbox")));
-                       makeMulti(e, "notification_INFO_QUIT_KICK_IDLING notification_INFO_JOIN_CONNECT_TEAM_BLUE notification_INFO_JOIN_CONNECT_TEAM_PINK notification_INFO_JOIN_CONNECT_TEAM_RED notification_INFO_JOIN_CONNECT_TEAM_YELLOW");
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "notification_CENTER_POWERUP_INVISIBILITY", _("Powerup notifications")));
-                       makeMulti(e, "notification_CENTER_POWERUP_SHIELD notification_CENTER_POWERUP_SPEED notification_CENTER_POWERUP_STRENGTH notification_CENTER_POWERDOWN_INVISIBILITY notification_CENTER_POWERDOWN_SHIELD notification_CENTER_POWERDOWN_SPEED notification_CENTER_POWERDOWN_STRENGTH notification_CENTER_SUPERWEAPON_BROKEN notification_CENTER_SUPERWEAPON_LOST notification_CENTER_SUPERWEAPON_PICKUP notification_INFO_POWERUP_INVISIBILITY notification_INFO_POWERUP_SHIELD notification_INFO_POWERUP_SPEED notification_INFO_POWERUP_STRENGTH");
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "notification_CENTER_ITEM_WEAPON_DONTHAVE", _("Weapon centerprint notifications")));
-                       makeMulti(e, "notification_CENTER_ITEM_WEAPON_DROP notification_CENTER_ITEM_WEAPON_GOT notification_CENTER_ITEM_WEAPON_NOAMMO notification_CENTER_ITEM_WEAPON_PRIMORSEC notification_CENTER_ITEM_WEAPON_UNAVAILABLE"); 
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "notification_INFO_ITEM_WEAPON_DONTHAVE", _("Weapon info message notifications")));
-                       makeMulti(e, "notification_INFO_ITEM_WEAPON_DROP notification_INFO_ITEM_WEAPON_GOT notification_INFO_ITEM_WEAPON_NOAMMO notification_INFO_ITEM_WEAPON_PRIMORSEC notification_INFO_ITEM_WEAPON_UNAVAILABLE"); 
-
-       me.gotoRC(me, 9, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Announcers")));
-       #if 0
-       // there's just not enough room for this, and it's not important enough to justify...
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 0, "notification_ANNCE_NUM_RESPAWN_1", _("Respawn countdown sounds")));
-                       makeMulti(e, "notification_ANNCE_NUM_RESPAWN_2 notification_ANNCE_NUM_RESPAWN_3 notification_ANNCE_NUM_RESPAWN_4 notification_ANNCE_NUM_RESPAWN_5 notification_ANNCE_NUM_RESPAWN_6 notification_ANNCE_NUM_RESPAWN_7 notification_ANNCE_NUM_RESPAWN_8 notification_ANNCE_NUM_RESPAWN_9 notification_ANNCE_NUM_RESPAWN_10");
-       #endif
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(1, 0, "notification_ANNCE_KILLSTREAK_03", _("Killstreak sounds")));
-                       makeMulti(e, "notification_ANNCE_KILLSTREAK_05 notification_ANNCE_KILLSTREAK_10 notification_ANNCE_KILLSTREAK_15 notification_ANNCE_KILLSTREAK_20 notification_ANNCE_KILLSTREAK_25 notification_ANNCE_KILLSTREAK_30");
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(1, 0, "notification_ANNCE_ACHIEVEMENT_AIRSHOT", _("Achievement sounds")));
-                       makeMulti(e, "notification_ANNCE_ACHIEVEMENT_AMAZING notification_ANNCE_ACHIEVEMENT_AWESOME notification_ANNCE_ACHIEVEMENT_BOTLIKE notification_ANNCE_ACHIEVEMENT_ELECTROBITCH notification_ANNCE_ACHIEVEMENT_IMPRESSIVE notification_ANNCE_ACHIEVEMENT_YODA");
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_messages.qc b/qcsrc/menu/xonotic/dialog_settings_game_messages.qc
new file mode 100644 (file)
index 0000000..034608d
--- /dev/null
@@ -0,0 +1,119 @@
+#ifdef INTERFACE
+CLASS(XonoticGameMessageSettingsTab) EXTENDS(XonoticTab)
+       //METHOD(XonoticGameWeaponsSettingsTab, toString, string(entity))
+       METHOD(XonoticGameMessageSettingsTab, fill, void(entity))
+       METHOD(XonoticGameMessageSettingsTab, showNotify, void(entity))
+       ATTRIB(XonoticGameMessageSettingsTab, title, string, _("Messages"))
+       ATTRIB(XonoticGameMessageSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameMessageSettingsTab, rows, float, 13)
+       ATTRIB(XonoticGameMessageSettingsTab, columns, float, 6)
+       ATTRIB(XonoticGameMessageSettingsTab, weaponsList, entity, NULL)
+ENDCLASS(XonoticGameMessageSettingsTab)
+entity makeXonoticGameMessageSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticGameMessageSettingsTab_showNotify(entity me)
+{
+       loadAllCvars(me);
+}
+entity makeXonoticGameMessageSettingsTab()
+{
+       entity me;
+       me = spawnXonoticGameMessageSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+
+void XonoticGameMessageSettingsTab_fill(entity me)
+{
+       entity e;
+
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Frag Information")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "notification_show_sprees", _("Display information about killing sprees")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "notification_show_sprees_info_specialonly", _("Only display sprees if they are achievements")));
+                       makeMulti(e, "notification_show_sprees_center_specialonly");
+                       setDependent(e, "notification_show_sprees", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "notification_show_sprees_center", _("Show spree information in centerprints")));
+                       setDependent(e, "notification_show_sprees", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(3, 0, "notification_show_sprees_info", _("Show spree information in death messages")));
+                       setDependent(e, "notification_show_sprees", 1, 1);
+       #if 0
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Sprees in info messages:")));
+                       setDependent(e, "notification_show_sprees", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("notification_show_sprees_info"));
+                       e.addValue(e, ZCTX(_("SPREES^Disabled")), "0");
+                       e.addValue(e, _("Target"), "1");
+                       e.addValue(e, _("Attacker"), "2");
+                       e.addValue(e, ZCTX(_("SPREES^Both")), "3");
+                       e.configureXonoticTextSliderValues(e);
+                       setDependent(e, "notification_show_sprees", 1, 1);
+       #endif
+       me.TR(me);
+               me.TDempty(me, 0.4);
+               me.TD(me, 1, 2.6, e = makeXonoticCheckBox(0, "notification_show_sprees_info_newline", _("Print on a seperate line")));
+                       setDependent(e, "notification_show_sprees", 1, 1);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "notification_CHOICE_FRAG", _("Add extra frag information to centerprint when available")));
+                       makeMulti(e, "notification_CHOICE_FRAGGED notification_CHOICE_TYPEFRAG notification_CHOICE_TYPEFRAGGED");
+                       e.sendCvars = true;
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "notification_show_location", _("Add frag location to death messages when available")));
+
+       me.gotoRC(me, 9, 0); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Gamemode Settings")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "notification_CHOICE_CTF_CAPTURE_TIME_RED", _("Display capture times in Capture The Flag")));
+                       makeMulti(e, "notification_CHOICE_CTF_CAPTURE_TIME_BLUE notification_CHOICE_CTF_CAPTURE_BROKEN_RED notification_CHOICE_CTF_CAPTURE_BROKEN_BLUE notification_CHOICE_CTF_CAPTURE_UNBROKEN_RED notification_CHOICE_CTF_CAPTURE_UNBROKEN_BLUE ");
+                       e.sendCvars = true;
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "notification_CHOICE_CTF_PICKUP_ENEMY", _("Display name of flag stealer in Capture The Flag")));
+                       makeMulti(e, "notification_CHOICE_CTF_PICKUP_TEAM");
+                       e.sendCvars = true;
+
+       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Other")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(4, 1, "con_notify", _("Display console messages in the top left corner")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "notification_allow_chatboxprint", _("Display all info messages in the chatbox")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "notification_INFO_QUIT_DISCONNECT", _("Display player statuses in the chatbox")));
+                       makeMulti(e, "notification_INFO_QUIT_KICK_IDLING notification_INFO_JOIN_CONNECT_TEAM_BLUE notification_INFO_JOIN_CONNECT_TEAM_PINK notification_INFO_JOIN_CONNECT_TEAM_RED notification_INFO_JOIN_CONNECT_TEAM_YELLOW");
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "notification_CENTER_POWERUP_INVISIBILITY", _("Powerup notifications")));
+                       makeMulti(e, "notification_CENTER_POWERUP_SHIELD notification_CENTER_POWERUP_SPEED notification_CENTER_POWERUP_STRENGTH notification_CENTER_POWERDOWN_INVISIBILITY notification_CENTER_POWERDOWN_SHIELD notification_CENTER_POWERDOWN_SPEED notification_CENTER_POWERDOWN_STRENGTH notification_CENTER_SUPERWEAPON_BROKEN notification_CENTER_SUPERWEAPON_LOST notification_CENTER_SUPERWEAPON_PICKUP notification_INFO_POWERUP_INVISIBILITY notification_INFO_POWERUP_SHIELD notification_INFO_POWERUP_SPEED notification_INFO_POWERUP_STRENGTH");
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "notification_CENTER_ITEM_WEAPON_DONTHAVE", _("Weapon centerprint notifications")));
+                       makeMulti(e, "notification_CENTER_ITEM_WEAPON_DROP notification_CENTER_ITEM_WEAPON_GOT notification_CENTER_ITEM_WEAPON_NOAMMO notification_CENTER_ITEM_WEAPON_PRIMORSEC notification_CENTER_ITEM_WEAPON_UNAVAILABLE");
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "notification_INFO_ITEM_WEAPON_DONTHAVE", _("Weapon info message notifications")));
+                       makeMulti(e, "notification_INFO_ITEM_WEAPON_DROP notification_INFO_ITEM_WEAPON_GOT notification_INFO_ITEM_WEAPON_NOAMMO notification_INFO_ITEM_WEAPON_PRIMORSEC notification_INFO_ITEM_WEAPON_UNAVAILABLE");
+
+       me.gotoRC(me, 9, 3.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Announcers")));
+       #if 0
+       // there's just not enough room for this, and it's not important enough to justify...
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 0, "notification_ANNCE_NUM_RESPAWN_1", _("Respawn countdown sounds")));
+                       makeMulti(e, "notification_ANNCE_NUM_RESPAWN_2 notification_ANNCE_NUM_RESPAWN_3 notification_ANNCE_NUM_RESPAWN_4 notification_ANNCE_NUM_RESPAWN_5 notification_ANNCE_NUM_RESPAWN_6 notification_ANNCE_NUM_RESPAWN_7 notification_ANNCE_NUM_RESPAWN_8 notification_ANNCE_NUM_RESPAWN_9 notification_ANNCE_NUM_RESPAWN_10");
+       #endif
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(1, 0, "notification_ANNCE_KILLSTREAK_03", _("Killstreak sounds")));
+                       makeMulti(e, "notification_ANNCE_KILLSTREAK_05 notification_ANNCE_KILLSTREAK_10 notification_ANNCE_KILLSTREAK_15 notification_ANNCE_KILLSTREAK_20 notification_ANNCE_KILLSTREAK_25 notification_ANNCE_KILLSTREAK_30");
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(1, 0, "notification_ANNCE_ACHIEVEMENT_AIRSHOT", _("Achievement sounds")));
+                       makeMulti(e, "notification_ANNCE_ACHIEVEMENT_AMAZING notification_ANNCE_ACHIEVEMENT_AWESOME notification_ANNCE_ACHIEVEMENT_BOTLIKE notification_ANNCE_ACHIEVEMENT_ELECTROBITCH notification_ANNCE_ACHIEVEMENT_IMPRESSIVE notification_ANNCE_ACHIEVEMENT_YODA");
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_model.c b/qcsrc/menu/xonotic/dialog_settings_game_model.c
deleted file mode 100644 (file)
index c2aedc1..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticGameModelSettingsTab) EXTENDS(XonoticTab)
-       //METHOD(XonoticGameModelSettingsTab, toString, string(entity))
-       METHOD(XonoticGameModelSettingsTab, fill, void(entity))
-       METHOD(XonoticGameModelSettingsTab, showNotify, void(entity))
-       ATTRIB(XonoticGameModelSettingsTab, title, string, _("Model"))
-       ATTRIB(XonoticGameModelSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameModelSettingsTab, rows, float, 13)
-       ATTRIB(XonoticGameModelSettingsTab, columns, float, 5)
-ENDCLASS(XonoticGameModelSettingsTab)
-entity makeXonoticGameModelSettingsTab();
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticGameModelSettingsTab_showNotify(entity me)
-{
-       loadAllCvars(me);
-}
-entity makeXonoticGameModelSettingsTab()
-{
-       entity me;
-       me = spawnXonoticGameModelSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-
-void XonoticGameModelSettingsTab_fill(entity me)
-{
-       entity e;
-       //float i;
-       
-       // Note that this is pretty terrible currently due to the lack of options for this tab...
-       // There is really not many other decent places for these options, additionally
-       // later I would like quite a few more options in this tab.
-
-       me.gotoRC(me, 0, 1); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Items")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_simple_items", _("Use simple 2D images instead of item models")));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Unavailable alpha:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.1, "cl_ghost_items"));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Unavailable color:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_ghost_items_color"));
-                       e.addValue(e, ZCTX(_("GHOITEMS^Black")), "-1 -1 -1");
-                       e.addValue(e, ZCTX(_("GHOITEMS^Dark")), "0.1 0.1 0.1");
-                       e.addValue(e, ZCTX(_("GHOITEMS^Tinted")), "0.6 0.6 0.6");
-                       e.addValue(e, ZCTX(_("GHOITEMS^Normal")), "1 1 1");
-                       e.addValue(e, ZCTX(_("GHOITEMS^Blue")), "-1 -1 3");
-                       e.configureXonoticTextSliderValues(e);
-                       setDependent(e, "cl_ghost_items", 0.001, 1);
-
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Players")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_forceplayermodels", _("Force player models to mine")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_forceplayercolors", _("Force player colors to mine")));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Body fading:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(0, 2, 0.2, "cl_deathglow"));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Gibs:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_nogibs"));
-                       e.addValue(e, ZCTX(_("GIBS^None")), "1");
-                       e.addValue(e, ZCTX(_("GIBS^Few")), "0.75");
-                       e.addValue(e, ZCTX(_("GIBS^Many")), "0.5");
-                       e.addValue(e, ZCTX(_("GIBS^Lots")), "0");
-                       e.configureXonoticTextSliderValues(e);
-                       setDependent(e, "cl_gentle", 0, 0);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_model.qc b/qcsrc/menu/xonotic/dialog_settings_game_model.qc
new file mode 100644 (file)
index 0000000..1f9a23f
--- /dev/null
@@ -0,0 +1,74 @@
+#ifdef INTERFACE
+CLASS(XonoticGameModelSettingsTab) EXTENDS(XonoticTab)
+       //METHOD(XonoticGameModelSettingsTab, toString, string(entity))
+       METHOD(XonoticGameModelSettingsTab, fill, void(entity))
+       METHOD(XonoticGameModelSettingsTab, showNotify, void(entity))
+       ATTRIB(XonoticGameModelSettingsTab, title, string, _("Model"))
+       ATTRIB(XonoticGameModelSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameModelSettingsTab, rows, float, 13)
+       ATTRIB(XonoticGameModelSettingsTab, columns, float, 5)
+ENDCLASS(XonoticGameModelSettingsTab)
+entity makeXonoticGameModelSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticGameModelSettingsTab_showNotify(entity me)
+{
+       loadAllCvars(me);
+}
+entity makeXonoticGameModelSettingsTab()
+{
+       entity me;
+       me = spawnXonoticGameModelSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+
+void XonoticGameModelSettingsTab_fill(entity me)
+{
+       entity e;
+       //float i;
+
+       // Note that this is pretty terrible currently due to the lack of options for this tab...
+       // There is really not many other decent places for these options, additionally
+       // later I would like quite a few more options in this tab.
+
+       me.gotoRC(me, 0, 1); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Items")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_simple_items", _("Use simple 2D images instead of item models")));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Unavailable alpha:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.1, "cl_ghost_items"));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Unavailable color:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_ghost_items_color"));
+                       e.addValue(e, ZCTX(_("GHOITEMS^Black")), "-1 -1 -1");
+                       e.addValue(e, ZCTX(_("GHOITEMS^Dark")), "0.1 0.1 0.1");
+                       e.addValue(e, ZCTX(_("GHOITEMS^Tinted")), "0.6 0.6 0.6");
+                       e.addValue(e, ZCTX(_("GHOITEMS^Normal")), "1 1 1");
+                       e.addValue(e, ZCTX(_("GHOITEMS^Blue")), "-1 -1 3");
+                       e.configureXonoticTextSliderValues(e);
+                       setDependent(e, "cl_ghost_items", 0.001, 1);
+
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Players")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_forceplayermodels", _("Force player models to mine")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_forceplayercolors", _("Force player colors to mine")));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Body fading:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(0, 2, 0.2, "cl_deathglow"));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Gibs:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_nogibs"));
+                       e.addValue(e, ZCTX(_("GIBS^None")), "1");
+                       e.addValue(e, ZCTX(_("GIBS^Few")), "0.75");
+                       e.addValue(e, ZCTX(_("GIBS^Many")), "0.5");
+                       e.addValue(e, ZCTX(_("GIBS^Lots")), "0");
+                       e.configureXonoticTextSliderValues(e);
+                       setDependent(e, "cl_gentle", 0, 0);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_view.c b/qcsrc/menu/xonotic/dialog_settings_game_view.c
deleted file mode 100644 (file)
index 3fd4512..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticGameViewSettingsTab) EXTENDS(XonoticTab)
-       //METHOD(XonoticGameCrosshairSettingsTab, toString, string(entity))
-       METHOD(XonoticGameViewSettingsTab, fill, void(entity))
-       METHOD(XonoticGameViewSettingsTab, showNotify, void(entity))
-       ATTRIB(XonoticGameViewSettingsTab, title, string, _("View"))
-       ATTRIB(XonoticGameViewSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameViewSettingsTab, rows, float, 13)
-       ATTRIB(XonoticGameViewSettingsTab, columns, float, 6.2)
-ENDCLASS(XonoticGameViewSettingsTab)
-entity makeXonoticGameViewSettingsTab();
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticGameViewSettingsTab_showNotify(entity me)
-{
-       loadAllCvars(me);
-}
-entity makeXonoticGameViewSettingsTab()
-{
-       entity me;
-       me = spawnXonoticGameViewSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-
-void XonoticGameViewSettingsTab_fill(entity me)
-{
-       entity e;
-
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "chase_active", "0", _("1st person perspective")));
-               makeMulti(e, "crosshair_hittest_showimpact");
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_eventchase_death", _("Slide to third person upon death")));
-               setDependent(e, "chase_active", -1, 0);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(0.05, 0, "cl_bobfall", _("Smooth the view when landing from a jump")));
-               setDependent(e, "chase_active", -1, 0);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(0.05, 0, "cl_smoothviewheight", _("Smooth the view while crouching")));
-               setDependent(e, "chase_active", -1, 0);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(1, 0, "v_idlescale", _("View waving while idle")));
-               setDependent(e, "chase_active", -1, 0);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(0.01, 0, "cl_bob", _("View bobbing while walking around")));
-               makeMulti(e, "cl_bob2");
-               setDependent(e, "chase_active", -1, 0);
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "chase_active", "1", _("3rd person perspective")));
-               makeMulti(e, "crosshair_hittest_showimpact");
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Back distance")));
-               setDependent(e, "chase_active", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticSlider(10, 100, 1, "chase_back"));
-               setDependent(e, "chase_active", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Up distance")));
-               setDependent(e, "chase_active", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticSlider(10, 50, 1, "chase_up"));
-               setDependent(e, "chase_active", 1, 1);
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_clippedspectating", _("Allow passing through walls while spectating")));
-       
-       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Field of view:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(60, 130, 5, "fov"));
-       me.TR(me);
-       me.TR(me);
-               //me.TDempty(me, 0.2);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, ZCTX(_("ZOOM^Zoom factor:"))));
-               me.TD(me, 1, 2, e = makeXonoticSlider(2, 16, 0.5, "cl_zoomfactor"));
-       me.TR(me);
-               //me.TDempty(me, 0.2);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, ZCTX(_("ZOOM^Zoom speed:"))));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_zoomspeed"));
-                       e.addValue(e, "1", "1"); // Samual: for() loop doesn't work here, even though it would make sense.
-                       e.addValue(e, "2", "2");
-                       e.addValue(e, "3", "3");
-                       e.addValue(e, "4", "4");
-                       e.addValue(e, "5", "5");
-                       e.addValue(e, "6", "6");
-                       e.addValue(e, "7", "7");
-                       e.addValue(e, "8", "8");
-                       e.addValue(e, ZCTX(_("ZOOM^Instant")), "-1");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               //me.TDempty(me, 0.2);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, ZCTX(_("ZOOM^Zoom sensitivity:"))));
-               me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.1, "cl_zoomsensitivity"));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "cl_velocityzoom_enabled", _("Velocity zoom")));
-               me.TD(me, 1, 2, e = makeXonoticCheckBoxEx(3, 1, "cl_velocityzoom_type", _("Forward movement only")));
-                       setDependent(e, "cl_velocityzoom_enabled", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, ZCTX(_("VZOOM^Factor"))));
-                       setDependentAND(e, "cl_velocityzoom_enabled", 1, 1, "cl_velocityzoom_type", 1, 3);
-               me.TD(me, 1, 2, e = makeXonoticSlider(-1, 1, 0.1, "cl_velocityzoom_factor"));
-                       setDependentAND(e, "cl_velocityzoom_enabled", 1, 1, "cl_velocityzoom_type", 1, 3);
-       me.TR(me);
-       me.TR(me);
-               //me.TDempty(me, 0.2);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_reticle", _("Display reticle 2D overlay while zooming")));
-       me.TR(me);
-               //me.TDempty(me, 0.2);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_unpress_zoom_on_death", _("Release zoom when you die or respawn")));
-                       makeMulti(e, "cl_unpress_zoom_on_spawn");
-       me.TR(me);
-               //me.TDempty(me, 0.2);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_unpress_zoom_on_weapon_switch", _("Release zoom when you switch weapons")));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_view.qc b/qcsrc/menu/xonotic/dialog_settings_game_view.qc
new file mode 100644 (file)
index 0000000..44e7419
--- /dev/null
@@ -0,0 +1,124 @@
+#ifdef INTERFACE
+CLASS(XonoticGameViewSettingsTab) EXTENDS(XonoticTab)
+       //METHOD(XonoticGameCrosshairSettingsTab, toString, string(entity))
+       METHOD(XonoticGameViewSettingsTab, fill, void(entity))
+       METHOD(XonoticGameViewSettingsTab, showNotify, void(entity))
+       ATTRIB(XonoticGameViewSettingsTab, title, string, _("View"))
+       ATTRIB(XonoticGameViewSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameViewSettingsTab, rows, float, 13)
+       ATTRIB(XonoticGameViewSettingsTab, columns, float, 6.2)
+ENDCLASS(XonoticGameViewSettingsTab)
+entity makeXonoticGameViewSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticGameViewSettingsTab_showNotify(entity me)
+{
+       loadAllCvars(me);
+}
+entity makeXonoticGameViewSettingsTab()
+{
+       entity me;
+       me = spawnXonoticGameViewSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+
+void XonoticGameViewSettingsTab_fill(entity me)
+{
+       entity e;
+
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "chase_active", "0", _("1st person perspective")));
+               makeMulti(e, "crosshair_hittest_showimpact");
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_eventchase_death", _("Slide to third person upon death")));
+               setDependent(e, "chase_active", -1, 0);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(0.05, 0, "cl_bobfall", _("Smooth the view when landing from a jump")));
+               setDependent(e, "chase_active", -1, 0);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(0.05, 0, "cl_smoothviewheight", _("Smooth the view while crouching")));
+               setDependent(e, "chase_active", -1, 0);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(1, 0, "v_idlescale", _("View waving while idle")));
+               setDependent(e, "chase_active", -1, 0);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(0.01, 0, "cl_bob", _("View bobbing while walking around")));
+               makeMulti(e, "cl_bob2");
+               setDependent(e, "chase_active", -1, 0);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "chase_active", "1", _("3rd person perspective")));
+               makeMulti(e, "crosshair_hittest_showimpact");
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Back distance")));
+               setDependent(e, "chase_active", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticSlider(10, 100, 1, "chase_back"));
+               setDependent(e, "chase_active", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Up distance")));
+               setDependent(e, "chase_active", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticSlider(10, 50, 1, "chase_up"));
+               setDependent(e, "chase_active", 1, 1);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_clippedspectating", _("Allow passing through walls while spectating")));
+
+       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Field of view:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(60, 130, 5, "fov"));
+       me.TR(me);
+       me.TR(me);
+               //me.TDempty(me, 0.2);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, ZCTX(_("ZOOM^Zoom factor:"))));
+               me.TD(me, 1, 2, e = makeXonoticSlider(2, 16, 0.5, "cl_zoomfactor"));
+       me.TR(me);
+               //me.TDempty(me, 0.2);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, ZCTX(_("ZOOM^Zoom speed:"))));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_zoomspeed"));
+                       e.addValue(e, "1", "1"); // Samual: for() loop doesn't work here, even though it would make sense.
+                       e.addValue(e, "2", "2");
+                       e.addValue(e, "3", "3");
+                       e.addValue(e, "4", "4");
+                       e.addValue(e, "5", "5");
+                       e.addValue(e, "6", "6");
+                       e.addValue(e, "7", "7");
+                       e.addValue(e, "8", "8");
+                       e.addValue(e, ZCTX(_("ZOOM^Instant")), "-1");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               //me.TDempty(me, 0.2);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, ZCTX(_("ZOOM^Zoom sensitivity:"))));
+               me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.1, "cl_zoomsensitivity"));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "cl_velocityzoom_enabled", _("Velocity zoom")));
+               me.TD(me, 1, 2, e = makeXonoticCheckBoxEx(3, 1, "cl_velocityzoom_type", _("Forward movement only")));
+                       setDependent(e, "cl_velocityzoom_enabled", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, ZCTX(_("VZOOM^Factor"))));
+                       setDependentAND(e, "cl_velocityzoom_enabled", 1, 1, "cl_velocityzoom_type", 1, 3);
+               me.TD(me, 1, 2, e = makeXonoticSlider(-1, 1, 0.1, "cl_velocityzoom_factor"));
+                       setDependentAND(e, "cl_velocityzoom_enabled", 1, 1, "cl_velocityzoom_type", 1, 3);
+       me.TR(me);
+       me.TR(me);
+               //me.TDempty(me, 0.2);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_reticle", _("Display reticle 2D overlay while zooming")));
+       me.TR(me);
+               //me.TDempty(me, 0.2);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_unpress_zoom_on_death", _("Release zoom when you die or respawn")));
+                       makeMulti(e, "cl_unpress_zoom_on_spawn");
+       me.TR(me);
+               //me.TDempty(me, 0.2);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_unpress_zoom_on_weapon_switch", _("Release zoom when you switch weapons")));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_weapons.c b/qcsrc/menu/xonotic/dialog_settings_game_weapons.c
deleted file mode 100644 (file)
index bc7cc7d..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticGameWeaponsSettingsTab) EXTENDS(XonoticTab)
-       //METHOD(XonoticGameWeaponsSettingsTab, toString, string(entity))
-       METHOD(XonoticGameWeaponsSettingsTab, fill, void(entity))
-       METHOD(XonoticGameWeaponsSettingsTab, showNotify, void(entity))
-       ATTRIB(XonoticGameWeaponsSettingsTab, title, string, _("Weapons"))
-       ATTRIB(XonoticGameWeaponsSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticGameWeaponsSettingsTab, rows, float, 13)
-       ATTRIB(XonoticGameWeaponsSettingsTab, columns, float, 6)
-       ATTRIB(XonoticGameWeaponsSettingsTab, weaponsList, entity, NULL)
-ENDCLASS(XonoticGameWeaponsSettingsTab)
-entity makeXonoticGameWeaponsSettingsTab();
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticGameWeaponsSettingsTab_showNotify(entity me)
-{
-       loadAllCvars(me);
-}
-entity makeXonoticGameWeaponsSettingsTab()
-{
-       entity me;
-       me = spawnXonoticGameWeaponsSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-
-void XonoticGameWeaponsSettingsTab_fill(entity me)
-{
-       entity e;
-
-       me.TR(me);
-               me.TDempty(me, 0.25);
-               me.TD(me, 1, 2.5, e = makeXonoticHeaderLabel(_("Weapon Priority List")));
-       me.TR(me);
-               me.TDempty(me, 0.25);
-               me.TD(me, 10, 2.5, e = me.weaponsList = makeXonoticWeaponsList());
-       me.gotoRC(me, 11, 0.25);
-               me.TD(me, 1, 1.25, e = makeXonoticButton(_("Up"), '0 0 0'));
-                       e.onClick = WeaponsList_MoveUp_Click;
-                       e.onClickEntity = me.weaponsList;
-               me.TD(me, 1, 1.25, e = makeXonoticButton(_("Down"), '0 0 0'));
-                       e.onClick = WeaponsList_MoveDown_Click;
-                       e.onClickEntity = me.weaponsList;
-
-       me.gotoRC(me, 0, 3); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_weaponpriority_useforcycling", _("Use priority list for weapon cycling")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_weaponimpulsemode", _("Cycle through only usable weapon selections")));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_autoswitch", _("Auto switch weapons on pickup")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_unpress_attack_on_weapon_switch", _("Release attack buttons when you switch weapons")));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "r_drawviewmodel", _("Draw 1st person weapon model")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.9, e = makeXonoticRadioButton(1, "cl_gunalign", "4", _("Left align")));
-                       setDependent(e, "r_drawviewmodel", 1, 1);
-               me.TD(me, 1, 0.9, e = makeXonoticRadioButton(1, "cl_gunalign", "1", _("Center")));
-                       setDependent(e, "r_drawviewmodel", 1, 1);
-               me.TD(me, 1, 1.0, e = makeXonoticRadioButton(1, "cl_gunalign", "3", _("Right align")));
-                       setDependent(e, "r_drawviewmodel", 1, 1);
-       me.TR(me);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_followmodel", _("Gun model swaying")));
-               makeMulti(e, "cl_leanmodel");
-               setDependent(e, "r_drawviewmodel", 1, 1);
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_bobmodel", _("Gun model bobbing")));
-               setDependent(e, "r_drawviewmodel", 1, 1);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_game_weapons.qc b/qcsrc/menu/xonotic/dialog_settings_game_weapons.qc
new file mode 100644 (file)
index 0000000..bc7cc7d
--- /dev/null
@@ -0,0 +1,77 @@
+#ifdef INTERFACE
+CLASS(XonoticGameWeaponsSettingsTab) EXTENDS(XonoticTab)
+       //METHOD(XonoticGameWeaponsSettingsTab, toString, string(entity))
+       METHOD(XonoticGameWeaponsSettingsTab, fill, void(entity))
+       METHOD(XonoticGameWeaponsSettingsTab, showNotify, void(entity))
+       ATTRIB(XonoticGameWeaponsSettingsTab, title, string, _("Weapons"))
+       ATTRIB(XonoticGameWeaponsSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticGameWeaponsSettingsTab, rows, float, 13)
+       ATTRIB(XonoticGameWeaponsSettingsTab, columns, float, 6)
+       ATTRIB(XonoticGameWeaponsSettingsTab, weaponsList, entity, NULL)
+ENDCLASS(XonoticGameWeaponsSettingsTab)
+entity makeXonoticGameWeaponsSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticGameWeaponsSettingsTab_showNotify(entity me)
+{
+       loadAllCvars(me);
+}
+entity makeXonoticGameWeaponsSettingsTab()
+{
+       entity me;
+       me = spawnXonoticGameWeaponsSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+
+void XonoticGameWeaponsSettingsTab_fill(entity me)
+{
+       entity e;
+
+       me.TR(me);
+               me.TDempty(me, 0.25);
+               me.TD(me, 1, 2.5, e = makeXonoticHeaderLabel(_("Weapon Priority List")));
+       me.TR(me);
+               me.TDempty(me, 0.25);
+               me.TD(me, 10, 2.5, e = me.weaponsList = makeXonoticWeaponsList());
+       me.gotoRC(me, 11, 0.25);
+               me.TD(me, 1, 1.25, e = makeXonoticButton(_("Up"), '0 0 0'));
+                       e.onClick = WeaponsList_MoveUp_Click;
+                       e.onClickEntity = me.weaponsList;
+               me.TD(me, 1, 1.25, e = makeXonoticButton(_("Down"), '0 0 0'));
+                       e.onClick = WeaponsList_MoveDown_Click;
+                       e.onClickEntity = me.weaponsList;
+
+       me.gotoRC(me, 0, 3); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_weaponpriority_useforcycling", _("Use priority list for weapon cycling")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_weaponimpulsemode", _("Cycle through only usable weapon selections")));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_autoswitch", _("Auto switch weapons on pickup")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_unpress_attack_on_weapon_switch", _("Release attack buttons when you switch weapons")));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "r_drawviewmodel", _("Draw 1st person weapon model")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.9, e = makeXonoticRadioButton(1, "cl_gunalign", "4", _("Left align")));
+                       setDependent(e, "r_drawviewmodel", 1, 1);
+               me.TD(me, 1, 0.9, e = makeXonoticRadioButton(1, "cl_gunalign", "1", _("Center")));
+                       setDependent(e, "r_drawviewmodel", 1, 1);
+               me.TD(me, 1, 1.0, e = makeXonoticRadioButton(1, "cl_gunalign", "3", _("Right align")));
+                       setDependent(e, "r_drawviewmodel", 1, 1);
+       me.TR(me);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_followmodel", _("Gun model swaying")));
+               makeMulti(e, "cl_leanmodel");
+               setDependent(e, "r_drawviewmodel", 1, 1);
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_bobmodel", _("Gun model bobbing")));
+               setDependent(e, "r_drawviewmodel", 1, 1);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_input.c b/qcsrc/menu/xonotic/dialog_settings_input.c
deleted file mode 100644 (file)
index 57b6cef..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticInputSettingsTab) EXTENDS(XonoticTab)
-       METHOD(XonoticInputSettingsTab, fill, void(entity))
-       ATTRIB(XonoticInputSettingsTab, title, string, _("Input"))
-       ATTRIB(XonoticInputSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticInputSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticInputSettingsTab, columns, float, 6.2) // added extra .2 for center space
-ENDCLASS(XonoticInputSettingsTab)
-entity makeXonoticInputSettingsTab();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticInputSettingsTab()
-{
-       entity me;
-       me = spawnXonoticInputSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-
-void CheckBox_Click_Redisplay(entity me, entity checkbox)
-{
-       CheckBox_Click(me, checkbox);
-       cmd("\ndefer 0.2 \"togglemenu 1\"\n");
-       //m_display();
-}
-void XonoticInputSettingsTab_fill(entity me)
-{
-       entity e;
-       entity kb = makeXonoticKeyBinder();
-
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Key Bindings")));
-       me.TR(me);
-               me.TD(me, me.rows - 3, 3, kb);
-       me.gotoRC(me, me.rows - 2, 0);
-               me.TD(me, 1, 1, e = makeXonoticButton(_("Change key..."), '0 0 0'));
-                       e.onClick = KeyBinder_Bind_Change;
-                       e.onClickEntity = kb;
-                       kb.keyGrabButton = e;
-               me.TD(me, 1, 1, e = makeXonoticButton(_("Edit..."), '0 0 0'));
-                       e.onClick = KeyBinder_Bind_Edit;
-                       e.onClickEntity = kb;
-                       kb.userbindEditButton = e;
-                       kb.userbindEditDialog = main.userbindEditDialog;
-                       main.userbindEditDialog.keybindBox = kb;
-               me.TD(me, 1, 1, e = makeXonoticButton(_("Clear"), '0 0 0'));
-                       e.onClick = KeyBinder_Bind_Clear;
-                       e.onClickEntity = kb;
-                       kb.clearButton = e;
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticButton(_("Reset all"), '0 0 0'));
-                       e.onClick = KeyBinder_Bind_Reset_All;
-                       e.onClickEntity = kb;
-
-       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Mouse")));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Sensitivity:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(1, 32, 0.2, "sensitivity"));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "m_filter", _("Smooth aiming")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(1.022, "m_pitch", _("Invert aiming")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "menu_mouse_absolute", _("Use system mouse positioning")));
-                       makeMulti(e, "hud_cursormode");
-                       e.onClick = CheckBox_Click_Redisplay;
-                       e.onClickEntity = e;
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "m_accelerate", _("Enable built in mouse acceleration")));
-       me.TR(me);
-               if(cvar_type("vid_dgamouse") & CVAR_TYPEFLAG_ENGINE)
-                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "vid_dgamouse", _("Disable system mouse acceleration")));
-               else if(cvar_type("apple_mouse_noaccel") & CVAR_TYPEFLAG_ENGINE)
-                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "apple_mouse_noaccel", _("Disable system mouse acceleration")));
-               else
-               {
-                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, string_null, _("Disable system mouse acceleration")));
-                       e.disabled = 1; // the option is never available in this case, just there for show
-               }
-
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Other")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "con_closeontoggleconsole", _("Pressing \"enter console\" key also closes it")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_movement_track_canjump", _("Automatically repeat jumping if holding jump")));
-                       e.sendCvars = TRUE;
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Jetpack on jump:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_jetpack_jump"));
-                       e.addValue(e, _("Disabled"), "0");
-                       e.addValue(e, _("Air only"), "1");
-                       e.addValue(e, _("All"), "2");
-                       e.configureXonoticTextSliderValues(e);
-                       e.sendCvars = TRUE;
-       me.TR(me);
-               if(cvar_type("joy_enable") & CVAR_TYPEFLAG_ENGINE)
-               {
-                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joy_enable", _("Use joystick input")));
-                       setDependent(e, "joy_detected", 1, 10000000);
-               }
-               else if(cvar_type("joystick") & CVAR_TYPEFLAG_ENGINE)
-               {
-                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joystick", _("Use joystick input")));
-                       setDependent(e, "joy_detected", 1, 10000000);
-               }
-               else
-               {
-                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, string_null, _("Use joystick input")));
-                       e.disabled = 1; // the option is never available in this case, just there for show
-               }
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_input.qc b/qcsrc/menu/xonotic/dialog_settings_input.qc
new file mode 100644 (file)
index 0000000..b4ac613
--- /dev/null
@@ -0,0 +1,116 @@
+#ifdef INTERFACE
+CLASS(XonoticInputSettingsTab) EXTENDS(XonoticTab)
+       METHOD(XonoticInputSettingsTab, fill, void(entity))
+       ATTRIB(XonoticInputSettingsTab, title, string, _("Input"))
+       ATTRIB(XonoticInputSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticInputSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticInputSettingsTab, columns, float, 6.2) // added extra .2 for center space
+ENDCLASS(XonoticInputSettingsTab)
+entity makeXonoticInputSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticInputSettingsTab()
+{
+       entity me;
+       me = spawnXonoticInputSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+
+void CheckBox_Click_Redisplay(entity me, entity checkbox)
+{
+       CheckBox_Click(me, checkbox);
+       cmd("\ndefer 0.2 \"togglemenu 1\"\n");
+       //m_display();
+}
+void XonoticInputSettingsTab_fill(entity me)
+{
+       entity e;
+       entity kb = makeXonoticKeyBinder();
+
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Key Bindings")));
+       me.TR(me);
+               me.TD(me, me.rows - 3, 3, kb);
+       me.gotoRC(me, me.rows - 2, 0);
+               me.TD(me, 1, 1, e = makeXonoticButton(_("Change key..."), '0 0 0'));
+                       e.onClick = KeyBinder_Bind_Change;
+                       e.onClickEntity = kb;
+                       kb.keyGrabButton = e;
+               me.TD(me, 1, 1, e = makeXonoticButton(_("Edit..."), '0 0 0'));
+                       e.onClick = KeyBinder_Bind_Edit;
+                       e.onClickEntity = kb;
+                       kb.userbindEditButton = e;
+                       kb.userbindEditDialog = main.userbindEditDialog;
+                       main.userbindEditDialog.keybindBox = kb;
+               me.TD(me, 1, 1, e = makeXonoticButton(_("Clear"), '0 0 0'));
+                       e.onClick = KeyBinder_Bind_Clear;
+                       e.onClickEntity = kb;
+                       kb.clearButton = e;
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticButton(_("Reset all"), '0 0 0'));
+                       e.onClick = KeyBinder_Bind_Reset_All;
+                       e.onClickEntity = kb;
+
+       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Mouse")));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Sensitivity:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(1, 32, 0.2, "sensitivity"));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "m_filter", _("Smooth aiming")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(1.022, "m_pitch", _("Invert aiming")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "menu_mouse_absolute", _("Use system mouse positioning")));
+                       makeMulti(e, "hud_cursormode");
+                       e.onClick = CheckBox_Click_Redisplay;
+                       e.onClickEntity = e;
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "m_accelerate", _("Enable built in mouse acceleration")));
+       me.TR(me);
+               if(cvar_type("vid_dgamouse") & CVAR_TYPEFLAG_ENGINE)
+                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "vid_dgamouse", _("Disable system mouse acceleration")));
+               else if(cvar_type("apple_mouse_noaccel") & CVAR_TYPEFLAG_ENGINE)
+                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "apple_mouse_noaccel", _("Disable system mouse acceleration")));
+               else
+               {
+                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, string_null, _("Disable system mouse acceleration")));
+                       e.disabled = 1; // the option is never available in this case, just there for show
+               }
+
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Other")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "con_closeontoggleconsole", _("Pressing \"enter console\" key also closes it")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_movement_track_canjump", _("Automatically repeat jumping if holding jump")));
+                       e.sendCvars = true;
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Jetpack on jump:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_jetpack_jump"));
+                       e.addValue(e, ZCTX(_("JPJUMP^Disabled")), "0");
+                       e.addValue(e, _("Air only"), "1");
+                       e.addValue(e, ZCTX(_("JPJUMP^All")), "2");
+                       e.configureXonoticTextSliderValues(e);
+                       e.sendCvars = true;
+       me.TR(me);
+               if(cvar_type("joy_enable") & CVAR_TYPEFLAG_ENGINE)
+               {
+                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joy_enable", _("Use joystick input")));
+                       setDependent(e, "joy_detected", 1, 10000000);
+               }
+               else if(cvar_type("joystick") & CVAR_TYPEFLAG_ENGINE)
+               {
+                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joystick", _("Use joystick input")));
+                       setDependent(e, "joy_detected", 1, 10000000);
+               }
+               else
+               {
+                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, string_null, _("Use joystick input")));
+                       e.disabled = 1; // the option is never available in this case, just there for show
+               }
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_input_userbind.c b/qcsrc/menu/xonotic/dialog_settings_input_userbind.c
deleted file mode 100644 (file)
index aaf182f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticUserbindEditDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticUserbindEditDialog, loadUserBind, void(entity, string, string, string))
-       METHOD(XonoticUserbindEditDialog, fill, void(entity))
-       ATTRIB(XonoticUserbindEditDialog, title, string, _("User defined key bind"))
-       ATTRIB(XonoticUserbindEditDialog, color, vector, SKINCOLOR_DIALOG_USERBIND)
-       ATTRIB(XonoticUserbindEditDialog, intendedWidth, float, 0.7)
-       ATTRIB(XonoticUserbindEditDialog, rows, float, 4)
-       ATTRIB(XonoticUserbindEditDialog, columns, float, 3)
-       ATTRIB(XonoticUserbindEditDialog, keybindBox, entity, NULL)
-
-       ATTRIB(XonoticUserbindEditDialog, nameBox, entity, NULL)
-       ATTRIB(XonoticUserbindEditDialog, commandPressBox, entity, NULL)
-       ATTRIB(XonoticUserbindEditDialog, commandReleaseBox, entity, NULL)
-ENDCLASS(XonoticUserbindEditDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticUserbindEditDialog_Save(entity btn, entity me)
-{
-       me.keybindBox.editUserbind(me.keybindBox, me.nameBox.text, me.commandPressBox.text, me.commandReleaseBox.text);
-       Dialog_Close(btn, me);
-}
-
-void XonoticUserbindEditDialog_loadUserBind(entity me, string theName, string theCommandPress, string theCommandRelease)
-{
-       me.nameBox.setText(me.nameBox, theName);
-               me.nameBox.keyDown(me.nameBox, K_END, 0, 0);
-       me.commandPressBox.setText(me.commandPressBox, theCommandPress);
-               me.nameBox.keyDown(me.commandPressBox, K_END, 0, 0);
-       me.commandReleaseBox.setText(me.commandReleaseBox, theCommandRelease);
-               me.nameBox.keyDown(me.commandReleaseBox, K_END, 0, 0);
-}
-
-void XonoticUserbindEditDialog_fill(entity me)
-{
-       entity e;
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Name:")));
-               me.TD(me, 1, me.columns - 1, me.nameBox = makeXonoticInputBox(0, string_null));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Command when pressed:")));
-               me.TD(me, 1, me.columns - 1, me.commandPressBox = makeXonoticInputBox(0, string_null));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Command when released:")));
-               me.TD(me, 1, me.columns - 1, me.commandReleaseBox = makeXonoticInputBox(0, string_null));
-       me.TR(me);
-               me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Save"), '0 0 0'));
-                       e.onClick = XonoticUserbindEditDialog_Save;
-                       e.onClickEntity = me;
-               me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Cancel"), '0 0 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_input_userbind.qc b/qcsrc/menu/xonotic/dialog_settings_input_userbind.qc
new file mode 100644 (file)
index 0000000..aaf182f
--- /dev/null
@@ -0,0 +1,55 @@
+#ifdef INTERFACE
+CLASS(XonoticUserbindEditDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticUserbindEditDialog, loadUserBind, void(entity, string, string, string))
+       METHOD(XonoticUserbindEditDialog, fill, void(entity))
+       ATTRIB(XonoticUserbindEditDialog, title, string, _("User defined key bind"))
+       ATTRIB(XonoticUserbindEditDialog, color, vector, SKINCOLOR_DIALOG_USERBIND)
+       ATTRIB(XonoticUserbindEditDialog, intendedWidth, float, 0.7)
+       ATTRIB(XonoticUserbindEditDialog, rows, float, 4)
+       ATTRIB(XonoticUserbindEditDialog, columns, float, 3)
+       ATTRIB(XonoticUserbindEditDialog, keybindBox, entity, NULL)
+
+       ATTRIB(XonoticUserbindEditDialog, nameBox, entity, NULL)
+       ATTRIB(XonoticUserbindEditDialog, commandPressBox, entity, NULL)
+       ATTRIB(XonoticUserbindEditDialog, commandReleaseBox, entity, NULL)
+ENDCLASS(XonoticUserbindEditDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticUserbindEditDialog_Save(entity btn, entity me)
+{
+       me.keybindBox.editUserbind(me.keybindBox, me.nameBox.text, me.commandPressBox.text, me.commandReleaseBox.text);
+       Dialog_Close(btn, me);
+}
+
+void XonoticUserbindEditDialog_loadUserBind(entity me, string theName, string theCommandPress, string theCommandRelease)
+{
+       me.nameBox.setText(me.nameBox, theName);
+               me.nameBox.keyDown(me.nameBox, K_END, 0, 0);
+       me.commandPressBox.setText(me.commandPressBox, theCommandPress);
+               me.nameBox.keyDown(me.commandPressBox, K_END, 0, 0);
+       me.commandReleaseBox.setText(me.commandReleaseBox, theCommandRelease);
+               me.nameBox.keyDown(me.commandReleaseBox, K_END, 0, 0);
+}
+
+void XonoticUserbindEditDialog_fill(entity me)
+{
+       entity e;
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Name:")));
+               me.TD(me, 1, me.columns - 1, me.nameBox = makeXonoticInputBox(0, string_null));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Command when pressed:")));
+               me.TD(me, 1, me.columns - 1, me.commandPressBox = makeXonoticInputBox(0, string_null));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Command when released:")));
+               me.TD(me, 1, me.columns - 1, me.commandReleaseBox = makeXonoticInputBox(0, string_null));
+       me.TR(me);
+               me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Save"), '0 0 0'));
+                       e.onClick = XonoticUserbindEditDialog_Save;
+                       e.onClickEntity = me;
+               me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Cancel"), '0 0 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_misc.c b/qcsrc/menu/xonotic/dialog_settings_misc.c
deleted file mode 100644 (file)
index 2ea9c1e..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticMiscSettingsTab) EXTENDS(XonoticTab)
-       METHOD(XonoticMiscSettingsTab, fill, void(entity))
-       ATTRIB(XonoticMiscSettingsTab, title, string, _("Misc"))
-       ATTRIB(XonoticMiscSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticMiscSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticMiscSettingsTab, columns, float, 6.2)
-ENDCLASS(XonoticMiscSettingsTab)
-entity makeXonoticMiscSettingsTab();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticMiscSettingsTab()
-{
-       entity me;
-       me = spawnXonoticMiscSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-void XonoticMiscSettingsTab_fill(entity me)
-{
-       entity e;
-       //entity sk;
-
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Network")));
-       me.TR(me);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Client UDP port:")));
-               me.TD(me, 1, 1.5, e = makeXonoticInputBox(0, "cl_port"));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Bandwidth:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("_cl_rate"));
-                       e.addValue(e, _("56k"), "4000");
-                       e.addValue(e, _("ISDN"), "7000");
-                       e.addValue(e, _("Slow ADSL"), "15000");
-                       e.addValue(e, _("Fast ADSL"), "20000");
-                       e.addValue(e, _("Broadband"), "66666");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Input packets/s:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(20, 100, 5, "cl_netfps"));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Server queries/s:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(20, 100, 10, "net_slist_queriespersecond"));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Downloads:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(1, 5, 1, "cl_curl_maxdownloads"));
-       me.TR(me);
-               me.TDempty(me, 0.1);
-               me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Speed (kB/s):")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(10, 2000, 50, "cl_curl_maxspeed"));
-       me.TR(me);
-               if(cvar("developer"))
-               {
-                       me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Local latency:")));
-                       me.TD(me, 1, 2, e = makeXonoticSlider(0, 1000, 25, "cl_netlocalping"));
-               }
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "shownetgraph", _("Show netgraph")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_movement", _("Client-side movement prediction")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_movement_errorcompensation", _("Movement error compensation")));
-               setDependent(e, "cl_movement", 1, 1);
-       me.TR(me);
-               if(cvar_type("crypto_aeslevel") & CVAR_TYPEFLAG_ENGINE)
-                       me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "crypto_aeslevel", _("Use encryption (AES) when available"))); // TODO: move up
-
-       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Framerate")));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Maximum:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_maxfps"));
-                       e.addValue(e, ZCTX(_("MAXFPS^5 fps")), "5");
-                       e.addValue(e, ZCTX(_("MAXFPS^10 fps")), "10");
-                       e.addValue(e, ZCTX(_("MAXFPS^20 fps")), "20");
-                       e.addValue(e, ZCTX(_("MAXFPS^30 fps")), "30");
-                       e.addValue(e, ZCTX(_("MAXFPS^40 fps")), "40");
-                       e.addValue(e, ZCTX(_("MAXFPS^50 fps")), "50");
-                       e.addValue(e, ZCTX(_("MAXFPS^60 fps")), "60");
-                       e.addValue(e, ZCTX(_("MAXFPS^70 fps")), "70");
-                       e.addValue(e, ZCTX(_("MAXFPS^100 fps")), "100");
-                       e.addValue(e, ZCTX(_("MAXFPS^125 fps")), "125");
-                       e.addValue(e, ZCTX(_("MAXFPS^200 fps")), "200");
-                       e.addValue(e, ZCTX(_("MAXFPS^Unlimited")), "0");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Target:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_minfps"));
-                       e.addValue(e, ZCTX(_("TRGT^Disabled")), "0");
-                       e.addValue(e, ZCTX(_("TRGT^30 fps")), "30");
-                       e.addValue(e, ZCTX(_("TRGT^40 fps")), "40");
-                       e.addValue(e, ZCTX(_("TRGT^50 fps")), "50");
-                       e.addValue(e, ZCTX(_("TRGT^60 fps")), "60");
-                       e.addValue(e, ZCTX(_("TRGT^100 fps")), "100");
-                       e.addValue(e, ZCTX(_("TRGT^125 fps")), "125");
-                       e.addValue(e, ZCTX(_("TRGT^200 fps")), "200");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Idle limit:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_maxidlefps"));
-                       e.addValue(e, ZCTX(_("IDLFPS^10 fps")), "10");
-                       e.addValue(e, ZCTX(_("IDLFPS^20 fps")), "20");
-                       e.addValue(e, ZCTX(_("IDLFPS^30 fps")), "30");
-                       e.addValue(e, ZCTX(_("IDLFPS^60 fps")), "60");
-                       e.addValue(e, ZCTX(_("IDLFPS^Unlimited")), "0");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_maxfps_alwayssleep", _("Save processing time for other apps")));
-               setDependent(e, "cl_maxfps", 1, 1000);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "showfps", _("Show frames per second")));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Other")));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Menu tooltips:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("menu_tooltips"));
-                       e.addValue(e, ZCTX(_("TLTIP^Disabled")), "0");
-                       e.addValue(e, ZCTX(_("TLTIP^Standard")), "1");
-                       e.addValue(e, ZCTX(_("TLTIP^Advanced")), "2");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "showtime", _("Show current date and time")));
-                       makeMulti(e, "showdate");
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "developer", _("Enable developer mode")));
-
-       me.TR(me);
-               me.TDempty(me, 0.5);
-               me.TD(me, 1, 2, e = makeXonoticButton(_("Advanced settings..."), '0 0 0'));
-                       e.onClick = DialogOpenButton_Click;
-                       e.onClickEntity = main.cvarsDialog;
-       me.TR(me);
-               me.TDempty(me, 0.5);
-               me.TD(me, 1, 2, e = makeXonoticButton(_("Factory reset"), '0 0 0'));
-                       e.onClick = DialogOpenButton_Click;
-                       e.onClickEntity = main.resetDialog;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_misc.qc b/qcsrc/menu/xonotic/dialog_settings_misc.qc
new file mode 100644 (file)
index 0000000..2ea9c1e
--- /dev/null
@@ -0,0 +1,143 @@
+#ifdef INTERFACE
+CLASS(XonoticMiscSettingsTab) EXTENDS(XonoticTab)
+       METHOD(XonoticMiscSettingsTab, fill, void(entity))
+       ATTRIB(XonoticMiscSettingsTab, title, string, _("Misc"))
+       ATTRIB(XonoticMiscSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticMiscSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticMiscSettingsTab, columns, float, 6.2)
+ENDCLASS(XonoticMiscSettingsTab)
+entity makeXonoticMiscSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticMiscSettingsTab()
+{
+       entity me;
+       me = spawnXonoticMiscSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+void XonoticMiscSettingsTab_fill(entity me)
+{
+       entity e;
+       //entity sk;
+
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Network")));
+       me.TR(me);
+               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Client UDP port:")));
+               me.TD(me, 1, 1.5, e = makeXonoticInputBox(0, "cl_port"));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Bandwidth:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("_cl_rate"));
+                       e.addValue(e, _("56k"), "4000");
+                       e.addValue(e, _("ISDN"), "7000");
+                       e.addValue(e, _("Slow ADSL"), "15000");
+                       e.addValue(e, _("Fast ADSL"), "20000");
+                       e.addValue(e, _("Broadband"), "66666");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Input packets/s:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(20, 100, 5, "cl_netfps"));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Server queries/s:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(20, 100, 10, "net_slist_queriespersecond"));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Downloads:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(1, 5, 1, "cl_curl_maxdownloads"));
+       me.TR(me);
+               me.TDempty(me, 0.1);
+               me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Speed (kB/s):")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(10, 2000, 50, "cl_curl_maxspeed"));
+       me.TR(me);
+               if(cvar("developer"))
+               {
+                       me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Local latency:")));
+                       me.TD(me, 1, 2, e = makeXonoticSlider(0, 1000, 25, "cl_netlocalping"));
+               }
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "shownetgraph", _("Show netgraph")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_movement", _("Client-side movement prediction")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_movement_errorcompensation", _("Movement error compensation")));
+               setDependent(e, "cl_movement", 1, 1);
+       me.TR(me);
+               if(cvar_type("crypto_aeslevel") & CVAR_TYPEFLAG_ENGINE)
+                       me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 1, "crypto_aeslevel", _("Use encryption (AES) when available"))); // TODO: move up
+
+       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Framerate")));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Maximum:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_maxfps"));
+                       e.addValue(e, ZCTX(_("MAXFPS^5 fps")), "5");
+                       e.addValue(e, ZCTX(_("MAXFPS^10 fps")), "10");
+                       e.addValue(e, ZCTX(_("MAXFPS^20 fps")), "20");
+                       e.addValue(e, ZCTX(_("MAXFPS^30 fps")), "30");
+                       e.addValue(e, ZCTX(_("MAXFPS^40 fps")), "40");
+                       e.addValue(e, ZCTX(_("MAXFPS^50 fps")), "50");
+                       e.addValue(e, ZCTX(_("MAXFPS^60 fps")), "60");
+                       e.addValue(e, ZCTX(_("MAXFPS^70 fps")), "70");
+                       e.addValue(e, ZCTX(_("MAXFPS^100 fps")), "100");
+                       e.addValue(e, ZCTX(_("MAXFPS^125 fps")), "125");
+                       e.addValue(e, ZCTX(_("MAXFPS^200 fps")), "200");
+                       e.addValue(e, ZCTX(_("MAXFPS^Unlimited")), "0");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Target:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_minfps"));
+                       e.addValue(e, ZCTX(_("TRGT^Disabled")), "0");
+                       e.addValue(e, ZCTX(_("TRGT^30 fps")), "30");
+                       e.addValue(e, ZCTX(_("TRGT^40 fps")), "40");
+                       e.addValue(e, ZCTX(_("TRGT^50 fps")), "50");
+                       e.addValue(e, ZCTX(_("TRGT^60 fps")), "60");
+                       e.addValue(e, ZCTX(_("TRGT^100 fps")), "100");
+                       e.addValue(e, ZCTX(_("TRGT^125 fps")), "125");
+                       e.addValue(e, ZCTX(_("TRGT^200 fps")), "200");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Idle limit:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_maxidlefps"));
+                       e.addValue(e, ZCTX(_("IDLFPS^10 fps")), "10");
+                       e.addValue(e, ZCTX(_("IDLFPS^20 fps")), "20");
+                       e.addValue(e, ZCTX(_("IDLFPS^30 fps")), "30");
+                       e.addValue(e, ZCTX(_("IDLFPS^60 fps")), "60");
+                       e.addValue(e, ZCTX(_("IDLFPS^Unlimited")), "0");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_maxfps_alwayssleep", _("Save processing time for other apps")));
+               setDependent(e, "cl_maxfps", 1, 1000);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "showfps", _("Show frames per second")));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Other")));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Menu tooltips:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("menu_tooltips"));
+                       e.addValue(e, ZCTX(_("TLTIP^Disabled")), "0");
+                       e.addValue(e, ZCTX(_("TLTIP^Standard")), "1");
+                       e.addValue(e, ZCTX(_("TLTIP^Advanced")), "2");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "showtime", _("Show current date and time")));
+                       makeMulti(e, "showdate");
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "developer", _("Enable developer mode")));
+
+       me.TR(me);
+               me.TDempty(me, 0.5);
+               me.TD(me, 1, 2, e = makeXonoticButton(_("Advanced settings..."), '0 0 0'));
+                       e.onClick = DialogOpenButton_Click;
+                       e.onClickEntity = main.cvarsDialog;
+       me.TR(me);
+               me.TDempty(me, 0.5);
+               me.TD(me, 1, 2, e = makeXonoticButton(_("Factory reset"), '0 0 0'));
+                       e.onClick = DialogOpenButton_Click;
+                       e.onClickEntity = main.resetDialog;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_misc_cvars.c b/qcsrc/menu/xonotic/dialog_settings_misc_cvars.c
deleted file mode 100644 (file)
index c2ea2a5..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticCvarsDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticCvarsDialog, fill, void(entity))
-       METHOD(XonoticCvarsDialog, showNotify, void(entity))
-       ATTRIB(XonoticCvarsDialog, title, string, _("Advanced settings"))
-       ATTRIB(XonoticCvarsDialog, color, vector, SKINCOLOR_DIALOG_CVARS)
-       ATTRIB(XonoticCvarsDialog, intendedWidth, float, 0.8)
-       ATTRIB(XonoticCvarsDialog, rows, float, 24)
-       ATTRIB(XonoticCvarsDialog, columns, float, 6)
-ENDCLASS(XonoticCvarsDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticCvarsDialog_showNotify(entity me)
-{
-       loadAllCvars(me);
-}
-void XonoticCvarsDialog_fill(entity me) // in this dialog, use SKINCOLOR_CVARLIST_CONTROLS to color ALL controls
-{
-
-       entity e, cvarlist;
-
-       cvarlist = makeXonoticCvarList();
-
-       cvarlist.color =
-               cvarlist.colorF =
-               cvarlist.color2 =
-               cvarlist.colorC =
-               SKINCOLOR_CVARLIST_CONTROLS;
-
-       // todo:
-       // add button which does cvar_resettodefaults_saveonly
-
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Cvar filter:")));
-               me.TD(me, 1, me.columns - 1, e = makeXonoticInputBox(0, string_null));
-                       e.color = SKINCOLOR_CVARLIST_CONTROLS;
-                       e.colorF = SKINCOLOR_CVARLIST_CONTROLS;
-                       e.cb_color = SKINCOLOR_CVARLIST_CONTROLS;
-                       e.cb_colorC = SKINCOLOR_CVARLIST_CONTROLS;
-                       e.cb_colorF = SKINCOLOR_CVARLIST_CONTROLS;
-                       e.onChange = CvarList_Filter_Change;
-                       e.onChangeEntity = cvarlist;
-                       cvarlist.controlledTextbox = e; // this COULD also be the Value box, but this leads to accidentally editing stuff
-       me.TR(me);
-               me.TD(me, me.rows - me.currentRow - 9, me.columns, cvarlist);
-       me.gotoRC(me, me.rows - 8, 0);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Setting:")));
-               me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
-                       cvarlist.cvarNameBox = e;
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Type:")));
-               me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
-                       cvarlist.cvarTypeBox = e;
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Value:")));
-               me.TD(me, 1, me.columns - 2, e = makeXonoticInputBox(0, string_null));
-                       cvarlist.cvarValueBox = e;
-                       e.color = SKINCOLOR_CVARLIST_CONTROLS;
-                       e.colorF = SKINCOLOR_CVARLIST_CONTROLS;
-                       e.cb_color = SKINCOLOR_CVARLIST_CONTROLS;
-                       e.cb_colorC = SKINCOLOR_CVARLIST_CONTROLS;
-                       e.cb_colorF = SKINCOLOR_CVARLIST_CONTROLS;
-                       e.onChange = CvarList_Value_Change;
-                       e.onChangeEntity = cvarlist;
-                       e.onEnter = CvarList_End_Editing;
-                       e.onEnterEntity = cvarlist;
-               me.TD(me, 1, 1, e = makeXonoticButton(string_null, SKINCOLOR_CVARLIST_CONTROLS));
-                       cvarlist.cvarDefaultBox = e;
-                       e.onClick = CvarList_Revert_Click;
-                       e.onClickEntity = cvarlist;
-                       e.allowCut = 1;
-                       e.marginLeft = e.marginRight = 0.5;
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Description:")));
-               me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
-                       cvarlist.cvarDescriptionBox = e;
-                       e.allowWrap = 1;
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), SKINCOLOR_CVARLIST_CONTROLS));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-}
-
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_misc_cvars.qc b/qcsrc/menu/xonotic/dialog_settings_misc_cvars.qc
new file mode 100644 (file)
index 0000000..c2ea2a5
--- /dev/null
@@ -0,0 +1,86 @@
+#ifdef INTERFACE
+CLASS(XonoticCvarsDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticCvarsDialog, fill, void(entity))
+       METHOD(XonoticCvarsDialog, showNotify, void(entity))
+       ATTRIB(XonoticCvarsDialog, title, string, _("Advanced settings"))
+       ATTRIB(XonoticCvarsDialog, color, vector, SKINCOLOR_DIALOG_CVARS)
+       ATTRIB(XonoticCvarsDialog, intendedWidth, float, 0.8)
+       ATTRIB(XonoticCvarsDialog, rows, float, 24)
+       ATTRIB(XonoticCvarsDialog, columns, float, 6)
+ENDCLASS(XonoticCvarsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticCvarsDialog_showNotify(entity me)
+{
+       loadAllCvars(me);
+}
+void XonoticCvarsDialog_fill(entity me) // in this dialog, use SKINCOLOR_CVARLIST_CONTROLS to color ALL controls
+{
+
+       entity e, cvarlist;
+
+       cvarlist = makeXonoticCvarList();
+
+       cvarlist.color =
+               cvarlist.colorF =
+               cvarlist.color2 =
+               cvarlist.colorC =
+               SKINCOLOR_CVARLIST_CONTROLS;
+
+       // todo:
+       // add button which does cvar_resettodefaults_saveonly
+
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Cvar filter:")));
+               me.TD(me, 1, me.columns - 1, e = makeXonoticInputBox(0, string_null));
+                       e.color = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.colorF = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.cb_color = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.cb_colorC = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.cb_colorF = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.onChange = CvarList_Filter_Change;
+                       e.onChangeEntity = cvarlist;
+                       cvarlist.controlledTextbox = e; // this COULD also be the Value box, but this leads to accidentally editing stuff
+       me.TR(me);
+               me.TD(me, me.rows - me.currentRow - 9, me.columns, cvarlist);
+       me.gotoRC(me, me.rows - 8, 0);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Setting:")));
+               me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
+                       cvarlist.cvarNameBox = e;
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Type:")));
+               me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
+                       cvarlist.cvarTypeBox = e;
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Value:")));
+               me.TD(me, 1, me.columns - 2, e = makeXonoticInputBox(0, string_null));
+                       cvarlist.cvarValueBox = e;
+                       e.color = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.colorF = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.cb_color = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.cb_colorC = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.cb_colorF = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.onChange = CvarList_Value_Change;
+                       e.onChangeEntity = cvarlist;
+                       e.onEnter = CvarList_End_Editing;
+                       e.onEnterEntity = cvarlist;
+               me.TD(me, 1, 1, e = makeXonoticButton(string_null, SKINCOLOR_CVARLIST_CONTROLS));
+                       cvarlist.cvarDefaultBox = e;
+                       e.onClick = CvarList_Revert_Click;
+                       e.onClickEntity = cvarlist;
+                       e.allowCut = 1;
+                       e.marginLeft = e.marginRight = 0.5;
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Description:")));
+               me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
+                       cvarlist.cvarDescriptionBox = e;
+                       e.allowWrap = 1;
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), SKINCOLOR_CVARLIST_CONTROLS));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_misc_reset.c b/qcsrc/menu/xonotic/dialog_settings_misc_reset.c
deleted file mode 100644 (file)
index 8f6da0a..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticResetDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticResetDialog, fill, void(entity))
-       ATTRIB(XonoticResetDialog, title, string, _("Factory reset"))
-       ATTRIB(XonoticResetDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
-       ATTRIB(XonoticResetDialog, intendedWidth, float, 0.5)
-       ATTRIB(XonoticResetDialog, rows, float, 4)
-       ATTRIB(XonoticResetDialog, columns, float, 2)
-       ATTRIB(XonoticResetDialog, name, string, "Factory reset")
-ENDCLASS(XonoticResetDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticResetDialog_fill(entity me)
-{
-       entity e;
-       me.TR(me);
-               me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("Are you sure you want to reset all settings?")));
-       me.TR(me);
-               me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("This will create a backup config in your data directory")));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Yes"), '1 0 0', "saveconfig backup.cfg\n;\n exec defaultXonotic.cfg\n", 0));
-               me.TD(me, 1, 1, e = makeXonoticButton(_("No"), '0 1 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_misc_reset.qc b/qcsrc/menu/xonotic/dialog_settings_misc_reset.qc
new file mode 100644 (file)
index 0000000..8f6da0a
--- /dev/null
@@ -0,0 +1,28 @@
+#ifdef INTERFACE
+CLASS(XonoticResetDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticResetDialog, fill, void(entity))
+       ATTRIB(XonoticResetDialog, title, string, _("Factory reset"))
+       ATTRIB(XonoticResetDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
+       ATTRIB(XonoticResetDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticResetDialog, rows, float, 4)
+       ATTRIB(XonoticResetDialog, columns, float, 2)
+       ATTRIB(XonoticResetDialog, name, string, "Factory reset")
+ENDCLASS(XonoticResetDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticResetDialog_fill(entity me)
+{
+       entity e;
+       me.TR(me);
+               me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("Are you sure you want to reset all settings?")));
+       me.TR(me);
+               me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("This will create a backup config in your data directory")));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Yes"), '1 0 0', "saveconfig backup.cfg\n;\n exec defaultXonotic.cfg\n", 0));
+               me.TD(me, 1, 1, e = makeXonoticButton(_("No"), '0 1 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_user.c b/qcsrc/menu/xonotic/dialog_settings_user.c
deleted file mode 100644 (file)
index 180efcc..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticUserSettingsTab) EXTENDS(XonoticTab)
-       METHOD(XonoticUserSettingsTab, fill, void(entity))
-       ATTRIB(XonoticUserSettingsTab, title, string, _("User"))
-       ATTRIB(XonoticUserSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticUserSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticUserSettingsTab, columns, float, 6)
-ENDCLASS(XonoticUserSettingsTab)
-entity makeXonoticUserSettingsTab();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticUserSettingsTab()
-{
-       entity me;
-       me = spawnXonoticUserSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-
-void XonoticUserSettingsTab_fill(entity me)
-{
-       entity e;
-       entity sk;
-
-       me.TR(me);
-               me.TDempty(me, 0.25);
-               me.TD(me, 1, 2.5, e = makeXonoticHeaderLabel(_("Menu Skins")));
-       me.TR(me);
-               me.TDempty(me, 0.25);
-               me.TD(me, me.rows - 2.5, 2.5, sk = makeXonoticSkinList());
-       me.gotoRC(me, me.rows - 1.5, 0.25);
-               me.TD(me, 1, 2.5, e = makeXonoticButton(_("Set skin"), '0 0 0'));
-                       e.onClick = SetSkin_Click;
-                       e.onClickEntity = sk;
-
-       /* AFTER 0.6 RELEASE TODO: Add a listbox which has fonts too, this way user can select the font they want.
-       me.gotoRC(me, 0, 2.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Text language:")));
-       me.TR(me);
-               me.TD(me, 6, 1, sk = makeXonoticLanguageList());
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticButton(_("Set language"), '0 0 0'));
-                       e.onClick = SetLanguage_Click;
-                       e.onClickEntity = sk;
-
-       me.gotoRC(me, 0, 3.3); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 1.5, e = makeXonoticTextLabel(0, _("Font:")));
-       me.TR(me);
-               me.TD(me, 2, 1.5, sk = makeXonoticLanguageList());
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1.5, e = makeXonoticButton(_("Set font"), '0 0 0'));
-                       e.onClick = SetLanguage_Click;
-                       e.onClickEntity = sk;*/
-
-       me.gotoRC(me, 0, 3.75); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 1.5, e = makeXonoticHeaderLabel(_("Text Language")));
-       me.TR(me);
-               me.TD(me, 8, 1.5, sk = makeXonoticLanguageList());
-
-       me.gotoRC(me, 9, 3.75); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 1.5, e = makeXonoticButton(_("Set language"), '0 0 0'));
-                       e.onClick = SetLanguage_Click;
-                       e.onClickEntity = sk;
-
-       me.gotoRC(me, 11.5, 3.25); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 2.5, e = makeXonoticCheckBox(0, "cl_gentle", _("Disable gore effects and harsh language")));
-
-       //me.TR(me);
-       //      me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Menu tooltips:")));
-       //      me.TD(me, 1, 2, e = makeXonoticTextSlider("menu_tooltips"));
-       //              e.addValue(e, ZCTX(_("TLTIP^Disabled")), "0");
-       //              e.addValue(e, ZCTX(_("TLTIP^Standard")), "1");
-       //              e.addValue(e, ZCTX(_("TLTIP^Advanced")), "2");
-       //              e.configureXonoticTextSliderValues(e);
-       //me.TR(me);
-       //      me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_allow_uidtracking", _("Allow player statistics to track your client"))); // TODO: move to profile tab
-       //me.TR(me);
-       //      me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_allow_uid2name", _("Allow player statistics to use your nickname")));
-       //      setDependent(e, "cl_allow_uidtracking", 1, 1);
-
-       //me.gotoRC(me, me.rows - 1, 2.6);
-       //      me.TD(me, 1, 2, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "sendcvar cl_gentle; sendcvar cl_allow_uidtracking; sendcvar cl_allow_uid2name;", COMMANDBUTTON_APPLY));
-
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_user.qc b/qcsrc/menu/xonotic/dialog_settings_user.qc
new file mode 100644 (file)
index 0000000..180efcc
--- /dev/null
@@ -0,0 +1,96 @@
+#ifdef INTERFACE
+CLASS(XonoticUserSettingsTab) EXTENDS(XonoticTab)
+       METHOD(XonoticUserSettingsTab, fill, void(entity))
+       ATTRIB(XonoticUserSettingsTab, title, string, _("User"))
+       ATTRIB(XonoticUserSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticUserSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticUserSettingsTab, columns, float, 6)
+ENDCLASS(XonoticUserSettingsTab)
+entity makeXonoticUserSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticUserSettingsTab()
+{
+       entity me;
+       me = spawnXonoticUserSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+
+void XonoticUserSettingsTab_fill(entity me)
+{
+       entity e;
+       entity sk;
+
+       me.TR(me);
+               me.TDempty(me, 0.25);
+               me.TD(me, 1, 2.5, e = makeXonoticHeaderLabel(_("Menu Skins")));
+       me.TR(me);
+               me.TDempty(me, 0.25);
+               me.TD(me, me.rows - 2.5, 2.5, sk = makeXonoticSkinList());
+       me.gotoRC(me, me.rows - 1.5, 0.25);
+               me.TD(me, 1, 2.5, e = makeXonoticButton(_("Set skin"), '0 0 0'));
+                       e.onClick = SetSkin_Click;
+                       e.onClickEntity = sk;
+
+       /* AFTER 0.6 RELEASE TODO: Add a listbox which has fonts too, this way user can select the font they want.
+       me.gotoRC(me, 0, 2.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Text language:")));
+       me.TR(me);
+               me.TD(me, 6, 1, sk = makeXonoticLanguageList());
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticButton(_("Set language"), '0 0 0'));
+                       e.onClick = SetLanguage_Click;
+                       e.onClickEntity = sk;
+
+       me.gotoRC(me, 0, 3.3); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 1.5, e = makeXonoticTextLabel(0, _("Font:")));
+       me.TR(me);
+               me.TD(me, 2, 1.5, sk = makeXonoticLanguageList());
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1.5, e = makeXonoticButton(_("Set font"), '0 0 0'));
+                       e.onClick = SetLanguage_Click;
+                       e.onClickEntity = sk;*/
+
+       me.gotoRC(me, 0, 3.75); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 1.5, e = makeXonoticHeaderLabel(_("Text Language")));
+       me.TR(me);
+               me.TD(me, 8, 1.5, sk = makeXonoticLanguageList());
+
+       me.gotoRC(me, 9, 3.75); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 1.5, e = makeXonoticButton(_("Set language"), '0 0 0'));
+                       e.onClick = SetLanguage_Click;
+                       e.onClickEntity = sk;
+
+       me.gotoRC(me, 11.5, 3.25); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 2.5, e = makeXonoticCheckBox(0, "cl_gentle", _("Disable gore effects and harsh language")));
+
+       //me.TR(me);
+       //      me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Menu tooltips:")));
+       //      me.TD(me, 1, 2, e = makeXonoticTextSlider("menu_tooltips"));
+       //              e.addValue(e, ZCTX(_("TLTIP^Disabled")), "0");
+       //              e.addValue(e, ZCTX(_("TLTIP^Standard")), "1");
+       //              e.addValue(e, ZCTX(_("TLTIP^Advanced")), "2");
+       //              e.configureXonoticTextSliderValues(e);
+       //me.TR(me);
+       //      me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_allow_uidtracking", _("Allow player statistics to track your client"))); // TODO: move to profile tab
+       //me.TR(me);
+       //      me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_allow_uid2name", _("Allow player statistics to use your nickname")));
+       //      setDependent(e, "cl_allow_uidtracking", 1, 1);
+
+       //me.gotoRC(me, me.rows - 1, 2.6);
+       //      me.TD(me, 1, 2, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "sendcvar cl_gentle; sendcvar cl_allow_uidtracking; sendcvar cl_allow_uid2name;", COMMANDBUTTON_APPLY));
+
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_user_languagewarning.c b/qcsrc/menu/xonotic/dialog_settings_user_languagewarning.c
deleted file mode 100644 (file)
index c830b55..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticLanguageWarningDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticLanguageWarningDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
-       ATTRIB(XonoticLanguageWarningDialog, title, string, _("Warning"))
-       ATTRIB(XonoticLanguageWarningDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
-       ATTRIB(XonoticLanguageWarningDialog, intendedWidth, float, 0.6)
-       ATTRIB(XonoticLanguageWarningDialog, rows, float, 5)
-       ATTRIB(XonoticLanguageWarningDialog, columns, float, 4)
-ENDCLASS(XonoticLanguageWarningDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticLanguageWarningDialog_fill(entity me)
-{
-       entity e;
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("While connected language changes will be applied only to the menu,")));
-       me.TR(me);
-               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("full language changes will take effect starting from the next game")));
-       me.TR(me);
-       me.TR(me);
-               // reconnect command doesn't work properly, otherwise it would replace disconnect
-               me.TD(me, 1, 2, e = makeXonoticCommandButton(_("Disconnect now"), '0 0 0', "disconnect", 0));
-               me.TD(me, 1, 2, e = makeXonoticCommandButton(_("Switch language"), '0 0 0', "prvm_language \"$_menu_prvm_language\"; menu_restart; menu_cmd languageselect", 0));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_user_languagewarning.qc b/qcsrc/menu/xonotic/dialog_settings_user_languagewarning.qc
new file mode 100644 (file)
index 0000000..c830b55
--- /dev/null
@@ -0,0 +1,26 @@
+#ifdef INTERFACE
+CLASS(XonoticLanguageWarningDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticLanguageWarningDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
+       ATTRIB(XonoticLanguageWarningDialog, title, string, _("Warning"))
+       ATTRIB(XonoticLanguageWarningDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+       ATTRIB(XonoticLanguageWarningDialog, intendedWidth, float, 0.6)
+       ATTRIB(XonoticLanguageWarningDialog, rows, float, 5)
+       ATTRIB(XonoticLanguageWarningDialog, columns, float, 4)
+ENDCLASS(XonoticLanguageWarningDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticLanguageWarningDialog_fill(entity me)
+{
+       entity e;
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("While connected language changes will be applied only to the menu,")));
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("full language changes will take effect starting from the next game")));
+       me.TR(me);
+       me.TR(me);
+               // reconnect command doesn't work properly, otherwise it would replace disconnect
+               me.TD(me, 1, 2, e = makeXonoticCommandButton(_("Disconnect now"), '0 0 0', "disconnect", 0));
+               me.TD(me, 1, 2, e = makeXonoticCommandButton(_("Switch language"), '0 0 0', "prvm_language \"$_menu_prvm_language\"; menu_restart; menu_cmd languageselect", 0));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_video.c b/qcsrc/menu/xonotic/dialog_settings_video.c
deleted file mode 100644 (file)
index 36929cb..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticVideoSettingsTab) EXTENDS(XonoticTab)
-       METHOD(XonoticVideoSettingsTab, fill, void(entity))
-       ATTRIB(XonoticVideoSettingsTab, title, string, _("Video"))
-       ATTRIB(XonoticVideoSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticVideoSettingsTab, rows, float, 15.5)
-       ATTRIB(XonoticVideoSettingsTab, columns, float, 6.2) // added extra .2 for center space
-       ATTRIB(XonoticVideoSettingsTab, name, string, "videosettings")
-ENDCLASS(XonoticVideoSettingsTab)
-entity makeXonoticVideoSettingsTab();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticVideoSettingsTab()
-{
-       entity me;
-       me = spawnXonoticVideoSettingsTab();
-       me.configureDialog(me);
-       return me;
-}
-void XonoticVideoSettingsTab_fill(entity me)
-{
-       entity e;
-
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Resolution:")));
-               me.TD(me, 1, 2, e = makeXonoticResolutionSlider());
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Font/UI size:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("menu_vid_scale"));
-                       e.addValue(e, ZCTX(_("SZ^Unreadable")), "-1");
-                       e.addValue(e, ZCTX(_("SZ^Tiny")), "-0.75");
-                       e.addValue(e, ZCTX(_("SZ^Little")), "-0.5");
-                       e.addValue(e, ZCTX(_("SZ^Small")), "-0.25");
-                       e.addValue(e, ZCTX(_("SZ^Medium")), "0");
-                       e.addValue(e, ZCTX(_("SZ^Large")), "0.25");
-                       e.addValue(e, ZCTX(_("SZ^Huge")), "0.5");
-                       e.addValue(e, ZCTX(_("SZ^Gigantic")), "0.75");
-                       e.addValue(e, ZCTX(_("SZ^Colossal")), "1");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Color depth:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("vid_bitsperpixel"));
-                       e.addValue(e, _("16bit"), "16");
-                       e.addValue(e, _("32bit"), "32");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "vid_fullscreen", _("Full screen")));
-               me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "vid_vsync", _("Vertical Synchronization")));
-
-       me.TR(me);
-               if(cvar("developer"))
-                       { me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "v_flipped", _("Flip view horizontally"))); }
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Anisotropy:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("gl_texture_anisotropy"));
-                       e.addValue(e, ZCTX(_("ANISO^Disabled")), "1");
-                       e.addValue(e, _("2x"), "2");
-                       e.addValue(e, _("4x"), "4");
-                       e.addValue(e, _("8x"), "8");
-                       e.addValue(e, _("16x"), "16");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Antialiasing:")));
-                       setDependent(e, "r_viewfbo", 0, 0);
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("vid_samples"));
-                       e.addValue(e, ZCTX(_("AA^Disabled")), "1");
-                       e.addValue(e, _("2x"), "2");
-                       e.addValue(e, _("4x"), "4");
-                       e.configureXonoticTextSliderValues(e);
-                       setDependent(e, "r_viewfbo", 0, 0);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 0, "r_viewfbo", _("High-quality frame buffer")));
-                       setDependent(e, "vid_samples", 1, 1);
-
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Depth first:")));
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("r_depthfirst"));
-                       e.addValue(e, ZCTX(_("DF^Disabled")), "0");
-                       e.addValue(e, ZCTX(_("DF^World")), "1");
-                       e.addValue(e, ZCTX(_("DF^All")), "2");
-                       e.configureXonoticTextSliderValues(e);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Vertex Buffer Objects (VBOs)")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.9, e = makeXonoticRadioButton(1, "gl_vbo", "0", ZCTX(_("VBO^Off"))));
-               me.TD(me, 1, 1.9, e = makeXonoticRadioButton(1, "gl_vbo", "3", _("Vertices, some Tris (compatible)")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.9, e = makeXonoticRadioButton(1, "gl_vbo", "2", _("Vertices")));
-               me.TD(me, 1, 1.9, e = makeXonoticRadioButton(1, "gl_vbo", "1", _("Vertices and Triangles")));
-
-       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Brightness:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(0.0, 0.5, 0.02, "v_brightness"));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Contrast:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(1.0, 3.0, 0.05, "v_contrast"));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Gamma:")));
-                       setDependentAND(e, "vid_gl20", 1, 1, "v_glslgamma", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticSlider(0.5, 2.0, 0.05, "v_gamma"));
-                       setDependentAND(e, "vid_gl20", 1, 1, "v_glslgamma", 1, 1);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Contrast boost:")));
-                       setDependentAND(e, "vid_gl20", 1, 1, "v_glslgamma", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticSlider(1.0, 5.0, 0.1, "v_contrastboost"));
-                       setDependentAND(e, "vid_gl20", 1, 1, "v_glslgamma", 1, 1);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Saturation:")));
-                       setDependent(e, "vid_gl20", 1, 1);
-               me.TD(me, 1, 2, e = makeXonoticSlider(0.5, 2.0, 0.05, "r_glsl_saturation"));
-                       setDependent(e, "vid_gl20", 1, 1);
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, ZCTX(_("LIT^Ambient:"))));
-               me.TD(me, 1, 2, e = makeXonoticSlider(0, 20.0, 0.25, "r_ambient"));
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Intensity:")));
-               me.TD(me, 1, 2, e = makeXonoticSlider(0.5, 2.0, 0.05, "r_hdr_scenebrightness"));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "gl_finish", _("Wait for GPU to finish each frame")));
-       me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "vid_gl20", _("Use OpenGL 2.0 shaders (GLSL)")));
-       me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "v_glslgamma", _("Use GLSL to handle color control")));
-                       setDependent(e, "vid_gl20", 1, 1);
-       if(cvar("developer"))
-       {
-               me.TR(me);
-                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "v_psycho", _("Psycho coloring (easter egg)")));
-                               setDependent(e, "vid_gl20", 1, 1);
-               me.TR(me);
-                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "r_trippy", _("Trippy vertices (easter egg)")));
-                               setDependent(e, "vid_gl20", 1, 1);
-       }
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "vid_width $_menu_vid_width; vid_height $_menu_vid_height; vid_pixelheight $_menu_vid_pixelheight; vid_desktopfullscreen $_menu_vid_desktopfullscreen; menu_cmd update_conwidths_before_vid_restart; vid_restart; menu_cmd sync", COMMANDBUTTON_APPLY));
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_video.qc b/qcsrc/menu/xonotic/dialog_settings_video.qc
new file mode 100644 (file)
index 0000000..36929cb
--- /dev/null
@@ -0,0 +1,145 @@
+#ifdef INTERFACE
+CLASS(XonoticVideoSettingsTab) EXTENDS(XonoticTab)
+       METHOD(XonoticVideoSettingsTab, fill, void(entity))
+       ATTRIB(XonoticVideoSettingsTab, title, string, _("Video"))
+       ATTRIB(XonoticVideoSettingsTab, intendedWidth, float, 0.9)
+       ATTRIB(XonoticVideoSettingsTab, rows, float, 15.5)
+       ATTRIB(XonoticVideoSettingsTab, columns, float, 6.2) // added extra .2 for center space
+       ATTRIB(XonoticVideoSettingsTab, name, string, "videosettings")
+ENDCLASS(XonoticVideoSettingsTab)
+entity makeXonoticVideoSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticVideoSettingsTab()
+{
+       entity me;
+       me = spawnXonoticVideoSettingsTab();
+       me.configureDialog(me);
+       return me;
+}
+void XonoticVideoSettingsTab_fill(entity me)
+{
+       entity e;
+
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Resolution:")));
+               me.TD(me, 1, 2, e = makeXonoticResolutionSlider());
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Font/UI size:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("menu_vid_scale"));
+                       e.addValue(e, ZCTX(_("SZ^Unreadable")), "-1");
+                       e.addValue(e, ZCTX(_("SZ^Tiny")), "-0.75");
+                       e.addValue(e, ZCTX(_("SZ^Little")), "-0.5");
+                       e.addValue(e, ZCTX(_("SZ^Small")), "-0.25");
+                       e.addValue(e, ZCTX(_("SZ^Medium")), "0");
+                       e.addValue(e, ZCTX(_("SZ^Large")), "0.25");
+                       e.addValue(e, ZCTX(_("SZ^Huge")), "0.5");
+                       e.addValue(e, ZCTX(_("SZ^Gigantic")), "0.75");
+                       e.addValue(e, ZCTX(_("SZ^Colossal")), "1");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Color depth:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("vid_bitsperpixel"));
+                       e.addValue(e, _("16bit"), "16");
+                       e.addValue(e, _("32bit"), "32");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "vid_fullscreen", _("Full screen")));
+               me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "vid_vsync", _("Vertical Synchronization")));
+
+       me.TR(me);
+               if(cvar("developer"))
+                       { me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "v_flipped", _("Flip view horizontally"))); }
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Anisotropy:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("gl_texture_anisotropy"));
+                       e.addValue(e, ZCTX(_("ANISO^Disabled")), "1");
+                       e.addValue(e, _("2x"), "2");
+                       e.addValue(e, _("4x"), "4");
+                       e.addValue(e, _("8x"), "8");
+                       e.addValue(e, _("16x"), "16");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Antialiasing:")));
+                       setDependent(e, "r_viewfbo", 0, 0);
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("vid_samples"));
+                       e.addValue(e, ZCTX(_("AA^Disabled")), "1");
+                       e.addValue(e, _("2x"), "2");
+                       e.addValue(e, _("4x"), "4");
+                       e.configureXonoticTextSliderValues(e);
+                       setDependent(e, "r_viewfbo", 0, 0);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 0, "r_viewfbo", _("High-quality frame buffer")));
+                       setDependent(e, "vid_samples", 1, 1);
+
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Depth first:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("r_depthfirst"));
+                       e.addValue(e, ZCTX(_("DF^Disabled")), "0");
+                       e.addValue(e, ZCTX(_("DF^World")), "1");
+                       e.addValue(e, ZCTX(_("DF^All")), "2");
+                       e.configureXonoticTextSliderValues(e);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Vertex Buffer Objects (VBOs)")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.9, e = makeXonoticRadioButton(1, "gl_vbo", "0", ZCTX(_("VBO^Off"))));
+               me.TD(me, 1, 1.9, e = makeXonoticRadioButton(1, "gl_vbo", "3", _("Vertices, some Tris (compatible)")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 0.9, e = makeXonoticRadioButton(1, "gl_vbo", "2", _("Vertices")));
+               me.TD(me, 1, 1.9, e = makeXonoticRadioButton(1, "gl_vbo", "1", _("Vertices and Triangles")));
+
+       me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Brightness:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(0.0, 0.5, 0.02, "v_brightness"));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Contrast:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(1.0, 3.0, 0.05, "v_contrast"));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Gamma:")));
+                       setDependentAND(e, "vid_gl20", 1, 1, "v_glslgamma", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticSlider(0.5, 2.0, 0.05, "v_gamma"));
+                       setDependentAND(e, "vid_gl20", 1, 1, "v_glslgamma", 1, 1);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Contrast boost:")));
+                       setDependentAND(e, "vid_gl20", 1, 1, "v_glslgamma", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticSlider(1.0, 5.0, 0.1, "v_contrastboost"));
+                       setDependentAND(e, "vid_gl20", 1, 1, "v_glslgamma", 1, 1);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Saturation:")));
+                       setDependent(e, "vid_gl20", 1, 1);
+               me.TD(me, 1, 2, e = makeXonoticSlider(0.5, 2.0, 0.05, "r_glsl_saturation"));
+                       setDependent(e, "vid_gl20", 1, 1);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, ZCTX(_("LIT^Ambient:"))));
+               me.TD(me, 1, 2, e = makeXonoticSlider(0, 20.0, 0.25, "r_ambient"));
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Intensity:")));
+               me.TD(me, 1, 2, e = makeXonoticSlider(0.5, 2.0, 0.05, "r_hdr_scenebrightness"));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "gl_finish", _("Wait for GPU to finish each frame")));
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "vid_gl20", _("Use OpenGL 2.0 shaders (GLSL)")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "v_glslgamma", _("Use GLSL to handle color control")));
+                       setDependent(e, "vid_gl20", 1, 1);
+       if(cvar("developer"))
+       {
+               me.TR(me);
+                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "v_psycho", _("Psycho coloring (easter egg)")));
+                               setDependent(e, "vid_gl20", 1, 1);
+               me.TR(me);
+                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "r_trippy", _("Trippy vertices (easter egg)")));
+                               setDependent(e, "vid_gl20", 1, 1);
+       }
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "vid_width $_menu_vid_width; vid_height $_menu_vid_height; vid_pixelheight $_menu_vid_pixelheight; vid_desktopfullscreen $_menu_vid_desktopfullscreen; menu_cmd update_conwidths_before_vid_restart; vid_restart; menu_cmd sync", COMMANDBUTTON_APPLY));
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_singleplayer.c b/qcsrc/menu/xonotic/dialog_singleplayer.c
deleted file mode 100644 (file)
index 6e13f65..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticSingleplayerDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticSingleplayerDialog, fill, void(entity))
-       ATTRIB(XonoticSingleplayerDialog, title, string, _("Singleplayer"))
-       ATTRIB(XonoticSingleplayerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
-       ATTRIB(XonoticSingleplayerDialog, intendedWidth, float, 0.80)
-       ATTRIB(XonoticSingleplayerDialog, rows, float, 24)
-       ATTRIB(XonoticSingleplayerDialog, columns, float, 5)
-       ATTRIB(XonoticSingleplayerDialog, campaignBox, entity, NULL)
-ENDCLASS(XonoticSingleplayerDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-
-void InstantAction_LoadMap(entity btn, entity dummy)
-{
-       float pmin = 2, pmax = 16, pstep = 1;
-
-       cvar_set("timelimit_override", "10");
-       cvar_set("g_lms_lives_override", "9");
-
-       if(random() < 0.4) // 40% are DM
-       {
-               MapInfo_SwitchGameType(MAPINFO_TYPE_DEATHMATCH);
-               pmin = 2;
-               pmax = 8;
-               pstep = 1;
-       }
-       else if(random() < 0.5) // half of the remaining 60%, i.e. 30%, are CTF
-       {
-               MapInfo_SwitchGameType(MAPINFO_TYPE_CTF);
-               pmin = 4;
-               pmax = 12;
-               pstep = 2;
-       }
-       else if(random() < 0.5) // half of the remaining 30%, i.e. 15%, are TDM
-       {
-               MapInfo_SwitchGameType(MAPINFO_TYPE_TEAM_DEATHMATCH);
-               pmin = 4;
-               pmax = 8;
-               pstep = 2;
-       }
-       else if(random() < 0.666) // 2/3 of the remaining 15%, i.e. 10%, are KH
-       {
-               MapInfo_SwitchGameType(MAPINFO_TYPE_KEYHUNT);
-               pmin = 6;
-               pmax = 6;
-               pstep = 6; // works both for 2 and 3 teams
-               // TODO find team count of map, set pstep=2 or 3, and use 2v2(v2) games at least
-       }
-       else // somehow distribute the remaining 5%
-       {
-               float r;
-               r = floor(random() * 4);
-               switch(r)
-               {
-                       default:
-                       case 0:
-                               MapInfo_SwitchGameType(MAPINFO_TYPE_LMS);
-                               pmin = 2;
-                               pmax = 6;
-                               pstep = 1;
-                               cvar_set("timelimit_override", "-1");
-                               break;
-                       case 1:
-                               MapInfo_SwitchGameType(MAPINFO_TYPE_DOMINATION);
-                               pmin = 2;
-                               pmax = 8;
-                               pstep = 2;
-                               break;
-                       case 2:
-                               MapInfo_SwitchGameType(MAPINFO_TYPE_ONSLAUGHT);
-                               pmin = 6;
-                               pmax = 16;
-                               pstep = 2;
-                               break;
-                       case 3:
-                               MapInfo_SwitchGameType(MAPINFO_TYPE_ASSAULT);
-                               pmin = 4;
-                               pmax = 16;
-                               pstep = 2;
-                               break;
-                       // CA, Freezetag: bot AI does not work, add them once it does
-               }
-       }
-
-       // find random map
-       MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
-       string s;
-       do
-       {
-               float m;
-               m = floor(random() * MapInfo_count);
-               s = MapInfo_BSPName_ByID(m);
-       }
-       while(!fexists(sprintf("maps/%s.waypoints", s)));
-       MapInfo_LoadMap(s, 1);
-
-       // configure bots
-       float p;
-       pmin = pstep * ceil(pmin / pstep);
-       pmax = pstep * floor(pmax / pstep);
-       p = pmin + pstep * floor(random() * ((pmax - pmin) / pstep + 1));
-       cvar_set("bot_number", ftos(p - 1));
-
-       // make sure we go back to menu
-       cvar_set("lastlevel", "1");
-}
-
-void XonoticSingleplayerDialog_fill(entity me)
-{
-       entity e, btnPrev, btnNext, lblTitle;
-
-       me.TR(me);
-               me.TDempty(me, (me.columns - 3) / 2);
-               me.TD(me, 2, 3, e = makeXonoticBigButton(_("Instant action! (random map with bots)"), '0 0 0'));
-                       e.onClick = InstantAction_LoadMap;
-                       e.onClickEntity = NULL;
-       me.TR(me);
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, btnPrev = makeXonoticButton("<<", '0 0 0'));
-               me.TD(me, 1, me.columns - 2, lblTitle = makeXonoticTextLabel(0.5, _("???")));
-               me.TD(me, 1, 1, btnNext = makeXonoticButton(">>", '0 0 0'));
-       me.TR(me);
-               me.TD(me, me.rows - 6, me.columns, me.campaignBox = makeXonoticCampaignList());
-                       btnPrev.onClick = MultiCampaign_Prev;
-                       btnPrev.onClickEntity = me.campaignBox;
-                       btnNext.onClick = MultiCampaign_Next;
-                       btnNext.onClickEntity = me.campaignBox;
-                       me.campaignBox.buttonNext = btnNext;
-                       me.campaignBox.buttonPrev = btnPrev;
-                       me.campaignBox.labelTitle = lblTitle;
-                       me.campaignBox.campaignGo(me.campaignBox, 0);
-
-       me.gotoRC(me, me.rows - 2, 0);
-               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Campaign Difficulty:")));
-               me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "-2", ZCTX(_("CSKL^Easy"))));
-               me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "-1", ZCTX(_("CSKL^Medium"))));
-               me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "0", ZCTX(_("CSKL^Hard"))));
-               me.TR(me);
-               me.TD(me, 1, me.columns, e = makeXonoticButton(_("Start Singleplayer!"), '0 0 0'));
-                       e.onClick = CampaignList_LoadMap;
-                       e.onClickEntity = me.campaignBox;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_singleplayer.qc b/qcsrc/menu/xonotic/dialog_singleplayer.qc
new file mode 100644 (file)
index 0000000..6e13f65
--- /dev/null
@@ -0,0 +1,146 @@
+#ifdef INTERFACE
+CLASS(XonoticSingleplayerDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticSingleplayerDialog, fill, void(entity))
+       ATTRIB(XonoticSingleplayerDialog, title, string, _("Singleplayer"))
+       ATTRIB(XonoticSingleplayerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
+       ATTRIB(XonoticSingleplayerDialog, intendedWidth, float, 0.80)
+       ATTRIB(XonoticSingleplayerDialog, rows, float, 24)
+       ATTRIB(XonoticSingleplayerDialog, columns, float, 5)
+       ATTRIB(XonoticSingleplayerDialog, campaignBox, entity, NULL)
+ENDCLASS(XonoticSingleplayerDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+
+void InstantAction_LoadMap(entity btn, entity dummy)
+{
+       float pmin = 2, pmax = 16, pstep = 1;
+
+       cvar_set("timelimit_override", "10");
+       cvar_set("g_lms_lives_override", "9");
+
+       if(random() < 0.4) // 40% are DM
+       {
+               MapInfo_SwitchGameType(MAPINFO_TYPE_DEATHMATCH);
+               pmin = 2;
+               pmax = 8;
+               pstep = 1;
+       }
+       else if(random() < 0.5) // half of the remaining 60%, i.e. 30%, are CTF
+       {
+               MapInfo_SwitchGameType(MAPINFO_TYPE_CTF);
+               pmin = 4;
+               pmax = 12;
+               pstep = 2;
+       }
+       else if(random() < 0.5) // half of the remaining 30%, i.e. 15%, are TDM
+       {
+               MapInfo_SwitchGameType(MAPINFO_TYPE_TEAM_DEATHMATCH);
+               pmin = 4;
+               pmax = 8;
+               pstep = 2;
+       }
+       else if(random() < 0.666) // 2/3 of the remaining 15%, i.e. 10%, are KH
+       {
+               MapInfo_SwitchGameType(MAPINFO_TYPE_KEYHUNT);
+               pmin = 6;
+               pmax = 6;
+               pstep = 6; // works both for 2 and 3 teams
+               // TODO find team count of map, set pstep=2 or 3, and use 2v2(v2) games at least
+       }
+       else // somehow distribute the remaining 5%
+       {
+               float r;
+               r = floor(random() * 4);
+               switch(r)
+               {
+                       default:
+                       case 0:
+                               MapInfo_SwitchGameType(MAPINFO_TYPE_LMS);
+                               pmin = 2;
+                               pmax = 6;
+                               pstep = 1;
+                               cvar_set("timelimit_override", "-1");
+                               break;
+                       case 1:
+                               MapInfo_SwitchGameType(MAPINFO_TYPE_DOMINATION);
+                               pmin = 2;
+                               pmax = 8;
+                               pstep = 2;
+                               break;
+                       case 2:
+                               MapInfo_SwitchGameType(MAPINFO_TYPE_ONSLAUGHT);
+                               pmin = 6;
+                               pmax = 16;
+                               pstep = 2;
+                               break;
+                       case 3:
+                               MapInfo_SwitchGameType(MAPINFO_TYPE_ASSAULT);
+                               pmin = 4;
+                               pmax = 16;
+                               pstep = 2;
+                               break;
+                       // CA, Freezetag: bot AI does not work, add them once it does
+               }
+       }
+
+       // find random map
+       MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
+       string s;
+       do
+       {
+               float m;
+               m = floor(random() * MapInfo_count);
+               s = MapInfo_BSPName_ByID(m);
+       }
+       while(!fexists(sprintf("maps/%s.waypoints", s)));
+       MapInfo_LoadMap(s, 1);
+
+       // configure bots
+       float p;
+       pmin = pstep * ceil(pmin / pstep);
+       pmax = pstep * floor(pmax / pstep);
+       p = pmin + pstep * floor(random() * ((pmax - pmin) / pstep + 1));
+       cvar_set("bot_number", ftos(p - 1));
+
+       // make sure we go back to menu
+       cvar_set("lastlevel", "1");
+}
+
+void XonoticSingleplayerDialog_fill(entity me)
+{
+       entity e, btnPrev, btnNext, lblTitle;
+
+       me.TR(me);
+               me.TDempty(me, (me.columns - 3) / 2);
+               me.TD(me, 2, 3, e = makeXonoticBigButton(_("Instant action! (random map with bots)"), '0 0 0'));
+                       e.onClick = InstantAction_LoadMap;
+                       e.onClickEntity = NULL;
+       me.TR(me);
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, btnPrev = makeXonoticButton("<<", '0 0 0'));
+               me.TD(me, 1, me.columns - 2, lblTitle = makeXonoticTextLabel(0.5, _("???")));
+               me.TD(me, 1, 1, btnNext = makeXonoticButton(">>", '0 0 0'));
+       me.TR(me);
+               me.TD(me, me.rows - 6, me.columns, me.campaignBox = makeXonoticCampaignList());
+                       btnPrev.onClick = MultiCampaign_Prev;
+                       btnPrev.onClickEntity = me.campaignBox;
+                       btnNext.onClick = MultiCampaign_Next;
+                       btnNext.onClickEntity = me.campaignBox;
+                       me.campaignBox.buttonNext = btnNext;
+                       me.campaignBox.buttonPrev = btnPrev;
+                       me.campaignBox.labelTitle = lblTitle;
+                       me.campaignBox.campaignGo(me.campaignBox, 0);
+
+       me.gotoRC(me, me.rows - 2, 0);
+               me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Campaign Difficulty:")));
+               me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "-2", ZCTX(_("CSKL^Easy"))));
+               me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "-1", ZCTX(_("CSKL^Medium"))));
+               me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "0", ZCTX(_("CSKL^Hard"))));
+               me.TR(me);
+               me.TD(me, 1, me.columns, e = makeXonoticButton(_("Start Singleplayer!"), '0 0 0'));
+                       e.onClick = CampaignList_LoadMap;
+                       e.onClickEntity = me.campaignBox;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_singleplayer_winner.c b/qcsrc/menu/xonotic/dialog_singleplayer_winner.c
deleted file mode 100644 (file)
index 8e584b8..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticWinnerDialog) EXTENDS(XonoticDialog)
-       METHOD(XonoticWinnerDialog, fill, void(entity))
-       ATTRIB(XonoticWinnerDialog, title, string, _("Winner"))
-       ATTRIB(XonoticWinnerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
-       ATTRIB(XonoticWinnerDialog, intendedWidth, float, 0.32)
-       ATTRIB(XonoticWinnerDialog, rows, float, 12)
-       ATTRIB(XonoticWinnerDialog, columns, float, 3)
-ENDCLASS(XonoticWinnerDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticWinnerDialog_fill(entity me)
-{
-       entity e;
-
-       me.TR(me);
-               me.TD(me, me.rows - 2, me.columns, e = makeXonoticImage("/gfx/winner", -1));
-
-       me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
-                       e.onClick = Dialog_Close;
-                       e.onClickEntity = me;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/dialog_singleplayer_winner.qc b/qcsrc/menu/xonotic/dialog_singleplayer_winner.qc
new file mode 100644 (file)
index 0000000..0d1c05a
--- /dev/null
@@ -0,0 +1,30 @@
+#ifdef INTERFACE
+CLASS(XonoticWinnerDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticWinnerDialog, fill, void(entity))
+       METHOD(XonoticWinnerDialog, focusEnter, void(entity))
+       ATTRIB(XonoticWinnerDialog, title, string, _("Winner"))
+       ATTRIB(XonoticWinnerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
+       ATTRIB(XonoticWinnerDialog, intendedWidth, float, 0.32)
+       ATTRIB(XonoticWinnerDialog, rows, float, 12)
+       ATTRIB(XonoticWinnerDialog, columns, float, 3)
+ENDCLASS(XonoticWinnerDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticWinnerDialog_fill(entity me)
+{
+       entity e;
+
+       me.TR(me);
+               me.TD(me, me.rows - 2, me.columns, e = makeXonoticImage("/gfx/winner", -1));
+
+       me.gotoRC(me, me.rows - 1, 0);
+               me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+void XonoticWinnerDialog_focusEnter(entity me)
+{
+       m_play_click_sound(MENU_SOUND_WINNER);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/dialog_teamselect.c b/qcsrc/menu/xonotic/dialog_teamselect.c
deleted file mode 100644 (file)
index 10efc3c..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticTeamSelectDialog) EXTENDS(XonoticRootDialog)
-       METHOD(XonoticTeamSelectDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
-       METHOD(XonoticTeamSelectDialog, showNotify, void(entity))
-       ATTRIB(XonoticTeamSelectDialog, title, string, _("Team Selection")) // ;)
-       ATTRIB(XonoticTeamSelectDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
-       ATTRIB(XonoticTeamSelectDialog, intendedWidth, float, 0.4)
-       ATTRIB(XonoticTeamSelectDialog, rows, float, 5)
-       ATTRIB(XonoticTeamSelectDialog, columns, float, 4)
-       ATTRIB(XonoticTeamSelectDialog, name, string, "TeamSelect")
-       ATTRIB(XonoticTeamSelectDialog, team1, entity, NULL)
-       ATTRIB(XonoticTeamSelectDialog, team2, entity, NULL)
-       ATTRIB(XonoticTeamSelectDialog, team3, entity, NULL)
-       ATTRIB(XonoticTeamSelectDialog, team4, entity, NULL)
-       ATTRIB(XonoticTeamSelectDialog, requiresConnection, float, TRUE)
-ENDCLASS(XonoticTeamSelectDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeTeamButton(string theName, vector theColor, string commandtheName)
-{
-       entity b;
-       b = makeXonoticBigCommandButton(theName, theColor, commandtheName, 1);
-       return b;
-}
-
-void XonoticTeamSelectDialog_showNotify(entity me)
-{
-       float teams, nTeams;
-       teams = cvar("_teams_available");
-       nTeams = 0;
-       me.team1.disabled = !(teams & 1); nTeams += !!(teams & 1);
-       me.team2.disabled = !(teams & 2); nTeams += !!(teams & 2);
-       me.team3.disabled = !(teams & 4); nTeams += !!(teams & 4);
-       me.team4.disabled = !(teams & 8); nTeams += !!(teams & 8);
-}
-
-void XonoticTeamSelectDialog_fill(entity me)
-{
-       entity e;
-       me.TR(me);
-               me.TD(me, 2, 4, e = makeTeamButton(_("join 'best' team (auto-select)"), '0 0 0', "cmd selectteam auto; cmd join"));
-                       e.preferredFocusPriority = 1;
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 2, 1, me.team1 = makeTeamButton(_("red"), '1 0.5 0.5', "cmd selectteam red; cmd join"));
-               me.TD(me, 2, 1, me.team2 = makeTeamButton(_("blue"), '0.5 0.5 1', "cmd selectteam blue; cmd join"));
-               me.TD(me, 2, 1, me.team3 = makeTeamButton(_("yellow"), '1 1 0.5', "cmd selectteam yellow; cmd join"));
-               me.TD(me, 2, 1, me.team4 = makeTeamButton(_("pink"), '1 0.5 1', "cmd selectteam pink; cmd join"));
-       me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 4, makeXonoticCommandButton(_("spectate"), '0 0 0', "cmd spectate", 1));
-}
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
diff --git a/qcsrc/menu/xonotic/dialog_teamselect.qc b/qcsrc/menu/xonotic/dialog_teamselect.qc
new file mode 100644 (file)
index 0000000..1ab68c3
--- /dev/null
@@ -0,0 +1,56 @@
+#ifdef INTERFACE
+CLASS(XonoticTeamSelectDialog) EXTENDS(XonoticRootDialog)
+       METHOD(XonoticTeamSelectDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
+       METHOD(XonoticTeamSelectDialog, showNotify, void(entity))
+       ATTRIB(XonoticTeamSelectDialog, title, string, _("Team Selection")) // ;)
+       ATTRIB(XonoticTeamSelectDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticTeamSelectDialog, intendedWidth, float, 0.4)
+       ATTRIB(XonoticTeamSelectDialog, rows, float, 5)
+       ATTRIB(XonoticTeamSelectDialog, columns, float, 4)
+       ATTRIB(XonoticTeamSelectDialog, name, string, "TeamSelect")
+       ATTRIB(XonoticTeamSelectDialog, team1, entity, NULL)
+       ATTRIB(XonoticTeamSelectDialog, team2, entity, NULL)
+       ATTRIB(XonoticTeamSelectDialog, team3, entity, NULL)
+       ATTRIB(XonoticTeamSelectDialog, team4, entity, NULL)
+       ATTRIB(XonoticTeamSelectDialog, requiresConnection, float, true)
+ENDCLASS(XonoticTeamSelectDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeTeamButton(string theName, vector theColor, string commandtheName)
+{
+       entity b;
+       b = makeXonoticBigCommandButton(theName, theColor, commandtheName, 1);
+       return b;
+}
+
+void XonoticTeamSelectDialog_showNotify(entity me)
+{
+       float teams, nTeams;
+       teams = cvar("_teams_available");
+       nTeams = 0;
+       me.team1.disabled = !(teams & 1); nTeams += !!(teams & 1);
+       me.team2.disabled = !(teams & 2); nTeams += !!(teams & 2);
+       me.team3.disabled = !(teams & 4); nTeams += !!(teams & 4);
+       me.team4.disabled = !(teams & 8); nTeams += !!(teams & 8);
+}
+
+void XonoticTeamSelectDialog_fill(entity me)
+{
+       entity e;
+       me.TR(me);
+               me.TD(me, 2, 4, e = makeTeamButton(_("join 'best' team (auto-select)"), '0 0 0', "cmd selectteam auto; cmd join"));
+                       e.preferredFocusPriority = 1;
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 2, 1, me.team1 = makeTeamButton(_("red"), '1 0.5 0.5', "cmd selectteam red; cmd join"));
+               me.TD(me, 2, 1, me.team2 = makeTeamButton(_("blue"), '0.5 0.5 1', "cmd selectteam blue; cmd join"));
+               me.TD(me, 2, 1, me.team3 = makeTeamButton(_("yellow"), '1 1 0.5', "cmd selectteam yellow; cmd join"));
+               me.TD(me, 2, 1, me.team4 = makeTeamButton(_("pink"), '1 0.5 1', "cmd selectteam pink; cmd join"));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 4, makeXonoticCommandButton(_("spectate"), '0 0 0', "cmd spectate", 1));
+}
+#endif
+
+/* Click. The c-word is here so you can grep for it :-) */
diff --git a/qcsrc/menu/xonotic/gametypebutton.c b/qcsrc/menu/xonotic/gametypebutton.c
deleted file mode 100644 (file)
index cc10f3d..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticGametypeButton) EXTENDS(RadioButton)
-       METHOD(XonoticGametypeButton, configureXonoticGametypeButton, void(entity, float, string, string))
-       METHOD(XonoticGametypeButton, setChecked, void(entity, float))
-       ATTRIB(XonoticGametypeButton, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticGametypeButton, image, string, SKINGFX_BUTTON_BIG)
-       ATTRIB(XonoticGametypeButton, color, vector, SKINCOLOR_BUTTON_N)
-       ATTRIB(XonoticGametypeButton, colorC, vector, SKINCOLOR_BUTTON_C)
-       ATTRIB(XonoticGametypeButton, colorF, vector, SKINCOLOR_BUTTON_F)
-       ATTRIB(XonoticGametypeButton, colorD, vector, SKINCOLOR_BUTTON_D)
-       ATTRIB(XonoticGametypeButton, srcMulti, float, 1)
-       ATTRIB(XonoticGametypeButton, useDownAsChecked, float, 1)
-
-       ATTRIB(XonoticGametypeButton, cvarName, string, string_null)
-       METHOD(XonoticGametypeButton, loadCvars, void(entity))
-       METHOD(XonoticGametypeButton, saveCvars, void(entity))
-
-       ATTRIB(XonoticGametypeButton, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticGametypeButton, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticGametypeButton)
-entity makeXonoticGametypeButton(float, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
-void GameTypeButton_Click(entity me, entity other);
-entity makeXonoticGametypeButton(float theGroup, string theCvar, string theText)
-{
-       entity me;
-       me = spawnXonoticGametypeButton();
-       me.configureXonoticGametypeButton(me, theGroup, theCvar, theText);
-       return me;
-}
-void XonoticGametypeButton_configureXonoticGametypeButton(entity me, float theGroup, string theCvar, string theText)
-{
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.tooltip = getZonedTooltipForIdentifier(theCvar);
-               me.loadCvars(me);
-       }
-       me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
-       me.align = 0.5;
-       me.onClick = GameTypeButton_Click;
-       me.onClickEntity = NULL;
-}
-void XonoticGametypeButton_setChecked(entity me, float val)
-{
-       if(val != me.checked)
-       {
-               me.checked = val;
-               me.saveCvars(me);
-       }
-}
-void XonoticGametypeButton_loadCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       me.checked = cvar(me.cvarName);
-}
-void XonoticGametypeButton_saveCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       cvar_set(me.cvarName, ftos(me.checked));
-}
-void GameTypeButton_Click(entity me, entity other)
-{
-       RadioButton_Click(me, other);
-       me.parent.gameTypeChangeNotify(me.parent);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/gametypebutton.qc b/qcsrc/menu/xonotic/gametypebutton.qc
new file mode 100644 (file)
index 0000000..cc10f3d
--- /dev/null
@@ -0,0 +1,73 @@
+#ifdef INTERFACE
+CLASS(XonoticGametypeButton) EXTENDS(RadioButton)
+       METHOD(XonoticGametypeButton, configureXonoticGametypeButton, void(entity, float, string, string))
+       METHOD(XonoticGametypeButton, setChecked, void(entity, float))
+       ATTRIB(XonoticGametypeButton, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticGametypeButton, image, string, SKINGFX_BUTTON_BIG)
+       ATTRIB(XonoticGametypeButton, color, vector, SKINCOLOR_BUTTON_N)
+       ATTRIB(XonoticGametypeButton, colorC, vector, SKINCOLOR_BUTTON_C)
+       ATTRIB(XonoticGametypeButton, colorF, vector, SKINCOLOR_BUTTON_F)
+       ATTRIB(XonoticGametypeButton, colorD, vector, SKINCOLOR_BUTTON_D)
+       ATTRIB(XonoticGametypeButton, srcMulti, float, 1)
+       ATTRIB(XonoticGametypeButton, useDownAsChecked, float, 1)
+
+       ATTRIB(XonoticGametypeButton, cvarName, string, string_null)
+       METHOD(XonoticGametypeButton, loadCvars, void(entity))
+       METHOD(XonoticGametypeButton, saveCvars, void(entity))
+
+       ATTRIB(XonoticGametypeButton, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticGametypeButton, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticGametypeButton)
+entity makeXonoticGametypeButton(float, string, string);
+#endif
+
+#ifdef IMPLEMENTATION
+void GameTypeButton_Click(entity me, entity other);
+entity makeXonoticGametypeButton(float theGroup, string theCvar, string theText)
+{
+       entity me;
+       me = spawnXonoticGametypeButton();
+       me.configureXonoticGametypeButton(me, theGroup, theCvar, theText);
+       return me;
+}
+void XonoticGametypeButton_configureXonoticGametypeButton(entity me, float theGroup, string theCvar, string theText)
+{
+       if(theCvar)
+       {
+               me.cvarName = theCvar;
+               me.tooltip = getZonedTooltipForIdentifier(theCvar);
+               me.loadCvars(me);
+       }
+       me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
+       me.align = 0.5;
+       me.onClick = GameTypeButton_Click;
+       me.onClickEntity = NULL;
+}
+void XonoticGametypeButton_setChecked(entity me, float val)
+{
+       if(val != me.checked)
+       {
+               me.checked = val;
+               me.saveCvars(me);
+       }
+}
+void XonoticGametypeButton_loadCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       me.checked = cvar(me.cvarName);
+}
+void XonoticGametypeButton_saveCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       cvar_set(me.cvarName, ftos(me.checked));
+}
+void GameTypeButton_Click(entity me, entity other)
+{
+       RadioButton_Click(me, other);
+       me.parent.gameTypeChangeNotify(me.parent);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/gametypelist.c b/qcsrc/menu/xonotic/gametypelist.c
deleted file mode 100644 (file)
index e3df844..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticGametypeList) EXTENDS(XonoticListBox)
-       METHOD(XonoticGametypeList, configureXonoticGametypeList, void(entity))
-       ATTRIB(XonoticGametypeList, rowsPerItem, float, 2)
-       METHOD(XonoticGametypeList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticGametypeList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticGametypeList, setSelected, void(entity, float))
-       METHOD(XonoticGametypeList, loadCvars, void(entity))
-       METHOD(XonoticGametypeList, saveCvars, void(entity))
-       METHOD(XonoticGametypeList, keyDown, float(entity, float, float, float))
-
-       ATTRIB(XonoticGametypeList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticGametypeList, realUpperMargin, float, 0)
-       ATTRIB(XonoticGametypeList, columnIconOrigin, float, 0)
-       ATTRIB(XonoticGametypeList, columnIconSize, float, 0)
-       ATTRIB(XonoticGametypeList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticGametypeList, columnNameSize, float, 0)
-ENDCLASS(XonoticGametypeList)
-entity makeXonoticGametypeList();
-#endif
-
-#ifdef IMPLEMENTATION
-
-entity makeXonoticGametypeList(void)
-{
-       entity me;
-       me = spawnXonoticGametypeList();
-       me.configureXonoticGametypeList(me);
-       return me;
-}
-void XonoticGametypeList_configureXonoticGametypeList(entity me)
-{
-       float i;
-       me.configureXonoticListBox(me);
-       me.nItems = GameType_GetCount();
-
-       // we want the pics mipmapped
-       for(i = 0; i < GameType_GetCount(); ++i)
-               draw_PreloadPictureWithFlags(GameType_GetIcon(i), PRECACHE_PIC_MIPMAP);
-
-       me.loadCvars(me);
-}
-void XonoticGametypeList_setSelected(entity me, float i)
-{
-       SUPER(XonoticGametypeList).setSelected(me, i);
-       me.saveCvars(me);
-}
-
-void XonoticGametypeList_loadCvars(entity me)
-{
-       float t;
-       t = MapInfo_CurrentGametype();
-       float i;
-       for(i = 0; i < GameType_GetCount(); ++i)
-               if(t == GameType_GetID(i))
-                       break;
-       if(i >= GameType_GetCount())
-       {
-               for(i = 0; i < GameType_GetCount(); ++i)
-                       if(t == MAPINFO_TYPE_DEATHMATCH)
-                               break;
-               if(i >= GameType_GetCount())
-                       i = 0;
-       }
-       me.setSelected(me, i);
-       // do we need this: me.parent.gameTypeChangeNotify(me.parent); // to make sure
-}
-void XonoticGametypeList_saveCvars(entity me)
-{
-       float t;
-       t = GameType_GetID(me.selectedItem);
-       if(t == MapInfo_CurrentGametype())
-               return;
-       MapInfo_SwitchGameType(t);
-       me.parent.gameTypeChangeNotify(me.parent);
-}
-void XonoticGametypeList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       string s1, s2;
-
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
-       draw_Picture(me.columnIconOrigin * eX, GameType_GetIcon(i), me.columnIconSize * eX + eY, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
-       s1 = GameType_GetName(i);
-       
-       if(_MapInfo_GetTeamPlayBool(GameType_GetID(i)))
-               s2 = _("teamplay");
-       else
-               s2 = _("free for all");
-
-       vector save_fontscale = draw_fontscale;
-       float f = draw_CondensedFontFactor(strcat(s1, " ", s2), FALSE, me.realFontSize, 1);
-       draw_fontscale_x *= f;
-       vector fs = me.realFontSize;
-       fs_x *= f;
-       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s1, fs, '1 1 1', SKINALPHA_TEXT, 0);
-       draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 1.0 * (me.columnNameSize - draw_TextWidth(s2, 0, fs))) * eX, s2, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0);
-       draw_fontscale = save_fontscale;
-}
-void XonoticGametypeList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.itemAbsSize = '0 0 0';
-       SUPER(XonoticServerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight));
-       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth)));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-       me.columnIconOrigin = 0;
-       me.columnIconSize = me.itemAbsSize_y / me.itemAbsSize_x;
-       me.columnNameOrigin = me.columnIconOrigin + me.columnIconSize + (0.5 * me.realFontSize_x);
-       me.columnNameSize = 1 - me.columnIconSize - (1.5 * me.realFontSize_x);
-}
-
-float XonoticGametypeList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       if(scan == K_ENTER || scan == K_KP_ENTER)
-       {
-               me.parent.gameTypeSelectNotify(me.parent);
-               return 1;
-       }
-
-       return SUPER(XonoticGametypeList).keyDown(me, scan, ascii, shift);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/gametypelist.qc b/qcsrc/menu/xonotic/gametypelist.qc
new file mode 100644 (file)
index 0000000..0d36c83
--- /dev/null
@@ -0,0 +1,131 @@
+#ifdef INTERFACE
+CLASS(XonoticGametypeList) EXTENDS(XonoticListBox)
+       METHOD(XonoticGametypeList, configureXonoticGametypeList, void(entity))
+       ATTRIB(XonoticGametypeList, rowsPerItem, float, 2)
+       METHOD(XonoticGametypeList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticGametypeList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticGametypeList, setSelected, void(entity, float))
+       METHOD(XonoticGametypeList, loadCvars, void(entity))
+       METHOD(XonoticGametypeList, saveCvars, void(entity))
+       METHOD(XonoticGametypeList, keyDown, float(entity, float, float, float))
+       METHOD(XonoticGametypeList, clickListBoxItem, void(entity, float, vector))
+
+       ATTRIB(XonoticGametypeList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticGametypeList, realUpperMargin, float, 0)
+       ATTRIB(XonoticGametypeList, columnIconOrigin, float, 0)
+       ATTRIB(XonoticGametypeList, columnIconSize, float, 0)
+       ATTRIB(XonoticGametypeList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticGametypeList, columnNameSize, float, 0)
+ENDCLASS(XonoticGametypeList)
+entity makeXonoticGametypeList();
+#endif
+
+#ifdef IMPLEMENTATION
+
+entity makeXonoticGametypeList(void)
+{
+       entity me;
+       me = spawnXonoticGametypeList();
+       me.configureXonoticGametypeList(me);
+       return me;
+}
+void XonoticGametypeList_configureXonoticGametypeList(entity me)
+{
+       me.configureXonoticListBox(me);
+       me.nItems = GameType_GetCount();
+
+       // we want the pics mipmapped
+       for(int i = 0; i < GameType_GetCount(); ++i)
+               draw_PreloadPictureWithFlags(GameType_GetIcon(i), PRECACHE_PIC_MIPMAP);
+
+       me.loadCvars(me);
+}
+void XonoticGametypeList_setSelected(entity me, float i)
+{
+       SUPER(XonoticGametypeList).setSelected(me, i);
+       me.saveCvars(me);
+}
+void XonoticGametypeList_loadCvars(entity me)
+{
+       float t;
+       t = MapInfo_CurrentGametype();
+       float i;
+       for(i = 0; i < GameType_GetCount(); ++i)
+               if(t == GameType_GetID(i))
+                       break;
+       if(i >= GameType_GetCount())
+       {
+               for(i = 0; i < GameType_GetCount(); ++i)
+                       if(t == MAPINFO_TYPE_DEATHMATCH)
+                               break;
+               if(i >= GameType_GetCount())
+                       i = 0;
+       }
+       me.setSelected(me, i);
+       // do we need this: me.parent.gameTypeChangeNotify(me.parent); // to make sure
+}
+void XonoticGametypeList_saveCvars(entity me)
+{
+       int t = GameType_GetID(me.selectedItem);
+       if (t == MapInfo_CurrentGametype()) {
+               return;
+       }
+       MapInfo_SwitchGameType(t);
+       entity owner = me.parent;
+       if (owner) { // not set immediately
+               owner.gameTypeChangeNotify(owner);
+       }
+}
+void XonoticGametypeList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       string s1, s2;
+
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+
+       draw_Picture(me.columnIconOrigin * eX, GameType_GetIcon(i), me.columnIconSize * eX + eY, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
+       s1 = GameType_GetName(i);
+
+       if(_MapInfo_GetTeamPlayBool(GameType_GetID(i)))
+               s2 = _("teamplay");
+       else
+               s2 = _("free for all");
+
+       vector save_fontscale = draw_fontscale;
+       float f = draw_CondensedFontFactor(strcat(s1, " ", s2), false, me.realFontSize, 1);
+       draw_fontscale.x *= f;
+       vector fs = me.realFontSize;
+       fs.x *= f;
+       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s1, fs, '1 1 1', SKINALPHA_TEXT, 0);
+       draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 1.0 * (me.columnNameSize - draw_TextWidth(s2, 0, fs))) * eX, s2, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0);
+       draw_fontscale = save_fontscale;
+}
+void XonoticGametypeList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.itemAbsSize = '0 0 0';
+       SUPER(XonoticServerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
+       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+       me.columnIconOrigin = 0;
+       me.columnIconSize = me.itemAbsSize.y / me.itemAbsSize.x;
+       me.columnNameOrigin = me.columnIconOrigin + me.columnIconSize + (0.5 * me.realFontSize.x);
+       me.columnNameSize = 1 - me.columnIconSize - (1.5 * me.realFontSize.x);
+}
+float XonoticGametypeList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       if(scan == K_ENTER || scan == K_KP_ENTER)
+       {
+               m_play_click_sound(MENU_SOUND_EXECUTE);
+               me.parent.gameTypeSelectNotify(me.parent);
+               return 1;
+       }
+
+       return SUPER(XonoticGametypeList).keyDown(me, scan, ascii, shift);
+}
+void XonoticGametypeList_clickListBoxItem(entity me, float i, vector where)
+{
+       m_play_click_sound(MENU_SOUND_SELECT);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/image.c b/qcsrc/menu/xonotic/image.c
deleted file mode 100644 (file)
index 9f0de67..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticImage) EXTENDS(Image)
-       METHOD(XonoticImage, configureXonoticImage, void(entity, string, float))
-ENDCLASS(XonoticImage)
-entity makeXonoticImage(string theImage, float theAspect);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticImage(string theImage, float theAspect)
-{
-       entity me;
-       me = spawnXonoticImage();
-       me.configureXonoticImage(me, theImage, theAspect);
-       return me;
-}
-void XonoticImage_configureXonoticImage(entity me, string theImage, float theAspect)
-{
-       me.configureImage(me, theImage);
-       me.forcedAspect = theAspect;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/image.qc b/qcsrc/menu/xonotic/image.qc
new file mode 100644 (file)
index 0000000..9f0de67
--- /dev/null
@@ -0,0 +1,21 @@
+#ifdef INTERFACE
+CLASS(XonoticImage) EXTENDS(Image)
+       METHOD(XonoticImage, configureXonoticImage, void(entity, string, float))
+ENDCLASS(XonoticImage)
+entity makeXonoticImage(string theImage, float theAspect);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticImage(string theImage, float theAspect)
+{
+       entity me;
+       me = spawnXonoticImage();
+       me.configureXonoticImage(me, theImage, theAspect);
+       return me;
+}
+void XonoticImage_configureXonoticImage(entity me, string theImage, float theAspect)
+{
+       me.configureImage(me, theImage);
+       me.forcedAspect = theAspect;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/inputbox.c b/qcsrc/menu/xonotic/inputbox.c
deleted file mode 100644 (file)
index 5d7d179..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticInputBox) EXTENDS(InputBox)
-       METHOD(XonoticInputBox, configureXonoticInputBox, void(entity, float, string))
-       METHOD(XonoticInputBox, focusLeave, void(entity))
-       METHOD(XonoticInputBox, setText, void(entity, string))
-       ATTRIB(XonoticInputBox, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticInputBox, image, string, SKINGFX_INPUTBOX)
-       ATTRIB(XonoticInputBox, onChange, void(entity, entity), func_null)
-       ATTRIB(XonoticInputBox, onChangeEntity, entity, NULL)
-       ATTRIB(XonoticInputBox, onEnter, void(entity, entity), func_null)
-       ATTRIB(XonoticInputBox, onEnterEntity, entity, NULL)
-       ATTRIB(XonoticInputBox, marginLeft, float, SKINMARGIN_INPUTBOX_CHARS)
-       ATTRIB(XonoticInputBox, marginRight, float, SKINMARGIN_INPUTBOX_CHARS)
-       ATTRIB(XonoticInputBox, color, vector, SKINCOLOR_INPUTBOX_N)
-       ATTRIB(XonoticInputBox, colorF, vector, SKINCOLOR_INPUTBOX_F)
-
-       ATTRIB(XonoticInputBox, alpha, float, SKINALPHA_TEXT)
-
-       // Clear button attributes
-       ATTRIB(XonoticInputBox, cb_offset, float, SKINOFFSET_CLEARBUTTON) // bound to range -1, 0
-       ATTRIB(XonoticInputBox, cb_src, string, SKINGFX_CLEARBUTTON)
-       ATTRIB(XonoticInputBox, cb_color, vector, SKINCOLOR_CLEARBUTTON_N)
-       ATTRIB(XonoticInputBox, cb_colorF, vector, SKINCOLOR_CLEARBUTTON_F)
-       ATTRIB(XonoticInputBox, cb_colorC, vector, SKINCOLOR_CLEARBUTTON_C)
-
-       ATTRIB(XonoticInputBox, cvarName, string, string_null)
-       METHOD(XonoticInputBox, loadCvars, void(entity))
-       METHOD(XonoticInputBox, saveCvars, void(entity))
-       ATTRIB(XonoticInputBox, sendCvars, float, 0)
-       METHOD(XonoticInputBox, keyDown, float(entity, float, float, float))
-
-       ATTRIB(XonoticInputBox, saveImmediately, float, 0)
-ENDCLASS(XonoticInputBox)
-entity makeXonoticInputBox(float, string);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticInputBox(float doEditColorCodes, string theCvar)
-{
-       entity me;
-       me = spawnXonoticInputBox();
-       me.configureXonoticInputBox(me, doEditColorCodes, theCvar);
-       return me;
-}
-void XonoticInputBox_configureXonoticInputBox(entity me, float doEditColorCodes, string theCvar)
-{
-       me.configureInputBox(me, "", 0, me.fontSize, me.image);
-       me.editColorCodes = doEditColorCodes;
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.tooltip = getZonedTooltipForIdentifier(theCvar);
-               me.loadCvars(me);
-       }
-       me.cursorPos = strlen(me.text);
-}
-void XonoticInputBox_focusLeave(entity me)
-{
-       me.saveCvars(me);
-}
-void XonoticInputBox_setText(entity me, string new)
-{
-       if(me.text != new)
-       {
-               SUPER(XonoticInputBox).setText(me, new);
-               if(me.onChange)
-                       me.onChange(me, me.onChangeEntity);
-               if(me.saveImmediately)
-                       me.saveCvars(me);
-       }
-       else
-               SUPER(XonoticInputBox).setText(me, new);
-}
-void XonoticInputBox_loadCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-       SUPER(XonoticInputBox).setText(me, cvar_string(me.cvarName));
-}
-void XonoticInputBox_saveCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-       cvar_set(me.cvarName, me.text);
-       CheckSendCvars(me, me.cvarName);
-}
-float XonoticInputBox_keyDown(entity me, float key, float ascii, float shift)
-{
-       float r;
-       r = 0;
-       if(key == K_ENTER || key == K_KP_ENTER)
-       {
-               if(me.cvarName)
-               {
-                       me.saveCvars(me);
-                       r = 1;
-               }
-               if(me.onEnter)
-                       me.onEnter(me, me.onEnterEntity);
-       }
-       if(SUPER(XonoticInputBox).keyDown(me, key, ascii, shift))
-               r = 1;
-       return r;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/inputbox.qc b/qcsrc/menu/xonotic/inputbox.qc
new file mode 100644 (file)
index 0000000..5d7d179
--- /dev/null
@@ -0,0 +1,105 @@
+#ifdef INTERFACE
+CLASS(XonoticInputBox) EXTENDS(InputBox)
+       METHOD(XonoticInputBox, configureXonoticInputBox, void(entity, float, string))
+       METHOD(XonoticInputBox, focusLeave, void(entity))
+       METHOD(XonoticInputBox, setText, void(entity, string))
+       ATTRIB(XonoticInputBox, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticInputBox, image, string, SKINGFX_INPUTBOX)
+       ATTRIB(XonoticInputBox, onChange, void(entity, entity), func_null)
+       ATTRIB(XonoticInputBox, onChangeEntity, entity, NULL)
+       ATTRIB(XonoticInputBox, onEnter, void(entity, entity), func_null)
+       ATTRIB(XonoticInputBox, onEnterEntity, entity, NULL)
+       ATTRIB(XonoticInputBox, marginLeft, float, SKINMARGIN_INPUTBOX_CHARS)
+       ATTRIB(XonoticInputBox, marginRight, float, SKINMARGIN_INPUTBOX_CHARS)
+       ATTRIB(XonoticInputBox, color, vector, SKINCOLOR_INPUTBOX_N)
+       ATTRIB(XonoticInputBox, colorF, vector, SKINCOLOR_INPUTBOX_F)
+
+       ATTRIB(XonoticInputBox, alpha, float, SKINALPHA_TEXT)
+
+       // Clear button attributes
+       ATTRIB(XonoticInputBox, cb_offset, float, SKINOFFSET_CLEARBUTTON) // bound to range -1, 0
+       ATTRIB(XonoticInputBox, cb_src, string, SKINGFX_CLEARBUTTON)
+       ATTRIB(XonoticInputBox, cb_color, vector, SKINCOLOR_CLEARBUTTON_N)
+       ATTRIB(XonoticInputBox, cb_colorF, vector, SKINCOLOR_CLEARBUTTON_F)
+       ATTRIB(XonoticInputBox, cb_colorC, vector, SKINCOLOR_CLEARBUTTON_C)
+
+       ATTRIB(XonoticInputBox, cvarName, string, string_null)
+       METHOD(XonoticInputBox, loadCvars, void(entity))
+       METHOD(XonoticInputBox, saveCvars, void(entity))
+       ATTRIB(XonoticInputBox, sendCvars, float, 0)
+       METHOD(XonoticInputBox, keyDown, float(entity, float, float, float))
+
+       ATTRIB(XonoticInputBox, saveImmediately, float, 0)
+ENDCLASS(XonoticInputBox)
+entity makeXonoticInputBox(float, string);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticInputBox(float doEditColorCodes, string theCvar)
+{
+       entity me;
+       me = spawnXonoticInputBox();
+       me.configureXonoticInputBox(me, doEditColorCodes, theCvar);
+       return me;
+}
+void XonoticInputBox_configureXonoticInputBox(entity me, float doEditColorCodes, string theCvar)
+{
+       me.configureInputBox(me, "", 0, me.fontSize, me.image);
+       me.editColorCodes = doEditColorCodes;
+       if(theCvar)
+       {
+               me.cvarName = theCvar;
+               me.tooltip = getZonedTooltipForIdentifier(theCvar);
+               me.loadCvars(me);
+       }
+       me.cursorPos = strlen(me.text);
+}
+void XonoticInputBox_focusLeave(entity me)
+{
+       me.saveCvars(me);
+}
+void XonoticInputBox_setText(entity me, string new)
+{
+       if(me.text != new)
+       {
+               SUPER(XonoticInputBox).setText(me, new);
+               if(me.onChange)
+                       me.onChange(me, me.onChangeEntity);
+               if(me.saveImmediately)
+                       me.saveCvars(me);
+       }
+       else
+               SUPER(XonoticInputBox).setText(me, new);
+}
+void XonoticInputBox_loadCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+       SUPER(XonoticInputBox).setText(me, cvar_string(me.cvarName));
+}
+void XonoticInputBox_saveCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+       cvar_set(me.cvarName, me.text);
+       CheckSendCvars(me, me.cvarName);
+}
+float XonoticInputBox_keyDown(entity me, float key, float ascii, float shift)
+{
+       float r;
+       r = 0;
+       if(key == K_ENTER || key == K_KP_ENTER)
+       {
+               if(me.cvarName)
+               {
+                       me.saveCvars(me);
+                       r = 1;
+               }
+               if(me.onEnter)
+                       me.onEnter(me, me.onEnterEntity);
+       }
+       if(SUPER(XonoticInputBox).keyDown(me, key, ascii, shift))
+               r = 1;
+       return r;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/keybinder.c b/qcsrc/menu/xonotic/keybinder.c
deleted file mode 100644 (file)
index c312e38..0000000
+++ /dev/null
@@ -1,372 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticKeyBinder) EXTENDS(XonoticListBox)
-       METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity))
-       ATTRIB(XonoticKeyBinder, rowsPerItem, float, 1)
-       METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticKeyBinder, clickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticKeyBinder, setSelected, void(entity, float))
-       METHOD(XonoticKeyBinder, keyDown, float(entity, float, float, float))
-       METHOD(XonoticKeyBinder, keyGrabbed, void(entity, float, float))
-
-       ATTRIB(XonoticKeyBinder, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticKeyBinder, realUpperMargin, float, 0)
-       ATTRIB(XonoticKeyBinder, columnFunctionOrigin, float, 0)
-       ATTRIB(XonoticKeyBinder, columnFunctionSize, float, 0)
-       ATTRIB(XonoticKeyBinder, columnKeysOrigin, float, 0)
-       ATTRIB(XonoticKeyBinder, columnKeysSize, float, 0)
-
-       ATTRIB(XonoticKeyBinder, lastClickedKey, float, -1)
-       ATTRIB(XonoticKeyBinder, lastClickedTime, float, 0)
-       ATTRIB(XonoticKeyBinder, previouslySelected, float, -1)
-       ATTRIB(XonoticKeyBinder, inMouseHandler, float, 0)
-       ATTRIB(XonoticKeyBinder, userbindEditButton, entity, NULL)
-       ATTRIB(XonoticKeyBinder, keyGrabButton, entity, NULL)
-       ATTRIB(XonoticKeyBinder, clearButton, entity, NULL)
-       ATTRIB(XonoticKeyBinder, userbindEditDialog, entity, NULL)
-       METHOD(XonoticKeyBinder, editUserbind, void(entity, string, string, string))
-ENDCLASS(XonoticKeyBinder)
-entity makeXonoticKeyBinder();
-void KeyBinder_Bind_Change(entity btn, entity me);
-void KeyBinder_Bind_Clear(entity btn, entity me);
-void KeyBinder_Bind_Edit(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-
-const string KEY_NOT_BOUND_CMD = "// not bound";
-
-#define MAX_KEYS_PER_FUNCTION 2
-#define MAX_KEYBINDS 256
-string Xonotic_KeyBinds_Functions[MAX_KEYBINDS];
-string Xonotic_KeyBinds_Descriptions[MAX_KEYBINDS];
-var float Xonotic_KeyBinds_Count = -1;
-
-void Xonotic_KeyBinds_Read()
-{
-       float fh;
-       string s;
-
-       Xonotic_KeyBinds_Count = 0;
-       fh = fopen(language_filename("keybinds.txt"), FILE_READ);
-       if(fh < 0)
-               return;
-       while((s = fgets(fh)))
-       {
-               if(tokenize_console(s) != 2)
-                       continue;
-               Xonotic_KeyBinds_Functions[Xonotic_KeyBinds_Count] = strzone(argv(0));
-               Xonotic_KeyBinds_Descriptions[Xonotic_KeyBinds_Count] = strzone(argv(1));
-               ++Xonotic_KeyBinds_Count;
-               if(Xonotic_KeyBinds_Count >= MAX_KEYBINDS)
-                       break;
-       }
-       fclose(fh);
-}
-
-entity makeXonoticKeyBinder()
-{
-       entity me;
-       me = spawnXonoticKeyBinder();
-       me.configureXonoticKeyBinder(me);
-       return me;
-}
-void replace_bind(string from, string to)
-{
-       float n, j, k;
-       n = tokenize(findkeysforcommand(from, 0)); // uses '...' strings
-       for(j = 0; j < n; ++j)
-       {
-               k = stof(argv(j));
-               if(k != -1)
-                       localcmd("\nbind \"", keynumtostring(k), "\" \"", to, "\"\n");
-       }
-       if(n)
-               cvar_set("_hud_showbinds_reload", "1");
-}
-void XonoticKeyBinder_configureXonoticKeyBinder(entity me)
-{
-       me.configureXonoticListBox(me);
-       if(Xonotic_KeyBinds_Count < 0)
-               Xonotic_KeyBinds_Read();
-       me.nItems = Xonotic_KeyBinds_Count;
-       me.setSelected(me, 0);
-
-       // TEMP: Xonotic 0.1 to later
-       replace_bind("impulse 1", "weapon_group_1");
-       replace_bind("impulse 2", "weapon_group_2");
-       replace_bind("impulse 3", "weapon_group_3");
-       replace_bind("impulse 4", "weapon_group_4");
-       replace_bind("impulse 5", "weapon_group_5");
-       replace_bind("impulse 6", "weapon_group_6");
-       replace_bind("impulse 7", "weapon_group_7");
-       replace_bind("impulse 8", "weapon_group_8");
-       replace_bind("impulse 9", "weapon_group_9");
-       replace_bind("impulse 14", "weapon_group_0");
-}
-void XonoticKeyBinder_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(XonoticKeyBinder).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight);
-       me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-
-       me.columnFunctionOrigin = 0;
-       me.columnKeysSize = me.realFontSize_x * 12;
-       me.columnFunctionSize = 1 - me.columnKeysSize - 2 * me.realFontSize_x;
-       me.columnKeysOrigin = me.columnFunctionOrigin + me.columnFunctionSize + me.realFontSize_x;
-
-       if(me.userbindEditButton)
-               me.userbindEditButton.disabled = (substring(Xonotic_KeyBinds_Descriptions[me.selectedItem], 0, 1) != "$");
-}
-void KeyBinder_Bind_Change(entity btn, entity me)
-{
-       string func;
-
-       func = Xonotic_KeyBinds_Functions[me.selectedItem];
-       if(func == "")
-               return;
-
-       me.keyGrabButton.forcePressed = 1;
-       me.clearButton.disabled = 1;
-       keyGrabber = me;
-}
-void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii)
-{
-       float n, j, k, nvalid;
-       string func;
-
-       me.keyGrabButton.forcePressed = 0;
-       me.clearButton.disabled = 0;
-
-       if(key == K_ESCAPE)
-               return;
-
-       // forbid these keys from being bound in the menu
-       if(key == K_CAPSLOCK || key == K_NUMLOCK)
-       {
-               KeyBinder_Bind_Change(me, me);
-               return;
-       }
-
-       func = Xonotic_KeyBinds_Functions[me.selectedItem];
-       if(func == "")
-               return;
-
-       n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
-       nvalid = 0;
-       for(j = 0; j < n; ++j)
-       {
-               k = stof(argv(j));
-               if(k != -1)
-                       ++nvalid;
-       }
-       if(nvalid >= MAX_KEYS_PER_FUNCTION)
-       {
-               for(j = 0; j < n; ++j)
-               {
-                       k = stof(argv(j));
-                       if(k != -1)
-                               //localcmd("\nunbind \"", keynumtostring(k), "\"\n");
-                               localcmd("\nbind \"", keynumtostring(k), "\" \"", KEY_NOT_BOUND_CMD, "\"\n");
-               }
-       }
-       localcmd("\nbind \"", keynumtostring(key), "\" \"", func, "\"\n");
-       localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
-       cvar_set("_hud_showbinds_reload", "1");
-}
-void XonoticKeyBinder_editUserbind(entity me, string theName, string theCommandPress, string theCommandRelease)
-{
-       string func, descr;
-
-       if(!me.userbindEditDialog)
-               return;
-
-       func = Xonotic_KeyBinds_Functions[me.selectedItem];
-       if(func == "")
-               return;
-
-       descr = Xonotic_KeyBinds_Descriptions[me.selectedItem];
-       if(substring(descr, 0, 1) != "$")
-               return;
-       descr = substring(descr, 1, strlen(descr) - 1);
-
-       // Hooray! It IS a user bind!
-       cvar_set(strcat(descr, "_description"), theName);
-       cvar_set(strcat(descr, "_press"), theCommandPress);
-       cvar_set(strcat(descr, "_release"), theCommandRelease);
-}
-void KeyBinder_Bind_Edit(entity btn, entity me)
-{
-       string func, descr;
-
-       if(!me.userbindEditDialog)
-               return;
-
-       func = Xonotic_KeyBinds_Functions[me.selectedItem];
-       if(func == "")
-               return;
-
-       descr = Xonotic_KeyBinds_Descriptions[me.selectedItem];
-       if(substring(descr, 0, 1) != "$")
-               return;
-       descr = substring(descr, 1, strlen(descr) - 1);
-
-       // Hooray! It IS a user bind!
-       me.userbindEditDialog.loadUserBind(me.userbindEditDialog, cvar_string(strcat(descr, "_description")), cvar_string(strcat(descr, "_press")), cvar_string(strcat(descr, "_release")));
-
-       DialogOpenButton_Click(btn, me.userbindEditDialog);
-}
-void KeyBinder_Bind_Clear(entity btn, entity me)
-{
-       float n, j, k;
-       string func;
-
-       func = Xonotic_KeyBinds_Functions[me.selectedItem];
-       if(func == "")
-               return;
-
-       n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
-       for(j = 0; j < n; ++j)
-       {
-               k = stof(argv(j));
-               if(k != -1)
-                       //localcmd("\nunbind \"", keynumtostring(k), "\"\n");
-                       localcmd("\nbind \"", keynumtostring(k), "\" \"", KEY_NOT_BOUND_CMD, "\"\n");
-       }
-       localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
-       cvar_set("_hud_showbinds_reload", "1");
-}
-void KeyBinder_Bind_Reset_All(entity btn, entity me)
-{
-       localcmd("unbindall\n");
-       localcmd("exec binds-default.cfg\n");
-       localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
-       cvar_set("_hud_showbinds_reload", "1");
-}
-void XonoticKeyBinder_clickListBoxItem(entity me, float i, vector where)
-{
-       if(i == me.lastClickedKey)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       KeyBinder_Bind_Change(NULL, me);
-               }
-       me.lastClickedKey = i;
-       me.lastClickedTime = time;
-}
-void XonoticKeyBinder_setSelected(entity me, float i)
-{
-       // handling of "unselectable" items
-       i = floor(0.5 + bound(0, i, me.nItems - 1));
-       if(me.pressed == 0 || me.pressed == 1) // keyboard or scrolling - skip unselectable items
-       {
-               if(i > me.previouslySelected)
-               {
-                       while((i < me.nItems - 1) && (Xonotic_KeyBinds_Functions[i] == ""))
-                               ++i;
-               }
-               while((i > 0) && (Xonotic_KeyBinds_Functions[i] == ""))
-                       --i;
-               while((i < me.nItems - 1) && (Xonotic_KeyBinds_Functions[i] == ""))
-                       ++i;
-       }
-       if(me.pressed == 3) // released the mouse - fall back to last valid item
-       {
-               if(Xonotic_KeyBinds_Functions[i] == "")
-                       i = me.previouslySelected;
-       }
-       if(Xonotic_KeyBinds_Functions[i] != "")
-               me.previouslySelected = i;
-       if(me.userbindEditButton)
-               me.userbindEditButton.disabled = (substring(Xonotic_KeyBinds_Descriptions[i], 0, 1) != "$");
-       SUPER(XonoticKeyBinder).setSelected(me, i);
-}
-float XonoticKeyBinder_keyDown(entity me, float key, float ascii, float shift)
-{
-       float r;
-       r = 1;
-       switch(key)
-       {
-               case K_ENTER:
-               case K_KP_ENTER:
-               case K_SPACE:
-                       KeyBinder_Bind_Change(me, me);
-                       break;
-               case K_DEL:
-               case K_KP_DEL:
-               case K_BACKSPACE:
-                       KeyBinder_Bind_Clear(me, me);
-                       break;
-               default:
-                       r = SUPER(XonoticKeyBinder).keyDown(me, key, ascii, shift);
-                       break;
-       }
-       return r;
-}
-void XonoticKeyBinder_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       string s;
-       float j, k, n;
-       vector theColor;
-       float theAlpha;
-       string func, descr;
-       float extraMargin;
-
-       descr = Xonotic_KeyBinds_Descriptions[i];
-       func = Xonotic_KeyBinds_Functions[i];
-
-       if(func == "")
-       {
-               theAlpha = 1;
-               theColor = SKINCOLOR_KEYGRABBER_TITLES;
-               theAlpha = SKINALPHA_KEYGRABBER_TITLES;
-               extraMargin = 0;
-       }
-       else
-       {
-               if(isSelected)
-               {
-                       if(keyGrabber == me)
-                               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_WAITING, SKINALPHA_LISTBOX_WAITING);
-                       else
-                               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-               }
-               theAlpha = SKINALPHA_KEYGRABBER_KEYS;
-               theColor = SKINCOLOR_KEYGRABBER_KEYS;
-               extraMargin = me.realFontSize_x * 0.5;
-       }
-
-       if(substring(descr, 0, 1) == "$")
-       {
-               s = substring(descr, 1, strlen(descr) - 1);
-               descr = cvar_string(strcat(s, "_description"));
-               if(descr == "")
-                       descr = s;
-               if(cvar_string(strcat(s, "_press")) == "")
-                       if(cvar_string(strcat(s, "_release")) == "")
-                               theAlpha *= SKINALPHA_DISABLED;
-       }
-
-       s = draw_TextShortenToWidth(descr, me.columnFunctionSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin * eY + extraMargin * eX, s, me.realFontSize, theColor, theAlpha, 0);
-       if(func != "")
-       {
-               n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
-               s = "";
-               for(j = 0; j < n; ++j)
-               {
-                       k = stof(argv(j));
-                       if(k != -1)
-                       {
-                               if(s != "")
-                                       s = strcat(s, ", ");
-                               s = strcat(s, keynumtostring(k));
-                       }
-               }
-               s = draw_TextShortenToWidth(s, me.columnKeysSize, 0, me.realFontSize);
-               draw_CenterText(me.realUpperMargin * eY + (me.columnKeysOrigin + 0.5 * me.columnKeysSize) * eX, s, me.realFontSize, theColor, theAlpha, 0);
-       }
-}
-#endif
diff --git a/qcsrc/menu/xonotic/keybinder.qc b/qcsrc/menu/xonotic/keybinder.qc
new file mode 100644 (file)
index 0000000..a083207
--- /dev/null
@@ -0,0 +1,365 @@
+#ifdef INTERFACE
+CLASS(XonoticKeyBinder) EXTENDS(XonoticListBox)
+       METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity))
+       ATTRIB(XonoticKeyBinder, rowsPerItem, float, 1)
+       METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticKeyBinder, setSelected, void(entity, float))
+       METHOD(XonoticKeyBinder, keyDown, float(entity, float, float, float))
+       METHOD(XonoticKeyBinder, keyGrabbed, void(entity, float, float))
+
+       ATTRIB(XonoticKeyBinder, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticKeyBinder, realUpperMargin, float, 0)
+       ATTRIB(XonoticKeyBinder, columnFunctionOrigin, float, 0)
+       ATTRIB(XonoticKeyBinder, columnFunctionSize, float, 0)
+       ATTRIB(XonoticKeyBinder, columnKeysOrigin, float, 0)
+       ATTRIB(XonoticKeyBinder, columnKeysSize, float, 0)
+
+       ATTRIB(XonoticKeyBinder, previouslySelected, float, -1)
+       ATTRIB(XonoticKeyBinder, inMouseHandler, float, 0)
+       ATTRIB(XonoticKeyBinder, userbindEditButton, entity, NULL)
+       ATTRIB(XonoticKeyBinder, keyGrabButton, entity, NULL)
+       ATTRIB(XonoticKeyBinder, clearButton, entity, NULL)
+       ATTRIB(XonoticKeyBinder, userbindEditDialog, entity, NULL)
+       METHOD(XonoticKeyBinder, editUserbind, void(entity, string, string, string))
+ENDCLASS(XonoticKeyBinder)
+entity makeXonoticKeyBinder();
+void KeyBinder_Bind_Change(entity btn, entity me);
+void KeyBinder_Bind_Clear(entity btn, entity me);
+void KeyBinder_Bind_Edit(entity btn, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+
+const string KEY_NOT_BOUND_CMD = "// not bound";
+
+const float MAX_KEYS_PER_FUNCTION = 2;
+const float MAX_KEYBINDS = 256;
+string Xonotic_KeyBinds_Functions[MAX_KEYBINDS];
+string Xonotic_KeyBinds_Descriptions[MAX_KEYBINDS];
+float Xonotic_KeyBinds_Count = -1;
+
+void Xonotic_KeyBinds_Read()
+{
+       float fh;
+       string s;
+
+       Xonotic_KeyBinds_Count = 0;
+       fh = fopen(language_filename("keybinds.txt"), FILE_READ);
+       if(fh < 0)
+               return;
+       while((s = fgets(fh)))
+       {
+               if(tokenize_console(s) != 2)
+                       continue;
+               Xonotic_KeyBinds_Functions[Xonotic_KeyBinds_Count] = strzone(argv(0));
+               Xonotic_KeyBinds_Descriptions[Xonotic_KeyBinds_Count] = strzone(argv(1));
+               ++Xonotic_KeyBinds_Count;
+               if(Xonotic_KeyBinds_Count >= MAX_KEYBINDS)
+                       break;
+       }
+       fclose(fh);
+}
+
+entity makeXonoticKeyBinder()
+{
+       entity me;
+       me = spawnXonoticKeyBinder();
+       me.configureXonoticKeyBinder(me);
+       return me;
+}
+void replace_bind(string from, string to)
+{
+       float n, j, k;
+       n = tokenize(findkeysforcommand(from, 0)); // uses '...' strings
+       for(j = 0; j < n; ++j)
+       {
+               k = stof(argv(j));
+               if(k != -1)
+                       localcmd("\nbind \"", keynumtostring(k), "\" \"", to, "\"\n");
+       }
+       if(n)
+               cvar_set("_hud_showbinds_reload", "1");
+}
+void XonoticKeyBinder_configureXonoticKeyBinder(entity me)
+{
+       me.configureXonoticListBox(me);
+       if(Xonotic_KeyBinds_Count < 0)
+               Xonotic_KeyBinds_Read();
+       me.nItems = Xonotic_KeyBinds_Count;
+       me.setSelected(me, 0);
+
+       // TEMP: Xonotic 0.1 to later
+       replace_bind("impulse 1", "weapon_group_1");
+       replace_bind("impulse 2", "weapon_group_2");
+       replace_bind("impulse 3", "weapon_group_3");
+       replace_bind("impulse 4", "weapon_group_4");
+       replace_bind("impulse 5", "weapon_group_5");
+       replace_bind("impulse 6", "weapon_group_6");
+       replace_bind("impulse 7", "weapon_group_7");
+       replace_bind("impulse 8", "weapon_group_8");
+       replace_bind("impulse 9", "weapon_group_9");
+       replace_bind("impulse 14", "weapon_group_0");
+}
+void XonoticKeyBinder_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(XonoticKeyBinder).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight);
+       me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+
+       me.columnFunctionOrigin = 0;
+       me.columnKeysSize = me.realFontSize.x * 12;
+       me.columnFunctionSize = 1 - me.columnKeysSize - 2 * me.realFontSize.x;
+       me.columnKeysOrigin = me.columnFunctionOrigin + me.columnFunctionSize + me.realFontSize.x;
+
+       if(me.userbindEditButton)
+               me.userbindEditButton.disabled = (substring(Xonotic_KeyBinds_Descriptions[me.selectedItem], 0, 1) != "$");
+}
+void KeyBinder_Bind_Change(entity btn, entity me)
+{
+       string func;
+
+       func = Xonotic_KeyBinds_Functions[me.selectedItem];
+       if(func == "")
+               return;
+
+       me.keyGrabButton.forcePressed = 1;
+       me.clearButton.disabled = 1;
+       keyGrabber = me;
+}
+void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii)
+{
+       float n, j, k, nvalid;
+       string func;
+
+       me.keyGrabButton.forcePressed = 0;
+       me.clearButton.disabled = 0;
+
+       if(key == K_ESCAPE)
+               return;
+
+       // forbid these keys from being bound in the menu
+       if(key == K_CAPSLOCK || key == K_NUMLOCK)
+       {
+               KeyBinder_Bind_Change(me, me);
+               return;
+       }
+
+       func = Xonotic_KeyBinds_Functions[me.selectedItem];
+       if(func == "")
+               return;
+
+       n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
+       nvalid = 0;
+       for(j = 0; j < n; ++j)
+       {
+               k = stof(argv(j));
+               if(k != -1)
+                       ++nvalid;
+       }
+       if(nvalid >= MAX_KEYS_PER_FUNCTION)
+       {
+               for(j = 0; j < n; ++j)
+               {
+                       k = stof(argv(j));
+                       if(k != -1)
+                               //localcmd("\nunbind \"", keynumtostring(k), "\"\n");
+                               localcmd("\nbind \"", keynumtostring(k), "\" \"", KEY_NOT_BOUND_CMD, "\"\n");
+               }
+       }
+       m_play_click_sound(MENU_SOUND_SELECT);
+       localcmd("\nbind \"", keynumtostring(key), "\" \"", func, "\"\n");
+       localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
+       cvar_set("_hud_showbinds_reload", "1");
+}
+void XonoticKeyBinder_editUserbind(entity me, string theName, string theCommandPress, string theCommandRelease)
+{
+       string func, descr;
+
+       if(!me.userbindEditDialog)
+               return;
+
+       func = Xonotic_KeyBinds_Functions[me.selectedItem];
+       if(func == "")
+               return;
+
+       descr = Xonotic_KeyBinds_Descriptions[me.selectedItem];
+       if(substring(descr, 0, 1) != "$")
+               return;
+       descr = substring(descr, 1, strlen(descr) - 1);
+
+       // Hooray! It IS a user bind!
+       cvar_set(strcat(descr, "_description"), theName);
+       cvar_set(strcat(descr, "_press"), theCommandPress);
+       cvar_set(strcat(descr, "_release"), theCommandRelease);
+}
+void KeyBinder_Bind_Edit(entity btn, entity me)
+{
+       string func, descr;
+
+       if(!me.userbindEditDialog)
+               return;
+
+       func = Xonotic_KeyBinds_Functions[me.selectedItem];
+       if(func == "")
+               return;
+
+       descr = Xonotic_KeyBinds_Descriptions[me.selectedItem];
+       if(substring(descr, 0, 1) != "$")
+               return;
+       descr = substring(descr, 1, strlen(descr) - 1);
+
+       // Hooray! It IS a user bind!
+       me.userbindEditDialog.loadUserBind(me.userbindEditDialog, cvar_string(strcat(descr, "_description")), cvar_string(strcat(descr, "_press")), cvar_string(strcat(descr, "_release")));
+
+       DialogOpenButton_Click(btn, me.userbindEditDialog);
+}
+void KeyBinder_Bind_Clear(entity btn, entity me)
+{
+       float n, j, k;
+       string func;
+
+       func = Xonotic_KeyBinds_Functions[me.selectedItem];
+       if(func == "")
+               return;
+
+       n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
+       for(j = 0; j < n; ++j)
+       {
+               k = stof(argv(j));
+               if(k != -1)
+                       //localcmd("\nunbind \"", keynumtostring(k), "\"\n");
+                       localcmd("\nbind \"", keynumtostring(k), "\" \"", KEY_NOT_BOUND_CMD, "\"\n");
+       }
+       m_play_click_sound(MENU_SOUND_CLEAR);
+       localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
+       cvar_set("_hud_showbinds_reload", "1");
+}
+void KeyBinder_Bind_Reset_All(entity btn, entity me)
+{
+       localcmd("unbindall\n");
+       localcmd("exec binds-xonotic.cfg\n");
+       localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
+       cvar_set("_hud_showbinds_reload", "1");
+}
+void XonoticKeyBinder_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       KeyBinder_Bind_Change(NULL, me);
+}
+void XonoticKeyBinder_setSelected(entity me, float i)
+{
+       // handling of "unselectable" items
+       i = floor(0.5 + bound(0, i, me.nItems - 1));
+       if(me.pressed == 0 || me.pressed == 1) // keyboard or scrolling - skip unselectable items
+       {
+               if(i > me.previouslySelected)
+               {
+                       while((i < me.nItems - 1) && (Xonotic_KeyBinds_Functions[i] == ""))
+                               ++i;
+               }
+               while((i > 0) && (Xonotic_KeyBinds_Functions[i] == ""))
+                       --i;
+               while((i < me.nItems - 1) && (Xonotic_KeyBinds_Functions[i] == ""))
+                       ++i;
+       }
+       if(me.pressed == 3) // released the mouse - fall back to last valid item
+       {
+               if(Xonotic_KeyBinds_Functions[i] == "")
+                       i = me.previouslySelected;
+       }
+       if(Xonotic_KeyBinds_Functions[i] != "")
+               me.previouslySelected = i;
+       if(me.userbindEditButton)
+               me.userbindEditButton.disabled = (substring(Xonotic_KeyBinds_Descriptions[i], 0, 1) != "$");
+       SUPER(XonoticKeyBinder).setSelected(me, i);
+}
+float XonoticKeyBinder_keyDown(entity me, float key, float ascii, float shift)
+{
+       float r;
+       r = 1;
+       switch(key)
+       {
+               case K_ENTER:
+               case K_KP_ENTER:
+               case K_SPACE:
+                       KeyBinder_Bind_Change(me, me);
+                       break;
+               case K_DEL:
+               case K_KP_DEL:
+               case K_BACKSPACE:
+                       KeyBinder_Bind_Clear(me, me);
+                       break;
+               default:
+                       r = SUPER(XonoticKeyBinder).keyDown(me, key, ascii, shift);
+                       break;
+       }
+       return r;
+}
+void XonoticKeyBinder_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       string s;
+       float j, k, n;
+       vector theColor;
+       float theAlpha;
+       string func, descr;
+       float extraMargin;
+
+       descr = Xonotic_KeyBinds_Descriptions[i];
+       func = Xonotic_KeyBinds_Functions[i];
+
+       if(func == "")
+       {
+               theAlpha = 1;
+               theColor = SKINCOLOR_KEYGRABBER_TITLES;
+               theAlpha = SKINALPHA_KEYGRABBER_TITLES;
+               extraMargin = 0;
+       }
+       else
+       {
+               if(isSelected)
+               {
+                       if(keyGrabber == me)
+                               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_WAITING, SKINALPHA_LISTBOX_WAITING);
+                       else
+                               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+               }
+               theAlpha = SKINALPHA_KEYGRABBER_KEYS;
+               theColor = SKINCOLOR_KEYGRABBER_KEYS;
+               extraMargin = me.realFontSize.x * 0.5;
+       }
+
+       if(substring(descr, 0, 1) == "$")
+       {
+               s = substring(descr, 1, strlen(descr) - 1);
+               descr = cvar_string(strcat(s, "_description"));
+               if(descr == "")
+                       descr = s;
+               if(cvar_string(strcat(s, "_press")) == "")
+                       if(cvar_string(strcat(s, "_release")) == "")
+                               theAlpha *= SKINALPHA_DISABLED;
+       }
+
+       s = draw_TextShortenToWidth(descr, me.columnFunctionSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin * eY + extraMargin * eX, s, me.realFontSize, theColor, theAlpha, 0);
+       if(func != "")
+       {
+               n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
+               s = "";
+               for(j = 0; j < n; ++j)
+               {
+                       k = stof(argv(j));
+                       if(k != -1)
+                       {
+                               if(s != "")
+                                       s = strcat(s, ", ");
+                               s = strcat(s, keynumtostring(k));
+                       }
+               }
+               s = draw_TextShortenToWidth(s, me.columnKeysSize, 0, me.realFontSize);
+               draw_CenterText(me.realUpperMargin * eY + (me.columnKeysOrigin + 0.5 * me.columnKeysSize) * eX, s, me.realFontSize, theColor, theAlpha, 0);
+       }
+}
+#endif
diff --git a/qcsrc/menu/xonotic/languagelist.c b/qcsrc/menu/xonotic/languagelist.c
deleted file mode 100644 (file)
index 2444578..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticLanguageList) EXTENDS(XonoticListBox)
-       METHOD(XonoticLanguageList, configureXonoticLanguageList, void(entity))
-       ATTRIB(XonoticLanguageList, rowsPerItem, float, 1)
-       METHOD(XonoticLanguageList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticLanguageList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticLanguageList, setSelected, void(entity, float))
-       METHOD(XonoticLanguageList, loadCvars, void(entity))
-       METHOD(XonoticLanguageList, saveCvars, void(entity))
-
-       ATTRIB(XonoticLanguageList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticLanguageList, realUpperMargin, float, 0)
-       ATTRIB(XonoticLanguageList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticLanguageList, columnNameSize, float, 0)
-       ATTRIB(XonoticLanguageList, columnPercentageOrigin, float, 0)
-       ATTRIB(XonoticLanguageList, columnPercentageSize, float, 0)
-
-       METHOD(XonoticLanguageList, clickListBoxItem, void(entity, float, vector)) // double click handling
-       METHOD(XonoticLanguageList, keyDown, float(entity, float, float, float)) // enter handling
-       ATTRIB(XonoticLanguageList, lastClickedLanguage, float, -1)
-       ATTRIB(XonoticLanguageList, lastClickedTime, float, 0)
-
-       METHOD(XonoticLanguageList, destroy, void(entity))
-
-       ATTRIB(XonoticLanguageList, languagelist, float, -1)
-       METHOD(XonoticLanguageList, getLanguages, void(entity))
-       METHOD(XonoticLanguageList, setLanguage, void(entity))
-       METHOD(XonoticLanguageList, languageParameter, string(entity, float, float))
-
-       ATTRIB(XonoticLanguageList, name, string, "languageselector") // change this to make it noninteractive (for first run dialog)
-ENDCLASS(XonoticLanguageList)
-
-entity makeXonoticLanguageList();
-void SetLanguage_Click(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-
-#define LANGPARM_ID 0
-#define LANGPARM_NAME 1
-#define LANGPARM_NAME_LOCALIZED 2
-#define LANGPARM_PERCENTAGE 3
-#define LANGPARM_COUNT 4
-
-entity makeXonoticLanguageList()
-{
-       entity me;
-       me = spawnXonoticLanguageList();
-       me.configureXonoticLanguageList(me);
-       return me;
-}
-
-void XonoticLanguageList_configureXonoticLanguageList(entity me)
-{
-       me.configureXonoticListBox(me);
-       me.getLanguages(me);
-       me.loadCvars(me);
-}
-
-void XonoticLanguageList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       string s, p;
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
-       s = me.languageParameter(me, i, LANGPARM_NAME_LOCALIZED);
-
-       vector save_fontscale = draw_fontscale;
-       float f = draw_CondensedFontFactor(s, FALSE, me.realFontSize, 1);
-       draw_fontscale_x *= f;
-       vector fs = me.realFontSize;
-       fs_x *= f;
-       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0);
-       draw_fontscale = save_fontscale;
-
-       p = me.languageParameter(me, i, LANGPARM_PERCENTAGE);
-       if(p != "")
-       {
-               vector save_fontscale = draw_fontscale;
-               float f = draw_CondensedFontFactor(p, FALSE, me.realFontSize, 1);
-               draw_fontscale_x *= f;
-               vector fs = me.realFontSize;
-               fs_x *= f;
-               draw_Text(me.realUpperMargin * eY + (me.columnPercentageOrigin + (me.columnPercentageSize - draw_TextWidth(p, 0, fs))) * eX, p, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0);
-               draw_fontscale = save_fontscale;
-       }
-}
-
-void XonoticLanguageList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(XonoticLanguageList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-       me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight);
-       me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-       me.columnPercentageSize = me.realFontSize_x * 3;
-       me.columnPercentageOrigin = 1 - me.columnPercentageSize;
-       me.columnNameOrigin = 0;
-       me.columnNameSize = me.columnPercentageOrigin;
-}
-
-void XonoticLanguageList_setSelected(entity me, float i)
-{
-       SUPER(XonoticLanguageList).setSelected(me, i);
-       me.saveCvars(me);
-}
-
-void XonoticLanguageList_loadCvars(entity me)
-{
-       string s;
-       float i, n;
-       s = cvar_string("_menu_prvm_language");
-       n = me.nItems;
-
-       // default to English
-       for(i = 0; i < n; ++i)
-       {
-               if(me.languageParameter(me, i, LANGPARM_ID) == "en")
-               {
-                       me.selectedItem = i;
-                       break;
-               }
-       }
-
-        // otherwise, find the language
-       for(i = 0; i < n; ++i)
-       {
-               if(me.languageParameter(me, i, LANGPARM_ID) == s)
-               {
-                       me.selectedItem = i;
-                       break;
-               }
-       }
-
-       // save it off (turning anything unknown into "en")
-       me.saveCvars(me);
-}
-
-void XonoticLanguageList_saveCvars(entity me)
-{
-       cvar_set("_menu_prvm_language", me.languageParameter(me, me.selectedItem, LANGPARM_ID));
-}
-
-void XonoticLanguageList_clickListBoxItem(entity me, float i, vector where)
-{
-       if(i == me.lastClickedLanguage)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       me.setSelected(me, i);
-                       me.setLanguage(me);
-               }
-       me.lastClickedLanguage = i;
-       me.lastClickedTime = time;
-}
-
-float XonoticLanguageList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       if(scan == K_ENTER || scan == K_KP_ENTER) {
-               me.setLanguage(me);
-               return 1;
-       }
-       else
-               return SUPER(XonoticLanguageList).keyDown(me, scan, ascii, shift);
-}
-
-void XonoticLanguageList_destroy(entity me)
-{
-       buf_del(me.languagelist);
-}
-
-void XonoticLanguageList_getLanguages(entity me)
-{
-       float buf, i, n, fh;
-       string s;
-
-       buf = buf_create();
-
-       fh = fopen("languages.txt", FILE_READ);
-       i = 0;
-       while((s = fgets(fh)))
-       {
-               n = tokenize_console(s);
-               if(n < 3)
-                       continue;
-               bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_ID, argv(0));
-               bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_NAME, argv(1));
-               float k = strstrofs(argv(2), "(", 0);
-               if(k > 0)
-               if(substring(argv(2), strlen(argv(2)) - 1, 1) == ")")
-               {
-                       string percent = substring(argv(2), k + 1, -2);
-                       if(percent != "100%")
-                               bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_PERCENTAGE, percent);
-               }
-               bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_NAME_LOCALIZED, (k < 0) ? argv(2) : substring(argv(2), 0, k - 1));
-               ++i;
-       }
-       fclose(fh);
-
-       me.languagelist = buf;
-       me.nItems = i;
-}
-
-void XonoticLanguageList_setLanguage(entity me)
-{
-       if(prvm_language != cvar_string("_menu_prvm_language"))
-       {
-               if(!(gamestatus & GAME_CONNECTED))
-                       localcmd("\nprvm_language \"$_menu_prvm_language\"; menu_restart; menu_cmd languageselect\n");
-               else
-                       DialogOpenButton_Click(me, main.languageWarningDialog);
-       }
-}
-
-string XonoticLanguageList_languageParameter(entity me, float i, float key)
-{
-       return bufstr_get(me.languagelist, i * LANGPARM_COUNT + key);
-}
-
-void SetLanguage_Click(entity btn, entity me)
-{
-       me.setLanguage(me);
-}
-
-#endif
diff --git a/qcsrc/menu/xonotic/languagelist.qc b/qcsrc/menu/xonotic/languagelist.qc
new file mode 100644 (file)
index 0000000..8aa0d2c
--- /dev/null
@@ -0,0 +1,218 @@
+#ifdef INTERFACE
+CLASS(XonoticLanguageList) EXTENDS(XonoticListBox)
+       METHOD(XonoticLanguageList, configureXonoticLanguageList, void(entity))
+       ATTRIB(XonoticLanguageList, rowsPerItem, float, 1)
+       METHOD(XonoticLanguageList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticLanguageList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticLanguageList, setSelected, void(entity, float))
+       METHOD(XonoticLanguageList, loadCvars, void(entity))
+       METHOD(XonoticLanguageList, saveCvars, void(entity))
+
+       ATTRIB(XonoticLanguageList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticLanguageList, realUpperMargin, float, 0)
+       ATTRIB(XonoticLanguageList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticLanguageList, columnNameSize, float, 0)
+       ATTRIB(XonoticLanguageList, columnPercentageOrigin, float, 0)
+       ATTRIB(XonoticLanguageList, columnPercentageSize, float, 0)
+
+       METHOD(XonoticLanguageList, doubleClickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticLanguageList, keyDown, float(entity, float, float, float)) // enter handling
+
+       METHOD(XonoticLanguageList, destroy, void(entity))
+
+       ATTRIB(XonoticLanguageList, languagelist, float, -1)
+       METHOD(XonoticLanguageList, getLanguages, void(entity))
+       METHOD(XonoticLanguageList, setLanguage, void(entity))
+       METHOD(XonoticLanguageList, languageParameter, string(entity, float, float))
+
+       ATTRIB(XonoticLanguageList, name, string, "languageselector") // change this to make it noninteractive (for first run dialog)
+ENDCLASS(XonoticLanguageList)
+
+entity makeXonoticLanguageList();
+void SetLanguage_Click(entity btn, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+
+const float LANGPARM_ID = 0;
+const float LANGPARM_NAME = 1;
+const float LANGPARM_NAME_LOCALIZED = 2;
+const float LANGPARM_PERCENTAGE = 3;
+const float LANGPARM_COUNT = 4;
+
+entity makeXonoticLanguageList()
+{
+       entity me;
+       me = spawnXonoticLanguageList();
+       me.configureXonoticLanguageList(me);
+       return me;
+}
+
+void XonoticLanguageList_configureXonoticLanguageList(entity me)
+{
+       me.configureXonoticListBox(me);
+       me.getLanguages(me);
+       me.loadCvars(me);
+}
+
+void XonoticLanguageList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       string s, p;
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+
+       s = me.languageParameter(me, i, LANGPARM_NAME_LOCALIZED);
+
+       vector save_fontscale = draw_fontscale;
+       float f = draw_CondensedFontFactor(s, false, me.realFontSize, 1);
+       draw_fontscale.x *= f;
+       vector fs = me.realFontSize;
+       fs.x *= f;
+       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0);
+       draw_fontscale = save_fontscale;
+
+       p = me.languageParameter(me, i, LANGPARM_PERCENTAGE);
+       if(p != "")
+       {
+               vector save_fontscale = draw_fontscale;
+               float f = draw_CondensedFontFactor(p, false, me.realFontSize, 1);
+               draw_fontscale.x *= f;
+               vector fs = me.realFontSize;
+               fs.x *= f;
+               draw_Text(me.realUpperMargin * eY + (me.columnPercentageOrigin + (me.columnPercentageSize - draw_TextWidth(p, 0, fs))) * eX, p, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0);
+               draw_fontscale = save_fontscale;
+       }
+}
+
+void XonoticLanguageList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(XonoticLanguageList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+       me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight);
+       me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+       me.columnPercentageSize = me.realFontSize.x * 3;
+       me.columnPercentageOrigin = 1 - me.columnPercentageSize;
+       me.columnNameOrigin = 0;
+       me.columnNameSize = me.columnPercentageOrigin;
+}
+
+void XonoticLanguageList_setSelected(entity me, float i)
+{
+       SUPER(XonoticLanguageList).setSelected(me, i);
+       me.saveCvars(me);
+}
+
+void XonoticLanguageList_loadCvars(entity me)
+{
+       string s;
+       float i, n;
+       s = cvar_string("_menu_prvm_language");
+       n = me.nItems;
+
+       // default to English
+       for(i = 0; i < n; ++i)
+       {
+               if(me.languageParameter(me, i, LANGPARM_ID) == "en")
+               {
+                       me.selectedItem = i;
+                       break;
+               }
+       }
+
+        // otherwise, find the language
+       for(i = 0; i < n; ++i)
+       {
+               if(me.languageParameter(me, i, LANGPARM_ID) == s)
+               {
+                       me.selectedItem = i;
+                       break;
+               }
+       }
+
+       // save it off (turning anything unknown into "en")
+       me.saveCvars(me);
+}
+
+void XonoticLanguageList_saveCvars(entity me)
+{
+       cvar_set("_menu_prvm_language", me.languageParameter(me, me.selectedItem, LANGPARM_ID));
+}
+
+void XonoticLanguageList_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       m_play_click_sound(MENU_SOUND_EXECUTE);
+       me.setLanguage(me);
+}
+
+float XonoticLanguageList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       if(scan == K_ENTER || scan == K_KP_ENTER)
+       {
+               m_play_click_sound(MENU_SOUND_EXECUTE);
+               me.setLanguage(me);
+               return 1;
+       }
+       else
+               return SUPER(XonoticLanguageList).keyDown(me, scan, ascii, shift);
+}
+
+void XonoticLanguageList_destroy(entity me)
+{
+       buf_del(me.languagelist);
+}
+
+void XonoticLanguageList_getLanguages(entity me)
+{
+       float buf, i, n, fh;
+       string s;
+
+       buf = buf_create();
+
+       fh = fopen("languages.txt", FILE_READ);
+       i = 0;
+       while((s = fgets(fh)))
+       {
+               n = tokenize_console(s);
+               if(n < 3)
+                       continue;
+               bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_ID, argv(0));
+               bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_NAME, argv(1));
+               float k = strstrofs(argv(2), "(", 0);
+               if(k > 0)
+               if(substring(argv(2), strlen(argv(2)) - 1, 1) == ")")
+               {
+                       string percent = substring(argv(2), k + 1, -2);
+                       if(percent != "100%")
+                               bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_PERCENTAGE, percent);
+               }
+               bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_NAME_LOCALIZED, (k < 0) ? argv(2) : substring(argv(2), 0, k - 1));
+               ++i;
+       }
+       fclose(fh);
+
+       me.languagelist = buf;
+       me.nItems = i;
+}
+
+void XonoticLanguageList_setLanguage(entity me)
+{
+       if(prvm_language != cvar_string("_menu_prvm_language"))
+       {
+               if(!(gamestatus & GAME_CONNECTED))
+                       localcmd("\nprvm_language \"$_menu_prvm_language\"; menu_restart; menu_cmd languageselect\n");
+               else
+                       DialogOpenButton_Click(me, main.languageWarningDialog);
+       }
+}
+
+string XonoticLanguageList_languageParameter(entity me, float i, float key)
+{
+       return bufstr_get(me.languagelist, i * LANGPARM_COUNT + key);
+}
+
+void SetLanguage_Click(entity btn, entity me)
+{
+       me.setLanguage(me);
+}
+
+#endif
diff --git a/qcsrc/menu/xonotic/listbox.c b/qcsrc/menu/xonotic/listbox.c
deleted file mode 100644 (file)
index 23fa58d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticListBox) EXTENDS(ListBox)
-       METHOD(XonoticListBox, configureXonoticListBox, void(entity))
-       ATTRIB(XonoticListBox, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticListBox, scrollbarWidth, float, SKINWIDTH_SCROLLBAR)
-       ATTRIB(XonoticListBox, src, string, SKINGFX_SCROLLBAR)
-       ATTRIB(XonoticListBox, tolerance, vector, SKINTOLERANCE_SLIDER)
-       ATTRIB(XonoticListBox, rowsPerItem, float, 1)
-       METHOD(XonoticListBox, resizeNotify, void(entity, vector, vector, vector, vector))
-       ATTRIB(XonoticListBox, color, vector, SKINCOLOR_SCROLLBAR_N)
-       ATTRIB(XonoticListBox, colorF, vector, SKINCOLOR_SCROLLBAR_F)
-       ATTRIB(XonoticListBox, color2, vector, SKINCOLOR_SCROLLBAR_S)
-       ATTRIB(XonoticListBox, colorC, vector, SKINCOLOR_SCROLLBAR_C)
-       ATTRIB(XonoticListBox, colorBG, vector, SKINCOLOR_LISTBOX_BACKGROUND)
-       ATTRIB(XonoticListBox, alphaBG, float, SKINALPHA_LISTBOX_BACKGROUND)
-ENDCLASS(XonoticListBox)
-entity makeXonoticListBox();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticListBox()
-{
-       entity me;
-       me = spawnXonoticListBox();
-       me.configureXonoticListBox(me);
-       return me;
-}
-void XonoticListBox_configureXonoticListBox(entity me)
-{
-       me.configureListBox(me, me.scrollbarWidth, 1); // item height gets set up later
-}
-void XonoticListBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.itemHeight = me.rowsPerItem * me.fontSize / absSize_y;
-       SUPER(XonoticListBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/listbox.qc b/qcsrc/menu/xonotic/listbox.qc
new file mode 100644 (file)
index 0000000..0ab574f
--- /dev/null
@@ -0,0 +1,37 @@
+#ifdef INTERFACE
+CLASS(XonoticListBox) EXTENDS(ListBox)
+       METHOD(XonoticListBox, configureXonoticListBox, void(entity))
+       ATTRIB(XonoticListBox, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticListBox, scrollbarWidth, float, SKINWIDTH_SCROLLBAR)
+       ATTRIB(XonoticListBox, src, string, SKINGFX_SCROLLBAR)
+       ATTRIB(XonoticListBox, tolerance, vector, SKINTOLERANCE_SLIDER)
+       ATTRIB(XonoticListBox, rowsPerItem, float, 1)
+       METHOD(XonoticListBox, resizeNotify, void(entity, vector, vector, vector, vector))
+       ATTRIB(XonoticListBox, color, vector, SKINCOLOR_SCROLLBAR_N)
+       ATTRIB(XonoticListBox, colorF, vector, SKINCOLOR_SCROLLBAR_F)
+       ATTRIB(XonoticListBox, color2, vector, SKINCOLOR_SCROLLBAR_S)
+       ATTRIB(XonoticListBox, colorC, vector, SKINCOLOR_SCROLLBAR_C)
+       ATTRIB(XonoticListBox, colorBG, vector, SKINCOLOR_LISTBOX_BACKGROUND)
+       ATTRIB(XonoticListBox, alphaBG, float, SKINALPHA_LISTBOX_BACKGROUND)
+ENDCLASS(XonoticListBox)
+entity makeXonoticListBox();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticListBox()
+{
+       entity me;
+       me = spawnXonoticListBox();
+       me.configureXonoticListBox(me);
+       return me;
+}
+void XonoticListBox_configureXonoticListBox(entity me)
+{
+       me.configureListBox(me, me.scrollbarWidth, 1); // item height gets set up later
+}
+void XonoticListBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.itemHeight = me.rowsPerItem * me.fontSize / absSize.y;
+       SUPER(XonoticListBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/mainwindow.c b/qcsrc/menu/xonotic/mainwindow.c
deleted file mode 100644 (file)
index 6fa40bf..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-#ifdef INTERFACE
-CLASS(MainWindow) EXTENDS(ModalController)
-       METHOD(MainWindow, configureMainWindow, void(entity))
-       METHOD(MainWindow, draw, void(entity))
-       ATTRIB(MainWindow, firstRunDialog, entity, NULL)
-       ATTRIB(MainWindow, advancedDialog, entity, NULL)
-       ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
-       ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
-       ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
-       ATTRIB(MainWindow, winnerDialog, entity, NULL)
-       ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
-       ATTRIB(MainWindow, cvarsDialog, entity, NULL)
-       ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL)
-       ATTRIB(MainWindow, viewDialog, entity, NULL)
-       ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
-       ATTRIB(MainWindow, languageWarningDialog, entity, NULL)
-       ATTRIB(MainWindow, mainNexposee, entity, NULL)
-       ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
-       ATTRIB(MainWindow, dialogToShow, entity, NULL)
-       ATTRIB(MainWindow, demostartconfirmDialog, entity, NULL)
-       ATTRIB(MainWindow, demotimeconfirmDialog, entity, NULL)
-       ATTRIB(MainWindow, resetDialog, entity, NULL)
-ENDCLASS(MainWindow)
-#endif
-
-#ifdef IMPLEMENTATION
-void MainWindow_draw(entity me)
-{
-       SUPER(MainWindow).draw(me);
-
-       if(me.dialogToShow)
-       {
-               DialogOpenButton_Click_withCoords(world, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
-               me.dialogToShow = NULL;
-       }
-}
-
-void DemoButton_Click(entity me, entity other)
-{
-       if(me.text == _("Do not press this button again!"))
-               DialogOpenButton_Click(me, other);
-       else
-               me.setText(me, _("Do not press this button again!"));
-}
-
-void MainWindow_configureMainWindow(entity me)
-{
-       entity n, i;
-
-       // dialog run upon startup
-       me.firstRunDialog = i = spawnXonoticFirstRunDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-
-       // hud_configure dialogs
-       i = spawnXonoticHUDExitDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDNotificationDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDAmmoDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDHealthArmorDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDChatDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDModIconsDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDPowerupsDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDPressedKeysDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDRaceTimerDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDRadarDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDScoreDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDTimerDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDVoteDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDWeaponsDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDEngineInfoDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDInfoMessagesDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-       
-       i = spawnXonoticHUDPhysicsDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-       
-       me.screenshotViewerDialog = i = spawnXonoticScreenshotViewerDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDCenterprintDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticHUDBuffsDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-
-       // dialogs used by settings
-       me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       me.cvarsDialog = i = spawnXonoticCvarsDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-       
-       me.resetDialog = i = spawnXonoticResetDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       me.languageWarningDialog = i = spawnXonoticLanguageWarningDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       me.hudconfirmDialog = i = spawnXonoticHUDConfirmDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-
-       // dialog used by singleplayer
-       me.winnerDialog = i = spawnXonoticWinnerDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-
-       // dialog used by multiplayer/join
-       me.serverInfoDialog = i = spawnXonoticServerInfoDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-       
-       me.demostartconfirmDialog = i = spawnXonoticDemoStartConfirmDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       me.demotimeconfirmDialog = i = spawnXonoticDemoTimeConfirmDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-
-       // dialogs used by multiplayer/create
-       me.mapInfoDialog = i = spawnXonoticMapInfoDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       me.mutatorsDialog = i = spawnXonoticMutatorsDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       // mutator dialogs
-       i = spawnXonoticSandboxToolsDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
-
-
-       // miscellaneous dialogs
-       i = spawnXonoticTeamSelectDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       i = spawnXonoticMonsterToolsDialog();
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
-
-
-       // main dialogs/windows
-       me.mainNexposee = n = spawnXonoticNexposee();
-       /*
-               if(checkextension("DP_GECKO_SUPPORT"))
-               {
-                       i = spawnXonoticNewsDialog();
-                       i.configureDialog(i);
-                       n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-                       n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
-               }
-       */
-               i = spawnXonoticSingleplayerDialog();
-               i.configureDialog(i);
-               n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-               n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
-
-               i = spawnXonoticMultiplayerDialog();
-               i.configureDialog(i);
-               n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-               n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
-
-               i = spawnXonoticSettingsDialog();
-               i.configureDialog(i);
-               n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-               n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
-
-               i = spawnXonoticCreditsDialog();
-               i.configureDialog(i);
-               n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-               n.setNexposee(n, i, SKINPOSITION_DIALOG_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
-               n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
-
-               i = spawnXonoticQuitDialog();
-               i.configureDialog(i);
-               n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-               n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
-               n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
-
-       me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
-       me.moveItemAfter(me, n, NULL);
-
-       me.initializeDialog(me, n);
-
-       if(cvar_string("_cl_name") == cvar_defstring("_cl_name"))
-               me.dialogToShow = me.firstRunDialog;
-}
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
diff --git a/qcsrc/menu/xonotic/mainwindow.qc b/qcsrc/menu/xonotic/mainwindow.qc
new file mode 100644 (file)
index 0000000..45a0f93
--- /dev/null
@@ -0,0 +1,253 @@
+#ifdef INTERFACE
+CLASS(MainWindow) EXTENDS(ModalController)
+       METHOD(MainWindow, configureMainWindow, void(entity))
+       METHOD(MainWindow, draw, void(entity))
+       ATTRIB(MainWindow, firstRunDialog, entity, NULL)
+       ATTRIB(MainWindow, advancedDialog, entity, NULL)
+       ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
+       ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
+       ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
+       ATTRIB(MainWindow, winnerDialog, entity, NULL)
+       ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
+       ATTRIB(MainWindow, cvarsDialog, entity, NULL)
+       ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL)
+       ATTRIB(MainWindow, viewDialog, entity, NULL)
+       ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
+       ATTRIB(MainWindow, languageWarningDialog, entity, NULL)
+       ATTRIB(MainWindow, mainNexposee, entity, NULL)
+       ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
+       ATTRIB(MainWindow, dialogToShow, entity, NULL)
+       ATTRIB(MainWindow, demostartconfirmDialog, entity, NULL)
+       ATTRIB(MainWindow, demotimeconfirmDialog, entity, NULL)
+       ATTRIB(MainWindow, resetDialog, entity, NULL)
+ENDCLASS(MainWindow)
+#endif
+
+#ifdef IMPLEMENTATION
+void MainWindow_draw(entity me)
+{
+       SUPER(MainWindow).draw(me);
+
+       if(me.dialogToShow)
+       {
+               DialogOpenButton_Click_withCoords(world, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
+               me.dialogToShow = NULL;
+       }
+}
+
+void DemoButton_Click(entity me, entity other)
+{
+       if(me.text == _("Do not press this button again!"))
+               DialogOpenButton_Click(me, other);
+       else
+               me.setText(me, _("Do not press this button again!"));
+}
+
+void MainWindow_configureMainWindow(entity me)
+{
+       entity n, i;
+
+       // dialog run upon startup
+       me.firstRunDialog = i = spawnXonoticFirstRunDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+
+       // hud_configure dialogs
+       i = spawnXonoticHUDExitDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDNotificationDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDAmmoDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDHealthArmorDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDChatDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDModIconsDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDPowerupsDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDPressedKeysDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDRaceTimerDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDRadarDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDScoreDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDTimerDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDVoteDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDWeaponsDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDEngineInfoDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDInfoMessagesDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDPhysicsDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       me.screenshotViewerDialog = i = spawnXonoticScreenshotViewerDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDCenterprintDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticHUDBuffsDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+
+       // dialogs used by settings
+       me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       me.cvarsDialog = i = spawnXonoticCvarsDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       me.resetDialog = i = spawnXonoticResetDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       me.languageWarningDialog = i = spawnXonoticLanguageWarningDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       me.hudconfirmDialog = i = spawnXonoticHUDConfirmDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+
+       // dialog used by singleplayer
+       me.winnerDialog = i = spawnXonoticWinnerDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+
+       // dialog used by multiplayer/join
+       me.serverInfoDialog = i = spawnXonoticServerInfoDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       me.demostartconfirmDialog = i = spawnXonoticDemoStartConfirmDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       me.demotimeconfirmDialog = i = spawnXonoticDemoTimeConfirmDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+
+       // dialogs used by multiplayer/create
+       me.mapInfoDialog = i = spawnXonoticMapInfoDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       me.mutatorsDialog = i = spawnXonoticMutatorsDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       // mutator dialogs
+       i = spawnXonoticSandboxToolsDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
+
+
+       // miscellaneous dialogs
+       i = spawnXonoticTeamSelectDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+       i = spawnXonoticMonsterToolsDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);
+
+
+       // main dialogs/windows
+       me.mainNexposee = n = spawnXonoticNexposee();
+       /*
+               if(checkextension("DP_GECKO_SUPPORT"))
+               {
+                       i = spawnXonoticNewsDialog();
+                       i.configureDialog(i);
+                       n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+                       n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
+               }
+       */
+               i = spawnXonoticSingleplayerDialog();
+               i.configureDialog(i);
+               n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+               n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
+
+               i = spawnXonoticMultiplayerDialog();
+               i.configureDialog(i);
+               n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+               n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
+
+               i = spawnXonoticSettingsDialog();
+               i.configureDialog(i);
+               n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+               n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
+
+               i = spawnXonoticCreditsDialog();
+               i.configureDialog(i);
+               n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+               n.setNexposee(n, i, SKINPOSITION_DIALOG_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
+               n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
+
+               i = spawnXonoticQuitDialog();
+               i.configureDialog(i);
+               n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+               n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
+               n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
+
+       me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
+       me.moveItemAfter(me, n, NULL);
+
+       me.initializeDialog(me, n);
+
+       if(cvar_string("_cl_name") == cvar_defstring("_cl_name"))
+               me.dialogToShow = me.firstRunDialog;
+}
+#endif
+
+/* Click. The c-word is here so you can grep for it :-) */
diff --git a/qcsrc/menu/xonotic/maplist.c b/qcsrc/menu/xonotic/maplist.c
deleted file mode 100644 (file)
index 60eeb44..0000000
+++ /dev/null
@@ -1,360 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticMapList) EXTENDS(XonoticListBox)
-       METHOD(XonoticMapList, configureXonoticMapList, void(entity))
-       ATTRIB(XonoticMapList, rowsPerItem, float, 4)
-       METHOD(XonoticMapList, draw, void(entity))
-       METHOD(XonoticMapList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticMapList, clickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticMapList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticMapList, refilter, void(entity))
-       METHOD(XonoticMapList, refilterCallback, void(entity, entity))
-       METHOD(XonoticMapList, keyDown, float(entity, float, float, float))
-
-       ATTRIB(XonoticMapList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticMapList, columnPreviewOrigin, float, 0)
-       ATTRIB(XonoticMapList, columnPreviewSize, float, 0)
-       ATTRIB(XonoticMapList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticMapList, columnNameSize, float, 0)
-       ATTRIB(XonoticMapList, checkMarkOrigin, vector, '0 0 0')
-       ATTRIB(XonoticMapList, checkMarkSize, vector, '0 0 0')
-       ATTRIB(XonoticMapList, realUpperMargin1, float, 0)
-       ATTRIB(XonoticMapList, realUpperMargin2, float, 0)
-
-       ATTRIB(XonoticMapList, lastClickedMap, float, -1)
-       ATTRIB(XonoticMapList, lastClickedTime, float, 0)
-
-       ATTRIB(XonoticMapList, lastGametype, float, 0)
-       ATTRIB(XonoticMapList, lastFeatures, float, 0)
-
-       ATTRIB(XonoticMapList, origin, vector, '0 0 0')
-       ATTRIB(XonoticMapList, itemAbsSize, vector, '0 0 0')
-
-       ATTRIB(XonoticMapList, g_maplistCache, string, string_null)
-       METHOD(XonoticMapList, g_maplistCacheToggle, void(entity, float))
-       METHOD(XonoticMapList, g_maplistCacheQuery, float(entity, float))
-
-       ATTRIB(XonoticMapList, startButton, entity, NULL)
-
-       METHOD(XonoticMapList, loadCvars, void(entity))
-
-       ATTRIB(XonoticMapList, typeToSearchString, string, string_null)
-       ATTRIB(XonoticMapList, typeToSearchTime, float, 0)
-
-       METHOD(XonoticMapList, destroy, void(entity))
-
-       ATTRIB(XonoticListBox, alphaBG, float, 0)
-ENDCLASS(XonoticMapList)
-entity makeXonoticMapList();
-void MapList_All(entity btn, entity me);
-void MapList_None(entity btn, entity me);
-void MapList_LoadMap(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticMapList_destroy(entity me)
-{
-       MapInfo_Shutdown();
-}
-
-entity makeXonoticMapList()
-{
-       entity me;
-       me = spawnXonoticMapList();
-       me.configureXonoticMapList(me);
-       return me;
-}
-
-void XonoticMapList_configureXonoticMapList(entity me)
-{
-       me.configureXonoticListBox(me);
-       me.refilter(me);
-}
-
-void XonoticMapList_loadCvars(entity me)
-{
-       me.refilter(me);
-}
-
-float XonoticMapList_g_maplistCacheQuery(entity me, float i)
-{
-       return stof(substring(me.g_maplistCache, i, 1));
-}
-void XonoticMapList_g_maplistCacheToggle(entity me, float i)
-{
-       string a, b, c, s, bspname;
-       float n;
-       s = me.g_maplistCache;
-       if (!s)
-               return;
-       b = substring(s, i, 1);
-       if(b == "0")
-               b = "1";
-       else if(b == "1")
-               b = "0";
-       else
-               return; // nothing happens
-       a = substring(s, 0, i);
-       c = substring(s, i+1, strlen(s) - (i+1));
-       strunzone(s);
-       me.g_maplistCache = strzone(strcat(a, b, c));
-       // TODO also update the actual cvar
-       if (!((bspname = MapInfo_BSPName_ByID(i))))
-               return;
-       if(b == "1")
-               cvar_set("g_maplist", strcat(bspname, " ", cvar_string("g_maplist")));
-       else
-       {
-               s = "";
-               n = tokenize_console(cvar_string("g_maplist"));
-               for(i = 0; i < n; ++i)
-                       if(argv(i) != bspname)
-                               s = strcat(s, " ", argv(i));
-               cvar_set("g_maplist", substring(s, 1, strlen(s) - 1));
-       }
-}
-
-void XonoticMapList_draw(entity me)
-{
-       if(me.startButton)
-               me.startButton.disabled = ((me.selectedItem < 0) || (me.selectedItem >= me.nItems));
-       SUPER(XonoticMapList).draw(me);
-}
-
-void XonoticMapList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.itemAbsSize = '0 0 0';
-       SUPER(XonoticMapList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight));
-       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth)));
-       me.realUpperMargin1 = 0.5 * (1 - 2.5 * me.realFontSize_y);
-       me.realUpperMargin2 = me.realUpperMargin1 + 1.5 * me.realFontSize_y;
-
-       me.columnPreviewOrigin = 0;
-       me.columnPreviewSize = me.itemAbsSize_y / me.itemAbsSize_x * 4 / 3;
-       me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize_x;
-       me.columnNameSize = 1 - me.columnPreviewSize - 2 * me.realFontSize_x;
-
-       me.checkMarkSize = (eX * (me.itemAbsSize_y / me.itemAbsSize_x) + eY) * 0.5;
-       me.checkMarkOrigin = eY + eX * (me.columnPreviewOrigin + me.columnPreviewSize) - me.checkMarkSize;
-}
-
-void XonoticMapList_clickListBoxItem(entity me, float i, vector where)
-{
-       if(where_x <= me.columnPreviewOrigin + me.columnPreviewSize)
-               if(where_x >= 0)
-                       me.g_maplistCacheToggle(me, i);
-
-       if(where_x >= me.columnNameOrigin)
-               if(where_x <= 1)
-               {
-                       if(i == me.lastClickedMap)
-                               if(time < me.lastClickedTime + 0.3)
-                               {
-                                       // DOUBLE CLICK!
-                                       // pop up map info screen
-                                       main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, i, me);
-                                       DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * i - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize));
-                                       return;
-                               }
-                       me.lastClickedMap = i;
-                       me.lastClickedTime = time;
-               }
-}
-
-void XonoticMapList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       // layout: Ping, Map name, Map name, NP, TP, MP
-       string s;
-       float theAlpha;
-       float included;
-
-       if(!MapInfo_Get_ByID(i))
-               return;
-
-       included = me.g_maplistCacheQuery(me, i);
-       if(included || isSelected)
-               theAlpha = SKINALPHA_MAPLIST_INCLUDEDFG;
-       else
-               theAlpha = SKINALPHA_MAPLIST_NOTINCLUDEDFG;
-
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-       else if(included)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_MAPLIST_INCLUDEDBG, SKINALPHA_MAPLIST_INCLUDEDBG);
-
-       if(draw_PictureSize(strcat("/maps/", MapInfo_Map_bspname)) == '0 0 0')
-               draw_Picture(me.columnPreviewOrigin * eX, "nopreview_map", me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
-       else
-               draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", MapInfo_Map_bspname), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
-
-       if(included)
-               draw_Picture(me.checkMarkOrigin, "checkmark", me.checkMarkSize, '1 1 1', 1);
-       s = draw_TextShortenToWidth(strdecolorize(MapInfo_Map_titlestring), me.columnNameSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_TITLE, theAlpha, 0);
-       s = draw_TextShortenToWidth(strdecolorize(MapInfo_Map_author), me.columnNameSize, 0,  me.realFontSize);
-       draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 1.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_AUTHOR, theAlpha, 0);
-
-       MapInfo_ClearTemps();
-}
-
-void XonoticMapList_refilter(entity me)
-{
-       float i, j, n;
-       string s;
-       float gt, f;
-       gt = MapInfo_CurrentGametype();
-       f = MapInfo_CurrentFeatures();
-       MapInfo_FilterGametype(gt, f, MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
-       me.nItems = MapInfo_count;
-       for(i = 0; i < MapInfo_count; ++i)
-               draw_PreloadPicture(strcat("/maps/", MapInfo_BSPName_ByID(i)));
-       if(me.g_maplistCache)
-               strunzone(me.g_maplistCache);
-       s = "0";
-       for(i = 1; i < MapInfo_count; i *= 2)
-               s = strcat(s, s);
-       n = tokenize_console(cvar_string("g_maplist"));
-       for(i = 0; i < n; ++i)
-       {
-               j = MapInfo_FindName(argv(i));
-               if(j >= 0)
-                       s = strcat(
-                               substring(s, 0, j),
-                               "1",
-                               substring(s, j+1, MapInfo_count - (j+1))
-                       );
-       }
-       me.g_maplistCache = strzone(s);
-       if(gt != me.lastGametype || f != me.lastFeatures)
-       {
-               me.lastGametype = gt;
-               me.lastFeatures = f;
-               me.setSelected(me, 0);
-       }
-}
-
-void XonoticMapList_refilterCallback(entity me, entity cb)
-{
-       me.refilter(me);
-}
-
-void MapList_All(entity btn, entity me)
-{
-       float i;
-       string s;
-       MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, MapInfo_ForbiddenFlags(), 0); // all
-       s = "";
-       for(i = 0; i < MapInfo_count; ++i)
-               s = strcat(s, " ", MapInfo_BSPName_ByID(i));
-       cvar_set("g_maplist", substring(s, 1, strlen(s) - 1));
-       me.refilter(me);
-}
-
-void MapList_None(entity btn, entity me)
-{
-       cvar_set("g_maplist", "");
-       me.refilter(me);
-}
-
-void MapList_LoadMap(entity btn, entity me)
-{
-       string m;
-       float i;
-
-       i = me.selectedItem;
-
-       if(btn.parent.instanceOfXonoticMapInfoDialog)
-       {
-               i = btn.parent.currentMapIndex;
-               Dialog_Close(btn, btn.parent);
-       }
-
-       if(i >= me.nItems || i < 0)
-               return;
-
-       m = MapInfo_BSPName_ByID(i);
-       if (!m)
-       {
-               print(_("Huh? Can't play this (m is NULL). Refiltering so this won't happen again.\n"));
-               me.refilter(me);
-               return;
-       }
-       if(MapInfo_CheckMap(m))
-       {
-               localcmd("\nmenu_loadmap_prepare\n");
-               if(cvar("menu_use_default_hostname"))
-                       localcmd("hostname \"", sprintf(_("%s's Xonotic Server"), strdecolorize(cvar_string("_cl_name"))), "\"\n");
-               MapInfo_LoadMap(m, 1);
-       }
-       else
-       {
-               print(_("Huh? Can't play this (invalid game type). Refiltering so this won't happen again.\n"));
-               me.refilter(me);
-               return;
-       }
-}
-
-float XonoticMapList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       string ch, save;
-       if(me.nItems <= 0)
-               return SUPER(XonoticMapList).keyDown(me, scan, ascii, shift);
-       if(scan == K_MOUSE2 || scan == K_SPACE || scan == K_ENTER || scan == K_KP_ENTER)
-       {
-               // pop up map info screen
-               main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, me.selectedItem, me);
-               DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * me.selectedItem - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize));
-       }
-       else if(scan == K_MOUSE3 || scan == K_INS || scan == K_KP_INS)
-       {
-               me.g_maplistCacheToggle(me, me.selectedItem);
-       }
-       else if(ascii == 43) // +
-       {
-               if (!me.g_maplistCacheQuery(me, me.selectedItem))
-                       me.g_maplistCacheToggle(me, me.selectedItem);
-       }
-       else if(ascii == 45) // -
-       {
-               if(me.g_maplistCacheQuery(me, me.selectedItem))
-                       me.g_maplistCacheToggle(me, me.selectedItem);
-       }
-       else if(scan == K_BACKSPACE)
-       {
-               if(time < me.typeToSearchTime)
-               {
-                       save = substring(me.typeToSearchString, 0, strlen(me.typeToSearchString) - 1);
-                       if(me.typeToSearchString)
-                               strunzone(me.typeToSearchString);
-                       me.typeToSearchString = strzone(save);
-                       me.typeToSearchTime = time + 0.5;
-                       if(strlen(me.typeToSearchString))
-                       {
-                               MapInfo_FindName(me.typeToSearchString);
-                               if(MapInfo_FindName_firstResult >= 0)
-                                       me.setSelected(me, MapInfo_FindName_firstResult);
-                       }
-               }
-       }
-       else if(ascii >= 32 && ascii != 127)
-       {
-               ch = chr(ascii);
-               if(time > me.typeToSearchTime)
-                       save = ch;
-               else
-                       save = strcat(me.typeToSearchString, ch);
-               if(me.typeToSearchString)
-                       strunzone(me.typeToSearchString);
-               me.typeToSearchString = strzone(save);
-               me.typeToSearchTime = time + 0.5;
-               MapInfo_FindName(me.typeToSearchString);
-               if(MapInfo_FindName_firstResult >= 0)
-                       me.setSelected(me, MapInfo_FindName_firstResult);
-       }
-       else
-               return SUPER(XonoticMapList).keyDown(me, scan, ascii, shift);
-       return 1;
-}
-
-#endif
diff --git a/qcsrc/menu/xonotic/maplist.qc b/qcsrc/menu/xonotic/maplist.qc
new file mode 100644 (file)
index 0000000..d88ad0e
--- /dev/null
@@ -0,0 +1,365 @@
+#ifdef INTERFACE
+CLASS(XonoticMapList) EXTENDS(XonoticListBox)
+       METHOD(XonoticMapList, configureXonoticMapList, void(entity))
+       ATTRIB(XonoticMapList, rowsPerItem, float, 4)
+       METHOD(XonoticMapList, draw, void(entity))
+       METHOD(XonoticMapList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticMapList, clickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticMapList, doubleClickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticMapList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticMapList, refilter, void(entity))
+       METHOD(XonoticMapList, refilterCallback, void(entity, entity))
+       METHOD(XonoticMapList, keyDown, float(entity, float, float, float))
+
+       ATTRIB(XonoticMapList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticMapList, columnPreviewOrigin, float, 0)
+       ATTRIB(XonoticMapList, columnPreviewSize, float, 0)
+       ATTRIB(XonoticMapList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticMapList, columnNameSize, float, 0)
+       ATTRIB(XonoticMapList, checkMarkOrigin, vector, '0 0 0')
+       ATTRIB(XonoticMapList, checkMarkSize, vector, '0 0 0')
+       ATTRIB(XonoticMapList, realUpperMargin1, float, 0)
+       ATTRIB(XonoticMapList, realUpperMargin2, float, 0)
+
+       ATTRIB(XonoticMapList, lastGametype, float, 0)
+       ATTRIB(XonoticMapList, lastFeatures, float, 0)
+
+       ATTRIB(XonoticMapList, origin, vector, '0 0 0')
+       ATTRIB(XonoticMapList, itemAbsSize, vector, '0 0 0')
+
+       ATTRIB(XonoticMapList, g_maplistCache, string, string_null)
+       METHOD(XonoticMapList, g_maplistCacheToggle, void(entity, float))
+       METHOD(XonoticMapList, g_maplistCacheQuery, float(entity, float))
+
+       ATTRIB(XonoticMapList, startButton, entity, NULL)
+
+       METHOD(XonoticMapList, loadCvars, void(entity))
+
+       ATTRIB(XonoticMapList, typeToSearchString, string, string_null)
+       ATTRIB(XonoticMapList, typeToSearchTime, float, 0)
+
+       METHOD(XonoticMapList, destroy, void(entity))
+
+       ATTRIB(XonoticListBox, alphaBG, float, 0)
+ENDCLASS(XonoticMapList)
+entity makeXonoticMapList();
+void MapList_All(entity btn, entity me);
+void MapList_None(entity btn, entity me);
+void MapList_LoadMap(entity btn, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticMapList_destroy(entity me)
+{
+       MapInfo_Shutdown();
+}
+
+entity makeXonoticMapList()
+{
+       entity me;
+       me = spawnXonoticMapList();
+       me.configureXonoticMapList(me);
+       return me;
+}
+
+void XonoticMapList_configureXonoticMapList(entity me)
+{
+       me.configureXonoticListBox(me);
+       me.refilter(me);
+}
+
+void XonoticMapList_loadCvars(entity me)
+{
+       me.refilter(me);
+}
+
+float XonoticMapList_g_maplistCacheQuery(entity me, float i)
+{
+       return stof(substring(me.g_maplistCache, i, 1));
+}
+void XonoticMapList_g_maplistCacheToggle(entity me, float i)
+{
+       string a, b, c, s, bspname;
+       float n;
+       s = me.g_maplistCache;
+       if (!s)
+               return;
+       b = substring(s, i, 1);
+       if(b == "0")
+               b = "1";
+       else if(b == "1")
+               b = "0";
+       else
+               return; // nothing happens
+       a = substring(s, 0, i);
+       c = substring(s, i+1, strlen(s) - (i+1));
+       strunzone(s);
+       me.g_maplistCache = strzone(strcat(a, b, c));
+       // TODO also update the actual cvar
+       if (!((bspname = MapInfo_BSPName_ByID(i))))
+               return;
+       if(b == "1")
+               cvar_set("g_maplist", strcat(bspname, " ", cvar_string("g_maplist")));
+       else
+       {
+               s = "";
+               n = tokenize_console(cvar_string("g_maplist"));
+               for(i = 0; i < n; ++i)
+                       if(argv(i) != bspname)
+                               s = strcat(s, " ", argv(i));
+               cvar_set("g_maplist", substring(s, 1, strlen(s) - 1));
+       }
+}
+
+void XonoticMapList_draw(entity me)
+{
+       if(me.startButton)
+               me.startButton.disabled = ((me.selectedItem < 0) || (me.selectedItem >= me.nItems));
+       SUPER(XonoticMapList).draw(me);
+}
+
+void XonoticMapList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.itemAbsSize = '0 0 0';
+       SUPER(XonoticMapList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
+       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
+       me.realUpperMargin1 = 0.5 * (1 - 2.5 * me.realFontSize.y);
+       me.realUpperMargin2 = me.realUpperMargin1 + 1.5 * me.realFontSize.y;
+
+       me.columnPreviewOrigin = 0;
+       me.columnPreviewSize = me.itemAbsSize.y / me.itemAbsSize.x * 4 / 3;
+       me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize.x;
+       me.columnNameSize = 1 - me.columnPreviewSize - 2 * me.realFontSize.x;
+
+       me.checkMarkSize = (eX * (me.itemAbsSize.y / me.itemAbsSize.x) + eY) * 0.5;
+       me.checkMarkOrigin = eY + eX * (me.columnPreviewOrigin + me.columnPreviewSize) - me.checkMarkSize;
+}
+
+void XonoticMapList_clickListBoxItem(entity me, float i, vector where)
+{
+       if(where.x <= me.columnPreviewOrigin + me.columnPreviewSize)
+               if(where.x >= 0)
+               {
+                       m_play_click_sound(MENU_SOUND_SELECT);
+                       me.g_maplistCacheToggle(me, i);
+               }
+}
+
+void XonoticMapList_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       if(where.x >= me.columnNameOrigin)
+               if(where.x <= 1)
+               {
+                       // pop up map info screen
+                       m_play_click_sound(MENU_SOUND_OPEN);
+                       main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, i, me);
+                       DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size.x) + eY * ((me.itemHeight * i - me.scrollPos) * me.size.y), eY * me.itemAbsSize.y + eX * (me.itemAbsSize.x * me.columnNameSize));
+               }
+}
+
+void XonoticMapList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       // layout: Ping, Map name, Map name, NP, TP, MP
+       string s;
+       float theAlpha;
+       float included;
+
+       if(!MapInfo_Get_ByID(i))
+               return;
+
+       included = me.g_maplistCacheQuery(me, i);
+       if(included || isSelected)
+               theAlpha = SKINALPHA_MAPLIST_INCLUDEDFG;
+       else
+               theAlpha = SKINALPHA_MAPLIST_NOTINCLUDEDFG;
+
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(included)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_MAPLIST_INCLUDEDBG, SKINALPHA_MAPLIST_INCLUDEDBG);
+
+       if(draw_PictureSize(strcat("/maps/", MapInfo_Map_bspname)) == '0 0 0')
+               draw_Picture(me.columnPreviewOrigin * eX, "nopreview_map", me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
+       else
+               draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", MapInfo_Map_bspname), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
+
+       if(included)
+               draw_Picture(me.checkMarkOrigin, "checkmark", me.checkMarkSize, '1 1 1', 1);
+       s = draw_TextShortenToWidth(strdecolorize(MapInfo_Map_titlestring), me.columnNameSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_TITLE, theAlpha, 0);
+       s = draw_TextShortenToWidth(strdecolorize(MapInfo_Map_author), me.columnNameSize, 0,  me.realFontSize);
+       draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 1.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_AUTHOR, theAlpha, 0);
+
+       MapInfo_ClearTemps();
+}
+
+void XonoticMapList_refilter(entity me)
+{
+       float i, j, n;
+       string s;
+       float gt, f;
+       gt = MapInfo_CurrentGametype();
+       f = MapInfo_CurrentFeatures();
+       MapInfo_FilterGametype(gt, f, MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
+       me.nItems = MapInfo_count;
+       for(i = 0; i < MapInfo_count; ++i)
+               draw_PreloadPicture(strcat("/maps/", MapInfo_BSPName_ByID(i)));
+       if(me.g_maplistCache)
+               strunzone(me.g_maplistCache);
+       s = "0";
+       for(i = 1; i < MapInfo_count; i *= 2)
+               s = strcat(s, s);
+       n = tokenize_console(cvar_string("g_maplist"));
+       for(i = 0; i < n; ++i)
+       {
+               j = MapInfo_FindName(argv(i));
+               if(j >= 0)
+                       s = strcat(
+                               substring(s, 0, j),
+                               "1",
+                               substring(s, j+1, MapInfo_count - (j+1))
+                       );
+       }
+       me.g_maplistCache = strzone(s);
+       if(gt != me.lastGametype || f != me.lastFeatures)
+       {
+               me.lastGametype = gt;
+               me.lastFeatures = f;
+               me.setSelected(me, 0);
+       }
+}
+
+void XonoticMapList_refilterCallback(entity me, entity cb)
+{
+       me.refilter(me);
+}
+
+void MapList_All(entity btn, entity me)
+{
+       float i;
+       string s;
+       MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, MapInfo_ForbiddenFlags(), 0); // all
+       s = "";
+       for(i = 0; i < MapInfo_count; ++i)
+               s = strcat(s, " ", MapInfo_BSPName_ByID(i));
+       cvar_set("g_maplist", substring(s, 1, strlen(s) - 1));
+       me.refilter(me);
+}
+
+void MapList_None(entity btn, entity me)
+{
+       cvar_set("g_maplist", "");
+       me.refilter(me);
+}
+
+void MapList_LoadMap(entity btn, entity me)
+{
+       string m;
+       float i;
+
+       i = me.selectedItem;
+
+       if(btn.parent.instanceOfXonoticMapInfoDialog)
+       {
+               i = btn.parent.currentMapIndex;
+               Dialog_Close(btn, btn.parent);
+       }
+
+       if(i >= me.nItems || i < 0)
+               return;
+
+       m = MapInfo_BSPName_ByID(i);
+       if (!m)
+       {
+               print(_("Huh? Can't play this (m is NULL). Refiltering so this won't happen again.\n"));
+               me.refilter(me);
+               return;
+       }
+       if(MapInfo_CheckMap(m))
+       {
+               localcmd("\nmenu_loadmap_prepare\n");
+               if(cvar("menu_use_default_hostname"))
+                       localcmd("hostname \"", sprintf(_("%s's Xonotic Server"), strdecolorize(cvar_string("_cl_name"))), "\"\n");
+               MapInfo_LoadMap(m, 1);
+       }
+       else
+       {
+               print(_("Huh? Can't play this (invalid game type). Refiltering so this won't happen again.\n"));
+               me.refilter(me);
+               return;
+       }
+}
+
+float XonoticMapList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       string ch, save;
+       if(me.nItems <= 0)
+               return SUPER(XonoticMapList).keyDown(me, scan, ascii, shift);
+       if(scan == K_MOUSE2 || scan == K_SPACE || scan == K_ENTER || scan == K_KP_ENTER)
+       {
+               // pop up map info screen
+               m_play_click_sound(MENU_SOUND_OPEN);
+               main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, me.selectedItem, me);
+               DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size.x) + eY * ((me.itemHeight * me.selectedItem - me.scrollPos) * me.size.y), eY * me.itemAbsSize.y + eX * (me.itemAbsSize.x * me.columnNameSize));
+       }
+       else if(scan == K_MOUSE3 || scan == K_INS || scan == K_KP_INS)
+       {
+               m_play_click_sound(MENU_SOUND_SELECT);
+               me.g_maplistCacheToggle(me, me.selectedItem);
+       }
+       else if(ascii == 43) // +
+       {
+               if (!me.g_maplistCacheQuery(me, me.selectedItem))
+               {
+                       m_play_click_sound(MENU_SOUND_SELECT);
+                       me.g_maplistCacheToggle(me, me.selectedItem);
+               }
+       }
+       else if(ascii == 45) // -
+       {
+               if(me.g_maplistCacheQuery(me, me.selectedItem))
+               {
+                       m_play_click_sound(MENU_SOUND_SELECT);
+                       me.g_maplistCacheToggle(me, me.selectedItem);
+               }
+       }
+       else if(scan == K_BACKSPACE)
+       {
+               if(time < me.typeToSearchTime)
+               {
+                       save = substring(me.typeToSearchString, 0, strlen(me.typeToSearchString) - 1);
+                       if(me.typeToSearchString)
+                               strunzone(me.typeToSearchString);
+                       me.typeToSearchString = strzone(save);
+                       me.typeToSearchTime = time + 0.5;
+                       if(strlen(me.typeToSearchString))
+                       {
+                               MapInfo_FindName(me.typeToSearchString);
+                               if(MapInfo_FindName_firstResult >= 0)
+                                       me.setSelected(me, MapInfo_FindName_firstResult);
+                       }
+               }
+       }
+       else if(ascii >= 32 && ascii != 127)
+       {
+               ch = chr(ascii);
+               if(time > me.typeToSearchTime)
+                       save = ch;
+               else
+                       save = strcat(me.typeToSearchString, ch);
+               if(me.typeToSearchString)
+                       strunzone(me.typeToSearchString);
+               me.typeToSearchString = strzone(save);
+               me.typeToSearchTime = time + 0.5;
+               MapInfo_FindName(me.typeToSearchString);
+               if(MapInfo_FindName_firstResult >= 0)
+                       me.setSelected(me, MapInfo_FindName_firstResult);
+       }
+       else
+               return SUPER(XonoticMapList).keyDown(me, scan, ascii, shift);
+       return 1;
+}
+
+#endif
diff --git a/qcsrc/menu/xonotic/nexposee.c b/qcsrc/menu/xonotic/nexposee.c
deleted file mode 100644 (file)
index b375393..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticNexposee) EXTENDS(Nexposee)
-       METHOD(XonoticNexposee, configureXonoticNexposee, void(entity))
-       METHOD(XonoticNexposee, close, void(entity))
-ENDCLASS(XonoticNexposee)
-entity makeXonoticNexposee();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticNexposee()
-{
-       entity me;
-       me = spawnXonoticNexposee();
-       me.configureXonoticNexposee(me);
-       return me;
-}
-
-void XonoticNexposee_configureXonoticNexposee(entity me)
-{
-}
-
-void XonoticNexposee_close(entity me)
-{
-       m_goto(string_null); // hide
-}
-#endif
diff --git a/qcsrc/menu/xonotic/nexposee.qc b/qcsrc/menu/xonotic/nexposee.qc
new file mode 100644 (file)
index 0000000..b375393
--- /dev/null
@@ -0,0 +1,26 @@
+#ifdef INTERFACE
+CLASS(XonoticNexposee) EXTENDS(Nexposee)
+       METHOD(XonoticNexposee, configureXonoticNexposee, void(entity))
+       METHOD(XonoticNexposee, close, void(entity))
+ENDCLASS(XonoticNexposee)
+entity makeXonoticNexposee();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticNexposee()
+{
+       entity me;
+       me = spawnXonoticNexposee();
+       me.configureXonoticNexposee(me);
+       return me;
+}
+
+void XonoticNexposee_configureXonoticNexposee(entity me)
+{
+}
+
+void XonoticNexposee_close(entity me)
+{
+       m_goto(string_null); // hide
+}
+#endif
diff --git a/qcsrc/menu/xonotic/playerlist.c b/qcsrc/menu/xonotic/playerlist.c
deleted file mode 100644 (file)
index b3ee386..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticPlayerList) EXTENDS(XonoticListBox)
-       ATTRIB(XonoticPlayerList, rowsPerItem, float, 1)
-       METHOD(XonoticPlayerList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticPlayerList, drawListBoxItem, void(entity, float, vector, float))
-       ATTRIB(XonoticPlayerList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticPlayerList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticPlayerList, columnNameSize, float, 0)
-       ATTRIB(XonoticPlayerList, columnScoreOrigin, float, 0)
-       ATTRIB(XonoticPlayerList, columnScoreSize, float, 0)
-       ATTRIB(XonoticPlayerList, realUpperMargin, float, 0)
-       ATTRIB(XonoticPlayerList, origin, vector, '0 0 0')
-       ATTRIB(XonoticPlayerList, itemAbsSize, vector, '0 0 0')
-       METHOD(XonoticPlayerList, setPlayerList, void(entity, string))
-       METHOD(XonoticPlayerList, getPlayerList, string(entity, float, float))
-       ATTRIB(XonoticPlayerList, playerList, float, -1)
-ENDCLASS(XonoticPlayerList)
-entity makeXonoticPlayerList();
-#endif
-
-#ifdef IMPLEMENTATION
-
-#define PLAYERPARM_SCORE 0
-#define PLAYERPARM_PING 1
-#define PLAYERPARM_TEAM 2
-#define PLAYERPARM_NAME 3
-#define PLAYERPARM_COUNT 4
-
-entity makeXonoticPlayerList()
-{
-       entity me;
-       me = spawnXonoticPlayerList();
-       me.configureXonoticListBox(me);
-       return me;
-}
-
-void XonoticPlayerList_setPlayerList(entity me, string plist)
-{
-       float buf,i,n;
-       string s;
-
-       buf = buf_create();
-       me.nItems = tokenizebyseparator(plist, "\n");
-       for(i = 0; i < me.nItems; ++i)
-       {
-               bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_NAME, argv(i)); // -666 100 "^4Nex ^2Player"
-       }
-
-       for(i = 0; i < me.nItems; ++i)
-       {
-               s = bufstr_get(buf, i * PLAYERPARM_COUNT + PLAYERPARM_NAME);
-               n = tokenize_console(s);
-
-               if(n == 4)
-               {
-                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_SCORE, argv(0)); // -666
-                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_PING,  argv(1)); // 100
-                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  argv(2)); // 0 for spec, else 1, 2, 3, 4
-                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_NAME,  argv(3)); // ^4Nex ^2Player
-               }
-               else
-               {
-                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_SCORE, argv(0)); // -666
-                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_PING,  argv(1)); // 100
-                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  "-1");
-                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_NAME,  argv(2)); // ^4Nex ^2Player
-               }
-       }
-       me.playerList = buf;
-}
-
-string XonoticPlayerList_getPlayerList(entity me, float i, float key)
-{
-       return bufstr_get(me.playerList, i * PLAYERPARM_COUNT + key);
-}
-
-void XonoticPlayerList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.itemAbsSize = '0 0 0';
-       SUPER(XonoticPlayerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight));
-       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth)));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-
-       // this list does 1 char left and right margin
-       me.columnScoreSize = 5 * me.realFontSize_x;
-       me.columnNameSize = 1 - 3 * me.realFontSize_x - me.columnScoreSize;
-
-       me.columnNameOrigin = me.realFontSize_x;
-       me.columnScoreOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize_x;
-}
-
-void XonoticPlayerList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       string s;
-       string score;
-       float t;
-       vector rgb;
-
-       t = stof(me.getPlayerList(me, i, PLAYERPARM_TEAM));
-       if(t == 1)
-               rgb = colormapPaletteColor(4, 0);
-       else if(t == 2)
-               rgb = colormapPaletteColor(13, 0);
-       else if(t == 3)
-               rgb = colormapPaletteColor(12, 0);
-       else if(t == 4)
-               rgb = colormapPaletteColor(9, 0);
-       else
-               rgb = SKINCOLOR_TEXT;
-
-       s = me.getPlayerList(me, i, PLAYERPARM_NAME);
-       score = me.getPlayerList(me, i, PLAYERPARM_SCORE);
-
-       if(substring(score, strlen(score) - 10, 10) == ":spectator")
-       {
-               score = _("spectator");
-       }
-       else
-       {
-               if((t = strstrofs(score, ":", 0)) >= 0)
-                       score = substring(score, 0, t);
-               if((t = strstrofs(score, ",", 0)) >= 0)
-                       score = substring(score, 0, t);
-
-               if(stof(score) == -666)
-                       score = _("spectator");
-       }
-
-       s = draw_TextShortenToWidth(s, me.columnNameSize, 1, me.realFontSize);
-       draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 1, me.realFontSize))) * eX, s, me.realFontSize, '1 1 1', 1, 1);
-
-       score = draw_TextShortenToWidth(score, me.columnScoreSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin2 * eY + (me.columnScoreOrigin + 1.00 * (me.columnScoreSize - draw_TextWidth(score, 1, me.realFontSize))) * eX, score, me.realFontSize, rgb, 1, 0);
-}
-
-#endif
diff --git a/qcsrc/menu/xonotic/playerlist.qc b/qcsrc/menu/xonotic/playerlist.qc
new file mode 100644 (file)
index 0000000..d4dc5af
--- /dev/null
@@ -0,0 +1,139 @@
+#ifdef INTERFACE
+CLASS(XonoticPlayerList) EXTENDS(XonoticListBox)
+       ATTRIB(XonoticPlayerList, rowsPerItem, float, 1)
+       METHOD(XonoticPlayerList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticPlayerList, drawListBoxItem, void(entity, float, vector, float))
+       ATTRIB(XonoticPlayerList, allowFocusSound, float, 0)
+       ATTRIB(XonoticPlayerList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticPlayerList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticPlayerList, columnNameSize, float, 0)
+       ATTRIB(XonoticPlayerList, columnScoreOrigin, float, 0)
+       ATTRIB(XonoticPlayerList, columnScoreSize, float, 0)
+       ATTRIB(XonoticPlayerList, realUpperMargin, float, 0)
+       ATTRIB(XonoticPlayerList, origin, vector, '0 0 0')
+       ATTRIB(XonoticPlayerList, itemAbsSize, vector, '0 0 0')
+       METHOD(XonoticPlayerList, setPlayerList, void(entity, string))
+       METHOD(XonoticPlayerList, getPlayerList, string(entity, float, float))
+       ATTRIB(XonoticPlayerList, playerList, float, -1)
+ENDCLASS(XonoticPlayerList)
+entity makeXonoticPlayerList();
+#endif
+
+#ifdef IMPLEMENTATION
+
+const float PLAYERPARM_SCORE = 0;
+const float PLAYERPARM_PING = 1;
+const float PLAYERPARM_TEAM = 2;
+const float PLAYERPARM_NAME = 3;
+const float PLAYERPARM_COUNT = 4;
+
+entity makeXonoticPlayerList()
+{
+       entity me;
+       me = spawnXonoticPlayerList();
+       me.configureXonoticListBox(me);
+       return me;
+}
+
+void XonoticPlayerList_setPlayerList(entity me, string plist)
+{
+       int buf,i,n;
+       string s;
+
+       buf = buf_create();
+       me.nItems = tokenizebyseparator(plist, "\n");
+       for(i = 0; i < me.nItems; ++i)
+       {
+               bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_NAME, argv(i)); // -666 100 "^4Nex ^2Player"
+       }
+
+       for(i = 0; i < me.nItems; ++i)
+       {
+               s = bufstr_get(buf, i * PLAYERPARM_COUNT + PLAYERPARM_NAME);
+               n = tokenize_console(s);
+
+               if(n == 4)
+               {
+                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_SCORE, argv(0)); // -666
+                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_PING,  argv(1)); // 100
+                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  argv(2)); // 0 for spec, else 1, 2, 3, 4
+                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_NAME,  argv(3)); // ^4Nex ^2Player
+               }
+               else
+               {
+                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_SCORE, argv(0)); // -666
+                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_PING,  argv(1)); // 100
+                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_TEAM,  "-1");
+                       bufstr_set(buf, i * PLAYERPARM_COUNT + PLAYERPARM_NAME,  argv(2)); // ^4Nex ^2Player
+               }
+       }
+       me.playerList = buf;
+}
+
+string XonoticPlayerList_getPlayerList(entity me, float i, float key)
+{
+       return bufstr_get(me.playerList, i * PLAYERPARM_COUNT + key);
+}
+
+void XonoticPlayerList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.itemAbsSize = '0 0 0';
+       SUPER(XonoticPlayerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
+       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+
+       // this list does 1 char left and right margin
+       me.columnScoreSize = 5 * me.realFontSize.x;
+       me.columnNameSize = 1 - 3 * me.realFontSize.x - me.columnScoreSize;
+
+       me.columnNameOrigin = me.realFontSize.x;
+       me.columnScoreOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize.x;
+}
+
+void XonoticPlayerList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       string s;
+       string score;
+       float t;
+       vector rgb;
+
+       t = stof(me.getPlayerList(me, i, PLAYERPARM_TEAM));
+       if(t == 1)
+               rgb = colormapPaletteColor(4, 0);
+       else if(t == 2)
+               rgb = colormapPaletteColor(13, 0);
+       else if(t == 3)
+               rgb = colormapPaletteColor(12, 0);
+       else if(t == 4)
+               rgb = colormapPaletteColor(9, 0);
+       else
+               rgb = SKINCOLOR_TEXT;
+
+       s = me.getPlayerList(me, i, PLAYERPARM_NAME);
+       score = me.getPlayerList(me, i, PLAYERPARM_SCORE);
+
+       if(substring(score, strlen(score) - 10, 10) == ":spectator")
+       {
+               score = _("spectator");
+       }
+       else
+       {
+               if((t = strstrofs(score, ":", 0)) >= 0)
+                       score = substring(score, 0, t);
+               if((t = strstrofs(score, ",", 0)) >= 0)
+                       score = substring(score, 0, t);
+
+               if(stof(score) == -666)
+                       score = _("spectator");
+       }
+
+       s = draw_TextShortenToWidth(s, me.columnNameSize, 1, me.realFontSize);
+       draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 1, me.realFontSize))) * eX, s, me.realFontSize, '1 1 1', 1, 1);
+
+       score = draw_TextShortenToWidth(score, me.columnScoreSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin2 * eY + (me.columnScoreOrigin + 1.00 * (me.columnScoreSize - draw_TextWidth(score, 1, me.realFontSize))) * eX, score, me.realFontSize, rgb, 1, 0);
+}
+
+#endif
diff --git a/qcsrc/menu/xonotic/playermodel.c b/qcsrc/menu/xonotic/playermodel.c
deleted file mode 100644 (file)
index 652c581..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticPlayerModelSelector) EXTENDS(XonoticImage)
-       METHOD(XonoticPlayerModelSelector, configureXonoticPlayerModelSelector, void(entity))
-       METHOD(XonoticPlayerModelSelector, loadCvars, void(entity))
-       METHOD(XonoticPlayerModelSelector, saveCvars, void(entity))
-       METHOD(XonoticPlayerModelSelector, draw, void(entity))
-       METHOD(XonoticPlayerModelSelector, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticPlayerModelSelector, showNotify, void(entity))
-       ATTRIB(XonoticPlayerModelSelector, currentModel, string, string_null)
-       ATTRIB(XonoticPlayerModelSelector, currentSkin, float, 0)
-       ATTRIB(XonoticPlayerModelSelector, currentModelImage, string, string_null)
-       ATTRIB(XonoticPlayerModelSelector, currentModelTitle, string, string_null)
-       ATTRIB(XonoticPlayerModelSelector, currentModelDescription, string, string_null)
-       METHOD(XonoticPlayerModelSelector, go, void(entity, float))
-       METHOD(XonoticPlayerModelSelector, destroy, void(entity))
-       ATTRIB(XonoticPlayerModelSelector, origin, vector, '0 0 0')
-       ATTRIB(XonoticPlayerModelSelector, size, vector, '0 0 0')
-       ATTRIB(XonoticPlayerModelSelector, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticPlayerModelSelector, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticPlayerModelSelector, titleFontSize, float, SKINFONTSIZE_TITLE)
-       ATTRIB(XonoticPlayerModelSelector, bufModels, float, -1)
-       ATTRIB(XonoticPlayerModelSelector, numModels, float, -1)
-       ATTRIB(XonoticPlayerModelSelector, idxModels, float, -1)
-ENDCLASS(XonoticPlayerModelSelector)
-entity makeXonoticPlayerModelSelector();
-void PlayerModelSelector_Next_Click(entity btn, entity me);
-void PlayerModelSelector_Prev_Click(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticPlayerModelSelector()
-{
-       entity me;
-       me = spawnXonoticPlayerModelSelector();
-       me.configureXonoticPlayerModelSelector(me);
-       return me;
-}
-
-#define BUFMODELS_TITLE 0
-#define BUFMODELS_IMAGE 1
-#define BUFMODELS_MODEL 2
-#define BUFMODELS_SKIN 3
-#define BUFMODELS_DESC 4
-#define BUFMODELS_COUNT 5
-
-#define XONVOTE186 1 // (nyov) removal of model text description
-
-void XonoticPlayerModelSelector_configureXonoticPlayerModelSelector(entity me)
-{
-       float sortbuf, glob, i;
-       string fn;
-
-       glob = search_begin(language_filename(get_model_datafilename(string_null, -1, "txt")), TRUE, TRUE);
-       if (glob < 0)
-               return;
-
-       me.configureXonoticImage(me, string_null, -1);
-
-       sortbuf = buf_create();
-       for(i = 0; i < search_getsize(glob); ++i)
-       {
-               // select model #i!
-               fn = search_getfilename(glob, i);
-               if(!get_model_parameters(fn, -1))
-                       continue;
-               bufstr_add(sortbuf, sprintf("%-128s%s", get_model_parameters_name, fn), 1);
-       }
-       search_end(glob);
-       buf_sort(sortbuf, 128, 0);
-       me.numModels = buf_getsize(sortbuf);
-       me.bufModels = buf_create();
-       for(i = 0; i < me.numModels; ++i)
-       {
-               fn = substring(bufstr_get(sortbuf, i), 128, -1);
-               if(!get_model_parameters(fn, -1))
-                       error("But it JUST worked!");
-               bufstr_set(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_TITLE, get_model_parameters_name);
-               bufstr_set(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_IMAGE, strcat("/", substring(get_model_datafilename(get_model_parameters_modelname, get_model_parameters_modelskin, "tga"), 0, -5)));
-               bufstr_set(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_MODEL, get_model_parameters_modelname);
-               bufstr_set(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_SKIN, ftos(get_model_parameters_modelskin));
-               get_model_parameters_desc = strcat(get_model_parameters_desc, "\n");
-#if XONVOTE186
-               if(get_model_parameters_sex)
-                       get_model_parameters_desc = strcat(get_model_parameters_desc, sprintf("\n%s", get_model_parameters_sex));
-#else
-               if(get_model_parameters_description)
-                       get_model_parameters_desc = strcat(get_model_parameters_desc, sprintf("\n%s\n", get_model_parameters_description));
-               if(get_model_parameters_sex)
-                       get_model_parameters_desc = strcat(get_model_parameters_desc, sprintf("\nSex: %s", get_model_parameters_sex));
-               if(get_model_parameters_weight)
-                       get_model_parameters_desc = strcat(get_model_parameters_desc, sprintf("\nWeight: %g kg", get_model_parameters_weight));
-               if(get_model_parameters_age)
-                       get_model_parameters_desc = strcat(get_model_parameters_desc, sprintf("\nAge: %g", get_model_parameters_age));
-#endif
-               while(substring(get_model_parameters_desc, -1, 1) == "\n")
-                       get_model_parameters_desc = substring(get_model_parameters_desc, 0, -2);
-               bufstr_set(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_DESC, get_model_parameters_desc);
-       }
-       buf_del(sortbuf);
-       get_model_parameters(string_null, 0);
-       me.loadCvars(me); // this will select the initial model, depending on the current cvars
-       me.go(me, 0); // this will set the vars for the selected model
-}
-void XonoticPlayerModelSelector_destroy(entity me)
-{
-       buf_del(me.bufModels);
-       me.bufModels = -1;
-}
-
-void XonoticPlayerModelSelector_loadCvars(entity me)
-{
-       string skin, modelname;
-       float i;
-
-       skin = cvar_string("_cl_playerskin");
-       modelname = cvar_string("_cl_playermodel");
-
-       for(i = 0; i < me.numModels; ++i)
-       {
-               if(bufstr_get(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_MODEL) == modelname)
-               if(bufstr_get(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_SKIN) == skin)
-                       break;
-       }
-       if(i >= me.numModels) // fail
-               i = 0;
-       me.idxModels = i;
-}
-
-void XonoticPlayerModelSelector_go(entity me, float d)
-{
-       me.idxModels = mod(me.idxModels + d + me.numModels, me.numModels);
-
-       if(me.currentModel)
-               strunzone(me.currentModel);
-       if(me.currentModelTitle)
-               strunzone(me.currentModelTitle);
-       if(me.currentModelImage)
-               strunzone(me.currentModelImage);
-       if(me.currentModelDescription)
-               strunzone(me.currentModelDescription);
-
-       // select model #i!
-       me.currentModelTitle = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_TITLE));
-       me.currentModelImage = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_IMAGE));
-       me.currentSkin = stof(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_SKIN));
-       me.currentModel = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_MODEL));
-       me.currentModelDescription = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_DESC));
-
-       // fix the image
-       if(draw_PictureSize(me.currentModelImage) == '0 0 0')
-               me.src = "nopreview_player";
-       else
-               me.src = me.currentModelImage;
-       me.updateAspect(me);
-}
-
-void PlayerModelSelector_Next_Click(entity btn, entity me)
-{
-       if (me.numModels <= 0)
-               return;
-       me.go(me, +1);
-       me.saveCvars(me);
-}
-
-void PlayerModelSelector_Prev_Click(entity btn, entity me)
-{
-       if (me.numModels <= 0)
-               return;
-       me.go(me, -1);
-       me.saveCvars(me);
-}
-
-void XonoticPlayerModelSelector_saveCvars(entity me)
-{
-       // we can't immediately apply here because of flood control
-       cvar_set("_cl_playermodel", me.currentModel);
-       cvar_set("_cl_playerskin", ftos(me.currentSkin));
-}
-
-void XonoticPlayerModelSelector_draw(entity me)
-{
-       float i, n;
-       vector o;
-
-       if (me.numModels <= 0)
-       {
-               draw_CenterText('0.5 0.5 0', _("<no model found>"), me.realFontSize, SKINCOLOR_TEXT, 0.6, FALSE);
-               return;
-       }
-
-       SUPER(XonoticPlayerModelSelector).draw(me);
-       // draw text on the image, handle \n in the description
-
-       draw_beginBoldFont();
-
-#if XONVOTE186 // (nyov) lower name display looks better when there is no description text
-       draw_CenterText('0.5 0.8 0', me.currentModelTitle, me.realFontSize * (me.titleFontSize / me.fontSize), SKINCOLOR_MODELTITLE, SKINALPHA_MODELTITLE, FALSE);
-#else
-       draw_CenterText('0.5 0 0', me.currentModelTitle, me.realFontSize * (me.titleFontSize / me.fontSize), SKINCOLOR_MODELTITLE, SKINALPHA_MODELTITLE, FALSE);
-#endif
-
-       draw_endBoldFont();
-
-       o = '0.5 1 0' - eY * me.realFontSize_y * ((n = tokenizebyseparator(me.currentModelDescription, "\n")) + 0.5);
-       for(i = 0; i < n; ++i)
-       {
-               draw_CenterText(o, argv(i), me.realFontSize, SKINCOLOR_TEXT, 1, FALSE);
-               o += eY * me.realFontSize_y;
-       }
-}
-
-void XonoticPlayerModelSelector_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(XonoticPlayerModelSelector).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-       me.realFontSize_y = me.fontSize / absSize_y;
-       me.realFontSize_x = me.fontSize / absSize_x;
-}
-
-void XonoticPlayerModelSelector_showNotify(entity me)
-{
-       me.configureXonoticPlayerModelSelector(me);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/playermodel.qc b/qcsrc/menu/xonotic/playermodel.qc
new file mode 100644 (file)
index 0000000..f498f8d
--- /dev/null
@@ -0,0 +1,223 @@
+#ifdef INTERFACE
+CLASS(XonoticPlayerModelSelector) EXTENDS(XonoticImage)
+       METHOD(XonoticPlayerModelSelector, configureXonoticPlayerModelSelector, void(entity))
+       METHOD(XonoticPlayerModelSelector, loadCvars, void(entity))
+       METHOD(XonoticPlayerModelSelector, saveCvars, void(entity))
+       METHOD(XonoticPlayerModelSelector, draw, void(entity))
+       METHOD(XonoticPlayerModelSelector, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticPlayerModelSelector, showNotify, void(entity))
+       ATTRIB(XonoticPlayerModelSelector, currentModel, string, string_null)
+       ATTRIB(XonoticPlayerModelSelector, currentSkin, float, 0)
+       ATTRIB(XonoticPlayerModelSelector, currentModelImage, string, string_null)
+       ATTRIB(XonoticPlayerModelSelector, currentModelTitle, string, string_null)
+       ATTRIB(XonoticPlayerModelSelector, currentModelDescription, string, string_null)
+       METHOD(XonoticPlayerModelSelector, go, void(entity, float))
+       METHOD(XonoticPlayerModelSelector, destroy, void(entity))
+       ATTRIB(XonoticPlayerModelSelector, origin, vector, '0 0 0')
+       ATTRIB(XonoticPlayerModelSelector, size, vector, '0 0 0')
+       ATTRIB(XonoticPlayerModelSelector, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticPlayerModelSelector, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticPlayerModelSelector, titleFontSize, float, SKINFONTSIZE_TITLE)
+       ATTRIB(XonoticPlayerModelSelector, bufModels, float, -1)
+       ATTRIB(XonoticPlayerModelSelector, numModels, float, -1)
+       ATTRIB(XonoticPlayerModelSelector, idxModels, float, -1)
+ENDCLASS(XonoticPlayerModelSelector)
+entity makeXonoticPlayerModelSelector();
+void PlayerModelSelector_Next_Click(entity btn, entity me);
+void PlayerModelSelector_Prev_Click(entity btn, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticPlayerModelSelector()
+{
+       entity me;
+       me = spawnXonoticPlayerModelSelector();
+       me.configureXonoticPlayerModelSelector(me);
+       return me;
+}
+
+const float BUFMODELS_TITLE = 0;
+const float BUFMODELS_IMAGE = 1;
+const float BUFMODELS_MODEL = 2;
+const float BUFMODELS_SKIN = 3;
+const float BUFMODELS_DESC = 4;
+const float BUFMODELS_COUNT = 5;
+
+#define XONVOTE186 1 // (nyov) removal of model text description
+
+void XonoticPlayerModelSelector_configureXonoticPlayerModelSelector(entity me)
+{
+       float sortbuf, glob, i;
+       string fn;
+
+       glob = search_begin(language_filename(get_model_datafilename(string_null, -1, "txt")), true, true);
+       if (glob < 0)
+               return;
+
+       me.configureXonoticImage(me, string_null, -1);
+
+       sortbuf = buf_create();
+       for(i = 0; i < search_getsize(glob); ++i)
+       {
+               // select model #i!
+               fn = search_getfilename(glob, i);
+               if(!get_model_parameters(fn, -1))
+                       continue;
+               bufstr_add(sortbuf, sprintf("%-128s%s", get_model_parameters_name, fn), 1);
+       }
+       search_end(glob);
+       buf_sort(sortbuf, 128, 0);
+       me.numModels = buf_getsize(sortbuf);
+       me.bufModels = buf_create();
+       for(i = 0; i < me.numModels; ++i)
+       {
+               fn = substring(bufstr_get(sortbuf, i), 128, -1);
+               if(!get_model_parameters(fn, -1))
+                       error("But it JUST worked!");
+               bufstr_set(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_TITLE, get_model_parameters_name);
+               bufstr_set(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_IMAGE, strcat("/", substring(get_model_datafilename(get_model_parameters_modelname, get_model_parameters_modelskin, "tga"), 0, -5)));
+               bufstr_set(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_MODEL, get_model_parameters_modelname);
+               bufstr_set(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_SKIN, ftos(get_model_parameters_modelskin));
+               get_model_parameters_desc = strcat(get_model_parameters_desc, "\n");
+#if XONVOTE186
+               if(get_model_parameters_sex)
+                       get_model_parameters_desc = strcat(get_model_parameters_desc, sprintf("\n%s", get_model_parameters_sex));
+#else
+               if(get_model_parameters_description)
+                       get_model_parameters_desc = strcat(get_model_parameters_desc, sprintf("\n%s\n", get_model_parameters_description));
+               if(get_model_parameters_sex)
+                       get_model_parameters_desc = strcat(get_model_parameters_desc, sprintf("\nSex: %s", get_model_parameters_sex));
+               if(get_model_parameters_weight)
+                       get_model_parameters_desc = strcat(get_model_parameters_desc, sprintf("\nWeight: %g kg", get_model_parameters_weight));
+               if(get_model_parameters_age)
+                       get_model_parameters_desc = strcat(get_model_parameters_desc, sprintf("\nAge: %g", get_model_parameters_age));
+#endif
+               while(substring(get_model_parameters_desc, -1, 1) == "\n")
+                       get_model_parameters_desc = substring(get_model_parameters_desc, 0, -2);
+               bufstr_set(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_DESC, get_model_parameters_desc);
+       }
+       buf_del(sortbuf);
+       get_model_parameters(string_null, 0);
+       me.loadCvars(me); // this will select the initial model, depending on the current cvars
+       me.go(me, 0); // this will set the vars for the selected model
+}
+void XonoticPlayerModelSelector_destroy(entity me)
+{
+       buf_del(me.bufModels);
+       me.bufModels = -1;
+}
+
+void XonoticPlayerModelSelector_loadCvars(entity me)
+{
+       string skin, modelname;
+       float i;
+
+       skin = cvar_string("_cl_playerskin");
+       modelname = cvar_string("_cl_playermodel");
+
+       for(i = 0; i < me.numModels; ++i)
+       {
+               if(bufstr_get(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_MODEL) == modelname)
+               if(bufstr_get(me.bufModels, BUFMODELS_COUNT*i+BUFMODELS_SKIN) == skin)
+                       break;
+       }
+       if(i >= me.numModels) // fail
+               i = 0;
+       me.idxModels = i;
+}
+
+void XonoticPlayerModelSelector_go(entity me, float d)
+{
+       me.idxModels = mod(me.idxModels + d + me.numModels, me.numModels);
+
+       if(me.currentModel)
+               strunzone(me.currentModel);
+       if(me.currentModelTitle)
+               strunzone(me.currentModelTitle);
+       if(me.currentModelImage)
+               strunzone(me.currentModelImage);
+       if(me.currentModelDescription)
+               strunzone(me.currentModelDescription);
+
+       // select model #i!
+       me.currentModelTitle = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_TITLE));
+       me.currentModelImage = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_IMAGE));
+       me.currentSkin = stof(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_SKIN));
+       me.currentModel = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_MODEL));
+       me.currentModelDescription = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_DESC));
+
+       // fix the image
+       if(draw_PictureSize(me.currentModelImage) == '0 0 0')
+               me.src = "nopreview_player";
+       else
+               me.src = me.currentModelImage;
+       me.updateAspect(me);
+}
+
+void PlayerModelSelector_Next_Click(entity btn, entity me)
+{
+       if (me.numModels <= 0)
+               return;
+       me.go(me, +1);
+       me.saveCvars(me);
+}
+
+void PlayerModelSelector_Prev_Click(entity btn, entity me)
+{
+       if (me.numModels <= 0)
+               return;
+       me.go(me, -1);
+       me.saveCvars(me);
+}
+
+void XonoticPlayerModelSelector_saveCvars(entity me)
+{
+       // we can't immediately apply here because of flood control
+       cvar_set("_cl_playermodel", me.currentModel);
+       cvar_set("_cl_playerskin", ftos(me.currentSkin));
+}
+
+void XonoticPlayerModelSelector_draw(entity me)
+{
+       float i, n;
+       vector o;
+
+       if (me.numModels <= 0)
+       {
+               draw_CenterText('0.5 0.5 0', _("<no model found>"), me.realFontSize, SKINCOLOR_TEXT, 0.6, false);
+               return;
+       }
+
+       SUPER(XonoticPlayerModelSelector).draw(me);
+       // draw text on the image, handle \n in the description
+
+       draw_beginBoldFont();
+
+#if XONVOTE186 // (nyov) lower name display looks better when there is no description text
+       draw_CenterText('0.5 0.8 0', me.currentModelTitle, me.realFontSize * (me.titleFontSize / me.fontSize), SKINCOLOR_MODELTITLE, SKINALPHA_MODELTITLE, false);
+#else
+       draw_CenterText('0.5 0 0', me.currentModelTitle, me.realFontSize * (me.titleFontSize / me.fontSize), SKINCOLOR_MODELTITLE, SKINALPHA_MODELTITLE, false);
+#endif
+
+       draw_endBoldFont();
+
+       o = '0.5 1 0' - eY * me.realFontSize.y * ((n = tokenizebyseparator(me.currentModelDescription, "\n")) + 0.5);
+       for(i = 0; i < n; ++i)
+       {
+               draw_CenterText(o, argv(i), me.realFontSize, SKINCOLOR_TEXT, 1, false);
+               o += eY * me.realFontSize.y;
+       }
+}
+
+void XonoticPlayerModelSelector_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(XonoticPlayerModelSelector).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+       me.realFontSize_y = me.fontSize / absSize.y;
+       me.realFontSize_x = me.fontSize / absSize.x;
+}
+
+void XonoticPlayerModelSelector_showNotify(entity me)
+{
+       me.configureXonoticPlayerModelSelector(me);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/playlist.c b/qcsrc/menu/xonotic/playlist.c
deleted file mode 100644 (file)
index 80fe313..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticPlayList) EXTENDS(XonoticListBox)
-       METHOD(XonoticPlayList, configureXonoticPlayList, void(entity))
-       ATTRIB(XonoticPlayList, rowsPerItem, float, 1)
-       METHOD(XonoticPlayList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticPlayList, draw, void(entity))
-       METHOD(XonoticPlayList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticPlayList, stopSound, void(entity))
-       METHOD(XonoticPlayList, startSound, void(entity, float))
-       METHOD(XonoticPlayList, resumeSound, void(entity))
-       METHOD(XonoticPlayList, pauseSound, void(entity))
-       METHOD(XonoticPlayList, clickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticPlayList, keyDown, float(entity, float, float, float))
-       METHOD(XonoticPlayList, mouseDrag, float(entity, vector))
-
-       METHOD(XonoticPlayList, addToPlayList, void(entity, string))
-       METHOD(XonoticPlayList, removeSelectedFromPlayList, void(entity))
-       ATTRIB(XonoticPlayList, playingTrack, float, -1)
-
-       ATTRIB(XonoticPlayList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticPlayList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticPlayList, columnNameSize, float, 0)
-       ATTRIB(XonoticPlayList, columnNumberOrigin, float, 0)
-       ATTRIB(XonoticPlayList, columnNumberSize, float, 0)
-       ATTRIB(XonoticPlayList, realUpperMargin, float, 0)
-       ATTRIB(XonoticPlayList, origin, vector, '0 0 0')
-       ATTRIB(XonoticPlayList, itemAbsSize, vector, '0 0 0')
-
-       ATTRIB(XonoticPlayList, lastClickedSound, float, -1)
-       ATTRIB(XonoticPlayList, lastClickedTime, float, 0)
-ENDCLASS(XonoticPlayList)
-
-entity makeXonoticPlayList();
-void PlayList_Remove(entity btn, entity me);
-void PlayList_Remove_All(entity btn, entity me);
-void StopSound_Click(entity btn, entity me);
-void StartSound_Click(entity btn, entity me);
-void PauseSound_Click(entity btn, entity me);
-void PrevSound_Click(entity btn, entity me);
-void NextSound_Click(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-
-entity makeXonoticPlayList()
-{
-       entity me;
-       me = spawnXonoticPlayList();
-       me.configureXonoticPlayList(me);
-       return me;
-}
-
-void XonoticPlayList_configureXonoticPlayList(entity me)
-{
-       me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
-       me.configureXonoticListBox(me);
-}
-
-void XonoticPlayList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.itemAbsSize = '0 0 0';
-       SUPER(XonoticPlayList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight));
-       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth)));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-
-       me.columnNumberOrigin = 0;
-       me.columnNumberSize = 3 * me.realFontSize_x;
-
-       me.columnNameOrigin = me.columnNumberSize + me.realFontSize_x;
-       me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize_x;
-}
-
-void XonoticPlayList_addToPlayList(entity me, string track)
-{
-       me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
-       if(me.nItems == 0)
-       {
-               cvar_set("music_playlist_list0", track);
-               return;
-       }
-       float i;
-       for(i = 0; i < me.nItems; ++i)
-       {
-               if(argv(i) == track)
-                       return; // track is already in playlist
-       }
-       cvar_set("music_playlist_list0", strcat(cvar_string("music_playlist_list0"), " ", track));
-}
-
-void XonoticPlayList_removeSelectedFromPlayList(entity me)
-{
-       float i, cpt = FALSE;
-       string s = "";
-       me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
-       if(me.nItems == 0)
-               return;
-       for(i = 0; i < me.nItems; ++i)
-       {
-               if(i == me.selectedItem)
-               {
-                       if(i == me.nItems - 1)
-                               me.setSelected(me, me.selectedItem - 1);
-                       if(cvar("music_playlist_index") == 0 || cvar("music_playlist_index") == 999)
-                       {
-                               if(cvar("music_playlist_current0") == i)
-                                       cpt = TRUE; // current playing track (we can't start next track here because startSound calls tokenize_console)
-                               else if(cvar("music_playlist_current0") > i)
-                                       cvar_set("music_playlist_current0", ftos(cvar("music_playlist_current0") - 1));
-                       }
-                       continue;
-               }
-               s = strcat(s, " ", argv(i));
-       }
-       // we must stop the current playing track if it has been removed
-       // otherwise pause/play button will resume from another track
-       if(s == "")
-       {
-               cvar_set("music_playlist_list0", "");
-               if(cpt)
-                       me.stopSound(me);
-       }
-       else
-       {
-               cvar_set("music_playlist_list0", substring(s, 1, strlen(s))); // remove initial space
-               if(cpt)
-                       me.startSound(me, 0);
-       }
-}
-
-void PlayList_Remove(entity btn, entity me)
-{
-       me.removeSelectedFromPlayList(me);
-}
-
-void PlayList_Remove_All(entity btn, entity me)
-{
-       cvar_set("music_playlist_list0", "");
-       me.stopSound(me);
-       me.selectedItem = 0;
-}
-
-float XonoticPlayList_mouseDrag(entity me, vector pos)
-{
-       float f, i;
-       i = me.selectedItem;
-       f = SUPER(XonoticPlayList).mouseDrag(me, pos);
-
-       if(me.pressed != 1) // don't change priority if the person is just scrolling
-       {
-               if(me.selectedItem != i)
-               {
-                       cvar_set("music_playlist_list0", swapInPriorityList(cvar_string("music_playlist_list0"), me.selectedItem, i));
-                       float c = cvar("music_playlist_current0");
-                       if(c == i)
-                               cvar_set("music_playlist_current0", ftos(me.selectedItem));
-                       else if(c == me.selectedItem)
-                               cvar_set("music_playlist_current0", ftos(i));
-               }
-       }
-
-       return f;
-}
-
-void XonoticPlayList_draw(entity me)
-{
-       me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
-       if(cvar("music_playlist_index") == 0 || cvar("music_playlist_index") == 999)
-               me.playingTrack = cvar("music_playlist_current0");
-       else
-               me.playingTrack = -1;
-       SUPER(XonoticPlayList).draw(me);
-}
-
-void XonoticPlayList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       string s;
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
-       if(i == me.playingTrack)
-       {
-               float f = cvar("music_playlist_sampleposition0");
-               if(f <= 0 || (((time * 2) & 1) && f > 0))
-                       draw_Text(me.realUpperMargin * eY + (me.columnNumberOrigin + me.columnNumberSize) * eX, chr(0xE000 + 141), me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
-       }
-
-       s = ftos(i+1);
-       draw_CenterText(me.realUpperMargin * eY + (me.columnNumberOrigin + 0.5 * me.columnNumberSize) * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
-
-       s = draw_TextShortenToWidth(argv(i), me.columnNameSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
-}
-
-void XonoticPlayList_stopSound(entity me)
-{
-       // STOP: list 0 is disabled by setting the index to -1
-       // we set sampleposition0 to 0 to forget the position that the engine saves in this frame (for this reason we need to wait a frame)
-       if(cvar("music_playlist_index") == 0 || cvar("music_playlist_index") == 999)
-       {
-               cvar_set("music_playlist_index", "-1");
-               localcmd("\nwait; music_playlist_sampleposition0 0\n");
-               localcmd("\ndefer 3 \"cd play $menu_cdtrack\"\n");
-       }
-}
-
-void StopSound_Click(entity btn, entity me)
-{
-       me.stopSound(me);
-}
-
-void XonoticPlayList_startSound(entity me, float offset)
-{
-       float f;
-       me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
-       if(offset)
-       {
-               if(cvar("music_playlist_index") == -1)
-                       return;
-               f = bound(0, cvar("music_playlist_current0") + offset, me.nItems - 1);
-               if(f == cvar("music_playlist_current0"))
-                       return;
-       }
-       else
-       {
-               f = me.selectedItem;
-               // if it was paused then resume
-               if(f == cvar("music_playlist_current0"))
-               if(cvar("music_playlist_index") == 999)
-               {
-                       me.resumeSound(me);
-                       return;
-               }
-               // if it was not paused then proceed with restart
-       }
-
-       // START: list 0 is disabled by setting the index to 999
-       // we set current0 to the selected track and sampleposition0 to 0 to forget the position that the engine saves in this frame (for this reason we need to wait a frame)
-       // then we switch back to list 0
-       cvar_set("music_playlist_index", "999");
-       cvar_set("music_playlist_current0", ftos(f));
-       localcmd("\nwait; music_playlist_sampleposition0 0; wait; music_playlist_index 0\n");
-}
-
-void StartSound_Click(entity btn, entity me)
-{
-       me.startSound(me, 0);
-}
-
-void PrevSound_Click(entity btn, entity me)
-{
-       me.startSound(me, -1);
-}
-
-void NextSound_Click(entity btn, entity me)
-{
-       me.startSound(me, +1);
-}
-
-void XonoticPlayList_resumeSound(entity me)
-{
-       // RESUME: list 0 is enabled by setting the index to 0
-       // (we reset sampleposition0 to 0 to mark the track as in playing back state)
-       if(cvar("music_playlist_index") == 999)
-               localcmd("\nmusic_playlist_index 0; wait; music_playlist_sampleposition0 0\n");
-}
-void XonoticPlayList_pauseSound(entity me)
-{
-       // PAUSE: list 0 is disabled by setting the index to 999
-       // (we know the track is paused because the engine sets sampleposition0 to remember current position)
-       if(cvar("music_playlist_index") == 0)
-               localcmd("\nmusic_playlist_index 999\n");
-       else me.resumeSound(me);
-}
-
-void PauseSound_Click(entity btn, entity me)
-{
-       me.pauseSound(me);
-}
-
-void XonoticPlayList_clickListBoxItem(entity me, float i, vector where)
-{
-       if(i == me.lastClickedSound)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       me.setSelected(me, i);
-                       me.startSound(me, 0);
-               }
-       me.lastClickedSound = i;
-       me.lastClickedTime = time;
-}
-
-float XonoticPlayList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       if(scan == K_ENTER || scan == K_KP_ENTER) {
-               me.startSound(me, 0);
-               return 1;
-       }
-       else if(scan == K_SPACE) {
-               me.pauseSound(me);
-               return 1;
-       }
-       else if(scan == K_DEL || scan == K_KP_DEL || scan == K_BACKSPACE || scan == K_MOUSE3) {
-               me.removeSelectedFromPlayList(me);
-               return 1;
-       }
-       else
-               return SUPER(XonoticPlayList).keyDown(me, scan, ascii, shift);
-}
-#endif
-
diff --git a/qcsrc/menu/xonotic/playlist.qc b/qcsrc/menu/xonotic/playlist.qc
new file mode 100644 (file)
index 0000000..fbe3c92
--- /dev/null
@@ -0,0 +1,302 @@
+#ifdef INTERFACE
+CLASS(XonoticPlayList) EXTENDS(XonoticListBox)
+       METHOD(XonoticPlayList, configureXonoticPlayList, void(entity))
+       ATTRIB(XonoticPlayList, rowsPerItem, float, 1)
+       METHOD(XonoticPlayList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticPlayList, draw, void(entity))
+       METHOD(XonoticPlayList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticPlayList, stopSound, void(entity))
+       METHOD(XonoticPlayList, startSound, void(entity, float))
+       METHOD(XonoticPlayList, resumeSound, void(entity))
+       METHOD(XonoticPlayList, pauseSound, void(entity))
+       METHOD(XonoticPlayList, doubleClickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticPlayList, keyDown, float(entity, float, float, float))
+       METHOD(XonoticPlayList, mouseDrag, float(entity, vector))
+
+       METHOD(XonoticPlayList, addToPlayList, void(entity, string))
+       METHOD(XonoticPlayList, removeSelectedFromPlayList, void(entity))
+       ATTRIB(XonoticPlayList, playingTrack, float, -1)
+
+       ATTRIB(XonoticPlayList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticPlayList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticPlayList, columnNameSize, float, 0)
+       ATTRIB(XonoticPlayList, columnNumberOrigin, float, 0)
+       ATTRIB(XonoticPlayList, columnNumberSize, float, 0)
+       ATTRIB(XonoticPlayList, realUpperMargin, float, 0)
+       ATTRIB(XonoticPlayList, origin, vector, '0 0 0')
+       ATTRIB(XonoticPlayList, itemAbsSize, vector, '0 0 0')
+ENDCLASS(XonoticPlayList)
+
+entity makeXonoticPlayList();
+void PlayList_Remove(entity btn, entity me);
+void PlayList_Remove_All(entity btn, entity me);
+void StopSound_Click(entity btn, entity me);
+void StartSound_Click(entity btn, entity me);
+void PauseSound_Click(entity btn, entity me);
+void PrevSound_Click(entity btn, entity me);
+void NextSound_Click(entity btn, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+
+entity makeXonoticPlayList()
+{
+       entity me;
+       me = spawnXonoticPlayList();
+       me.configureXonoticPlayList(me);
+       return me;
+}
+
+void XonoticPlayList_configureXonoticPlayList(entity me)
+{
+       me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
+       me.configureXonoticListBox(me);
+}
+
+void XonoticPlayList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.itemAbsSize = '0 0 0';
+       SUPER(XonoticPlayList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
+       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+
+       me.columnNumberOrigin = 0;
+       me.columnNumberSize = 3 * me.realFontSize.x;
+
+       me.columnNameOrigin = me.columnNumberSize + me.realFontSize.x;
+       me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize.x;
+}
+
+void XonoticPlayList_addToPlayList(entity me, string track)
+{
+       me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
+       if(me.nItems == 0)
+       {
+               cvar_set("music_playlist_list0", track);
+               return;
+       }
+       float i;
+       for(i = 0; i < me.nItems; ++i)
+       {
+               if(argv(i) == track)
+                       return; // track is already in playlist
+       }
+       cvar_set("music_playlist_list0", strcat(cvar_string("music_playlist_list0"), " ", track));
+}
+
+void XonoticPlayList_removeSelectedFromPlayList(entity me)
+{
+       float i, cpt = false;
+       string s = "";
+       me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
+       if(me.nItems == 0)
+               return;
+       for(i = 0; i < me.nItems; ++i)
+       {
+               if(i == me.selectedItem)
+               {
+                       if(i == me.nItems - 1)
+                               me.setSelected(me, me.selectedItem - 1);
+                       if(cvar("music_playlist_index") == 0 || cvar("music_playlist_index") == 999)
+                       {
+                               if(cvar("music_playlist_current0") == i)
+                                       cpt = true; // current playing track (we can't start next track here because startSound calls tokenize_console)
+                               else if(cvar("music_playlist_current0") > i)
+                                       cvar_set("music_playlist_current0", ftos(cvar("music_playlist_current0") - 1));
+                       }
+                       continue;
+               }
+               s = strcat(s, " ", argv(i));
+       }
+       // we must stop the current playing track if it has been removed
+       // otherwise pause/play button will resume from another track
+       if(s == "")
+       {
+               cvar_set("music_playlist_list0", "");
+               if(cpt)
+                       me.stopSound(me);
+       }
+       else
+       {
+               cvar_set("music_playlist_list0", substring(s, 1, strlen(s))); // remove initial space
+               if(cpt)
+                       me.startSound(me, 0);
+       }
+}
+
+void PlayList_Remove(entity btn, entity me)
+{
+       me.removeSelectedFromPlayList(me);
+}
+
+void PlayList_Remove_All(entity btn, entity me)
+{
+       cvar_set("music_playlist_list0", "");
+       me.stopSound(me);
+       me.selectedItem = 0;
+}
+
+float XonoticPlayList_mouseDrag(entity me, vector pos)
+{
+       float f, i;
+       i = me.selectedItem;
+       f = SUPER(XonoticPlayList).mouseDrag(me, pos);
+
+       if(me.pressed != 1) // don't change priority if the person is just scrolling
+       {
+               if(me.selectedItem != i)
+               {
+                       cvar_set("music_playlist_list0", swapInPriorityList(cvar_string("music_playlist_list0"), me.selectedItem, i));
+                       float c = cvar("music_playlist_current0");
+                       if(c == i)
+                               cvar_set("music_playlist_current0", ftos(me.selectedItem));
+                       else if(c == me.selectedItem)
+                               cvar_set("music_playlist_current0", ftos(i));
+               }
+       }
+
+       return f;
+}
+
+void XonoticPlayList_draw(entity me)
+{
+       me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
+       if(cvar("music_playlist_index") == 0 || cvar("music_playlist_index") == 999)
+               me.playingTrack = cvar("music_playlist_current0");
+       else
+               me.playingTrack = -1;
+       SUPER(XonoticPlayList).draw(me);
+}
+
+void XonoticPlayList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       string s;
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+
+       if(i == me.playingTrack)
+       {
+               float f = cvar("music_playlist_sampleposition0");
+               if(f <= 0 || (((time * 2) & 1) && f > 0))
+                       draw_Text(me.realUpperMargin * eY + (me.columnNumberOrigin + me.columnNumberSize) * eX, "\xE2\x96\xB6", me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+       }
+
+       s = ftos(i+1);
+       draw_CenterText(me.realUpperMargin * eY + (me.columnNumberOrigin + 0.5 * me.columnNumberSize) * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+
+       s = draw_TextShortenToWidth(argv(i), me.columnNameSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+}
+
+void XonoticPlayList_stopSound(entity me)
+{
+       // STOP: list 0 is disabled by setting the index to -1
+       // we set sampleposition0 to 0 to forget the position that the engine saves in this frame (for this reason we need to wait a frame)
+       if(cvar("music_playlist_index") == 0 || cvar("music_playlist_index") == 999)
+       {
+               cvar_set("music_playlist_index", "-1");
+               localcmd("\nwait; music_playlist_sampleposition0 0\n");
+               localcmd("\ndefer 3 \"cd play $menu_cdtrack\"\n");
+       }
+}
+
+void StopSound_Click(entity btn, entity me)
+{
+       me.stopSound(me);
+}
+
+void XonoticPlayList_startSound(entity me, float offset)
+{
+       float f;
+       me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
+       if(offset)
+       {
+               if(cvar("music_playlist_index") == -1)
+                       return;
+               f = bound(0, cvar("music_playlist_current0") + offset, me.nItems - 1);
+               if(f == cvar("music_playlist_current0"))
+                       return;
+       }
+       else
+       {
+               f = me.selectedItem;
+               // if it was paused then resume
+               if(f == cvar("music_playlist_current0"))
+               if(cvar("music_playlist_index") == 999)
+               {
+                       me.resumeSound(me);
+                       return;
+               }
+               // if it was not paused then proceed with restart
+       }
+
+       // START: list 0 is disabled by setting the index to 999
+       // we set current0 to the selected track and sampleposition0 to 0 to forget the position that the engine saves in this frame (for this reason we need to wait a frame)
+       // then we switch back to list 0
+       cvar_set("music_playlist_index", "999");
+       cvar_set("music_playlist_current0", ftos(f));
+       localcmd("\nwait; music_playlist_sampleposition0 0; wait; music_playlist_index 0\n");
+}
+
+void StartSound_Click(entity btn, entity me)
+{
+       me.startSound(me, 0);
+}
+
+void PrevSound_Click(entity btn, entity me)
+{
+       me.startSound(me, -1);
+}
+
+void NextSound_Click(entity btn, entity me)
+{
+       me.startSound(me, +1);
+}
+
+void XonoticPlayList_resumeSound(entity me)
+{
+       // RESUME: list 0 is enabled by setting the index to 0
+       // (we reset sampleposition0 to 0 to mark the track as in playing back state)
+       if(cvar("music_playlist_index") == 999)
+               localcmd("\nmusic_playlist_index 0; wait; music_playlist_sampleposition0 0\n");
+}
+void XonoticPlayList_pauseSound(entity me)
+{
+       // PAUSE: list 0 is disabled by setting the index to 999
+       // (we know the track is paused because the engine sets sampleposition0 to remember current position)
+       if(cvar("music_playlist_index") == 0)
+               localcmd("\nmusic_playlist_index 999\n");
+       else me.resumeSound(me);
+}
+
+void PauseSound_Click(entity btn, entity me)
+{
+       me.pauseSound(me);
+}
+
+void XonoticPlayList_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       me.startSound(me, 0);
+}
+
+float XonoticPlayList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       if(scan == K_ENTER || scan == K_KP_ENTER) {
+               me.startSound(me, 0);
+               return 1;
+       }
+       else if(scan == K_SPACE) {
+               me.pauseSound(me);
+               return 1;
+       }
+       else if(scan == K_DEL || scan == K_KP_DEL || scan == K_BACKSPACE || scan == K_MOUSE3) {
+               me.removeSelectedFromPlayList(me);
+               return 1;
+       }
+       else
+               return SUPER(XonoticPlayList).keyDown(me, scan, ascii, shift);
+}
+#endif
+
diff --git a/qcsrc/menu/xonotic/radiobutton.c b/qcsrc/menu/xonotic/radiobutton.c
deleted file mode 100644 (file)
index 85cc4fc..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticRadioButton) EXTENDS(RadioButton)
-       METHOD(XonoticRadioButton, configureXonoticRadioButton, void(entity, float, string, string, string))
-       METHOD(XonoticRadioButton, draw, void(entity))
-       METHOD(XonoticRadioButton, setChecked, void(entity, float))
-       ATTRIB(XonoticRadioButton, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticRadioButton, image, string, SKINGFX_RADIOBUTTON)
-       ATTRIB(XonoticRadioButton, color, vector, SKINCOLOR_RADIOBUTTON_N)
-       ATTRIB(XonoticRadioButton, colorC, vector, SKINCOLOR_RADIOBUTTON_C)
-       ATTRIB(XonoticRadioButton, colorF, vector, SKINCOLOR_RADIOBUTTON_F)
-       ATTRIB(XonoticRadioButton, colorD, vector, SKINCOLOR_RADIOBUTTON_D)
-
-       ATTRIB(XonoticRadioButton, cvarName, string, string_null)
-       ATTRIB(XonoticRadioButton, cvarValue, string, string_null)
-       ATTRIB(XonoticRadioButton, cvarOffValue, string, string_null)
-       ATTRIB(XonoticRadioButton, getCvarValueFromCvar, float, 0)
-       METHOD(XonoticRadioButton, loadCvars, void(entity))
-       METHOD(XonoticRadioButton, saveCvars, void(entity))
-
-       ATTRIB(XonoticRadioButton, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticRadioButton, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticRadioButton)
-entity makeXonoticRadioButton(float, string, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticRadioButton(float theGroup, string theCvar, string theValue, string theText)
-{
-       entity me;
-       me = spawnXonoticRadioButton();
-       me.configureXonoticRadioButton(me, theGroup, theCvar, theValue, theText);
-       return me;
-}
-void XonoticRadioButton_configureXonoticRadioButton(entity me, float theGroup, string theCvar, string theValue, string theText)
-{
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.cvarValue = theValue;
-               me.tooltip = getZonedTooltipForIdentifier(theCvar);
-               me.loadCvars(me);
-       }
-       me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
-}
-void XonoticRadioButton_setChecked(entity me, float val)
-{
-       if(val != me.checked)
-       {
-               me.checked = val;
-               me.saveCvars(me);
-       }
-}
-void XonoticRadioButton_loadCvars(entity me)
-{
-       if(me.cvarValue)
-       {
-               if(me.cvarName)
-                       me.checked = (cvar_string(me.cvarName) == me.cvarValue);
-       }
-       else
-       {
-               if(me.cvarName)
-               {
-                       me.checked = !!cvar(me.cvarName);
-               }
-               else
-               {
-                       // this is difficult
-                       // this is the "generic" selection... but at this time, not
-                       // everything is constructed yet.
-                       // we need to set this later in draw()
-                       me.checked = 0;
-               }
-       }
-}
-void XonoticRadioButton_draw(entity me)
-{
-       if (!me.cvarValue)
-               if (!me.cvarName)
-               {
-                       // this is the "other" option
-                       // always select this if none other is
-                       entity e;
-                       float found;
-                       found = 0;
-                       for(e = me.parent.firstChild; e; e = e.nextSibling)
-                               if(e.group == me.group)
-                                       if(e.checked)
-                                               found = 1;
-                       if(!found)
-                               me.setChecked(me, 1);
-               }
-       SUPER(XonoticRadioButton).draw(me);
-}
-void XonoticRadioButton_saveCvars(entity me)
-{
-       if(me.cvarValue)
-       {
-               if(me.cvarName)
-               {
-                       if(me.checked)
-                       {
-                               if(me.getCvarValueFromCvar)
-                                       cvar_set(me.cvarName, cvar_string(me.cvarValue));
-                               else
-                                       cvar_set(me.cvarName, me.cvarValue);
-                       }
-                       else if(me.cvarOffValue)
-                               cvar_set(me.cvarName, me.cvarOffValue);
-               }
-       }
-       else
-       {
-               if(me.cvarName)
-               {
-                       cvar_set(me.cvarName, ftos(me.checked));
-               }
-       }
-}
-#endif
diff --git a/qcsrc/menu/xonotic/radiobutton.qc b/qcsrc/menu/xonotic/radiobutton.qc
new file mode 100644 (file)
index 0000000..85cc4fc
--- /dev/null
@@ -0,0 +1,120 @@
+#ifdef INTERFACE
+CLASS(XonoticRadioButton) EXTENDS(RadioButton)
+       METHOD(XonoticRadioButton, configureXonoticRadioButton, void(entity, float, string, string, string))
+       METHOD(XonoticRadioButton, draw, void(entity))
+       METHOD(XonoticRadioButton, setChecked, void(entity, float))
+       ATTRIB(XonoticRadioButton, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticRadioButton, image, string, SKINGFX_RADIOBUTTON)
+       ATTRIB(XonoticRadioButton, color, vector, SKINCOLOR_RADIOBUTTON_N)
+       ATTRIB(XonoticRadioButton, colorC, vector, SKINCOLOR_RADIOBUTTON_C)
+       ATTRIB(XonoticRadioButton, colorF, vector, SKINCOLOR_RADIOBUTTON_F)
+       ATTRIB(XonoticRadioButton, colorD, vector, SKINCOLOR_RADIOBUTTON_D)
+
+       ATTRIB(XonoticRadioButton, cvarName, string, string_null)
+       ATTRIB(XonoticRadioButton, cvarValue, string, string_null)
+       ATTRIB(XonoticRadioButton, cvarOffValue, string, string_null)
+       ATTRIB(XonoticRadioButton, getCvarValueFromCvar, float, 0)
+       METHOD(XonoticRadioButton, loadCvars, void(entity))
+       METHOD(XonoticRadioButton, saveCvars, void(entity))
+
+       ATTRIB(XonoticRadioButton, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticRadioButton, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticRadioButton)
+entity makeXonoticRadioButton(float, string, string, string);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticRadioButton(float theGroup, string theCvar, string theValue, string theText)
+{
+       entity me;
+       me = spawnXonoticRadioButton();
+       me.configureXonoticRadioButton(me, theGroup, theCvar, theValue, theText);
+       return me;
+}
+void XonoticRadioButton_configureXonoticRadioButton(entity me, float theGroup, string theCvar, string theValue, string theText)
+{
+       if(theCvar)
+       {
+               me.cvarName = theCvar;
+               me.cvarValue = theValue;
+               me.tooltip = getZonedTooltipForIdentifier(theCvar);
+               me.loadCvars(me);
+       }
+       me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
+}
+void XonoticRadioButton_setChecked(entity me, float val)
+{
+       if(val != me.checked)
+       {
+               me.checked = val;
+               me.saveCvars(me);
+       }
+}
+void XonoticRadioButton_loadCvars(entity me)
+{
+       if(me.cvarValue)
+       {
+               if(me.cvarName)
+                       me.checked = (cvar_string(me.cvarName) == me.cvarValue);
+       }
+       else
+       {
+               if(me.cvarName)
+               {
+                       me.checked = !!cvar(me.cvarName);
+               }
+               else
+               {
+                       // this is difficult
+                       // this is the "generic" selection... but at this time, not
+                       // everything is constructed yet.
+                       // we need to set this later in draw()
+                       me.checked = 0;
+               }
+       }
+}
+void XonoticRadioButton_draw(entity me)
+{
+       if (!me.cvarValue)
+               if (!me.cvarName)
+               {
+                       // this is the "other" option
+                       // always select this if none other is
+                       entity e;
+                       float found;
+                       found = 0;
+                       for(e = me.parent.firstChild; e; e = e.nextSibling)
+                               if(e.group == me.group)
+                                       if(e.checked)
+                                               found = 1;
+                       if(!found)
+                               me.setChecked(me, 1);
+               }
+       SUPER(XonoticRadioButton).draw(me);
+}
+void XonoticRadioButton_saveCvars(entity me)
+{
+       if(me.cvarValue)
+       {
+               if(me.cvarName)
+               {
+                       if(me.checked)
+                       {
+                               if(me.getCvarValueFromCvar)
+                                       cvar_set(me.cvarName, cvar_string(me.cvarValue));
+                               else
+                                       cvar_set(me.cvarName, me.cvarValue);
+                       }
+                       else if(me.cvarOffValue)
+                               cvar_set(me.cvarName, me.cvarOffValue);
+               }
+       }
+       else
+       {
+               if(me.cvarName)
+               {
+                       cvar_set(me.cvarName, ftos(me.checked));
+               }
+       }
+}
+#endif
diff --git a/qcsrc/menu/xonotic/rootdialog.c b/qcsrc/menu/xonotic/rootdialog.c
deleted file mode 100644 (file)
index e8c9db3..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticRootDialog) EXTENDS(XonoticDialog)
-       // still to be customized by user
-       /*
-       ATTRIB(XonoticDialog, closable, float, 1)
-       ATTRIB(XonoticDialog, title, string, _("Form1")) // ;)
-       ATTRIB(XonoticDialog, color, vector, '1 0.5 1')
-       ATTRIB(XonoticDialog, intendedWidth, float, 0)
-       ATTRIB(XonoticDialog, rows, float, 3)
-       ATTRIB(XonoticDialog, columns, float, 2)
-       */
-       METHOD(XonoticRootDialog, close, void(entity))
-ENDCLASS(XonoticRootDialog)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticRootDialog_close(entity me)
-{
-       m_goto(string_null);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/rootdialog.qc b/qcsrc/menu/xonotic/rootdialog.qc
new file mode 100644 (file)
index 0000000..e8c9db3
--- /dev/null
@@ -0,0 +1,21 @@
+#ifdef INTERFACE
+CLASS(XonoticRootDialog) EXTENDS(XonoticDialog)
+       // still to be customized by user
+       /*
+       ATTRIB(XonoticDialog, closable, float, 1)
+       ATTRIB(XonoticDialog, title, string, _("Form1")) // ;)
+       ATTRIB(XonoticDialog, color, vector, '1 0.5 1')
+       ATTRIB(XonoticDialog, intendedWidth, float, 0)
+       ATTRIB(XonoticDialog, rows, float, 3)
+       ATTRIB(XonoticDialog, columns, float, 2)
+       */
+       METHOD(XonoticRootDialog, close, void(entity))
+ENDCLASS(XonoticRootDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticRootDialog_close(entity me)
+{
+       m_goto(string_null);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/screenshotimage.c b/qcsrc/menu/xonotic/screenshotimage.c
deleted file mode 100644 (file)
index 469f177..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticScreenshotImage) EXTENDS(XonoticImage)
-       METHOD(XonoticScreenshotImage, configureXonoticScreenshotImage, void(entity))
-       METHOD(XonoticScreenshotImage, load, void(entity, string))
-       METHOD(XonoticScreenshotImage, draw, void(entity))
-       ATTRIB(XonoticScreenshotImage, focusable, float, 1) // mousePress and mouseDrag work only if focusable is set
-       METHOD(XonoticScreenshotImage, mousePress, float(entity, vector))
-       METHOD(XonoticScreenshotImage, mouseDrag, float(entity, vector))
-       METHOD(XonoticScreenshotImage, mouseMove, float(entity, vector))
-       METHOD(XonoticScreenshotImage, resizeNotify, void(entity, vector, vector, vector, vector))
-       ATTRIB(XonoticScreenshotImage, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticScreenshotImage, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticScreenshotImage, showTitle, float, 1)
-       ATTRIB(XonoticScreenshotImage, screenshotTime, float, 0)
-       ATTRIB(XonoticScreenshotImage, screenshotTitle, string, string_null)
-ENDCLASS(XonoticScreenshotImage)
-entity makeXonoticScreenshotImage();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticScreenshotImage()
-{
-       entity me;
-       me = spawnXonoticScreenshotImage();
-       me.configureXonoticScreenshotImage(me);
-       return me;
-}
-
-void XonoticScreenshotImage_configureXonoticScreenshotImage(entity me)
-{
-       me.configureXonoticImage(me, string_null, -2);
-       me.zoomLimitedByTheBox = FALSE; // enable this to forbid enlarging the image more than the containing box (if making use of draw_SetClip is a too bad thing)
-       me.zoomSnapToTheBox = FALSE; // disabled: it's cooler
-}
-
-void XonoticScreenshotImage_load(entity me, string theImage)
-{
-       me.screenshotTime = time;
-       me.src = theImage;
-       if (me.screenshotTitle)
-               strunzone(me.screenshotTitle);
-       me.screenshotTitle = strzone(substring(me.src, 13, strlen(theImage) - 13)); //strip "/screenshots/"
-
-       me.initZoom(me); // this image may have a different size
-       me.setZoom(me, 0, 0);
-}
-
-float XonoticScreenshotImage_mousePress(entity me, vector coords)
-{
-       return me.drag_setStartPos(me, coords);
-}
-
-float XonoticScreenshotImage_mouseDrag(entity me, vector coords)
-{
-       return me.drag(me, coords);
-}
-
-float XonoticScreenshotImage_mouseMove(entity me, vector coords)
-{
-       return me.drag_setStartPos(me, coords);
-}
-
-void XonoticScreenshotImage_draw(entity me)
-{
-       if (me.src != "")
-       {
-               float theAlpha;
-               SUPER(XonoticScreenshotImage).draw(me);
-               if (me.showTitle && time < me.screenshotTime + 4) // 3 seconds at full alpha, 1 second fading out
-               {
-                       theAlpha = (4 - (time - me.screenshotTime));
-                       draw_CenterText('0.5 0 0', me.screenshotTitle, me.realFontSize, '1 1 1', theAlpha, FALSE);
-               }
-               if (time < me.zoomTime + 2) // 1 seconds at full alpha, 1 second fading out
-               {
-                       string zoomString;
-                       float z;
-                       z = me.zoomFactor * 100;
-                       if (z - floor(z) == 0)
-                               zoomString = sprintf("%d%%", z);
-                       else
-                               zoomString = sprintf("%.2f%%", z);
-                       theAlpha = (2 - (time - me.zoomTime));
-                       draw_Text('0.05 0.95 0', zoomString, me.realFontSize, '1 1 1', theAlpha, FALSE);
-               }
-       }
-}
-
-void XonoticScreenshotImage_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(XonoticScreenshotImage).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-       me.realFontSize_y = me.fontSize / absSize_y;
-       me.realFontSize_x = me.fontSize / absSize_x;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/screenshotimage.qc b/qcsrc/menu/xonotic/screenshotimage.qc
new file mode 100644 (file)
index 0000000..a800a84
--- /dev/null
@@ -0,0 +1,95 @@
+#ifdef INTERFACE
+CLASS(XonoticScreenshotImage) EXTENDS(XonoticImage)
+       METHOD(XonoticScreenshotImage, configureXonoticScreenshotImage, void(entity))
+       METHOD(XonoticScreenshotImage, load, void(entity, string))
+       METHOD(XonoticScreenshotImage, draw, void(entity))
+       ATTRIB(XonoticScreenshotImage, focusable, float, 1) // mousePress and mouseDrag work only if focusable is set
+       METHOD(XonoticScreenshotImage, mousePress, float(entity, vector))
+       METHOD(XonoticScreenshotImage, mouseDrag, float(entity, vector))
+       METHOD(XonoticScreenshotImage, mouseMove, float(entity, vector))
+       METHOD(XonoticScreenshotImage, resizeNotify, void(entity, vector, vector, vector, vector))
+       ATTRIB(XonoticScreenshotImage, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticScreenshotImage, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticScreenshotImage, showTitle, float, 1)
+       ATTRIB(XonoticScreenshotImage, screenshotTime, float, 0)
+       ATTRIB(XonoticScreenshotImage, screenshotTitle, string, string_null)
+ENDCLASS(XonoticScreenshotImage)
+entity makeXonoticScreenshotImage();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticScreenshotImage()
+{
+       entity me;
+       me = spawnXonoticScreenshotImage();
+       me.configureXonoticScreenshotImage(me);
+       return me;
+}
+
+void XonoticScreenshotImage_configureXonoticScreenshotImage(entity me)
+{
+       me.configureXonoticImage(me, string_null, -2);
+       me.zoomLimitedByTheBox = false; // enable this to forbid enlarging the image more than the containing box (if making use of draw_SetClip is a too bad thing)
+       me.zoomSnapToTheBox = false; // disabled: it's cooler
+}
+
+void XonoticScreenshotImage_load(entity me, string theImage)
+{
+       me.screenshotTime = time;
+       me.src = theImage;
+       if (me.screenshotTitle)
+               strunzone(me.screenshotTitle);
+       me.screenshotTitle = strzone(substring(me.src, 13, strlen(theImage) - 13)); //strip "/screenshots/"
+
+       me.initZoom(me); // this image may have a different size
+       me.setZoom(me, 0, 0);
+}
+
+float XonoticScreenshotImage_mousePress(entity me, vector coords)
+{
+       return me.drag_setStartPos(me, coords);
+}
+
+float XonoticScreenshotImage_mouseDrag(entity me, vector coords)
+{
+       return me.drag(me, coords);
+}
+
+float XonoticScreenshotImage_mouseMove(entity me, vector coords)
+{
+       return me.drag_setStartPos(me, coords);
+}
+
+void XonoticScreenshotImage_draw(entity me)
+{
+       if (me.src != "")
+       {
+               float theAlpha;
+               SUPER(XonoticScreenshotImage).draw(me);
+               if (me.showTitle && time < me.screenshotTime + 4) // 3 seconds at full alpha, 1 second fading out
+               {
+                       theAlpha = (4 - (time - me.screenshotTime));
+                       draw_CenterText('0.5 0 0', me.screenshotTitle, me.realFontSize, '1 1 1', theAlpha, false);
+               }
+               if (time < me.zoomTime + 2) // 1 seconds at full alpha, 1 second fading out
+               {
+                       string zoomString;
+                       float z;
+                       z = me.zoomFactor * 100;
+                       if (z - floor(z) == 0)
+                               zoomString = sprintf("%d%%", z);
+                       else
+                               zoomString = sprintf("%.2f%%", z);
+                       theAlpha = (2 - (time - me.zoomTime));
+                       draw_Text('0.05 0.95 0', zoomString, me.realFontSize, '1 1 1', theAlpha, false);
+               }
+       }
+}
+
+void XonoticScreenshotImage_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(XonoticScreenshotImage).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+       me.realFontSize_y = me.fontSize / absSize.y;
+       me.realFontSize_x = me.fontSize / absSize.x;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/screenshotlist.c b/qcsrc/menu/xonotic/screenshotlist.c
deleted file mode 100644 (file)
index dd8b61e..0000000
+++ /dev/null
@@ -1,307 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticScreenshotList) EXTENDS(XonoticListBox)
-       METHOD(XonoticScreenshotList, configureXonoticScreenshotList, void(entity))
-       ATTRIB(XonoticScreenshotList, rowsPerItem, float, 1)
-       METHOD(XonoticScreenshotList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticScreenshotList, setSelected, void(entity, float))
-       METHOD(XonoticScreenshotList, draw, void(entity))
-       METHOD(XonoticScreenshotList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticScreenshotList, getScreenshots, void(entity))
-       METHOD(XonoticScreenshotList, previewScreenshot, void(entity))
-       METHOD(XonoticScreenshotList, startScreenshot, void(entity))
-       METHOD(XonoticScreenshotList, screenshotName, string(entity, float))
-       METHOD(XonoticScreenshotList, clickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticScreenshotList, keyDown, float(entity, float, float, float))
-       METHOD(XonoticScreenshotList, destroy, void(entity))
-       METHOD(XonoticScreenshotList, showNotify, void(entity))
-       ATTRIB(XonoticScreenshotList, listScreenshot, float, -1)
-       ATTRIB(XonoticScreenshotList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticScreenshotList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticScreenshotList, columnNameSize, float, 0)
-       ATTRIB(XonoticScreenshotList, realUpperMargin, float, 0)
-       ATTRIB(XonoticScreenshotList, origin, vector, '0 0 0')
-       ATTRIB(XonoticScreenshotList, itemAbsSize, vector, '0 0 0')
-       ATTRIB(XonoticScreenshotList, lastClickedScreenshot, float, -1)
-       ATTRIB(XonoticScreenshotList, lastClickedTime, float, 0)
-       ATTRIB(XonoticScreenshotList, filterString, string, string_null)
-       ATTRIB(XonoticScreenshotList, filterBox, entity, NULL)
-       ATTRIB(XonoticScreenshotList, filterTime, float, 0)
-
-       ATTRIB(XonoticScreenshotList, newScreenshotTime, float, 0)
-       ATTRIB(XonoticScreenshotList, newSlideShowScreenshotTime, float, 0)
-       ATTRIB(XonoticScreenshotList, prevSelectedItem, float, 0)
-
-       ATTRIB(XonoticScreenshotList, screenshotBrowserDialog, entity, NULL)
-       ATTRIB(XonoticScreenshotList, screenshotPreview, entity, NULL)
-       ATTRIB(XonoticScreenshotList, screenshotViewerDialog, entity, NULL)
-       METHOD(XonoticScreenshotList, goScreenshot, void(entity, float))
-       METHOD(XonoticScreenshotList, startSlideShow, void(entity))
-       METHOD(XonoticScreenshotList, stopSlideShow, void(entity))
-ENDCLASS(XonoticScreenshotList)
-
-entity makeXonoticScreenshotList();
-void StartScreenshot_Click(entity btn, entity me);
-void ScreenshotList_Refresh_Click(entity btn, entity me);
-void ScreenshotList_Filter_Would_Change(entity box, entity me);
-void ScreenshotList_Filter_Change(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-
-entity makeXonoticScreenshotList()
-{
-       entity me;
-       me = spawnXonoticScreenshotList();
-       me.configureXonoticScreenshotList(me);
-       return me;
-}
-
-void XonoticScreenshotList_configureXonoticScreenshotList(entity me)
-{
-       me.configureXonoticListBox(me);
-       me.getScreenshots(me);
-}
-
-string XonoticScreenshotList_screenshotName(entity me, float i)
-{
-       string s;
-       s = bufstr_get(me.listScreenshot, i);
-
-       if(substring(s, 0, 1) == "/")
-               s = substring(s, 1, strlen(s) - 1);  // remove the first forward slash
-
-       return s;
-}
-
-// if subdir is TRUE look in subdirectories too (1 level)
-void getScreenshots_for_ext(entity me, string ext, float subdir)
-{
-       string s;
-       if (subdir)
-               s="screenshots/*/";
-       else
-               s="screenshots/";
-       if(me.filterString)
-               s=strcat(s, me.filterString, ext);
-       else
-               s=strcat(s, "*", ext);
-
-       float list, i, n;
-       list = search_begin(s, FALSE, TRUE);
-       if(list >= 0)
-       {
-               n = search_getsize(list);
-               for(i = 0; i < n; ++i)
-               {
-                       s = search_getfilename(list, i); // get initial full file name
-                       s = substring(s, 12, (strlen(s) - 12 - 4)); // remove "screenshots/" prefix and ".<ext>" suffix
-                       s = strdecolorize(s); // remove any pre-existing colors
-                       if(subdir)
-                       {
-                               s = strreplace("/", "^7/", s); // clear colors at the forward slash
-                               s = strcat("/", rgb_to_hexcolor(SKINCOLOR_SCREENSHOTLIST_SUBDIR), s); // add a forward slash for sorting, then color
-                               bufstr_add(me.listScreenshot, s, TRUE);
-                       }
-                       else { bufstr_add(me.listScreenshot, s, TRUE); }
-               }
-               search_end(list);
-       }
-
-       if (subdir)
-               getScreenshots_for_ext(me, ext, FALSE);
-}
-
-void XonoticScreenshotList_getScreenshots(entity me)
-{
-       if (me.listScreenshot >= 0)
-               buf_del(me.listScreenshot);
-       me.listScreenshot = buf_create();
-       if (me.listScreenshot < 0)
-       {
-               me.nItems = 0;
-               return;
-       }
-       getScreenshots_for_ext(me, ".jpg", TRUE);
-       getScreenshots_for_ext(me, ".tga", TRUE);
-       getScreenshots_for_ext(me, ".png", TRUE);
-       me.nItems = buf_getsize(me.listScreenshot);
-       if(me.nItems > 0)
-               buf_sort(me.listScreenshot, 128, FALSE);
-}
-
-void XonoticScreenshotList_destroy(entity me)
-{
-       if(me.nItems > 0)
-               buf_del(me.listScreenshot);
-}
-
-void XonoticScreenshotList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.itemAbsSize = '0 0 0';
-       SUPER(XonoticScreenshotList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight));
-       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth)));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-
-       me.columnNameOrigin = me.realFontSize_x;
-       me.columnNameSize = 1 - 2 * me.realFontSize_x;
-}
-
-void XonoticScreenshotList_setSelected(entity me, float i)
-{
-       if (me.newSlideShowScreenshotTime)
-               me.startSlideShow(me);
-       me.prevSelectedItem = me.selectedItem;
-       SUPER(XonoticScreenshotList).setSelected(me, i);
-       if (me.pressed && me.selectedItem != me.prevSelectedItem)
-       {
-               // while dragging the scrollbar (or an item)
-               // for a smooth mouse movement do not load immediately the new selected images
-               me.newScreenshotTime = time + 0.22; // dragging an item we need a delay > 0.2 (from listbox: me.dragScrollTimer = time + 0.2;)
-       }
-       else if (time > me.newScreenshotTime)
-       {
-               me.newScreenshotTime = 0;
-               me.previewScreenshot(me); // load the preview on selection change
-       }
-}
-
-void XonoticScreenshotList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       string s;
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
-       s = me.screenshotName(me,i);
-       s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 1);
-}
-
-void XonoticScreenshotList_showNotify(entity me)
-{
-       me.getScreenshots(me);
-       me.previewScreenshot(me);
-}
-
-void ScreenshotList_Refresh_Click(entity btn, entity me)
-{
-       me.getScreenshots(me);
-       me.setSelected(me, 0); //always select the first element after a list update
-}
-
-void ScreenshotList_Filter_Change(entity box, entity me)
-{
-       if(me.filterString)
-               strunzone(me.filterString);
-
-       if(box.text != "")
-       {
-               if (strstrofs(box.text, "*", 0) >= 0 || strstrofs(box.text, "?", 0) >= 0)
-                       me.filterString = strzone(box.text);
-               else
-                       me.filterString = strzone(strcat("*", box.text, "*"));
-       }
-       else
-               me.filterString = string_null;
-
-       ScreenshotList_Refresh_Click(world, me);
-}
-
-void ScreenshotList_Filter_Would_Change(entity box, entity me)
-{
-       me.filterBox = box;
-       me.filterTime = time + 0.5;
-}
-
-void XonoticScreenshotList_draw(entity me)
-{
-       if (me.filterTime && time > me.filterTime)
-       {
-               ScreenshotList_Filter_Change(me.filterBox, me);
-               me.filterTime = 0;
-       }
-       if (me.newScreenshotTime && time > me.newScreenshotTime)
-       {
-               me.previewScreenshot(me);
-               me.newScreenshotTime = 0;
-       }
-       else if (me.newSlideShowScreenshotTime && time > me.newSlideShowScreenshotTime)
-       {
-               if (me.selectedItem == me.nItems - 1) //last screenshot?
-               {
-                       // restart from the first screenshot
-                       me.setSelected(me, 0);
-                       me.goScreenshot(me, +0);
-               }
-               else
-                       me.goScreenshot(me, +1);
-       }
-       SUPER(XonoticScreenshotList).draw(me);
-}
-
-void XonoticScreenshotList_startSlideShow(entity me)
-{
-       me.newSlideShowScreenshotTime = time + 3;
-}
-
-void XonoticScreenshotList_stopSlideShow(entity me)
-{
-       me.newSlideShowScreenshotTime = 0;
-}
-
-void XonoticScreenshotList_goScreenshot(entity me, float d)
-{
-       if(!me.screenshotViewerDialog)
-               return;
-       me.setSelected(me, me.selectedItem + d);
-       me.screenshotViewerDialog.loadScreenshot(me.screenshotViewerDialog, strcat("/screenshots/", strdecolorize(me.screenshotName(me,me.selectedItem))));
-}
-
-void XonoticScreenshotList_startScreenshot(entity me)
-{
-       me.screenshotViewerDialog.loadScreenshot(me.screenshotViewerDialog, strcat("/screenshots/", strdecolorize(me.screenshotName(me,me.selectedItem))));
-       // pop up screenshot
-       DialogOpenButton_Click_withCoords(NULL, me.screenshotViewerDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * me.selectedItem - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize));
-}
-
-void XonoticScreenshotList_previewScreenshot(entity me)
-{
-       if(!me.screenshotBrowserDialog)
-               return;
-       if (me.nItems <= 0)
-               me.screenshotBrowserDialog.loadPreviewScreenshot(me.screenshotBrowserDialog, "");
-       else
-               me.screenshotBrowserDialog.loadPreviewScreenshot(me.screenshotBrowserDialog, strcat("/screenshots/", strdecolorize(me.screenshotName(me,me.selectedItem))));
-}
-
-void StartScreenshot_Click(entity btn, entity me)
-{
-       me.startScreenshot(me);
-}
-
-void XonoticScreenshotList_clickListBoxItem(entity me, float i, vector where)
-{
-       if(i == me.lastClickedScreenshot)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       // pop up screenshot
-                       me.setSelected(me, i);
-                       me.startScreenshot(me);
-               }
-       me.lastClickedScreenshot = i;
-       me.lastClickedTime = time;
-}
-
-float XonoticScreenshotList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       if(scan == K_ENTER || scan == K_KP_ENTER || scan == K_MOUSE2 || scan == K_SPACE) {
-               me.startScreenshot(me);
-               return 1;
-       }
-       if(scan == K_MWHEELUP || scan == K_MWHEELDOWN)
-               me.newScreenshotTime = time + 0.2;
-       return SUPER(XonoticScreenshotList).keyDown(me, scan, ascii, shift);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/screenshotlist.qc b/qcsrc/menu/xonotic/screenshotlist.qc
new file mode 100644 (file)
index 0000000..225eefb
--- /dev/null
@@ -0,0 +1,296 @@
+#ifdef INTERFACE
+CLASS(XonoticScreenshotList) EXTENDS(XonoticListBox)
+       METHOD(XonoticScreenshotList, configureXonoticScreenshotList, void(entity))
+       ATTRIB(XonoticScreenshotList, rowsPerItem, float, 1)
+       METHOD(XonoticScreenshotList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticScreenshotList, setSelected, void(entity, float))
+       METHOD(XonoticScreenshotList, draw, void(entity))
+       METHOD(XonoticScreenshotList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticScreenshotList, getScreenshots, void(entity))
+       METHOD(XonoticScreenshotList, previewScreenshot, void(entity))
+       METHOD(XonoticScreenshotList, startScreenshot, void(entity))
+       METHOD(XonoticScreenshotList, screenshotName, string(entity, float))
+       METHOD(XonoticScreenshotList, doubleClickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticScreenshotList, keyDown, float(entity, float, float, float))
+       METHOD(XonoticScreenshotList, destroy, void(entity))
+       METHOD(XonoticScreenshotList, showNotify, void(entity))
+       ATTRIB(XonoticScreenshotList, listScreenshot, float, -1)
+       ATTRIB(XonoticScreenshotList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticScreenshotList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticScreenshotList, columnNameSize, float, 0)
+       ATTRIB(XonoticScreenshotList, realUpperMargin, float, 0)
+       ATTRIB(XonoticScreenshotList, origin, vector, '0 0 0')
+       ATTRIB(XonoticScreenshotList, itemAbsSize, vector, '0 0 0')
+       ATTRIB(XonoticScreenshotList, filterString, string, string_null)
+       ATTRIB(XonoticScreenshotList, filterBox, entity, NULL)
+       ATTRIB(XonoticScreenshotList, filterTime, float, 0)
+
+       ATTRIB(XonoticScreenshotList, newScreenshotTime, float, 0)
+       ATTRIB(XonoticScreenshotList, newSlideShowScreenshotTime, float, 0)
+       ATTRIB(XonoticScreenshotList, prevSelectedItem, float, 0)
+
+       ATTRIB(XonoticScreenshotList, screenshotBrowserDialog, entity, NULL)
+       ATTRIB(XonoticScreenshotList, screenshotPreview, entity, NULL)
+       ATTRIB(XonoticScreenshotList, screenshotViewerDialog, entity, NULL)
+       METHOD(XonoticScreenshotList, goScreenshot, void(entity, float))
+       METHOD(XonoticScreenshotList, startSlideShow, void(entity))
+       METHOD(XonoticScreenshotList, stopSlideShow, void(entity))
+ENDCLASS(XonoticScreenshotList)
+
+entity makeXonoticScreenshotList();
+void StartScreenshot_Click(entity btn, entity me);
+void ScreenshotList_Refresh_Click(entity btn, entity me);
+void ScreenshotList_Filter_Would_Change(entity box, entity me);
+void ScreenshotList_Filter_Change(entity box, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+
+entity makeXonoticScreenshotList()
+{
+       entity me;
+       me = spawnXonoticScreenshotList();
+       me.configureXonoticScreenshotList(me);
+       return me;
+}
+
+void XonoticScreenshotList_configureXonoticScreenshotList(entity me)
+{
+       me.configureXonoticListBox(me);
+       me.getScreenshots(me);
+}
+
+string XonoticScreenshotList_screenshotName(entity me, float i)
+{
+       string s;
+       s = bufstr_get(me.listScreenshot, i);
+
+       if(substring(s, 0, 1) == "/")
+               s = substring(s, 1, strlen(s) - 1);  // remove the first forward slash
+
+       return s;
+}
+
+// if subdir is true look in subdirectories too (1 level)
+void getScreenshots_for_ext(entity me, string ext, float subdir)
+{
+       string s;
+       if (subdir)
+               s="screenshots/*/";
+       else
+               s="screenshots/";
+       if(me.filterString)
+               s=strcat(s, me.filterString, ext);
+       else
+               s=strcat(s, "*", ext);
+
+       float list, i, n;
+       list = search_begin(s, false, true);
+       if(list >= 0)
+       {
+               n = search_getsize(list);
+               for(i = 0; i < n; ++i)
+               {
+                       s = search_getfilename(list, i); // get initial full file name
+                       s = substring(s, 12, (strlen(s) - 12 - 4)); // remove "screenshots/" prefix and ".<ext>" suffix
+                       s = strdecolorize(s); // remove any pre-existing colors
+                       if(subdir)
+                       {
+                               s = strreplace("/", "^7/", s); // clear colors at the forward slash
+                               s = strcat("/", rgb_to_hexcolor(SKINCOLOR_SCREENSHOTLIST_SUBDIR), s); // add a forward slash for sorting, then color
+                               bufstr_add(me.listScreenshot, s, true);
+                       }
+                       else { bufstr_add(me.listScreenshot, s, true); }
+               }
+               search_end(list);
+       }
+
+       if (subdir)
+               getScreenshots_for_ext(me, ext, false);
+}
+
+void XonoticScreenshotList_getScreenshots(entity me)
+{
+       if (me.listScreenshot >= 0)
+               buf_del(me.listScreenshot);
+       me.listScreenshot = buf_create();
+       if (me.listScreenshot < 0)
+       {
+               me.nItems = 0;
+               return;
+       }
+       getScreenshots_for_ext(me, ".jpg", true);
+       getScreenshots_for_ext(me, ".tga", true);
+       getScreenshots_for_ext(me, ".png", true);
+       me.nItems = buf_getsize(me.listScreenshot);
+       if(me.nItems > 0)
+               buf_sort(me.listScreenshot, 128, false);
+}
+
+void XonoticScreenshotList_destroy(entity me)
+{
+       if(me.nItems > 0)
+               buf_del(me.listScreenshot);
+}
+
+void XonoticScreenshotList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.itemAbsSize = '0 0 0';
+       SUPER(XonoticScreenshotList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
+       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+
+       me.columnNameOrigin = me.realFontSize.x;
+       me.columnNameSize = 1 - 2 * me.realFontSize.x;
+}
+
+void XonoticScreenshotList_setSelected(entity me, float i)
+{
+       if (me.newSlideShowScreenshotTime)
+               me.startSlideShow(me);
+       me.prevSelectedItem = me.selectedItem;
+       SUPER(XonoticScreenshotList).setSelected(me, i);
+       if (me.pressed && me.selectedItem != me.prevSelectedItem)
+       {
+               // while dragging the scrollbar (or an item)
+               // for a smooth mouse movement do not load immediately the new selected images
+               me.newScreenshotTime = time + 0.22; // dragging an item we need a delay > 0.2 (from listbox: me.dragScrollTimer = time + 0.2;)
+       }
+       else if (time > me.newScreenshotTime)
+       {
+               me.newScreenshotTime = 0;
+               me.previewScreenshot(me); // load the preview on selection change
+       }
+}
+
+void XonoticScreenshotList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       string s;
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+
+       s = me.screenshotName(me,i);
+       s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 1);
+}
+
+void XonoticScreenshotList_showNotify(entity me)
+{
+       me.getScreenshots(me);
+       me.previewScreenshot(me);
+}
+
+void ScreenshotList_Refresh_Click(entity btn, entity me)
+{
+       me.getScreenshots(me);
+       me.setSelected(me, 0); //always select the first element after a list update
+}
+
+void ScreenshotList_Filter_Change(entity box, entity me)
+{
+       if(me.filterString)
+               strunzone(me.filterString);
+
+       if(box.text != "")
+       {
+               if (strstrofs(box.text, "*", 0) >= 0 || strstrofs(box.text, "?", 0) >= 0)
+                       me.filterString = strzone(box.text);
+               else
+                       me.filterString = strzone(strcat("*", box.text, "*"));
+       }
+       else
+               me.filterString = string_null;
+
+       ScreenshotList_Refresh_Click(world, me);
+}
+
+void ScreenshotList_Filter_Would_Change(entity box, entity me)
+{
+       me.filterBox = box;
+       me.filterTime = time + 0.5;
+}
+
+void XonoticScreenshotList_draw(entity me)
+{
+       if (me.filterTime && time > me.filterTime)
+       {
+               ScreenshotList_Filter_Change(me.filterBox, me);
+               me.filterTime = 0;
+       }
+       if (me.newScreenshotTime && time > me.newScreenshotTime)
+       {
+               me.previewScreenshot(me);
+               me.newScreenshotTime = 0;
+       }
+       else if (me.newSlideShowScreenshotTime && time > me.newSlideShowScreenshotTime)
+       {
+               if (me.selectedItem == me.nItems - 1) //last screenshot?
+               {
+                       // restart from the first screenshot
+                       me.setSelected(me, 0);
+                       me.goScreenshot(me, +0);
+               }
+               else
+                       me.goScreenshot(me, +1);
+       }
+       SUPER(XonoticScreenshotList).draw(me);
+}
+
+void XonoticScreenshotList_startSlideShow(entity me)
+{
+       me.newSlideShowScreenshotTime = time + 3;
+}
+
+void XonoticScreenshotList_stopSlideShow(entity me)
+{
+       me.newSlideShowScreenshotTime = 0;
+}
+
+void XonoticScreenshotList_goScreenshot(entity me, float d)
+{
+       if(!me.screenshotViewerDialog)
+               return;
+       me.setSelected(me, me.selectedItem + d);
+       me.screenshotViewerDialog.loadScreenshot(me.screenshotViewerDialog, strcat("/screenshots/", strdecolorize(me.screenshotName(me,me.selectedItem))));
+}
+
+void XonoticScreenshotList_startScreenshot(entity me)
+{
+       me.screenshotViewerDialog.loadScreenshot(me.screenshotViewerDialog, strcat("/screenshots/", strdecolorize(me.screenshotName(me,me.selectedItem))));
+       // pop up screenshot
+       DialogOpenButton_Click_withCoords(NULL, me.screenshotViewerDialog, me.origin + eX * (me.columnNameOrigin * me.size.x) + eY * ((me.itemHeight * me.selectedItem - me.scrollPos) * me.size.y), eY * me.itemAbsSize.y + eX * (me.itemAbsSize.x * me.columnNameSize));
+}
+
+void XonoticScreenshotList_previewScreenshot(entity me)
+{
+       if(!me.screenshotBrowserDialog)
+               return;
+       if (me.nItems <= 0)
+               me.screenshotBrowserDialog.loadPreviewScreenshot(me.screenshotBrowserDialog, "");
+       else
+               me.screenshotBrowserDialog.loadPreviewScreenshot(me.screenshotBrowserDialog, strcat("/screenshots/", strdecolorize(me.screenshotName(me,me.selectedItem))));
+}
+
+void StartScreenshot_Click(entity btn, entity me)
+{
+       me.startScreenshot(me);
+}
+
+void XonoticScreenshotList_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       me.startScreenshot(me);
+}
+
+float XonoticScreenshotList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       if(scan == K_ENTER || scan == K_KP_ENTER || scan == K_MOUSE2 || scan == K_SPACE) {
+               me.startScreenshot(me);
+               return 1;
+       }
+       if(scan == K_MWHEELUP || scan == K_MWHEELDOWN)
+               me.newScreenshotTime = time + 0.2;
+       return SUPER(XonoticScreenshotList).keyDown(me, scan, ascii, shift);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/serverlist.c b/qcsrc/menu/xonotic/serverlist.c
deleted file mode 100644 (file)
index 8b3a9e9..0000000
+++ /dev/null
@@ -1,1327 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticServerList) EXTENDS(XonoticListBox)
-       METHOD(XonoticServerList, configureXonoticServerList, void(entity))
-       ATTRIB(XonoticServerList, rowsPerItem, float, 1)
-       METHOD(XonoticServerList, draw, void(entity))
-       METHOD(XonoticServerList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticServerList, clickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticServerList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticServerList, keyDown, float(entity, float, float, float))
-       METHOD(XonoticServerList, toggleFavorite, void(entity, string))
-
-       ATTRIB(XonoticServerList, iconsSizeFactor, float, 0.85)
-
-       ATTRIB(XonoticServerList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticServerList, realUpperMargin, float, 0)
-       ATTRIB(XonoticServerList, columnIconsOrigin, float, 0)
-       ATTRIB(XonoticServerList, columnIconsSize, float, 0)
-       ATTRIB(XonoticServerList, columnPingOrigin, float, 0)
-       ATTRIB(XonoticServerList, columnPingSize, float, 0)
-       ATTRIB(XonoticServerList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticServerList, columnNameSize, float, 0)
-       ATTRIB(XonoticServerList, columnMapOrigin, float, 0)
-       ATTRIB(XonoticServerList, columnMapSize, float, 0)
-       ATTRIB(XonoticServerList, columnTypeOrigin, float, 0)
-       ATTRIB(XonoticServerList, columnTypeSize, float, 0)
-       ATTRIB(XonoticServerList, columnPlayersOrigin, float, 0)
-       ATTRIB(XonoticServerList, columnPlayersSize, float, 0)
-
-       ATTRIB(XonoticServerList, selectedServer, string, string_null) // to restore selected server when needed
-       METHOD(XonoticServerList, setSelected, void(entity, float))
-       METHOD(XonoticServerList, setSortOrder, void(entity, float, float))
-       ATTRIB(XonoticServerList, filterShowEmpty, float, 1)
-       ATTRIB(XonoticServerList, filterShowFull, float, 1)
-       ATTRIB(XonoticServerList, filterString, string, string_null)
-       ATTRIB(XonoticServerList, controlledTextbox, entity, NULL)
-       ATTRIB(XonoticServerList, ipAddressBox, entity, NULL)
-       ATTRIB(XonoticServerList, favoriteButton, entity, NULL)
-       ATTRIB(XonoticServerList, nextRefreshTime, float, 0)
-       METHOD(XonoticServerList, refreshServerList, void(entity, float)) // refresh mode: REFRESHSERVERLIST_*
-       ATTRIB(XonoticServerList, needsRefresh, float, 1)
-       METHOD(XonoticServerList, focusEnter, void(entity))
-       METHOD(XonoticServerList, positionSortButton, void(entity, entity, float, float, string, void(entity, entity)))
-       ATTRIB(XonoticServerList, sortButton1, entity, NULL)
-       ATTRIB(XonoticServerList, sortButton2, entity, NULL)
-       ATTRIB(XonoticServerList, sortButton3, entity, NULL)
-       ATTRIB(XonoticServerList, sortButton4, entity, NULL)
-       ATTRIB(XonoticServerList, sortButton5, entity, NULL)
-       ATTRIB(XonoticServerList, connectButton, entity, NULL)
-       ATTRIB(XonoticServerList, infoButton, entity, NULL)
-       ATTRIB(XonoticServerList, currentSortOrder, float, 0)
-       ATTRIB(XonoticServerList, currentSortField, float, -1)
-       ATTRIB(XonoticServerList, lastClickedServer, float, -1)
-       ATTRIB(XonoticServerList, lastClickedTime, float, 0)
-
-       ATTRIB(XonoticServerList, ipAddressBoxFocused, float, -1)
-
-       ATTRIB(XonoticServerList, seenIPv4, float, 0)
-       ATTRIB(XonoticServerList, seenIPv6, float, 0)
-       ATTRIB(XonoticServerList, categoriesHeight, float, 1.25)
-
-       METHOD(XonoticServerList, getTotalHeight, float(entity))
-       METHOD(XonoticServerList, getItemAtPos, float(entity, float))
-       METHOD(XonoticServerList, getItemStart, float(entity, float))
-       METHOD(XonoticServerList, getItemHeight, float(entity, float))
-ENDCLASS(XonoticServerList)
-entity makeXonoticServerList();
-
-#ifndef IMPLEMENTATION
-float autocvar_menu_slist_categories;
-float autocvar_menu_slist_categories_onlyifmultiple; 
-float autocvar_menu_slist_purethreshold;
-float autocvar_menu_slist_modimpurity;
-float autocvar_menu_slist_recommendations;
-float autocvar_menu_slist_recommendations_maxping;
-float autocvar_menu_slist_recommendations_minfreeslots; 
-float autocvar_menu_slist_recommendations_minhumans;
-float autocvar_menu_slist_recommendations_purethreshold; 
-
-// server cache fields
-#define SLIST_FIELDS \
-       SLIST_FIELD(CNAME,       "cname") \
-       SLIST_FIELD(PING,        "ping") \
-       SLIST_FIELD(GAME,        "game") \
-       SLIST_FIELD(MOD,         "mod") \
-       SLIST_FIELD(MAP,         "map") \
-       SLIST_FIELD(NAME,        "name") \
-       SLIST_FIELD(MAXPLAYERS,  "maxplayers") \
-       SLIST_FIELD(NUMPLAYERS,  "numplayers") \
-       SLIST_FIELD(NUMHUMANS,   "numhumans") \
-       SLIST_FIELD(NUMBOTS,     "numbots") \
-       SLIST_FIELD(PROTOCOL,    "protocol") \
-       SLIST_FIELD(FREESLOTS,   "freeslots") \
-       SLIST_FIELD(PLAYERS,     "players") \
-       SLIST_FIELD(QCSTATUS,    "qcstatus") \
-       SLIST_FIELD(CATEGORY,    "category") \
-       SLIST_FIELD(ISFAVORITE,  "isfavorite")
-
-#define SLIST_FIELD(suffix,name) float SLIST_FIELD_##suffix;
-SLIST_FIELDS
-#undef SLIST_FIELD
-
-const float REFRESHSERVERLIST_RESORT = 0;    // sort the server list again to update for changes to e.g. favorite status, categories
-const float REFRESHSERVERLIST_REFILTER = 1;  // ..., also update filter and sort criteria
-const float REFRESHSERVERLIST_ASK = 2;       // ..., also suggest querying servers now
-const float REFRESHSERVERLIST_RESET = 3;     // ..., also clear the list first
-
-// function declarations
-float IsServerInList(string list, string srv);
-#define IsFavorite(srv) IsServerInList(cvar_string("net_slist_favorites"), srv)
-#define IsPromoted(srv) IsServerInList(_Nex_ExtResponseSystem_PromotedServers, srv)
-#define IsRecommended(srv) IsServerInList(_Nex_ExtResponseSystem_RecommendedServers, srv)
-
-entity RetrieveCategoryEnt(float catnum);
-
-float CheckCategoryOverride(float cat);
-float CheckCategoryForEntry(float entry); 
-float m_gethostcachecategory(float entry) { return CheckCategoryOverride(CheckCategoryForEntry(entry)); }
-
-void RegisterSLCategories();
-
-void ServerList_Connect_Click(entity btn, entity me);
-void ServerList_Categories_Click(entity box, entity me);
-void ServerList_ShowEmpty_Click(entity box, entity me);
-void ServerList_ShowFull_Click(entity box, entity me);
-void ServerList_Filter_Change(entity box, entity me);
-void ServerList_Favorite_Click(entity btn, entity me);
-void ServerList_Info_Click(entity btn, entity me);
-void ServerList_Update_favoriteButton(entity btn, entity me);
-
-// fields for category entities
-#define MAX_CATEGORIES 9
-#define CATEGORY_FIRST 1
-entity categories[MAX_CATEGORIES];
-float category_ent_count;
-.string cat_name;
-.string cat_string;
-.string cat_enoverride_string;
-.string cat_dioverride_string;
-.float cat_enoverride;
-.float cat_dioverride;
-
-// fields for drawing categories
-float category_name[MAX_CATEGORIES];
-float category_item[MAX_CATEGORIES];
-float category_draw_count;
-
-#define SLIST_CATEGORIES \
-       SLIST_CATEGORY(CAT_FAVORITED,    "",            "",             ZCTX(_("SLCAT^Favorites"))) \
-       SLIST_CATEGORY(CAT_RECOMMENDED,  "",            "",             ZCTX(_("SLCAT^Recommended"))) \
-       SLIST_CATEGORY(CAT_NORMAL,       "",            "CAT_SERVERS",  ZCTX(_("SLCAT^Normal Servers"))) \
-       SLIST_CATEGORY(CAT_SERVERS,      "CAT_NORMAL",  "CAT_SERVERS",  ZCTX(_("SLCAT^Servers"))) \
-       SLIST_CATEGORY(CAT_XPM,          "CAT_NORMAL",  "CAT_SERVERS",  ZCTX(_("SLCAT^Competitive Mode"))) \
-       SLIST_CATEGORY(CAT_MODIFIED,     "",            "CAT_SERVERS",  ZCTX(_("SLCAT^Modified Servers"))) \
-       SLIST_CATEGORY(CAT_OVERKILL,     "",            "CAT_SERVERS",  ZCTX(_("SLCAT^Overkill Mode"))) \
-       SLIST_CATEGORY(CAT_INSTAGIB,     "",            "CAT_SERVERS",  ZCTX(_("SLCAT^InstaGib Mode"))) \
-       SLIST_CATEGORY(CAT_DEFRAG,       "",            "CAT_SERVERS",  ZCTX(_("SLCAT^Defrag Mode")))
-
-#define SLIST_CATEGORY_AUTOCVAR(name) autocvar_menu_slist_categories_##name##_override
-#define SLIST_CATEGORY(name,enoverride,dioverride,str) \
-       float name; \
-       var string SLIST_CATEGORY_AUTOCVAR(name) = enoverride;
-SLIST_CATEGORIES
-#undef SLIST_CATEGORY
-
-#endif
-#endif
-#ifdef IMPLEMENTATION
-
-void RegisterSLCategories()
-{
-       entity cat;
-       #define SLIST_CATEGORY(name,enoverride,dioverride,str) \
-               SET_FIELD_COUNT(name, CATEGORY_FIRST, category_ent_count) \
-               CHECK_MAX_COUNT(name, MAX_CATEGORIES, category_ent_count, "SLIST_CATEGORY") \
-               cat = spawn(); \
-               categories[name - 1] = cat; \
-               cat.classname = "slist_category"; \
-               cat.cat_name = strzone(#name); \
-               cat.cat_enoverride_string = strzone(SLIST_CATEGORY_AUTOCVAR(name)); \
-               cat.cat_dioverride_string = strzone(dioverride); \
-               cat.cat_string = strzone(str);
-       SLIST_CATEGORIES
-       #undef SLIST_CATEGORY
-
-       float i, x, catnum;
-       string s;
-
-       #define PROCESS_OVERRIDE(override_string,override_field) \
-               for(i = 0; i < category_ent_count; ++i) \
-               { \
-                       s = categories[i].override_string; \
-                       if((s != "") && (s != categories[i].cat_name)) \
-                       { \
-                               catnum = 0; \
-                               for(x = 0; x < category_ent_count; ++x) \
-                               { if(categories[x].cat_name == s) { \
-                                       catnum = (x+1); \
-                                       break; \
-                               } } \
-                               if(catnum) \
-                               { \
-                                       strunzone(categories[i].override_string); \
-                                       categories[i].override_field = catnum; \
-                                       continue; \
-                               } \
-                               else \
-                               { \
-                                       printf( \
-                                               "RegisterSLCategories(): Improper override '%s' for category '%s'!\n", \
-                                               s, \
-                                               categories[i].cat_name \
-                                       ); \
-                               } \
-                       } \
-                       strunzone(categories[i].override_string); \
-                       categories[i].override_field = 0; \
-               }
-       PROCESS_OVERRIDE(cat_enoverride_string, cat_enoverride)
-       PROCESS_OVERRIDE(cat_dioverride_string, cat_dioverride)
-       #undef PROCESS_OVERRIDE
-}
-
-// Supporting Functions
-entity RetrieveCategoryEnt(float catnum)
-{
-       if((catnum > 0) && (catnum <= category_ent_count))
-       {
-               return categories[catnum - 1];
-       }
-       else
-       {
-               error(sprintf("RetrieveCategoryEnt(%d): Improper category number!\n", catnum));
-               return world;
-       }
-}
-
-float IsServerInList(string list, string srv)
-{
-       string p;
-       float i, n;
-       if(srv == "")
-               return FALSE;
-       srv = netaddress_resolve(srv, 26000);
-       if(srv == "")
-               return FALSE;
-       p = crypto_getidfp(srv);
-       n = tokenize_console(list);
-       for(i = 0; i < n; ++i)
-       {
-               if(substring(argv(i), 0, 1) != "[" && strlen(argv(i)) == 44 && strstrofs(argv(i), ".", 0) < 0)
-               {
-                       if(p)
-                               if(argv(i) == p)
-                                       return TRUE;
-               }
-               else
-               {
-                       if(srv == netaddress_resolve(argv(i), 26000))
-                               return TRUE;
-               }
-       }
-       return FALSE;
-}
-
-float CheckCategoryOverride(float cat)
-{
-       entity catent = RetrieveCategoryEnt(cat);
-       if(catent)
-       {
-               float override = (autocvar_menu_slist_categories ? catent.cat_enoverride : catent.cat_dioverride); 
-               if(override) { return override; }
-               else { return cat; }
-       }
-       else
-       {
-               error(sprintf("CheckCategoryOverride(%d): Improper category number!\n", cat));
-               return cat;
-       }
-}
-
-float CheckCategoryForEntry(float entry)
-{
-       string s, k, v, modtype = "";
-       float j, m, impure = 0, freeslots = 0, sflags = 0;
-       s = gethostcachestring(SLIST_FIELD_QCSTATUS, entry);
-       m = tokenizebyseparator(s, ":");
-
-       for(j = 2; j < m; ++j)
-       {
-               if(argv(j) == "") { break; }
-               k = substring(argv(j), 0, 1);
-               v = substring(argv(j), 1, -1);
-               switch(k)
-               {
-                       case "P": { impure = stof(v); break; }
-                       case "S": { freeslots = stof(v); break; }
-                       case "F": { sflags = stof(v); break; }
-                       case "M": { modtype = strtolower(v); break; }
-               }
-       }
-
-       if(modtype != "xonotic") { impure += autocvar_menu_slist_modimpurity; }
-
-       // check if this server is favorited
-       if(gethostcachenumber(SLIST_FIELD_ISFAVORITE, entry)) { return CAT_FAVORITED; }
-
-       // now check if it's recommended
-       if(autocvar_menu_slist_recommendations)
-       {
-               string cname = gethostcachestring(SLIST_FIELD_CNAME, entry);
-               
-               if(IsPromoted(cname)) { return CAT_RECOMMENDED; }
-               else
-               {
-                       float recommended = 0;
-                       if(autocvar_menu_slist_recommendations & 1)
-                       {
-                               if(IsRecommended(cname)) { ++recommended; }
-                               else { --recommended; }
-                       }
-                       if(autocvar_menu_slist_recommendations & 2)
-                       {
-                               if(
-                                       ///// check for minimum free slots
-                                       (freeslots >= autocvar_menu_slist_recommendations_minfreeslots)
-                                       
-                                       && // check for purity requirement
-                                       (
-                                               (autocvar_menu_slist_recommendations_purethreshold < 0)
-                                               ||
-                                               (impure <= autocvar_menu_slist_recommendations_purethreshold)
-                                       )
-                                       
-                                       && // check for minimum amount of humans
-                                       (
-                                               gethostcachenumber(SLIST_FIELD_NUMHUMANS, entry)
-                                               >=
-                                               autocvar_menu_slist_recommendations_minhumans
-                                       )
-                                       
-                                       && // check for maximum latency
-                                       (
-                                               gethostcachenumber(SLIST_FIELD_PING, entry)
-                                               <=
-                                               autocvar_menu_slist_recommendations_maxping
-                                       )
-                               )
-                                       { ++recommended; }
-                               else
-                                       { --recommended; }
-                       }
-                       if(recommended > 0) { return CAT_RECOMMENDED; }
-               }
-       }
-
-       // if not favorited or recommended, check modname
-       if(modtype != "xonotic")
-       {
-               switch(modtype)
-               {
-                       // old servers which don't report their mod name are considered modified now
-                       case "": { return CAT_MODIFIED; }
-                       
-                       case "xpm": { return CAT_XPM; }
-                       case "minstagib":
-                       case "instagib": { return CAT_INSTAGIB; }
-                       case "overkill": { return CAT_OVERKILL; }
-                       //case "nix": { return CAT_NIX; }
-                       //case "newtoys": { return CAT_NEWTOYS; }
-
-                       // "cts" is allowed as compat, xdf is replacement
-                       case "cts": 
-                       case "xdf": { return CAT_DEFRAG; }
-                       
-                       default: { dprintf("Found strange mod type: %s\n", modtype); return CAT_MODIFIED; }
-               }
-       }
-
-       // must be normal or impure server
-       return ((impure > autocvar_menu_slist_purethreshold) ? CAT_MODIFIED : CAT_NORMAL);
-}
-
-void XonoticServerList_toggleFavorite(entity me, string srv)
-{
-       string s, s0, s1, s2, srv_resolved, p;
-       float i, n, f;
-       srv_resolved = netaddress_resolve(srv, 26000);
-       p = crypto_getidfp(srv_resolved);
-       s = cvar_string("net_slist_favorites");
-       n = tokenize_console(s);
-       f = 0;
-       for(i = 0; i < n; ++i)
-       {
-               if(substring(argv(i), 0, 1) != "[" && strlen(argv(i)) == 44 && strstrofs(argv(i), ".", 0) < 0)
-               {
-                       if(p)
-                               if(argv(i) != p)
-                                       continue;
-               }
-               else
-               {
-                       if(srv_resolved != netaddress_resolve(argv(i), 26000))
-                               continue;
-               }
-               s0 = s1 = s2 = "";
-               if(i > 0)
-                       s0 = substring(s, 0, argv_end_index(i - 1));
-               if(i < n-1)
-                       s2 = substring(s, argv_start_index(i + 1), -1);
-               if(s0 != "" && s2 != "")
-                       s1 = " ";
-               cvar_set("net_slist_favorites", strcat(s0, s1, s2));
-               s = cvar_string("net_slist_favorites");
-               n = tokenize_console(s);
-               f = 1;
-               --i;
-       }
-
-       if(!f)
-       {
-               s1 = "";
-               if(s != "")
-                       s1 = " ";
-               if(p)
-                       cvar_set("net_slist_favorites", strcat(s, s1, p));
-               else
-                       cvar_set("net_slist_favorites", strcat(s, s1, srv));
-       }
-
-       me.refreshServerList(me, REFRESHSERVERLIST_RESORT);
-}
-
-void ServerList_Update_favoriteButton(entity btn, entity me)
-{
-       me.favoriteButton.setText(me.favoriteButton,
-               (IsFavorite(me.ipAddressBox.text) ?
-                       _("Remove") : _("Favorite")
-               )
-       );
-}
-
-entity makeXonoticServerList()
-{
-       entity me;
-       me = spawnXonoticServerList();
-       me.configureXonoticServerList(me);
-       return me;
-}
-void XonoticServerList_configureXonoticServerList(entity me)
-{
-       me.configureXonoticListBox(me);
-
-       // update field ID's
-       #define SLIST_FIELD(suffix,name) SLIST_FIELD_##suffix = gethostcacheindexforkey(name);
-       SLIST_FIELDS
-       #undef SLIST_FIELD
-
-       // clear list
-       me.nItems = 0;
-}
-void XonoticServerList_setSelected(entity me, float i)
-{
-       float save;
-       save = me.selectedItem;
-       SUPER(XonoticServerList).setSelected(me, i);
-       /*
-       if(me.selectedItem == save)
-               return;
-       */
-       if(me.nItems == 0)
-               return;
-       if(gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT) != me.nItems)
-               return; // sorry, it would be wrong
-
-       if(me.selectedServer)
-               strunzone(me.selectedServer);
-       me.selectedServer = strzone(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
-
-       me.ipAddressBox.setText(me.ipAddressBox, me.selectedServer);
-       me.ipAddressBox.cursorPos = strlen(me.selectedServer);
-       me.ipAddressBoxFocused = -1;
-}
-void XonoticServerList_refreshServerList(entity me, float mode)
-{
-       //print("refresh of type ", ftos(mode), "\n");
-
-       if(mode >= REFRESHSERVERLIST_REFILTER)
-       {
-               float m, i, n;
-               float listflags = 0;
-               string s, typestr, modstr;
-
-               s = me.filterString;
-
-               m = strstrofs(s, ":", 0);
-               if(m >= 0)
-               {
-                       typestr = substring(s, 0, m);
-                       s = substring(s, m + 1, strlen(s) - m - 1);
-                       while(substring(s, 0, 1) == " ")
-                               s = substring(s, 1, strlen(s) - 1);
-               }
-               else
-                       typestr = "";
-
-               modstr = cvar_string("menu_slist_modfilter");
-
-               m = SLIST_MASK_AND - 1;
-               resethostcachemasks();
-
-               // ping: reject negative ping (no idea why this happens in the first place, engine bug)
-               sethostcachemasknumber(++m, SLIST_FIELD_PING, 0, SLIST_TEST_GREATEREQUAL);
-
-               // show full button
-               if(!me.filterShowFull)
-               {
-                       sethostcachemasknumber(++m, SLIST_FIELD_FREESLOTS, 1, SLIST_TEST_GREATEREQUAL); // legacy
-                       sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, ":S0:", SLIST_TEST_NOTCONTAIN); // g_maxplayers support
-               }
-
-               // show empty button
-               if(!me.filterShowEmpty)
-                       sethostcachemasknumber(++m, SLIST_FIELD_NUMHUMANS, 1, SLIST_TEST_GREATEREQUAL);
-
-               // gametype filtering
-               if(typestr != "")
-                       sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, strcat(typestr, ":"), SLIST_TEST_STARTSWITH);
-
-               // mod filtering
-               if(modstr != "")
-               {
-                       if(substring(modstr, 0, 1) == "!")
-                               sethostcachemaskstring(++m, SLIST_FIELD_MOD, resolvemod(substring(modstr, 1, strlen(modstr) - 1)), SLIST_TEST_NOTEQUAL);
-                       else
-                               sethostcachemaskstring(++m, SLIST_FIELD_MOD, resolvemod(modstr), SLIST_TEST_EQUAL);
-               }
-
-               // server banning
-               n = tokenizebyseparator(_Nex_ExtResponseSystem_BannedServers, " ");
-               for(i = 0; i < n; ++i)
-                       if(argv(i) != "")
-                               sethostcachemaskstring(++m, SLIST_FIELD_CNAME, argv(i), SLIST_TEST_NOTSTARTSWITH);
-
-               m = SLIST_MASK_OR - 1;
-               if(s != "")
-               {
-                       sethostcachemaskstring(++m, SLIST_FIELD_NAME, s, SLIST_TEST_CONTAINS);
-                       sethostcachemaskstring(++m, SLIST_FIELD_MAP, s, SLIST_TEST_CONTAINS);
-                       sethostcachemaskstring(++m, SLIST_FIELD_PLAYERS, s, SLIST_TEST_CONTAINS);
-                       sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, strcat(s, ":"), SLIST_TEST_STARTSWITH);
-               }
-
-               // sorting flags
-               //listflags |= SLSF_FAVORITES;
-               listflags |= SLSF_CATEGORIES;
-               if(me.currentSortOrder < 0) { listflags |= SLSF_DESCENDING; }
-               sethostcachesort(me.currentSortField, listflags);
-       }
-       
-       resorthostcache();
-       if(mode >= REFRESHSERVERLIST_ASK)
-               refreshhostcache(mode >= REFRESHSERVERLIST_RESET);
-}
-void XonoticServerList_focusEnter(entity me)
-{
-       if(time < me.nextRefreshTime)
-       {
-               //print("sorry, no refresh yet\n");
-               return;
-       }
-       me.nextRefreshTime = time + 10;
-       me.refreshServerList(me, REFRESHSERVERLIST_ASK);
-}
-
-void XonoticServerList_draw(entity me)
-{
-       float i, found, owned;
-
-       if(_Nex_ExtResponseSystem_BannedServersNeedsRefresh)
-       {
-               if(!me.needsRefresh)
-                       me.needsRefresh = 2;
-               _Nex_ExtResponseSystem_BannedServersNeedsRefresh = 0;
-       }
-
-       if(_Nex_ExtResponseSystem_PromotedServersNeedsRefresh)
-       {
-               if(!me.needsRefresh)
-                       me.needsRefresh = 3;
-               _Nex_ExtResponseSystem_PromotedServersNeedsRefresh = 0;
-       }
-
-       if(_Nex_ExtResponseSystem_RecommendedServersNeedsRefresh)
-       {
-               if(!me.needsRefresh)
-                       me.needsRefresh = 3;
-               _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh = 0;
-       }
-
-       if(me.currentSortField == -1)
-       {
-               me.setSortOrder(me, SLIST_FIELD_PING, +1);
-               me.refreshServerList(me, REFRESHSERVERLIST_RESET);
-       }
-       else if(me.needsRefresh == 1)
-       {
-               me.needsRefresh = 2; // delay by one frame to make sure "slist" has been executed
-       }
-       else if(me.needsRefresh == 2)
-       {
-               me.needsRefresh = 0;
-               me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
-       }
-       else if(me.needsRefresh == 3)
-       {
-               me.needsRefresh = 0;
-               me.refreshServerList(me, REFRESHSERVERLIST_RESORT);
-       }
-
-       owned = ((me.selectedServer == me.ipAddressBox.text) && (me.ipAddressBox.text != ""));
-
-       for(i = 0; i < category_draw_count; ++i) { category_name[i] = -1; category_item[i] = -1; }
-       category_draw_count = 0;
-
-       if(autocvar_menu_slist_categories >= 0) // if less than 0, don't even draw a category heading for favorites
-       {
-               float itemcount = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT);
-               me.nItems = itemcount;
-               
-               //float visible = floor(me.scrollPos / me.itemHeight);
-               // ^ unfortunately no such optimization can be made-- we must process through the
-               // entire list, otherwise there is no way to know which item is first in its category.
-
-               // binary search method suggested by div
-               float x;
-               float begin = 0;
-               for(x = 1; x <= category_ent_count; ++x) {
-                       float first = begin;
-                       float last = (itemcount - 1);
-                       if (first > last) {
-                               // List is empty.
-                               break;
-                       }
-                       float catf = gethostcachenumber(SLIST_FIELD_CATEGORY, first);
-                       float catl = gethostcachenumber(SLIST_FIELD_CATEGORY, last);
-                       if (catf > x) {
-                               // The first one is already > x.
-                               // Therefore, category x does not exist.
-                               // Higher numbered categories do exist though.
-                       } else if (catl < x) {
-                               // The last one is < x.
-                               // Thus this category - and any following -
-                               // don't exist.
-                               break;
-                       } else if (catf == x) {
-                               // Starts at first. This breaks the loop
-                               // invariant in the binary search and thus has
-                               // to be handled separately.
-                               if(gethostcachenumber(SLIST_FIELD_CATEGORY, first) != x)
-                                       error("Category mismatch I");
-                               if(first > 0)
-                                       if(gethostcachenumber(SLIST_FIELD_CATEGORY, first - 1) == x)
-                                               error("Category mismatch II");
-                               category_name[category_draw_count] = x;
-                               category_item[category_draw_count] = first;
-                               ++category_draw_count;
-                               begin = first + 1;
-                       } else {
-                               // At this point, catf <= x < catl, thus
-                               // catf < catl, thus first < last.
-                               // INVARIANTS:
-                               // last - first >= 1
-                               // catf == gethostcachenumber(SLIST_FIELD_CATEGORY(first)
-                               // catl == gethostcachenumber(SLIST_FIELD_CATEGORY(last)
-                               // catf < x
-                               // catl >= x
-                               while (last - first > 1) {
-                                       float middle = floor((first + last) / 2);
-                                       // By loop condition, middle != first && middle != last.
-                                       float cat = gethostcachenumber(SLIST_FIELD_CATEGORY, middle);
-                                       if (cat >= x) {
-                                               last = middle;
-                                               catl = cat;
-                                       } else {
-                                               first = middle;
-                                               catf = cat;
-                                       }
-                               }
-                               if (catl == x) {
-                                       if(gethostcachenumber(SLIST_FIELD_CATEGORY, last) != x)
-                                               error("Category mismatch III");
-                                       if(last > 0)
-                                               if(gethostcachenumber(SLIST_FIELD_CATEGORY, last - 1) == x)
-                                                       error("Category mismatch IV");
-                                       category_name[category_draw_count] = x;
-                                       category_item[category_draw_count] = last;
-                                       ++category_draw_count;
-                                       begin = last + 1; // already scanned through these, skip 'em
-                               }
-                               else
-                                       begin = last; // already scanned through these, skip 'em
-                       }
-               }
-               if(autocvar_menu_slist_categories_onlyifmultiple && (category_draw_count == 1))
-               {
-                       category_name[0] = -1;
-                       category_item[0] = -1;
-                       category_draw_count = 0;
-                       me.nItems = itemcount;
-               }
-       }
-       else { me.nItems = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT); }
-
-       me.connectButton.disabled = ((me.nItems == 0) && (me.ipAddressBox.text == ""));
-       me.infoButton.disabled = ((me.nItems == 0) || !owned);
-       me.favoriteButton.disabled = ((me.nItems == 0) && (me.ipAddressBox.text == ""));
-
-       found = 0;
-       if(me.selectedServer)
-       {
-               for(i = 0; i < me.nItems; ++i)
-               {
-                       if(gethostcachestring(SLIST_FIELD_CNAME, i) == me.selectedServer)
-                       {
-                               if(i != me.selectedItem)
-                               {
-                                       me.lastClickedServer = -1;
-                                       me.selectedItem = i;
-                               }
-                               found = 1;
-                               break;
-                       }
-               }
-       }
-       if(!found)
-       {
-               if(me.nItems > 0)
-               {
-                       if(me.selectedItem >= me.nItems)
-                               me.selectedItem = me.nItems - 1;
-                       if(me.selectedServer)
-                               strunzone(me.selectedServer);
-                       me.selectedServer = strzone(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
-               }
-       }
-       
-       if(owned)
-       {
-               if(me.selectedServer != me.ipAddressBox.text)
-               {
-                       me.ipAddressBox.setText(me.ipAddressBox, me.selectedServer);
-                       me.ipAddressBox.cursorPos = strlen(me.selectedServer);
-                       me.ipAddressBoxFocused = -1;
-               }
-       }
-
-       if(me.ipAddressBoxFocused != me.ipAddressBox.focused)
-       {
-               if(me.ipAddressBox.focused || me.ipAddressBoxFocused < 0)
-                       ServerList_Update_favoriteButton(NULL, me);
-               me.ipAddressBoxFocused = me.ipAddressBox.focused;
-       }
-
-       SUPER(XonoticServerList).draw(me);
-}
-void ServerList_PingSort_Click(entity btn, entity me)
-{
-       me.setSortOrder(me, SLIST_FIELD_PING, +1);
-}
-void ServerList_NameSort_Click(entity btn, entity me)
-{
-       me.setSortOrder(me, SLIST_FIELD_NAME, -1); // why?
-}
-void ServerList_MapSort_Click(entity btn, entity me)
-{
-       me.setSortOrder(me, SLIST_FIELD_MAP, -1); // why?
-}
-void ServerList_PlayerSort_Click(entity btn, entity me)
-{
-       me.setSortOrder(me, SLIST_FIELD_NUMHUMANS, -1);
-}
-void ServerList_TypeSort_Click(entity btn, entity me)
-{
-       string s, t;
-       float i, m;
-       s = me.filterString;
-       m = strstrofs(s, ":", 0);
-       if(m >= 0)
-       {
-               s = substring(s, 0, m);
-               while(substring(s, m+1, 1) == " ") // skip spaces
-                       ++m;
-       }
-       else
-               s = "";
-
-       for(i = 1; ; i *= 2) // 20 modes ought to be enough for anyone
-       {
-               t = MapInfo_Type_ToString(i);
-               if(i > 1)
-                       if(t == "") // it repeats (default case)
-                       {
-                               // no type was found
-                               // choose the first one
-                               s = MapInfo_Type_ToString(1);
-                               break;
-                       }
-               if(s == t)
-               {
-                       // the type was found
-                       // choose the next one
-                       s = MapInfo_Type_ToString(i * 2);
-                       if(s == "")
-                               s = MapInfo_Type_ToString(1);
-                       break;
-               }
-       }
-
-       if(s != "")
-               s = strcat(s, ":");
-       s = strcat(s, substring(me.filterString, m+1, strlen(me.filterString) - m - 1));
-
-       me.controlledTextbox.setText(me.controlledTextbox, s);
-       me.controlledTextbox.keyDown(me.controlledTextbox, K_END, 0, 0);
-       me.controlledTextbox.keyUp(me.controlledTextbox, K_END, 0, 0);
-       //ServerList_Filter_Change(me.controlledTextbox, me);
-}
-void ServerList_Filter_Change(entity box, entity me)
-{
-       if(me.filterString)
-               strunzone(me.filterString);
-       if(box.text != "")
-               me.filterString = strzone(box.text);
-       else
-               me.filterString = string_null;
-       me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
-
-       me.ipAddressBox.setText(me.ipAddressBox, "");
-       me.ipAddressBox.cursorPos = 0;
-       me.ipAddressBoxFocused = -1;
-}
-void ServerList_Categories_Click(entity box, entity me)
-{
-       box.setChecked(box, autocvar_menu_slist_categories = !autocvar_menu_slist_categories);
-       me.refreshServerList(me, REFRESHSERVERLIST_RESORT);
-
-       me.ipAddressBox.setText(me.ipAddressBox, "");
-       me.ipAddressBox.cursorPos = 0;
-       me.ipAddressBoxFocused = -1;
-}
-void ServerList_ShowEmpty_Click(entity box, entity me)
-{
-       box.setChecked(box, me.filterShowEmpty = !me.filterShowEmpty);
-       me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
-
-       me.ipAddressBox.setText(me.ipAddressBox, "");
-       me.ipAddressBox.cursorPos = 0;
-       me.ipAddressBoxFocused = -1;
-}
-void ServerList_ShowFull_Click(entity box, entity me)
-{
-       box.setChecked(box, me.filterShowFull = !me.filterShowFull);
-       me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
-
-       me.ipAddressBox.setText(me.ipAddressBox, "");
-       me.ipAddressBox.cursorPos = 0;
-       me.ipAddressBoxFocused = -1;
-}
-void XonoticServerList_setSortOrder(entity me, float fld, float direction)
-{
-       if(me.currentSortField == fld)
-               direction = -me.currentSortOrder;
-       me.currentSortOrder = direction;
-       me.currentSortField = fld;
-       me.sortButton1.forcePressed = (fld == SLIST_FIELD_PING);
-       me.sortButton2.forcePressed = (fld == SLIST_FIELD_NAME);
-       me.sortButton3.forcePressed = (fld == SLIST_FIELD_MAP);
-       me.sortButton4.forcePressed = 0;
-       me.sortButton5.forcePressed = (fld == SLIST_FIELD_NUMHUMANS);
-       me.selectedItem = 0;
-       if(me.selectedServer)
-               strunzone(me.selectedServer);
-       me.selectedServer = string_null;
-       me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
-}
-void XonoticServerList_positionSortButton(entity me, entity btn, float theOrigin, float theSize, string theTitle, void(entity, entity) theFunc)
-{
-       vector originInLBSpace, sizeInLBSpace;
-       originInLBSpace = eY * (-me.itemHeight);
-       sizeInLBSpace = eY * me.itemHeight + eX * (1 - me.controlWidth);
-
-       vector originInDialogSpace, sizeInDialogSpace;
-       originInDialogSpace = boxToGlobal(originInLBSpace, me.Container_origin, me.Container_size);
-       sizeInDialogSpace = boxToGlobalSize(sizeInLBSpace, me.Container_size);
-
-       btn.Container_origin_x = originInDialogSpace_x + sizeInDialogSpace_x * theOrigin;
-       btn.Container_size_x   =                         sizeInDialogSpace_x * theSize;
-       btn.setText(btn, theTitle);
-       btn.onClick = theFunc;
-       btn.onClickEntity = me;
-       btn.resized = 1;
-}
-void XonoticServerList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(XonoticServerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight);
-       me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-
-       me.columnIconsOrigin = 0;
-       me.columnIconsSize = me.realFontSize_x * 4 * me.iconsSizeFactor;
-       me.columnPingSize = me.realFontSize_x * 3;
-       me.columnMapSize = me.realFontSize_x * 10;
-       me.columnTypeSize = me.realFontSize_x * 4;
-       me.columnPlayersSize = me.realFontSize_x * 5;
-       me.columnNameSize = 1 - me.columnPlayersSize - me.columnMapSize - me.columnPingSize - me.columnIconsSize - me.columnTypeSize - 5 * me.realFontSize_x;
-       me.columnPingOrigin = me.columnIconsOrigin + me.columnIconsSize + me.realFontSize_x;
-       me.columnNameOrigin = me.columnPingOrigin + me.columnPingSize + me.realFontSize_x;
-       me.columnMapOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize_x;
-       me.columnTypeOrigin = me.columnMapOrigin + me.columnMapSize + me.realFontSize_x;
-       me.columnPlayersOrigin = me.columnTypeOrigin + me.columnTypeSize + me.realFontSize_x;
-
-       me.positionSortButton(me, me.sortButton1, me.columnPingOrigin, me.columnPingSize, _("Ping"), ServerList_PingSort_Click);
-       me.positionSortButton(me, me.sortButton2, me.columnNameOrigin, me.columnNameSize, _("Host name"), ServerList_NameSort_Click);
-       me.positionSortButton(me, me.sortButton3, me.columnMapOrigin, me.columnMapSize, _("Map"), ServerList_MapSort_Click);
-       me.positionSortButton(me, me.sortButton4, me.columnTypeOrigin, me.columnTypeSize, _("Type"), ServerList_TypeSort_Click);
-       me.positionSortButton(me, me.sortButton5, me.columnPlayersOrigin, me.columnPlayersSize, _("Players"), ServerList_PlayerSort_Click);
-
-       float f;
-       f = me.currentSortField;
-       if(f >= 0)
-       {
-               me.currentSortField = -1;
-               me.setSortOrder(me, f, me.currentSortOrder); // force resetting the sort order
-       }
-}
-void ServerList_Connect_Click(entity btn, entity me)
-{
-       localcmd(sprintf("connect %s\n",
-               ((me.ipAddressBox.text != "") ?
-                       me.ipAddressBox.text : me.selectedServer
-               )
-       ));
-}
-void ServerList_Favorite_Click(entity btn, entity me)
-{
-       string ipstr;
-       ipstr = netaddress_resolve(me.ipAddressBox.text, 26000);
-       if(ipstr != "")
-       {
-               me.toggleFavorite(me, me.ipAddressBox.text);
-               me.ipAddressBoxFocused = -1;
-       }
-}
-void ServerList_Info_Click(entity btn, entity me)
-{
-       if (me.nItems != 0)
-               main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem);
-
-       vector org = boxToGlobal(eY * (me.selectedItem * me.itemHeight - me.scrollPos), me.origin, me.size);
-       vector sz = boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), me.size);
-       DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz);
-}
-void XonoticServerList_clickListBoxItem(entity me, float i, vector where)
-{
-       if(i == me.lastClickedServer)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       ServerList_Connect_Click(NULL, me);
-               }
-       me.lastClickedServer = i;
-       me.lastClickedTime = time;
-}
-void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       // layout: Ping, Server name, Map name, NP, TP, MP
-       float p, q;
-       float isv4, isv6;
-       vector theColor;
-       float theAlpha;
-       float m, pure, freeslots, j, sflags;
-       string s, typestr, versionstr, k, v, modname;
-
-       //printf("time: %f, i: %d, item: %d, nitems: %d\n", time, i, item, me.nItems);
-
-       vector oldscale = draw_scale;
-       vector oldshift = draw_shift;
-#define SET_YRANGE(start,end) \
-       draw_scale = boxToGlobalSize(eX * 1 + eY * (end - start), oldscale); \
-       draw_shift = boxToGlobal(eY * start, oldshift, oldscale);
-
-       for (j = 0; j < category_draw_count; ++j) {
-               // Matches exactly the headings with increased height.
-               if (i == category_item[j])
-                       break;
-       }
-
-       if (j < category_draw_count)
-       {
-               entity catent = RetrieveCategoryEnt(category_name[j]);
-               if(catent)
-               {
-                       SET_YRANGE(
-                               (me.categoriesHeight - 1) / (me.categoriesHeight + 1),
-                               me.categoriesHeight / (me.categoriesHeight + 1)
-                       );
-                       draw_Text(
-                               eY * me.realUpperMargin
-                               +
-#if 0
-                               eX * (me.columnNameOrigin + (me.columnNameSize - draw_TextWidth(catent.cat_string, 0, me.realFontSize)) * 0.5),
-                               catent.cat_string,
-#else
-                               eX * (me.columnNameOrigin),
-                               strcat(catent.cat_string, ":"),
-#endif
-                               me.realFontSize,
-                               SKINCOLOR_SERVERLIST_CATEGORY,
-                               SKINALPHA_SERVERLIST_CATEGORY,
-                               0
-                       );
-                       SET_YRANGE(me.categoriesHeight / (me.categoriesHeight + 1), 1);
-               }
-       }
-       
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
-       s = gethostcachestring(SLIST_FIELD_QCSTATUS, i);
-       m = tokenizebyseparator(s, ":");
-       typestr = "";
-       if(m >= 2)
-       {
-               typestr = argv(0);
-               versionstr = argv(1);
-       }
-       freeslots = -1;
-       sflags = -1;
-       modname = "";
-       pure = 0;
-       for(j = 2; j < m; ++j)
-       {
-               if(argv(j) == "")
-                       break;
-               k = substring(argv(j), 0, 1);
-               v = substring(argv(j), 1, -1);
-               if(k == "P")
-                       pure = stof(v);
-               else if(k == "S")
-                       freeslots = stof(v);
-               else if(k == "F")
-                       sflags = stof(v);
-               else if(k == "M")
-                       modname = v;
-       }
-
-#ifdef COMPAT_NO_MOD_IS_XONOTIC
-       if(modname == "")
-               modname = "Xonotic";
-#endif
-
-       /*
-       SLIST_FIELD_MOD = gethostcacheindexforkey("mod");
-       s = gethostcachestring(SLIST_FIELD_MOD, i);
-       if(s != "data")
-               if(modname == "Xonotic")
-                       modname = s;
-       */
-
-       // list the mods here on which the pure server check actually works
-       if(modname != "Xonotic")
-       if(modname != "InstaGib" || modname != "MinstaGib")
-       if(modname != "CTS")
-       if(modname != "NIX")
-       if(modname != "NewToys")
-               pure = 0;
-
-       if(gethostcachenumber(SLIST_FIELD_FREESLOTS, i) <= 0)
-               theAlpha = SKINALPHA_SERVERLIST_FULL;
-       else if(freeslots == 0)
-               theAlpha = SKINALPHA_SERVERLIST_FULL; // g_maxplayers support
-       else if (!gethostcachenumber(SLIST_FIELD_NUMHUMANS, i))
-               theAlpha = SKINALPHA_SERVERLIST_EMPTY;
-       else
-               theAlpha = 1;
-
-       p = gethostcachenumber(SLIST_FIELD_PING, i);
-#define PING_LOW 75
-#define PING_MED 200
-#define PING_HIGH 500
-       if(p < PING_LOW)
-               theColor = SKINCOLOR_SERVERLIST_LOWPING + (SKINCOLOR_SERVERLIST_MEDPING - SKINCOLOR_SERVERLIST_LOWPING) * (p / PING_LOW);
-       else if(p < PING_MED)
-               theColor = SKINCOLOR_SERVERLIST_MEDPING + (SKINCOLOR_SERVERLIST_HIGHPING - SKINCOLOR_SERVERLIST_MEDPING) * ((p - PING_LOW) / (PING_MED - PING_LOW));
-       else if(p < PING_HIGH)
-       {
-               theColor = SKINCOLOR_SERVERLIST_HIGHPING;
-               theAlpha *= 1 + (SKINALPHA_SERVERLIST_HIGHPING - 1) * ((p - PING_MED) / (PING_HIGH - PING_MED));
-       }
-       else
-       {
-               theColor = eX;
-               theAlpha *= SKINALPHA_SERVERLIST_HIGHPING;
-       }
-
-       if(gethostcachenumber(SLIST_FIELD_ISFAVORITE, i))
-       {
-               theColor = theColor * (1 - SKINALPHA_SERVERLIST_FAVORITE) + SKINCOLOR_SERVERLIST_FAVORITE * SKINALPHA_SERVERLIST_FAVORITE;
-               theAlpha = theAlpha * (1 - SKINALPHA_SERVERLIST_FAVORITE) + SKINALPHA_SERVERLIST_FAVORITE;
-       }
-
-       s = gethostcachestring(SLIST_FIELD_CNAME, i);
-
-       isv4 = isv6 = 0;
-       if(substring(s, 0, 1) == "[")
-       {
-               isv6 = 1;
-               me.seenIPv6 += 1;
-       }
-       else if(strstrofs("0123456789", substring(s, 0, 1), 0) >= 0)
-       {
-               isv4 = 1;
-               me.seenIPv4 += 1;
-       }
-
-       q = stof(substring(crypto_getencryptlevel(s), 0, 1));
-       if((q <= 0 && cvar("crypto_aeslevel") >= 3) || (q >= 3 && cvar("crypto_aeslevel") <= 0))
-       {
-               theColor = SKINCOLOR_SERVERLIST_IMPOSSIBLE;
-               theAlpha = SKINALPHA_SERVERLIST_IMPOSSIBLE;
-       }
-
-       if(q == 1)
-       {
-               if(cvar("crypto_aeslevel") >= 2)
-                       q |= 4;
-       }
-       if(q == 2)
-       {
-               if(cvar("crypto_aeslevel") >= 1)
-                       q |= 4;
-       }
-       if(q == 3)
-               q = 5;
-       else if(q >= 3)
-               q -= 2;
-       // possible status:
-       // 0: crypto off
-       // 1: AES possible
-       // 2: AES recommended but not available
-       // 3: AES possible and will be used
-       // 4: AES recommended and will be used
-       // 5: AES required
-
-       // --------------
-       //  RENDER ICONS
-       // --------------
-       vector iconSize = '0 0 0';
-       iconSize_y = me.realFontSize_y * me.iconsSizeFactor;
-       iconSize_x = me.realFontSize_x * me.iconsSizeFactor;
-
-       vector iconPos = '0 0 0';
-       iconPos_x = (me.columnIconsSize - 3 * iconSize_x) * 0.5;
-       iconPos_y = (1 - iconSize_y) * 0.5;
-
-       string n;
-
-       if (!(me.seenIPv4 && me.seenIPv6))
-       {
-               iconPos_x += iconSize_x * 0.5;
-       }
-       else if(me.seenIPv4 && me.seenIPv6)
-       {
-               n = string_null;
-               if(isv6)
-                       draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_ipv6"), 0); // PRECACHE_PIC_MIPMAP
-               else if(isv4)
-                       draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_ipv4"), 0); // PRECACHE_PIC_MIPMAP
-               if(n)
-                       draw_Picture(iconPos, n, iconSize, '1 1 1', 1);
-               iconPos_x += iconSize_x;
-       }
-
-       if(q > 0)
-       {
-               draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_aeslevel", ftos(q)), 0); // PRECACHE_PIC_MIPMAP
-               draw_Picture(iconPos, n, iconSize, '1 1 1', 1);
-       }
-       iconPos_x += iconSize_x;
-
-       if(modname == "Xonotic")
-       {
-               if(pure == 0)
-               {
-                       draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_pure1"), PRECACHE_PIC_MIPMAP);
-                       draw_Picture(iconPos, n, iconSize, '1 1 1', 1);
-               }
-       }
-       else
-       {
-               draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_mod_", modname), PRECACHE_PIC_MIPMAP);
-               if(draw_PictureSize(n) == '0 0 0')
-                       draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_mod_"), PRECACHE_PIC_MIPMAP);
-               if(pure == 0)
-                       draw_Picture(iconPos, n, iconSize, '1 1 1', 1);
-               else
-                       draw_Picture(iconPos, n, iconSize, '1 1 1', SKINALPHA_SERVERLIST_ICON_NONPURE);
-       }
-       iconPos_x += iconSize_x;
-
-       if(sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS))
-       {
-               draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_stats1"), 0); // PRECACHE_PIC_MIPMAP
-               draw_Picture(iconPos, n, iconSize, '1 1 1', 1);
-       }
-       iconPos_x += iconSize_x;
-       
-       // --------------
-       //  RENDER TEXT
-       // --------------
-       
-       // ping
-       s = ftos(p);
-       draw_Text(me.realUpperMargin * eY + (me.columnPingOrigin + me.columnPingSize - draw_TextWidth(s, 0, me.realFontSize)) * eX, s, me.realFontSize, theColor, theAlpha, 0);
-
-       // server name
-       s = draw_TextShortenToWidth(gethostcachestring(SLIST_FIELD_NAME, i), me.columnNameSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, me.realFontSize, theColor, theAlpha, 0);
-
-       // server map
-       s = draw_TextShortenToWidth(gethostcachestring(SLIST_FIELD_MAP, i), me.columnMapSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin * eY + (me.columnMapOrigin + (me.columnMapSize - draw_TextWidth(s, 0, me.realFontSize)) * 0.5) * eX, s, me.realFontSize, theColor, theAlpha, 0);
-
-       // server gametype
-       s = draw_TextShortenToWidth(typestr, me.columnTypeSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin * eY + (me.columnTypeOrigin + (me.columnTypeSize - draw_TextWidth(s, 0, me.realFontSize)) * 0.5) * eX, s, me.realFontSize, theColor, theAlpha, 0);
-
-       // server playercount
-       s = strcat(ftos(gethostcachenumber(SLIST_FIELD_NUMHUMANS, i)), "/", ftos(gethostcachenumber(SLIST_FIELD_MAXPLAYERS, i)));
-       draw_Text(me.realUpperMargin * eY + (me.columnPlayersOrigin + (me.columnPlayersSize - draw_TextWidth(s, 0, me.realFontSize)) * 0.5) * eX, s, me.realFontSize, theColor, theAlpha, 0);
-}
-
-float XonoticServerList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       vector org, sz;
-
-       org = boxToGlobal(eY * (me.selectedItem * me.itemHeight - me.scrollPos), me.origin, me.size);
-       sz = boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), me.size);
-
-       if(scan == K_ENTER || scan == K_KP_ENTER)
-       {
-               ServerList_Connect_Click(NULL, me);
-               return 1;
-       }
-       else if(scan == K_MOUSE2 || scan == K_SPACE)
-       {
-               if(me.nItems != 0)
-               {
-                       main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem);
-                       DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz);
-                       return 1;
-               }
-               return 0;
-       }
-       else if(scan == K_INS || scan == K_MOUSE3 || scan == K_KP_INS)
-       {
-               if(me.nItems != 0)
-               {
-                       me.toggleFavorite(me, me.selectedServer);
-                       me.ipAddressBoxFocused = -1;
-                       return 1;
-               }
-               return 0;
-       }
-       else if(SUPER(XonoticServerList).keyDown(me, scan, ascii, shift))
-               return 1;
-       else if(!me.controlledTextbox)
-               return 0;
-       else
-               return me.controlledTextbox.keyDown(me.controlledTextbox, scan, ascii, shift);
-}
-
-float XonoticServerList_getTotalHeight(entity me) {
-       float num_normal_rows = me.nItems;
-       float num_headers = category_draw_count;
-       return me.itemHeight * (num_normal_rows + me.categoriesHeight * num_headers);
-}
-float XonoticServerList_getItemAtPos(entity me, float pos) {
-       pos = pos / me.itemHeight;
-       float i;
-       for (i = category_draw_count - 1; i >= 0; --i) {
-               float itemidx = category_item[i];
-               float itempos = i * me.categoriesHeight + category_item[i];
-               if (pos >= itempos + me.categoriesHeight + 1)
-                       return itemidx + 1 + floor(pos - (itempos + me.categoriesHeight + 1));
-               if (pos >= itempos)
-                       return itemidx;
-       }
-       // No category matches? Note that category 0 is... 0. Therefore no headings exist at all.
-       return floor(pos);
-}
-float XonoticServerList_getItemStart(entity me, float item) {
-       float i;
-       for (i = category_draw_count - 1; i >= 0; --i) {
-               float itemidx = category_item[i];
-               float itempos = i * me.categoriesHeight + category_item[i];
-               if (item >= itemidx + 1)
-                       return (itempos + me.categoriesHeight + 1 + item - (itemidx + 1)) * me.itemHeight;
-               if (item >= itemidx)
-                       return itempos * me.itemHeight;
-       }
-       // No category matches? Note that category 0 is... 0. Therefore no headings exist at all.
-       return item * me.itemHeight;
-}
-float XonoticServerList_getItemHeight(entity me, float item) {
-       float i;
-       for (i = 0; i < category_draw_count; ++i) {
-               // Matches exactly the headings with increased height.
-               if (item == category_item[i])
-                       return me.itemHeight * (me.categoriesHeight + 1);
-       }
-       return me.itemHeight;
-}
-
-#endif
diff --git a/qcsrc/menu/xonotic/serverlist.qc b/qcsrc/menu/xonotic/serverlist.qc
new file mode 100644 (file)
index 0000000..c6c53cc
--- /dev/null
@@ -0,0 +1,1317 @@
+#ifdef INTERFACE
+CLASS(XonoticServerList) EXTENDS(XonoticListBox)
+       METHOD(XonoticServerList, configureXonoticServerList, void(entity))
+       ATTRIB(XonoticServerList, rowsPerItem, float, 1)
+       METHOD(XonoticServerList, draw, void(entity))
+       METHOD(XonoticServerList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticServerList, doubleClickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticServerList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticServerList, keyDown, float(entity, float, float, float))
+       METHOD(XonoticServerList, toggleFavorite, void(entity, string))
+
+       ATTRIB(XonoticServerList, iconsSizeFactor, float, 0.85)
+
+       ATTRIB(XonoticServerList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticServerList, realUpperMargin, float, 0)
+       ATTRIB(XonoticServerList, columnIconsOrigin, float, 0)
+       ATTRIB(XonoticServerList, columnIconsSize, float, 0)
+       ATTRIB(XonoticServerList, columnPingOrigin, float, 0)
+       ATTRIB(XonoticServerList, columnPingSize, float, 0)
+       ATTRIB(XonoticServerList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticServerList, columnNameSize, float, 0)
+       ATTRIB(XonoticServerList, columnMapOrigin, float, 0)
+       ATTRIB(XonoticServerList, columnMapSize, float, 0)
+       ATTRIB(XonoticServerList, columnTypeOrigin, float, 0)
+       ATTRIB(XonoticServerList, columnTypeSize, float, 0)
+       ATTRIB(XonoticServerList, columnPlayersOrigin, float, 0)
+       ATTRIB(XonoticServerList, columnPlayersSize, float, 0)
+
+       ATTRIB(XonoticServerList, selectedServer, string, string_null) // to restore selected server when needed
+       METHOD(XonoticServerList, setSelected, void(entity, float))
+       METHOD(XonoticServerList, setSortOrder, void(entity, float, float))
+       ATTRIB(XonoticServerList, filterShowEmpty, float, 1)
+       ATTRIB(XonoticServerList, filterShowFull, float, 1)
+       ATTRIB(XonoticServerList, filterString, string, string_null)
+       ATTRIB(XonoticServerList, controlledTextbox, entity, NULL)
+       ATTRIB(XonoticServerList, ipAddressBox, entity, NULL)
+       ATTRIB(XonoticServerList, favoriteButton, entity, NULL)
+       ATTRIB(XonoticServerList, nextRefreshTime, float, 0)
+       METHOD(XonoticServerList, refreshServerList, void(entity, float)) // refresh mode: REFRESHSERVERLIST_*
+       ATTRIB(XonoticServerList, needsRefresh, float, 1)
+       METHOD(XonoticServerList, focusEnter, void(entity))
+       METHOD(XonoticServerList, positionSortButton, void(entity, entity, float, float, string, void(entity, entity)))
+       ATTRIB(XonoticServerList, sortButton1, entity, NULL)
+       ATTRIB(XonoticServerList, sortButton2, entity, NULL)
+       ATTRIB(XonoticServerList, sortButton3, entity, NULL)
+       ATTRIB(XonoticServerList, sortButton4, entity, NULL)
+       ATTRIB(XonoticServerList, sortButton5, entity, NULL)
+       ATTRIB(XonoticServerList, connectButton, entity, NULL)
+       ATTRIB(XonoticServerList, infoButton, entity, NULL)
+       ATTRIB(XonoticServerList, currentSortOrder, float, 0)
+       ATTRIB(XonoticServerList, currentSortField, float, -1)
+
+       ATTRIB(XonoticServerList, ipAddressBoxFocused, float, -1)
+
+       ATTRIB(XonoticServerList, seenIPv4, float, 0)
+       ATTRIB(XonoticServerList, seenIPv6, float, 0)
+       ATTRIB(XonoticServerList, categoriesHeight, float, 1.25)
+
+       METHOD(XonoticServerList, getTotalHeight, float(entity))
+       METHOD(XonoticServerList, getItemAtPos, float(entity, float))
+       METHOD(XonoticServerList, getItemStart, float(entity, float))
+       METHOD(XonoticServerList, getItemHeight, float(entity, float))
+ENDCLASS(XonoticServerList)
+entity makeXonoticServerList();
+
+#ifndef IMPLEMENTATION
+float autocvar_menu_slist_categories;
+float autocvar_menu_slist_categories_onlyifmultiple;
+float autocvar_menu_slist_purethreshold;
+float autocvar_menu_slist_modimpurity;
+float autocvar_menu_slist_recommendations;
+float autocvar_menu_slist_recommendations_maxping;
+float autocvar_menu_slist_recommendations_minfreeslots;
+float autocvar_menu_slist_recommendations_minhumans;
+float autocvar_menu_slist_recommendations_purethreshold;
+
+// server cache fields
+#define SLIST_FIELDS \
+       SLIST_FIELD(CNAME,       "cname") \
+       SLIST_FIELD(PING,        "ping") \
+       SLIST_FIELD(GAME,        "game") \
+       SLIST_FIELD(MOD,         "mod") \
+       SLIST_FIELD(MAP,         "map") \
+       SLIST_FIELD(NAME,        "name") \
+       SLIST_FIELD(MAXPLAYERS,  "maxplayers") \
+       SLIST_FIELD(NUMPLAYERS,  "numplayers") \
+       SLIST_FIELD(NUMHUMANS,   "numhumans") \
+       SLIST_FIELD(NUMBOTS,     "numbots") \
+       SLIST_FIELD(PROTOCOL,    "protocol") \
+       SLIST_FIELD(FREESLOTS,   "freeslots") \
+       SLIST_FIELD(PLAYERS,     "players") \
+       SLIST_FIELD(QCSTATUS,    "qcstatus") \
+       SLIST_FIELD(CATEGORY,    "category") \
+       SLIST_FIELD(ISFAVORITE,  "isfavorite")
+
+#define SLIST_FIELD(suffix,name) float SLIST_FIELD_##suffix;
+SLIST_FIELDS
+#undef SLIST_FIELD
+
+const float REFRESHSERVERLIST_RESORT = 0;    // sort the server list again to update for changes to e.g. favorite status, categories
+const float REFRESHSERVERLIST_REFILTER = 1;  // ..., also update filter and sort criteria
+const float REFRESHSERVERLIST_ASK = 2;       // ..., also suggest querying servers now
+const float REFRESHSERVERLIST_RESET = 3;     // ..., also clear the list first
+
+// function declarations
+float IsServerInList(string list, string srv);
+#define IsFavorite(srv) IsServerInList(cvar_string("net_slist_favorites"), srv)
+#define IsPromoted(srv) IsServerInList(_Nex_ExtResponseSystem_PromotedServers, srv)
+#define IsRecommended(srv) IsServerInList(_Nex_ExtResponseSystem_RecommendedServers, srv)
+
+entity RetrieveCategoryEnt(float catnum);
+
+float CheckCategoryOverride(float cat);
+float CheckCategoryForEntry(float entry);
+float m_gethostcachecategory(float entry) { return CheckCategoryOverride(CheckCategoryForEntry(entry)); }
+
+void RegisterSLCategories();
+
+void ServerList_Connect_Click(entity btn, entity me);
+void ServerList_Categories_Click(entity box, entity me);
+void ServerList_ShowEmpty_Click(entity box, entity me);
+void ServerList_ShowFull_Click(entity box, entity me);
+void ServerList_Filter_Change(entity box, entity me);
+void ServerList_Favorite_Click(entity btn, entity me);
+void ServerList_Info_Click(entity btn, entity me);
+void ServerList_Update_favoriteButton(entity btn, entity me);
+
+// fields for category entities
+const float MAX_CATEGORIES = 9;
+const float CATEGORY_FIRST = 1;
+entity categories[MAX_CATEGORIES];
+float category_ent_count;
+.string cat_name;
+.string cat_string;
+.string cat_enoverride_string;
+.string cat_dioverride_string;
+.float cat_enoverride;
+.float cat_dioverride;
+
+// fields for drawing categories
+float category_name[MAX_CATEGORIES];
+float category_item[MAX_CATEGORIES];
+float category_draw_count;
+
+#define SLIST_CATEGORIES \
+       SLIST_CATEGORY(CAT_FAVORITED,    "",            "",             ZCTX(_("SLCAT^Favorites"))) \
+       SLIST_CATEGORY(CAT_RECOMMENDED,  "",            "",             ZCTX(_("SLCAT^Recommended"))) \
+       SLIST_CATEGORY(CAT_NORMAL,       "",            "CAT_SERVERS",  ZCTX(_("SLCAT^Normal Servers"))) \
+       SLIST_CATEGORY(CAT_SERVERS,      "CAT_NORMAL",  "CAT_SERVERS",  ZCTX(_("SLCAT^Servers"))) \
+       SLIST_CATEGORY(CAT_XPM,          "CAT_NORMAL",  "CAT_SERVERS",  ZCTX(_("SLCAT^Competitive Mode"))) \
+       SLIST_CATEGORY(CAT_MODIFIED,     "",            "CAT_SERVERS",  ZCTX(_("SLCAT^Modified Servers"))) \
+       SLIST_CATEGORY(CAT_OVERKILL,     "",            "CAT_SERVERS",  ZCTX(_("SLCAT^Overkill Mode"))) \
+       SLIST_CATEGORY(CAT_INSTAGIB,     "",            "CAT_SERVERS",  ZCTX(_("SLCAT^InstaGib Mode"))) \
+       SLIST_CATEGORY(CAT_DEFRAG,       "",            "CAT_SERVERS",  ZCTX(_("SLCAT^Defrag Mode")))
+
+#define SLIST_CATEGORY_AUTOCVAR(name) autocvar_menu_slist_categories_##name##_override
+#define SLIST_CATEGORY(name,enoverride,dioverride,str) \
+       float name; \
+       string SLIST_CATEGORY_AUTOCVAR(name) = enoverride;
+SLIST_CATEGORIES
+#undef SLIST_CATEGORY
+
+#endif
+#endif
+#ifdef IMPLEMENTATION
+
+void RegisterSLCategories()
+{
+       entity cat;
+       #define SLIST_CATEGORY(name,enoverride,dioverride,str) \
+               SET_FIELD_COUNT(name, CATEGORY_FIRST, category_ent_count) \
+               CHECK_MAX_COUNT(name, MAX_CATEGORIES, category_ent_count, "SLIST_CATEGORY") \
+               cat = spawn(); \
+               categories[name - 1] = cat; \
+               cat.classname = "slist_category"; \
+               cat.cat_name = strzone(#name); \
+               cat.cat_enoverride_string = strzone(SLIST_CATEGORY_AUTOCVAR(name)); \
+               cat.cat_dioverride_string = strzone(dioverride); \
+               cat.cat_string = strzone(str);
+       SLIST_CATEGORIES
+       #undef SLIST_CATEGORY
+
+       float i, x, catnum;
+       string s;
+
+       #define PROCESS_OVERRIDE(override_string,override_field) \
+               for(i = 0; i < category_ent_count; ++i) \
+               { \
+                       s = categories[i].override_string; \
+                       if((s != "") && (s != categories[i].cat_name)) \
+                       { \
+                               catnum = 0; \
+                               for(x = 0; x < category_ent_count; ++x) \
+                               { if(categories[x].cat_name == s) { \
+                                       catnum = (x+1); \
+                                       break; \
+                               } } \
+                               if(catnum) \
+                               { \
+                                       strunzone(categories[i].override_string); \
+                                       categories[i].override_field = catnum; \
+                                       continue; \
+                               } \
+                               else \
+                               { \
+                                       printf( \
+                                               "RegisterSLCategories(): Improper override '%s' for category '%s'!\n", \
+                                               s, \
+                                               categories[i].cat_name \
+                                       ); \
+                               } \
+                       } \
+                       strunzone(categories[i].override_string); \
+                       categories[i].override_field = 0; \
+               }
+       PROCESS_OVERRIDE(cat_enoverride_string, cat_enoverride)
+       PROCESS_OVERRIDE(cat_dioverride_string, cat_dioverride)
+       #undef PROCESS_OVERRIDE
+}
+
+// Supporting Functions
+entity RetrieveCategoryEnt(float catnum)
+{
+       if((catnum > 0) && (catnum <= category_ent_count))
+       {
+               return categories[catnum - 1];
+       }
+       else
+       {
+               error(sprintf("RetrieveCategoryEnt(%d): Improper category number!\n", catnum));
+               return world;
+       }
+}
+
+float IsServerInList(string list, string srv)
+{
+       string p;
+       float i, n;
+       if(srv == "")
+               return false;
+       srv = netaddress_resolve(srv, 26000);
+       if(srv == "")
+               return false;
+       p = crypto_getidfp(srv);
+       n = tokenize_console(list);
+       for(i = 0; i < n; ++i)
+       {
+               if(substring(argv(i), 0, 1) != "[" && strlen(argv(i)) == 44 && strstrofs(argv(i), ".", 0) < 0)
+               {
+                       if(p)
+                               if(argv(i) == p)
+                                       return true;
+               }
+               else
+               {
+                       if(srv == netaddress_resolve(argv(i), 26000))
+                               return true;
+               }
+       }
+       return false;
+}
+
+float CheckCategoryOverride(float cat)
+{
+       entity catent = RetrieveCategoryEnt(cat);
+       if(catent)
+       {
+               float override = (autocvar_menu_slist_categories ? catent.cat_enoverride : catent.cat_dioverride);
+               if(override) { return override; }
+               else { return cat; }
+       }
+       else
+       {
+               error(sprintf("CheckCategoryOverride(%d): Improper category number!\n", cat));
+               return cat;
+       }
+}
+
+float CheckCategoryForEntry(float entry)
+{
+       string s, k, v, modtype = "";
+       float j, m, impure = 0, freeslots = 0, sflags = 0;
+       s = gethostcachestring(SLIST_FIELD_QCSTATUS, entry);
+       m = tokenizebyseparator(s, ":");
+
+       for(j = 2; j < m; ++j)
+       {
+               if(argv(j) == "") { break; }
+               k = substring(argv(j), 0, 1);
+               v = substring(argv(j), 1, -1);
+               switch(k)
+               {
+                       case "P": { impure = stof(v); break; }
+                       case "S": { freeslots = stof(v); break; }
+                       case "F": { sflags = stof(v); break; }
+                       case "M": { modtype = strtolower(v); break; }
+               }
+       }
+
+       if(modtype != "xonotic") { impure += autocvar_menu_slist_modimpurity; }
+
+       // check if this server is favorited
+       if(gethostcachenumber(SLIST_FIELD_ISFAVORITE, entry)) { return CAT_FAVORITED; }
+
+       // now check if it's recommended
+       if(autocvar_menu_slist_recommendations)
+       {
+               string cname = gethostcachestring(SLIST_FIELD_CNAME, entry);
+
+               if(IsPromoted(cname)) { return CAT_RECOMMENDED; }
+               else
+               {
+                       float recommended = 0;
+                       if(autocvar_menu_slist_recommendations & 1)
+                       {
+                               if(IsRecommended(cname)) { ++recommended; }
+                               else { --recommended; }
+                       }
+                       if(autocvar_menu_slist_recommendations & 2)
+                       {
+                               if(
+                                       ///// check for minimum free slots
+                                       (freeslots >= autocvar_menu_slist_recommendations_minfreeslots)
+
+                                       && // check for purity requirement
+                                       (
+                                               (autocvar_menu_slist_recommendations_purethreshold < 0)
+                                               ||
+                                               (impure <= autocvar_menu_slist_recommendations_purethreshold)
+                                       )
+
+                                       && // check for minimum amount of humans
+                                       (
+                                               gethostcachenumber(SLIST_FIELD_NUMHUMANS, entry)
+                                               >=
+                                               autocvar_menu_slist_recommendations_minhumans
+                                       )
+
+                                       && // check for maximum latency
+                                       (
+                                               gethostcachenumber(SLIST_FIELD_PING, entry)
+                                               <=
+                                               autocvar_menu_slist_recommendations_maxping
+                                       )
+                               )
+                                       { ++recommended; }
+                               else
+                                       { --recommended; }
+                       }
+                       if(recommended > 0) { return CAT_RECOMMENDED; }
+               }
+       }
+
+       // if not favorited or recommended, check modname
+       if(modtype != "xonotic")
+       {
+               switch(modtype)
+               {
+                       // old servers which don't report their mod name are considered modified now
+                       case "": { return CAT_MODIFIED; }
+
+                       case "xpm": { return CAT_XPM; }
+                       case "minstagib":
+                       case "instagib": { return CAT_INSTAGIB; }
+                       case "overkill": { return CAT_OVERKILL; }
+                       //case "nix": { return CAT_NIX; }
+                       //case "newtoys": { return CAT_NEWTOYS; }
+
+                       // "cts" is allowed as compat, xdf is replacement
+                       case "cts":
+                       case "xdf": { return CAT_DEFRAG; }
+
+                       default: { dprintf("Found strange mod type: %s\n", modtype); return CAT_MODIFIED; }
+               }
+       }
+
+       // must be normal or impure server
+       return ((impure > autocvar_menu_slist_purethreshold) ? CAT_MODIFIED : CAT_NORMAL);
+}
+
+void XonoticServerList_toggleFavorite(entity me, string srv)
+{
+       string s, s0, s1, s2, srv_resolved, p;
+       float i, n, f;
+       srv_resolved = netaddress_resolve(srv, 26000);
+       p = crypto_getidfp(srv_resolved);
+       s = cvar_string("net_slist_favorites");
+       n = tokenize_console(s);
+       f = 0;
+       for(i = 0; i < n; ++i)
+       {
+               if(substring(argv(i), 0, 1) != "[" && strlen(argv(i)) == 44 && strstrofs(argv(i), ".", 0) < 0)
+               {
+                       if(p)
+                               if(argv(i) != p)
+                                       continue;
+               }
+               else
+               {
+                       if(srv_resolved != netaddress_resolve(argv(i), 26000))
+                               continue;
+               }
+               s0 = s1 = s2 = "";
+               if(i > 0)
+                       s0 = substring(s, 0, argv_end_index(i - 1));
+               if(i < n-1)
+                       s2 = substring(s, argv_start_index(i + 1), -1);
+               if(s0 != "" && s2 != "")
+                       s1 = " ";
+               cvar_set("net_slist_favorites", strcat(s0, s1, s2));
+               s = cvar_string("net_slist_favorites");
+               n = tokenize_console(s);
+               f = 1;
+               --i;
+       }
+
+       if(!f)
+       {
+               s1 = "";
+               if(s != "")
+                       s1 = " ";
+               if(p)
+                       cvar_set("net_slist_favorites", strcat(s, s1, p));
+               else
+                       cvar_set("net_slist_favorites", strcat(s, s1, srv));
+       }
+
+       me.refreshServerList(me, REFRESHSERVERLIST_RESORT);
+}
+
+void ServerList_Update_favoriteButton(entity btn, entity me)
+{
+       me.favoriteButton.setText(me.favoriteButton,
+               (IsFavorite(me.ipAddressBox.text) ?
+                       _("Remove") : _("Favorite")
+               )
+       );
+}
+
+entity makeXonoticServerList()
+{
+       entity me;
+       me = spawnXonoticServerList();
+       me.configureXonoticServerList(me);
+       return me;
+}
+void XonoticServerList_configureXonoticServerList(entity me)
+{
+       me.configureXonoticListBox(me);
+
+       // update field ID's
+       #define SLIST_FIELD(suffix,name) SLIST_FIELD_##suffix = gethostcacheindexforkey(name);
+       SLIST_FIELDS
+       #undef SLIST_FIELD
+
+       // clear list
+       me.nItems = 0;
+}
+void XonoticServerList_setSelected(entity me, float i)
+{
+       float save;
+       save = me.selectedItem;
+       SUPER(XonoticServerList).setSelected(me, i);
+       /*
+       if(me.selectedItem == save)
+               return;
+       */
+       if(me.nItems == 0)
+               return;
+       if(gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT) != me.nItems)
+               return; // sorry, it would be wrong
+
+       if(me.selectedServer)
+               strunzone(me.selectedServer);
+       me.selectedServer = strzone(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
+
+       me.ipAddressBox.setText(me.ipAddressBox, me.selectedServer);
+       me.ipAddressBox.cursorPos = strlen(me.selectedServer);
+       me.ipAddressBoxFocused = -1;
+}
+void XonoticServerList_refreshServerList(entity me, float mode)
+{
+       //print("refresh of type ", ftos(mode), "\n");
+
+       if(mode >= REFRESHSERVERLIST_REFILTER)
+       {
+               float m, i, n;
+               float listflags = 0;
+               string s, typestr, modstr;
+
+               s = me.filterString;
+
+               m = strstrofs(s, ":", 0);
+               if(m >= 0)
+               {
+                       typestr = substring(s, 0, m);
+                       s = substring(s, m + 1, strlen(s) - m - 1);
+                       while(substring(s, 0, 1) == " ")
+                               s = substring(s, 1, strlen(s) - 1);
+               }
+               else
+                       typestr = "";
+
+               modstr = cvar_string("menu_slist_modfilter");
+
+               m = SLIST_MASK_AND - 1;
+               resethostcachemasks();
+
+               // ping: reject negative ping (no idea why this happens in the first place, engine bug)
+               sethostcachemasknumber(++m, SLIST_FIELD_PING, 0, SLIST_TEST_GREATEREQUAL);
+
+               // show full button
+               if(!me.filterShowFull)
+               {
+                       sethostcachemasknumber(++m, SLIST_FIELD_FREESLOTS, 1, SLIST_TEST_GREATEREQUAL); // legacy
+                       sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, ":S0:", SLIST_TEST_NOTCONTAIN); // g_maxplayers support
+               }
+
+               // show empty button
+               if(!me.filterShowEmpty)
+                       sethostcachemasknumber(++m, SLIST_FIELD_NUMHUMANS, 1, SLIST_TEST_GREATEREQUAL);
+
+               // gametype filtering
+               if(typestr != "")
+                       sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, strcat(typestr, ":"), SLIST_TEST_STARTSWITH);
+
+               // mod filtering
+               if(modstr != "")
+               {
+                       if(substring(modstr, 0, 1) == "!")
+                               sethostcachemaskstring(++m, SLIST_FIELD_MOD, resolvemod(substring(modstr, 1, strlen(modstr) - 1)), SLIST_TEST_NOTEQUAL);
+                       else
+                               sethostcachemaskstring(++m, SLIST_FIELD_MOD, resolvemod(modstr), SLIST_TEST_EQUAL);
+               }
+
+               // server banning
+               n = tokenizebyseparator(_Nex_ExtResponseSystem_BannedServers, " ");
+               for(i = 0; i < n; ++i)
+                       if(argv(i) != "")
+                               sethostcachemaskstring(++m, SLIST_FIELD_CNAME, argv(i), SLIST_TEST_NOTSTARTSWITH);
+
+               m = SLIST_MASK_OR - 1;
+               if(s != "")
+               {
+                       sethostcachemaskstring(++m, SLIST_FIELD_NAME, s, SLIST_TEST_CONTAINS);
+                       sethostcachemaskstring(++m, SLIST_FIELD_MAP, s, SLIST_TEST_CONTAINS);
+                       sethostcachemaskstring(++m, SLIST_FIELD_PLAYERS, s, SLIST_TEST_CONTAINS);
+                       sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, strcat(s, ":"), SLIST_TEST_STARTSWITH);
+               }
+
+               // sorting flags
+               //listflags |= SLSF_FAVORITES;
+               listflags |= SLSF_CATEGORIES;
+               if(me.currentSortOrder < 0) { listflags |= SLSF_DESCENDING; }
+               sethostcachesort(me.currentSortField, listflags);
+       }
+
+       resorthostcache();
+       if(mode >= REFRESHSERVERLIST_ASK)
+               refreshhostcache(mode >= REFRESHSERVERLIST_RESET);
+}
+void XonoticServerList_focusEnter(entity me)
+{
+       SUPER(XonoticServerList).focusEnter(me);
+       if(time < me.nextRefreshTime)
+       {
+               //print("sorry, no refresh yet\n");
+               return;
+       }
+       me.nextRefreshTime = time + 10;
+       me.refreshServerList(me, REFRESHSERVERLIST_ASK);
+}
+
+void XonoticServerList_draw(entity me)
+{
+       float i, found, owned;
+
+       if(_Nex_ExtResponseSystem_BannedServersNeedsRefresh)
+       {
+               if(!me.needsRefresh)
+                       me.needsRefresh = 2;
+               _Nex_ExtResponseSystem_BannedServersNeedsRefresh = 0;
+       }
+
+       if(_Nex_ExtResponseSystem_PromotedServersNeedsRefresh)
+       {
+               if(!me.needsRefresh)
+                       me.needsRefresh = 3;
+               _Nex_ExtResponseSystem_PromotedServersNeedsRefresh = 0;
+       }
+
+       if(_Nex_ExtResponseSystem_RecommendedServersNeedsRefresh)
+       {
+               if(!me.needsRefresh)
+                       me.needsRefresh = 3;
+               _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh = 0;
+       }
+
+       if(me.currentSortField == -1)
+       {
+               me.setSortOrder(me, SLIST_FIELD_PING, +1);
+               me.refreshServerList(me, REFRESHSERVERLIST_RESET);
+       }
+       else if(me.needsRefresh == 1)
+       {
+               me.needsRefresh = 2; // delay by one frame to make sure "slist" has been executed
+       }
+       else if(me.needsRefresh == 2)
+       {
+               me.needsRefresh = 0;
+               me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
+       }
+       else if(me.needsRefresh == 3)
+       {
+               me.needsRefresh = 0;
+               me.refreshServerList(me, REFRESHSERVERLIST_RESORT);
+       }
+
+       owned = ((me.selectedServer == me.ipAddressBox.text) && (me.ipAddressBox.text != ""));
+
+       for(i = 0; i < category_draw_count; ++i) { category_name[i] = -1; category_item[i] = -1; }
+       category_draw_count = 0;
+
+       if(autocvar_menu_slist_categories >= 0) // if less than 0, don't even draw a category heading for favorites
+       {
+               float itemcount = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT);
+               me.nItems = itemcount;
+
+               //float visible = floor(me.scrollPos / me.itemHeight);
+               // ^ unfortunately no such optimization can be made-- we must process through the
+               // entire list, otherwise there is no way to know which item is first in its category.
+
+               // binary search method suggested by div
+               float x;
+               float begin = 0;
+               for(x = 1; x <= category_ent_count; ++x) {
+                       float first = begin;
+                       float last = (itemcount - 1);
+                       if (first > last) {
+                               // List is empty.
+                               break;
+                       }
+                       float catf = gethostcachenumber(SLIST_FIELD_CATEGORY, first);
+                       float catl = gethostcachenumber(SLIST_FIELD_CATEGORY, last);
+                       if (catf > x) {
+                               // The first one is already > x.
+                               // Therefore, category x does not exist.
+                               // Higher numbered categories do exist though.
+                       } else if (catl < x) {
+                               // The last one is < x.
+                               // Thus this category - and any following -
+                               // don't exist.
+                               break;
+                       } else if (catf == x) {
+                               // Starts at first. This breaks the loop
+                               // invariant in the binary search and thus has
+                               // to be handled separately.
+                               if(gethostcachenumber(SLIST_FIELD_CATEGORY, first) != x)
+                                       error("Category mismatch I");
+                               if(first > 0)
+                                       if(gethostcachenumber(SLIST_FIELD_CATEGORY, first - 1) == x)
+                                               error("Category mismatch II");
+                               category_name[category_draw_count] = x;
+                               category_item[category_draw_count] = first;
+                               ++category_draw_count;
+                               begin = first + 1;
+                       } else {
+                               // At this point, catf <= x < catl, thus
+                               // catf < catl, thus first < last.
+                               // INVARIANTS:
+                               // last - first >= 1
+                               // catf == gethostcachenumber(SLIST_FIELD_CATEGORY(first)
+                               // catl == gethostcachenumber(SLIST_FIELD_CATEGORY(last)
+                               // catf < x
+                               // catl >= x
+                               while (last - first > 1) {
+                                       float middle = floor((first + last) / 2);
+                                       // By loop condition, middle != first && middle != last.
+                                       float cat = gethostcachenumber(SLIST_FIELD_CATEGORY, middle);
+                                       if (cat >= x) {
+                                               last = middle;
+                                               catl = cat;
+                                       } else {
+                                               first = middle;
+                                               catf = cat;
+                                       }
+                               }
+                               if (catl == x) {
+                                       if(gethostcachenumber(SLIST_FIELD_CATEGORY, last) != x)
+                                               error("Category mismatch III");
+                                       if(last > 0)
+                                               if(gethostcachenumber(SLIST_FIELD_CATEGORY, last - 1) == x)
+                                                       error("Category mismatch IV");
+                                       category_name[category_draw_count] = x;
+                                       category_item[category_draw_count] = last;
+                                       ++category_draw_count;
+                                       begin = last + 1; // already scanned through these, skip 'em
+                               }
+                               else
+                                       begin = last; // already scanned through these, skip 'em
+                       }
+               }
+               if(autocvar_menu_slist_categories_onlyifmultiple && (category_draw_count == 1))
+               {
+                       category_name[0] = -1;
+                       category_item[0] = -1;
+                       category_draw_count = 0;
+                       me.nItems = itemcount;
+               }
+       }
+       else { me.nItems = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT); }
+
+       me.connectButton.disabled = ((me.nItems == 0) && (me.ipAddressBox.text == ""));
+       me.infoButton.disabled = ((me.nItems == 0) || !owned);
+       me.favoriteButton.disabled = ((me.nItems == 0) && (me.ipAddressBox.text == ""));
+
+       found = 0;
+       if(me.selectedServer)
+       {
+               for(i = 0; i < me.nItems; ++i)
+               {
+                       if(gethostcachestring(SLIST_FIELD_CNAME, i) == me.selectedServer)
+                       {
+                               me.selectedItem = i;
+                               found = 1;
+                               break;
+                       }
+               }
+       }
+       if(!found)
+       {
+               if(me.nItems > 0)
+               {
+                       if(me.selectedItem >= me.nItems)
+                               me.selectedItem = me.nItems - 1;
+                       if(me.selectedServer)
+                               strunzone(me.selectedServer);
+                       me.selectedServer = strzone(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
+               }
+       }
+
+       if(owned)
+       {
+               if(me.selectedServer != me.ipAddressBox.text)
+               {
+                       me.ipAddressBox.setText(me.ipAddressBox, me.selectedServer);
+                       me.ipAddressBox.cursorPos = strlen(me.selectedServer);
+                       me.ipAddressBoxFocused = -1;
+               }
+       }
+
+       if(me.ipAddressBoxFocused != me.ipAddressBox.focused)
+       {
+               if(me.ipAddressBox.focused || me.ipAddressBoxFocused < 0)
+                       ServerList_Update_favoriteButton(NULL, me);
+               me.ipAddressBoxFocused = me.ipAddressBox.focused;
+       }
+
+       SUPER(XonoticServerList).draw(me);
+}
+void ServerList_PingSort_Click(entity btn, entity me)
+{
+       me.setSortOrder(me, SLIST_FIELD_PING, +1);
+}
+void ServerList_NameSort_Click(entity btn, entity me)
+{
+       me.setSortOrder(me, SLIST_FIELD_NAME, -1); // why?
+}
+void ServerList_MapSort_Click(entity btn, entity me)
+{
+       me.setSortOrder(me, SLIST_FIELD_MAP, -1); // why?
+}
+void ServerList_PlayerSort_Click(entity btn, entity me)
+{
+       me.setSortOrder(me, SLIST_FIELD_NUMHUMANS, -1);
+}
+void ServerList_TypeSort_Click(entity btn, entity me)
+{
+       string s, t;
+       float i, m;
+       s = me.filterString;
+       m = strstrofs(s, ":", 0);
+       if(m >= 0)
+       {
+               s = substring(s, 0, m);
+               while(substring(s, m+1, 1) == " ") // skip spaces
+                       ++m;
+       }
+       else
+               s = "";
+
+       for(i = 1; ; i *= 2) // 20 modes ought to be enough for anyone
+       {
+               t = MapInfo_Type_ToString(i);
+               if(i > 1)
+                       if(t == "") // it repeats (default case)
+                       {
+                               // no type was found
+                               // choose the first one
+                               s = MapInfo_Type_ToString(1);
+                               break;
+                       }
+               if(s == t)
+               {
+                       // the type was found
+                       // choose the next one
+                       s = MapInfo_Type_ToString(i * 2);
+                       if(s == "")
+                               s = MapInfo_Type_ToString(1);
+                       break;
+               }
+       }
+
+       if(s != "")
+               s = strcat(s, ":");
+       s = strcat(s, substring(me.filterString, m+1, strlen(me.filterString) - m - 1));
+
+       me.controlledTextbox.setText(me.controlledTextbox, s);
+       me.controlledTextbox.keyDown(me.controlledTextbox, K_END, 0, 0);
+       me.controlledTextbox.keyUp(me.controlledTextbox, K_END, 0, 0);
+       //ServerList_Filter_Change(me.controlledTextbox, me);
+}
+void ServerList_Filter_Change(entity box, entity me)
+{
+       if(me.filterString)
+               strunzone(me.filterString);
+       if(box.text != "")
+               me.filterString = strzone(box.text);
+       else
+               me.filterString = string_null;
+       me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
+
+       me.ipAddressBox.setText(me.ipAddressBox, "");
+       me.ipAddressBox.cursorPos = 0;
+       me.ipAddressBoxFocused = -1;
+}
+void ServerList_Categories_Click(entity box, entity me)
+{
+       box.setChecked(box, autocvar_menu_slist_categories = !autocvar_menu_slist_categories);
+       me.refreshServerList(me, REFRESHSERVERLIST_RESORT);
+
+       me.ipAddressBox.setText(me.ipAddressBox, "");
+       me.ipAddressBox.cursorPos = 0;
+       me.ipAddressBoxFocused = -1;
+}
+void ServerList_ShowEmpty_Click(entity box, entity me)
+{
+       box.setChecked(box, me.filterShowEmpty = !me.filterShowEmpty);
+       me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
+
+       me.ipAddressBox.setText(me.ipAddressBox, "");
+       me.ipAddressBox.cursorPos = 0;
+       me.ipAddressBoxFocused = -1;
+}
+void ServerList_ShowFull_Click(entity box, entity me)
+{
+       box.setChecked(box, me.filterShowFull = !me.filterShowFull);
+       me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
+
+       me.ipAddressBox.setText(me.ipAddressBox, "");
+       me.ipAddressBox.cursorPos = 0;
+       me.ipAddressBoxFocused = -1;
+}
+void XonoticServerList_setSortOrder(entity me, float fld, float direction)
+{
+       if(me.currentSortField == fld)
+               direction = -me.currentSortOrder;
+       me.currentSortOrder = direction;
+       me.currentSortField = fld;
+       me.sortButton1.forcePressed = (fld == SLIST_FIELD_PING);
+       me.sortButton2.forcePressed = (fld == SLIST_FIELD_NAME);
+       me.sortButton3.forcePressed = (fld == SLIST_FIELD_MAP);
+       me.sortButton4.forcePressed = 0;
+       me.sortButton5.forcePressed = (fld == SLIST_FIELD_NUMHUMANS);
+       me.selectedItem = 0;
+       if(me.selectedServer)
+               strunzone(me.selectedServer);
+       me.selectedServer = string_null;
+       me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
+}
+void XonoticServerList_positionSortButton(entity me, entity btn, float theOrigin, float theSize, string theTitle, void(entity, entity) theFunc)
+{
+       vector originInLBSpace, sizeInLBSpace;
+       originInLBSpace = eY * (-me.itemHeight);
+       sizeInLBSpace = eY * me.itemHeight + eX * (1 - me.controlWidth);
+
+       vector originInDialogSpace, sizeInDialogSpace;
+       originInDialogSpace = boxToGlobal(originInLBSpace, me.Container_origin, me.Container_size);
+       sizeInDialogSpace = boxToGlobalSize(sizeInLBSpace, me.Container_size);
+
+       btn.Container_origin_x = originInDialogSpace.x + sizeInDialogSpace.x * theOrigin;
+       btn.Container_size_x   =                         sizeInDialogSpace.x * theSize;
+       btn.setText(btn, theTitle);
+       btn.onClick = theFunc;
+       btn.onClickEntity = me;
+       btn.resized = 1;
+}
+void XonoticServerList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(XonoticServerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight);
+       me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+
+       me.columnIconsOrigin = 0;
+       me.columnIconsSize = me.realFontSize.x * 4 * me.iconsSizeFactor;
+       me.columnPingSize = me.realFontSize.x * 3;
+       me.columnMapSize = me.realFontSize.x * 10;
+       me.columnTypeSize = me.realFontSize.x * 4;
+       me.columnPlayersSize = me.realFontSize.x * 5;
+       me.columnNameSize = 1 - me.columnPlayersSize - me.columnMapSize - me.columnPingSize - me.columnIconsSize - me.columnTypeSize - 5 * me.realFontSize.x;
+       me.columnPingOrigin = me.columnIconsOrigin + me.columnIconsSize + me.realFontSize.x;
+       me.columnNameOrigin = me.columnPingOrigin + me.columnPingSize + me.realFontSize.x;
+       me.columnMapOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize.x;
+       me.columnTypeOrigin = me.columnMapOrigin + me.columnMapSize + me.realFontSize.x;
+       me.columnPlayersOrigin = me.columnTypeOrigin + me.columnTypeSize + me.realFontSize.x;
+
+       me.positionSortButton(me, me.sortButton1, me.columnPingOrigin, me.columnPingSize, _("Ping"), ServerList_PingSort_Click);
+       me.positionSortButton(me, me.sortButton2, me.columnNameOrigin, me.columnNameSize, _("Host name"), ServerList_NameSort_Click);
+       me.positionSortButton(me, me.sortButton3, me.columnMapOrigin, me.columnMapSize, _("Map"), ServerList_MapSort_Click);
+       me.positionSortButton(me, me.sortButton4, me.columnTypeOrigin, me.columnTypeSize, _("Type"), ServerList_TypeSort_Click);
+       me.positionSortButton(me, me.sortButton5, me.columnPlayersOrigin, me.columnPlayersSize, _("Players"), ServerList_PlayerSort_Click);
+
+       float f;
+       f = me.currentSortField;
+       if(f >= 0)
+       {
+               me.currentSortField = -1;
+               me.setSortOrder(me, f, me.currentSortOrder); // force resetting the sort order
+       }
+}
+void ServerList_Connect_Click(entity btn, entity me)
+{
+       localcmd(sprintf("connect %s\n",
+               ((me.ipAddressBox.text != "") ?
+                       me.ipAddressBox.text : me.selectedServer
+               )
+       ));
+}
+void ServerList_Favorite_Click(entity btn, entity me)
+{
+       string ipstr;
+       ipstr = netaddress_resolve(me.ipAddressBox.text, 26000);
+       if(ipstr != "")
+       {
+               m_play_click_sound(MENU_SOUND_SELECT);
+               me.toggleFavorite(me, me.ipAddressBox.text);
+               me.ipAddressBoxFocused = -1;
+       }
+}
+void ServerList_Info_Click(entity btn, entity me)
+{
+       if (me.nItems != 0)
+               main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem);
+
+       vector org = boxToGlobal(eY * (me.selectedItem * me.itemHeight - me.scrollPos), me.origin, me.size);
+       vector sz = boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), me.size);
+       DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz);
+}
+void XonoticServerList_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       ServerList_Connect_Click(NULL, me);
+}
+void XonoticServerList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       // layout: Ping, Server name, Map name, NP, TP, MP
+       float p, q;
+       float isv4, isv6;
+       vector theColor;
+       float theAlpha;
+       float m, pure, freeslots, j, sflags;
+       string s, typestr, versionstr, k, v, modname;
+
+       //printf("time: %f, i: %d, item: %d, nitems: %d\n", time, i, item, me.nItems);
+
+       vector oldscale = draw_scale;
+       vector oldshift = draw_shift;
+#define SET_YRANGE(start,end) \
+       draw_scale = boxToGlobalSize(eX * 1 + eY * (end - start), oldscale); \
+       draw_shift = boxToGlobal(eY * start, oldshift, oldscale);
+
+       for (j = 0; j < category_draw_count; ++j) {
+               // Matches exactly the headings with increased height.
+               if (i == category_item[j])
+                       break;
+       }
+
+       if (j < category_draw_count)
+       {
+               entity catent = RetrieveCategoryEnt(category_name[j]);
+               if(catent)
+               {
+                       SET_YRANGE(
+                               (me.categoriesHeight - 1) / (me.categoriesHeight + 1),
+                               me.categoriesHeight / (me.categoriesHeight + 1)
+                       );
+                       draw_Text(
+                               eY * me.realUpperMargin
+                               +
+#if 0
+                               eX * (me.columnNameOrigin + (me.columnNameSize - draw_TextWidth(catent.cat_string, 0, me.realFontSize)) * 0.5),
+                               catent.cat_string,
+#else
+                               eX * (me.columnNameOrigin),
+                               strcat(catent.cat_string, ":"),
+#endif
+                               me.realFontSize,
+                               SKINCOLOR_SERVERLIST_CATEGORY,
+                               SKINALPHA_SERVERLIST_CATEGORY,
+                               0
+                       );
+                       SET_YRANGE(me.categoriesHeight / (me.categoriesHeight + 1), 1);
+               }
+       }
+
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+
+       s = gethostcachestring(SLIST_FIELD_QCSTATUS, i);
+       m = tokenizebyseparator(s, ":");
+       typestr = "";
+       if(m >= 2)
+       {
+               typestr = argv(0);
+               versionstr = argv(1);
+       }
+       freeslots = -1;
+       sflags = -1;
+       modname = "";
+       pure = 0;
+       for(j = 2; j < m; ++j)
+       {
+               if(argv(j) == "")
+                       break;
+               k = substring(argv(j), 0, 1);
+               v = substring(argv(j), 1, -1);
+               if(k == "P")
+                       pure = stof(v);
+               else if(k == "S")
+                       freeslots = stof(v);
+               else if(k == "F")
+                       sflags = stof(v);
+               else if(k == "M")
+                       modname = v;
+       }
+
+#ifdef COMPAT_NO_MOD_IS_XONOTIC
+       if(modname == "")
+               modname = "Xonotic";
+#endif
+
+       /*
+       SLIST_FIELD_MOD = gethostcacheindexforkey("mod");
+       s = gethostcachestring(SLIST_FIELD_MOD, i);
+       if(s != "data")
+               if(modname == "Xonotic")
+                       modname = s;
+       */
+
+       // list the mods here on which the pure server check actually works
+       if(modname != "Xonotic")
+       if(modname != "InstaGib" || modname != "MinstaGib")
+       if(modname != "CTS")
+       if(modname != "NIX")
+       if(modname != "NewToys")
+               pure = 0;
+
+       if(gethostcachenumber(SLIST_FIELD_FREESLOTS, i) <= 0)
+               theAlpha = SKINALPHA_SERVERLIST_FULL;
+       else if(freeslots == 0)
+               theAlpha = SKINALPHA_SERVERLIST_FULL; // g_maxplayers support
+       else if (!gethostcachenumber(SLIST_FIELD_NUMHUMANS, i))
+               theAlpha = SKINALPHA_SERVERLIST_EMPTY;
+       else
+               theAlpha = 1;
+
+       p = gethostcachenumber(SLIST_FIELD_PING, i);
+       const float PING_LOW = 75;
+       const float PING_MED = 200;
+       const float PING_HIGH = 500;
+       if(p < PING_LOW)
+               theColor = SKINCOLOR_SERVERLIST_LOWPING + (SKINCOLOR_SERVERLIST_MEDPING - SKINCOLOR_SERVERLIST_LOWPING) * (p / PING_LOW);
+       else if(p < PING_MED)
+               theColor = SKINCOLOR_SERVERLIST_MEDPING + (SKINCOLOR_SERVERLIST_HIGHPING - SKINCOLOR_SERVERLIST_MEDPING) * ((p - PING_LOW) / (PING_MED - PING_LOW));
+       else if(p < PING_HIGH)
+       {
+               theColor = SKINCOLOR_SERVERLIST_HIGHPING;
+               theAlpha *= 1 + (SKINALPHA_SERVERLIST_HIGHPING - 1) * ((p - PING_MED) / (PING_HIGH - PING_MED));
+       }
+       else
+       {
+               theColor = eX;
+               theAlpha *= SKINALPHA_SERVERLIST_HIGHPING;
+       }
+
+       if(gethostcachenumber(SLIST_FIELD_ISFAVORITE, i))
+       {
+               theColor = theColor * (1 - SKINALPHA_SERVERLIST_FAVORITE) + SKINCOLOR_SERVERLIST_FAVORITE * SKINALPHA_SERVERLIST_FAVORITE;
+               theAlpha = theAlpha * (1 - SKINALPHA_SERVERLIST_FAVORITE) + SKINALPHA_SERVERLIST_FAVORITE;
+       }
+
+       s = gethostcachestring(SLIST_FIELD_CNAME, i);
+
+       isv4 = isv6 = 0;
+       if(substring(s, 0, 1) == "[")
+       {
+               isv6 = 1;
+               me.seenIPv6 += 1;
+       }
+       else if(strstrofs("0123456789", substring(s, 0, 1), 0) >= 0)
+       {
+               isv4 = 1;
+               me.seenIPv4 += 1;
+       }
+
+       q = stof(substring(crypto_getencryptlevel(s), 0, 1));
+       if((q <= 0 && cvar("crypto_aeslevel") >= 3) || (q >= 3 && cvar("crypto_aeslevel") <= 0))
+       {
+               theColor = SKINCOLOR_SERVERLIST_IMPOSSIBLE;
+               theAlpha = SKINALPHA_SERVERLIST_IMPOSSIBLE;
+       }
+
+       if(q == 1)
+       {
+               if(cvar("crypto_aeslevel") >= 2)
+                       q |= 4;
+       }
+       if(q == 2)
+       {
+               if(cvar("crypto_aeslevel") >= 1)
+                       q |= 4;
+       }
+       if(q == 3)
+               q = 5;
+       else if(q >= 3)
+               q -= 2;
+       // possible status:
+       // 0: crypto off
+       // 1: AES possible
+       // 2: AES recommended but not available
+       // 3: AES possible and will be used
+       // 4: AES recommended and will be used
+       // 5: AES required
+
+       // --------------
+       //  RENDER ICONS
+       // --------------
+       vector iconSize = '0 0 0';
+       iconSize_y = me.realFontSize.y * me.iconsSizeFactor;
+       iconSize_x = me.realFontSize.x * me.iconsSizeFactor;
+
+       vector iconPos = '0 0 0';
+       iconPos_x = (me.columnIconsSize - 3 * iconSize.x) * 0.5;
+       iconPos_y = (1 - iconSize.y) * 0.5;
+
+       string n;
+
+       if (!(me.seenIPv4 && me.seenIPv6))
+       {
+               iconPos.x += iconSize.x * 0.5;
+       }
+       else if(me.seenIPv4 && me.seenIPv6)
+       {
+               n = string_null;
+               if(isv6)
+                       draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_ipv6"), 0); // PRECACHE_PIC_MIPMAP
+               else if(isv4)
+                       draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_ipv4"), 0); // PRECACHE_PIC_MIPMAP
+               if(n)
+                       draw_Picture(iconPos, n, iconSize, '1 1 1', 1);
+               iconPos.x += iconSize.x;
+       }
+
+       if(q > 0)
+       {
+               draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_aeslevel", ftos(q)), 0); // PRECACHE_PIC_MIPMAP
+               draw_Picture(iconPos, n, iconSize, '1 1 1', 1);
+       }
+       iconPos.x += iconSize.x;
+
+       if(modname == "Xonotic")
+       {
+               if(pure == 0)
+               {
+                       draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_pure1"), PRECACHE_PIC_MIPMAP);
+                       draw_Picture(iconPos, n, iconSize, '1 1 1', 1);
+               }
+       }
+       else
+       {
+               draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_mod_", modname), PRECACHE_PIC_MIPMAP);
+               if(draw_PictureSize(n) == '0 0 0')
+                       draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_mod_"), PRECACHE_PIC_MIPMAP);
+               if(pure == 0)
+                       draw_Picture(iconPos, n, iconSize, '1 1 1', 1);
+               else
+                       draw_Picture(iconPos, n, iconSize, '1 1 1', SKINALPHA_SERVERLIST_ICON_NONPURE);
+       }
+       iconPos.x += iconSize.x;
+
+       if(sflags >= 0 && (sflags & SERVERFLAG_PLAYERSTATS))
+       {
+               draw_PreloadPictureWithFlags(n = strcat(SKINGFX_SERVERLIST_ICON, "_stats1"), 0); // PRECACHE_PIC_MIPMAP
+               draw_Picture(iconPos, n, iconSize, '1 1 1', 1);
+       }
+       iconPos.x += iconSize.x;
+
+       // --------------
+       //  RENDER TEXT
+       // --------------
+
+       // ping
+       s = ftos(p);
+       draw_Text(me.realUpperMargin * eY + (me.columnPingOrigin + me.columnPingSize - draw_TextWidth(s, 0, me.realFontSize)) * eX, s, me.realFontSize, theColor, theAlpha, 0);
+
+       // server name
+       s = draw_TextShortenToWidth(gethostcachestring(SLIST_FIELD_NAME, i), me.columnNameSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, me.realFontSize, theColor, theAlpha, 0);
+
+       // server map
+       s = draw_TextShortenToWidth(gethostcachestring(SLIST_FIELD_MAP, i), me.columnMapSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin * eY + (me.columnMapOrigin + (me.columnMapSize - draw_TextWidth(s, 0, me.realFontSize)) * 0.5) * eX, s, me.realFontSize, theColor, theAlpha, 0);
+
+       // server gametype
+       s = draw_TextShortenToWidth(typestr, me.columnTypeSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin * eY + (me.columnTypeOrigin + (me.columnTypeSize - draw_TextWidth(s, 0, me.realFontSize)) * 0.5) * eX, s, me.realFontSize, theColor, theAlpha, 0);
+
+       // server playercount
+       s = strcat(ftos(gethostcachenumber(SLIST_FIELD_NUMHUMANS, i)), "/", ftos(gethostcachenumber(SLIST_FIELD_MAXPLAYERS, i)));
+       draw_Text(me.realUpperMargin * eY + (me.columnPlayersOrigin + (me.columnPlayersSize - draw_TextWidth(s, 0, me.realFontSize)) * 0.5) * eX, s, me.realFontSize, theColor, theAlpha, 0);
+}
+
+float XonoticServerList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       vector org, sz;
+
+       org = boxToGlobal(eY * (me.selectedItem * me.itemHeight - me.scrollPos), me.origin, me.size);
+       sz = boxToGlobalSize(eY * me.itemHeight + eX * (1 - me.controlWidth), me.size);
+
+       if(scan == K_ENTER || scan == K_KP_ENTER)
+       {
+               ServerList_Connect_Click(NULL, me);
+               return 1;
+       }
+       else if(scan == K_MOUSE2 || scan == K_SPACE)
+       {
+               if(me.nItems != 0)
+               {
+                       m_play_click_sound(MENU_SOUND_OPEN);
+                       main.serverInfoDialog.loadServerInfo(main.serverInfoDialog, me.selectedItem);
+                       DialogOpenButton_Click_withCoords(me, main.serverInfoDialog, org, sz);
+                       return 1;
+               }
+               return 0;
+       }
+       else if(scan == K_INS || scan == K_MOUSE3 || scan == K_KP_INS)
+       {
+               if(me.nItems != 0)
+               {
+                       me.toggleFavorite(me, me.selectedServer);
+                       me.ipAddressBoxFocused = -1;
+                       return 1;
+               }
+               return 0;
+       }
+       else if(SUPER(XonoticServerList).keyDown(me, scan, ascii, shift))
+               return 1;
+       else if(!me.controlledTextbox)
+               return 0;
+       else
+               return me.controlledTextbox.keyDown(me.controlledTextbox, scan, ascii, shift);
+}
+
+float XonoticServerList_getTotalHeight(entity me) {
+       float num_normal_rows = me.nItems;
+       float num_headers = category_draw_count;
+       return me.itemHeight * (num_normal_rows + me.categoriesHeight * num_headers);
+}
+float XonoticServerList_getItemAtPos(entity me, float pos) {
+       pos = pos / me.itemHeight;
+       float i;
+       for (i = category_draw_count - 1; i >= 0; --i) {
+               float itemidx = category_item[i];
+               float itempos = i * me.categoriesHeight + category_item[i];
+               if (pos >= itempos + me.categoriesHeight + 1)
+                       return itemidx + 1 + floor(pos - (itempos + me.categoriesHeight + 1));
+               if (pos >= itempos)
+                       return itemidx;
+       }
+       // No category matches? Note that category 0 is... 0. Therefore no headings exist at all.
+       return floor(pos);
+}
+float XonoticServerList_getItemStart(entity me, float item) {
+       float i;
+       for (i = category_draw_count - 1; i >= 0; --i) {
+               float itemidx = category_item[i];
+               float itempos = i * me.categoriesHeight + category_item[i];
+               if (item >= itemidx + 1)
+                       return (itempos + me.categoriesHeight + 1 + item - (itemidx + 1)) * me.itemHeight;
+               if (item >= itemidx)
+                       return itempos * me.itemHeight;
+       }
+       // No category matches? Note that category 0 is... 0. Therefore no headings exist at all.
+       return item * me.itemHeight;
+}
+float XonoticServerList_getItemHeight(entity me, float item) {
+       float i;
+       for (i = 0; i < category_draw_count; ++i) {
+               // Matches exactly the headings with increased height.
+               if (item == category_item[i])
+                       return me.itemHeight * (me.categoriesHeight + 1);
+       }
+       return me.itemHeight;
+}
+
+#endif
diff --git a/qcsrc/menu/xonotic/skinlist.c b/qcsrc/menu/xonotic/skinlist.c
deleted file mode 100644 (file)
index 0387303..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticSkinList) EXTENDS(XonoticListBox)
-       METHOD(XonoticSkinList, configureXonoticSkinList, void(entity))
-       ATTRIB(XonoticSkinList, rowsPerItem, float, 4)
-       METHOD(XonoticSkinList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticSkinList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticSkinList, getSkins, void(entity))
-       METHOD(XonoticSkinList, setSkin, void(entity))
-       METHOD(XonoticSkinList, loadCvars, void(entity))
-       METHOD(XonoticSkinList, saveCvars, void(entity))
-       METHOD(XonoticSkinList, skinParameter, string(entity, float, float))
-       METHOD(XonoticSkinList, clickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticSkinList, keyDown, float(entity, float, float, float))
-       METHOD(XonoticSkinList, destroy, void(entity))
-
-       ATTRIB(XonoticSkinList, skinlist, float, -1)
-       ATTRIB(XonoticSkinList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticSkinList, columnPreviewOrigin, float, 0)
-       ATTRIB(XonoticSkinList, columnPreviewSize, float, 0)
-       ATTRIB(XonoticSkinList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticSkinList, columnNameSize, float, 0)
-       ATTRIB(XonoticSkinList, realUpperMargin1, float, 0)
-       ATTRIB(XonoticSkinList, realUpperMargin2, float, 0)
-       ATTRIB(XonoticSkinList, origin, vector, '0 0 0')
-       ATTRIB(XonoticSkinList, itemAbsSize, vector, '0 0 0')
-
-       ATTRIB(XonoticSkinList, lastClickedSkin, float, -1)
-       ATTRIB(XonoticSkinList, lastClickedTime, float, 0)
-
-       ATTRIB(XonoticSkinList, name, string, "skinselector")
-ENDCLASS(XonoticSkinList)
-
-entity makeXonoticSkinList();
-void SetSkin_Click(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-
-#define SKINPARM_NAME 0
-#define SKINPARM_TITLE 1
-#define SKINPARM_AUTHOR 2
-#define SKINPARM_PREVIEW 3
-#define SKINPARM_COUNT 4
-
-entity makeXonoticSkinList()
-{
-       entity me;
-       me = spawnXonoticSkinList();
-       me.configureXonoticSkinList(me);
-       return me;
-}
-
-void XonoticSkinList_configureXonoticSkinList(entity me)
-{
-       me.configureXonoticListBox(me);
-       me.getSkins(me);
-       me.loadCvars(me);
-}
-
-void XonoticSkinList_loadCvars(entity me)
-{
-       string s;
-       float i, n;
-       s = cvar_string("menu_skin");
-       n = me.nItems;
-       for(i = 0; i < n; ++i)
-       {
-               if(me.skinParameter(me, i, SKINPARM_NAME) == s)
-               {
-                       me.selectedItem = i;
-                       break;
-               }
-       }
-}
-
-void XonoticSkinList_saveCvars(entity me)
-{
-       cvar_set("menu_skin", me.skinParameter(me, me.selectedItem, SKINPARM_NAME));
-}
-
-string XonoticSkinList_skinParameter(entity me, float i, float key)
-{
-       return bufstr_get(me.skinlist, i * SKINPARM_COUNT + key);
-}
-
-void XonoticSkinList_getSkins(entity me)
-{
-       float glob, buf, i, n, fh;
-       string s;
-
-       buf = buf_create();
-       glob = search_begin("gfx/menu/*/skinvalues.txt", TRUE, TRUE);
-       if(glob < 0)
-       {
-               me.skinlist = buf;
-               me.nItems = 0;
-               return;
-       }
-
-       n = search_getsize(glob);
-       for(i = 0; i < n; ++i)
-       {
-               s = search_getfilename(glob, i);
-               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_NAME, substring(s, 9, strlen(s) - 24)); // the * part
-               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_TITLE, _("<TITLE>"));
-               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_AUTHOR, _("<AUTHOR>"));
-               if(draw_PictureSize(strcat("/gfx/menu/", substring(s, 9, strlen(s) - 24), "/skinpreview")) == '0 0 0')
-                       bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_PREVIEW, "nopreview_menuskin");
-               else
-                       bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_PREVIEW, strcat("/gfx/menu/", substring(s, 9, strlen(s) - 24), "/skinpreview"));
-               fh = fopen(language_filename(s), FILE_READ);
-               if(fh < 0)
-               {
-                       print("Warning: can't open skinvalues.txt file\n");
-                       continue;
-               }
-               while((s = fgets(fh)))
-               {
-                       // these two are handled by skinlist.qc
-                       if(substring(s, 0, 6) == "title ")
-                               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_TITLE, substring(s, 6, strlen(s) - 6));
-                       else if(substring(s, 0, 7) == "author ")
-                               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_AUTHOR, substring(s, 7, strlen(s) - 7));
-               }
-               fclose(fh);
-       }
-
-       search_end(glob);
-
-       me.skinlist = buf;
-       me.nItems = n;
-}
-
-void XonoticSkinList_destroy(entity me)
-{
-       buf_del(me.skinlist);
-}
-
-void XonoticSkinList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.itemAbsSize = '0 0 0';
-       SUPER(XonoticSkinList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight));
-       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth)));
-       me.realUpperMargin1 = 0.5 * (1 - 2.5 * me.realFontSize_y);
-       me.realUpperMargin2 = me.realUpperMargin1 + 1.5 * me.realFontSize_y;
-
-       me.columnPreviewOrigin = 0;
-       me.columnPreviewSize = me.itemAbsSize_y / me.itemAbsSize_x * 4 / 3;
-       me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize_x;
-       me.columnNameSize = 1 - me.columnPreviewSize - 2 * me.realFontSize_x;
-}
-
-void XonoticSkinList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       string s;
-
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
-       s = me.skinParameter(me, i, SKINPARM_PREVIEW);
-       draw_Picture(me.columnPreviewOrigin * eX, s, me.columnPreviewSize * eX + eY, '1 1 1', 1);
-
-       s = me.skinParameter(me, i, SKINPARM_TITLE);
-       s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_SKINLIST_TITLE, SKINALPHA_TEXT, 0);
-
-       s = me.skinParameter(me, i, SKINPARM_AUTHOR);
-       s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 1.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_SKINLIST_AUTHOR, SKINALPHA_TEXT, 0);
-}
-
-void XonoticSkinList_setSkin(entity me)
-{
-       me.saveCvars(me);
-       localcmd("\nmenu_restart\nmenu_cmd skinselect\n");
-}
-
-void SetSkin_Click(entity btn, entity me)
-{
-       me.setSkin(me);
-}
-
-void XonoticSkinList_clickListBoxItem(entity me, float i, vector where)
-{
-       if(i == me.lastClickedSkin)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       me.setSelected(me, i);
-                       me.setSkin(me);
-               }
-       me.lastClickedSkin = i;
-       me.lastClickedTime = time;
-}
-
-float XonoticSkinList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       if(scan == K_ENTER || scan == K_KP_ENTER) {
-               me.setSkin(me);
-               return 1;
-       }
-       else
-               return SUPER(XonoticSkinList).keyDown(me, scan, ascii, shift);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/skinlist.qc b/qcsrc/menu/xonotic/skinlist.qc
new file mode 100644 (file)
index 0000000..9990c83
--- /dev/null
@@ -0,0 +1,199 @@
+#ifdef INTERFACE
+CLASS(XonoticSkinList) EXTENDS(XonoticListBox)
+       METHOD(XonoticSkinList, configureXonoticSkinList, void(entity))
+       ATTRIB(XonoticSkinList, rowsPerItem, float, 4)
+       METHOD(XonoticSkinList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticSkinList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticSkinList, getSkins, void(entity))
+       METHOD(XonoticSkinList, setSkin, void(entity))
+       METHOD(XonoticSkinList, loadCvars, void(entity))
+       METHOD(XonoticSkinList, saveCvars, void(entity))
+       METHOD(XonoticSkinList, skinParameter, string(entity, float, float))
+       METHOD(XonoticSkinList, doubleClickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticSkinList, keyDown, float(entity, float, float, float))
+       METHOD(XonoticSkinList, destroy, void(entity))
+
+       ATTRIB(XonoticSkinList, skinlist, float, -1)
+       ATTRIB(XonoticSkinList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticSkinList, columnPreviewOrigin, float, 0)
+       ATTRIB(XonoticSkinList, columnPreviewSize, float, 0)
+       ATTRIB(XonoticSkinList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticSkinList, columnNameSize, float, 0)
+       ATTRIB(XonoticSkinList, realUpperMargin1, float, 0)
+       ATTRIB(XonoticSkinList, realUpperMargin2, float, 0)
+       ATTRIB(XonoticSkinList, origin, vector, '0 0 0')
+       ATTRIB(XonoticSkinList, itemAbsSize, vector, '0 0 0')
+
+       ATTRIB(XonoticSkinList, name, string, "skinselector")
+ENDCLASS(XonoticSkinList)
+
+entity makeXonoticSkinList();
+void SetSkin_Click(entity btn, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+
+const float SKINPARM_NAME = 0;
+const float SKINPARM_TITLE = 1;
+const float SKINPARM_AUTHOR = 2;
+const float SKINPARM_PREVIEW = 3;
+const float SKINPARM_COUNT = 4;
+
+entity makeXonoticSkinList()
+{
+       entity me;
+       me = spawnXonoticSkinList();
+       me.configureXonoticSkinList(me);
+       return me;
+}
+
+void XonoticSkinList_configureXonoticSkinList(entity me)
+{
+       me.configureXonoticListBox(me);
+       me.getSkins(me);
+       me.loadCvars(me);
+}
+
+void XonoticSkinList_loadCvars(entity me)
+{
+       string s;
+       float i, n;
+       s = cvar_string("menu_skin");
+       n = me.nItems;
+       for(i = 0; i < n; ++i)
+       {
+               if(me.skinParameter(me, i, SKINPARM_NAME) == s)
+               {
+                       me.selectedItem = i;
+                       break;
+               }
+       }
+}
+
+void XonoticSkinList_saveCvars(entity me)
+{
+       cvar_set("menu_skin", me.skinParameter(me, me.selectedItem, SKINPARM_NAME));
+}
+
+string XonoticSkinList_skinParameter(entity me, float i, float key)
+{
+       return bufstr_get(me.skinlist, i * SKINPARM_COUNT + key);
+}
+
+void XonoticSkinList_getSkins(entity me)
+{
+       float glob, buf, i, n, fh;
+       string s;
+
+       buf = buf_create();
+       glob = search_begin("gfx/menu/*/skinvalues.txt", true, true);
+       if(glob < 0)
+       {
+               me.skinlist = buf;
+               me.nItems = 0;
+               return;
+       }
+
+       n = search_getsize(glob);
+       for(i = 0; i < n; ++i)
+       {
+               s = search_getfilename(glob, i);
+               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_NAME, substring(s, 9, strlen(s) - 24)); // the * part
+               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_TITLE, _("<TITLE>"));
+               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_AUTHOR, _("<AUTHOR>"));
+               if(draw_PictureSize(strcat("/gfx/menu/", substring(s, 9, strlen(s) - 24), "/skinpreview")) == '0 0 0')
+                       bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_PREVIEW, "nopreview_menuskin");
+               else
+                       bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_PREVIEW, strcat("/gfx/menu/", substring(s, 9, strlen(s) - 24), "/skinpreview"));
+               fh = fopen(language_filename(s), FILE_READ);
+               if(fh < 0)
+               {
+                       print("Warning: can't open skinvalues.txt file\n");
+                       continue;
+               }
+               while((s = fgets(fh)))
+               {
+                       // these two are handled by skinlist.qc
+                       if(substring(s, 0, 6) == "title ")
+                               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_TITLE, substring(s, 6, strlen(s) - 6));
+                       else if(substring(s, 0, 7) == "author ")
+                               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_AUTHOR, substring(s, 7, strlen(s) - 7));
+               }
+               fclose(fh);
+       }
+
+       search_end(glob);
+
+       me.skinlist = buf;
+       me.nItems = n;
+}
+
+void XonoticSkinList_destroy(entity me)
+{
+       buf_del(me.skinlist);
+}
+
+void XonoticSkinList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.itemAbsSize = '0 0 0';
+       SUPER(XonoticSkinList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
+       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
+       me.realUpperMargin1 = 0.5 * (1 - 2.5 * me.realFontSize.y);
+       me.realUpperMargin2 = me.realUpperMargin1 + 1.5 * me.realFontSize.y;
+
+       me.columnPreviewOrigin = 0;
+       me.columnPreviewSize = me.itemAbsSize.y / me.itemAbsSize.x * 4 / 3;
+       me.columnNameOrigin = me.columnPreviewOrigin + me.columnPreviewSize + me.realFontSize.x;
+       me.columnNameSize = 1 - me.columnPreviewSize - 2 * me.realFontSize.x;
+}
+
+void XonoticSkinList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       string s;
+
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+
+       s = me.skinParameter(me, i, SKINPARM_PREVIEW);
+       draw_Picture(me.columnPreviewOrigin * eX, s, me.columnPreviewSize * eX + eY, '1 1 1', 1);
+
+       s = me.skinParameter(me, i, SKINPARM_TITLE);
+       s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_SKINLIST_TITLE, SKINALPHA_TEXT, 0);
+
+       s = me.skinParameter(me, i, SKINPARM_AUTHOR);
+       s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 1.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_SKINLIST_AUTHOR, SKINALPHA_TEXT, 0);
+}
+
+void XonoticSkinList_setSkin(entity me)
+{
+       me.saveCvars(me);
+       localcmd("\nmenu_restart\nmenu_cmd skinselect\n");
+}
+
+void SetSkin_Click(entity btn, entity me)
+{
+       me.setSkin(me);
+}
+
+void XonoticSkinList_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       m_play_click_sound(MENU_SOUND_EXECUTE);
+       me.setSkin(me);
+}
+
+float XonoticSkinList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       if(scan == K_ENTER || scan == K_KP_ENTER)
+       {
+               m_play_click_sound(MENU_SOUND_EXECUTE);
+               me.setSkin(me);
+               return 1;
+       }
+       else
+               return SUPER(XonoticSkinList).keyDown(me, scan, ascii, shift);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/slider.c b/qcsrc/menu/xonotic/slider.c
deleted file mode 100644 (file)
index d63fe1c..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticSlider) EXTENDS(Slider)
-       METHOD(XonoticSlider, configureXonoticSlider, void(entity, float, float, float, string))
-       METHOD(XonoticSlider, setValue, void(entity, float))
-       ATTRIB(XonoticSlider, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
-       ATTRIB(XonoticSlider, image, string, SKINGFX_SLIDER)
-       ATTRIB(XonoticSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
-       ATTRIB(XonoticSlider, align, float, 0.5)
-       ATTRIB(XonoticSlider, color, vector, SKINCOLOR_SLIDER_N)
-       ATTRIB(XonoticSlider, colorC, vector, SKINCOLOR_SLIDER_C)
-       ATTRIB(XonoticSlider, colorF, vector, SKINCOLOR_SLIDER_F)
-       ATTRIB(XonoticSlider, colorD, vector, SKINCOLOR_SLIDER_D)
-       ATTRIB(XonoticSlider, color2, vector, SKINCOLOR_SLIDER_S)
-
-       ATTRIB(XonoticSlider, cvarName, string, string_null)
-       METHOD(XonoticSlider, loadCvars, void(entity))
-       METHOD(XonoticSlider, saveCvars, void(entity))
-       ATTRIB(XonoticSlider, sendCvars, float, 0)
-
-       ATTRIB(XonoticSlider, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticSlider, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticSlider)
-entity makeXonoticSlider(float, float, float, string);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticSlider(float theValueMin, float theValueMax, float theValueStep, string theCvar)
-{
-       entity me;
-       me = spawnXonoticSlider();
-       me.configureXonoticSlider(me, theValueMin, theValueMax, theValueStep, theCvar);
-       return me;
-}
-void XonoticSlider_configureXonoticSlider(entity me, float theValueMin, float theValueMax, float theValueStep, string theCvar)
-{
-       float vp;
-       vp = theValueStep * 10;
-       while(fabs(vp) < fabs(theValueMax - theValueMin) / 40)
-               vp *= 10;
-
-       me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
-
-       if(theCvar)
-       {
-               // Prevent flickering of the slider button by initialising the
-               // slider out of bounds to hide the button before loading the cvar
-               me.configureSliderValues(me, theValueMin, theValueMin-theValueStep, theValueMax, theValueStep, theValueStep, vp);
-               me.cvarName = theCvar;
-               me.loadCvars(me);
-               me.tooltip = getZonedTooltipForIdentifier(theCvar);
-       }
-       else
-               me.configureSliderValues(me, theValueMin, theValueMin, theValueMax, theValueStep, theValueStep, vp);
-}
-void XonoticSlider_setValue(entity me, float val)
-{
-       if(val != me.value)
-       {
-               SUPER(XonoticSlider).setValue( me, val );
-               me.saveCvars(me);
-       }
-}
-void XonoticSlider_loadCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       me.setValue( me, cvar(me.cvarName) );
-}
-void XonoticSlider_saveCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       cvar_set(me.cvarName, ftos(me.value));
-
-       CheckSendCvars(me, me.cvarName);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/slider.qc b/qcsrc/menu/xonotic/slider.qc
new file mode 100644 (file)
index 0000000..d63fe1c
--- /dev/null
@@ -0,0 +1,80 @@
+#ifdef INTERFACE
+CLASS(XonoticSlider) EXTENDS(Slider)
+       METHOD(XonoticSlider, configureXonoticSlider, void(entity, float, float, float, string))
+       METHOD(XonoticSlider, setValue, void(entity, float))
+       ATTRIB(XonoticSlider, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
+       ATTRIB(XonoticSlider, image, string, SKINGFX_SLIDER)
+       ATTRIB(XonoticSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
+       ATTRIB(XonoticSlider, align, float, 0.5)
+       ATTRIB(XonoticSlider, color, vector, SKINCOLOR_SLIDER_N)
+       ATTRIB(XonoticSlider, colorC, vector, SKINCOLOR_SLIDER_C)
+       ATTRIB(XonoticSlider, colorF, vector, SKINCOLOR_SLIDER_F)
+       ATTRIB(XonoticSlider, colorD, vector, SKINCOLOR_SLIDER_D)
+       ATTRIB(XonoticSlider, color2, vector, SKINCOLOR_SLIDER_S)
+
+       ATTRIB(XonoticSlider, cvarName, string, string_null)
+       METHOD(XonoticSlider, loadCvars, void(entity))
+       METHOD(XonoticSlider, saveCvars, void(entity))
+       ATTRIB(XonoticSlider, sendCvars, float, 0)
+
+       ATTRIB(XonoticSlider, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticSlider, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticSlider)
+entity makeXonoticSlider(float, float, float, string);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticSlider(float theValueMin, float theValueMax, float theValueStep, string theCvar)
+{
+       entity me;
+       me = spawnXonoticSlider();
+       me.configureXonoticSlider(me, theValueMin, theValueMax, theValueStep, theCvar);
+       return me;
+}
+void XonoticSlider_configureXonoticSlider(entity me, float theValueMin, float theValueMax, float theValueStep, string theCvar)
+{
+       float vp;
+       vp = theValueStep * 10;
+       while(fabs(vp) < fabs(theValueMax - theValueMin) / 40)
+               vp *= 10;
+
+       me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
+
+       if(theCvar)
+       {
+               // Prevent flickering of the slider button by initialising the
+               // slider out of bounds to hide the button before loading the cvar
+               me.configureSliderValues(me, theValueMin, theValueMin-theValueStep, theValueMax, theValueStep, theValueStep, vp);
+               me.cvarName = theCvar;
+               me.loadCvars(me);
+               me.tooltip = getZonedTooltipForIdentifier(theCvar);
+       }
+       else
+               me.configureSliderValues(me, theValueMin, theValueMin, theValueMax, theValueStep, theValueStep, vp);
+}
+void XonoticSlider_setValue(entity me, float val)
+{
+       if(val != me.value)
+       {
+               SUPER(XonoticSlider).setValue( me, val );
+               me.saveCvars(me);
+       }
+}
+void XonoticSlider_loadCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       me.setValue( me, cvar(me.cvarName) );
+}
+void XonoticSlider_saveCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       cvar_set(me.cvarName, ftos(me.value));
+
+       CheckSendCvars(me, me.cvarName);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/slider_decibels.c b/qcsrc/menu/xonotic/slider_decibels.c
deleted file mode 100644 (file)
index bf847e3..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticDecibelsSlider) EXTENDS(XonoticSlider)
-       METHOD(XonoticDecibelsSlider, loadCvars, void(entity))
-       METHOD(XonoticDecibelsSlider, saveCvars, void(entity))
-       METHOD(XonoticDecibelsSlider, valueToText, string(entity, float))
-ENDCLASS(XonoticDecibelsSlider)
-entity makeXonoticDecibelsSlider(float, float, float, string);
-#endif
-
-#ifdef IMPLEMENTATION
-
-float toDecibelOfSquare(float f, float mi)
-{
-       float A = log(10) / 20; // note: about 0.115; inverse: about 8.686
-       if(mi != 0)
-       {
-               // linear scale part
-               float t = 1 / A + mi;
-               float y = exp(1 + A * mi);
-               if(f <= y)
-                       return mi + (t - mi) * (f / y);
-       }
-       return log(f) / A;
-}
-
-float fromDecibelOfSquare(float f, float mi)
-{
-       float A = log(10) / 20; // note: about 0.115; inverse: about 8.686
-       if(mi != 0)
-       {
-               // linear scale part
-               float t = 1 / A + mi;
-               float y = exp(1 + A * mi);
-               if(f <= t)
-                       return y * ((f - mi) / (t - mi));
-       }
-       return exp(A * f);
-}
-
-entity makeXonoticDecibelsSlider(float theValueMin, float theValueMax, float theValueStep, string theCvar)
-{
-       entity me;
-       me = spawnXonoticDecibelsSlider();
-       me.configureXonoticSlider(me, theValueMin, theValueMax, theValueStep, theCvar);
-       return me;
-}
-void XonoticDecibelsSlider_loadCvars(entity me)
-{
-       float v;
-
-       if (!me.cvarName)
-               return;
-
-       v = cvar(me.cvarName);
-
-       // snapping
-       if(v > fromDecibelOfSquare(me.valueMax - 0.5 * me.valueStep, me.valueMin))
-               Slider_setValue(me, me.valueMax);
-       else
-               Slider_setValue(me, me.valueStep * floor(0.5 + toDecibelOfSquare(v, me.valueMin) / me.valueStep) );
-}
-void XonoticDecibelsSlider_saveCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       if(me.value > me.valueMax - 0.5 * me.valueStep)
-               cvar_set(me.cvarName, ftos(fromDecibelOfSquare(me.valueMax, me.valueMin)));
-       else
-               cvar_set(me.cvarName, ftos(fromDecibelOfSquare(me.value, me.valueMin)));
-}
-
-float autocvar_menu_snd_sliderscale;
-string XonoticDecibelsSlider_valueToText(entity me, float v)
-{
-       if(v > me.valueMax - 0.5 * me.valueStep)
-               return CTX(_("VOL^MAX"));
-       else if(v <= me.valueMin)
-               return CTX(_("VOL^OFF"));
-       else if(autocvar_menu_snd_sliderscale == 3) // fake percent scale
-               return sprintf("%d %%", (v - me.valueMin) / (me.valueMax - me.valueMin) * 100);
-       else if(autocvar_menu_snd_sliderscale == 2) // 0..10 scale
-               return sprintf("%.1f", (v - me.valueMin) / (me.valueMax - me.valueMin) * 10);
-       else if(autocvar_menu_snd_sliderscale == 1) // real percent scale
-               return sprintf("%.2f %%", fromDecibelOfSquare(v, me.valueMin) * 100);
-       else // decibel scale
-               return sprintf(_("%s dB"), ftos_decimals(toDecibelOfSquare(fromDecibelOfSquare(v, me.valueMin), 0), me.valueDigits));
-}
-
-void _TEST_XonoticDecibelsSlider()
-{
-       float i;
-       for(i = -400; i < 0; ++i)
-       {
-               float db = i * 0.1;
-               float v = fromDecibelOfSquare(db, -40);
-               float dbv = toDecibelOfSquare(v, -40);
-               float d = dbv - db;
-               printf("%f -> %f -> %f (diff: %f)\n", db, v, dbv, d);
-               TEST_Check(fabs(d) > 0.02);
-       }
-       TEST_OK();
-}
-
-#endif
diff --git a/qcsrc/menu/xonotic/slider_decibels.qc b/qcsrc/menu/xonotic/slider_decibels.qc
new file mode 100644 (file)
index 0000000..0763232
--- /dev/null
@@ -0,0 +1,107 @@
+#include "../../warpzonelib/mathlib.qh"
+
+#ifdef INTERFACE
+CLASS(XonoticDecibelsSlider) EXTENDS(XonoticSlider)
+       METHOD(XonoticDecibelsSlider, loadCvars, void(entity))
+       METHOD(XonoticDecibelsSlider, saveCvars, void(entity))
+       METHOD(XonoticDecibelsSlider, valueToText, string(entity, float))
+ENDCLASS(XonoticDecibelsSlider)
+entity makeXonoticDecibelsSlider(float, float, float, string);
+#endif
+
+#ifdef IMPLEMENTATION
+
+float toDecibelOfSquare(float f, float mi)
+{
+       float A = log(10) / 20; // note: about 0.115; inverse: about 8.686
+       if(mi != 0)
+       {
+               // linear scale part
+               float t = 1 / A + mi;
+               float y = exp(1 + A * mi);
+               if(f <= y)
+                       return mi + (t - mi) * (f / y);
+       }
+       return log(f) / A;
+}
+
+float fromDecibelOfSquare(float f, float mi)
+{
+       float A = log(10) / 20; // note: about 0.115; inverse: about 8.686
+       if(mi != 0)
+       {
+               // linear scale part
+               float t = 1 / A + mi;
+               float y = exp(1 + A * mi);
+               if(f <= t)
+                       return y * ((f - mi) / (t - mi));
+       }
+       return exp(A * f);
+}
+
+entity makeXonoticDecibelsSlider(float theValueMin, float theValueMax, float theValueStep, string theCvar)
+{
+       entity me;
+       me = spawnXonoticDecibelsSlider();
+       me.configureXonoticSlider(me, theValueMin, theValueMax, theValueStep, theCvar);
+       return me;
+}
+void XonoticDecibelsSlider_loadCvars(entity me)
+{
+       float v;
+
+       if (!me.cvarName)
+               return;
+
+       v = cvar(me.cvarName);
+
+       // snapping
+       if(v > fromDecibelOfSquare(me.valueMax - 0.5 * me.valueStep, me.valueMin))
+               Slider_setValue(me, me.valueMax);
+       else
+               Slider_setValue(me, me.valueStep * floor(0.5 + toDecibelOfSquare(v, me.valueMin) / me.valueStep) );
+}
+void XonoticDecibelsSlider_saveCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       if(me.value > me.valueMax - 0.5 * me.valueStep)
+               cvar_set(me.cvarName, ftos(fromDecibelOfSquare(me.valueMax, me.valueMin)));
+       else
+               cvar_set(me.cvarName, ftos(fromDecibelOfSquare(me.value, me.valueMin)));
+}
+
+float autocvar_menu_snd_sliderscale;
+string XonoticDecibelsSlider_valueToText(entity me, float v)
+{
+       if(v > me.valueMax - 0.5 * me.valueStep)
+               return CTX(_("VOL^MAX"));
+       else if(v <= me.valueMin)
+               return CTX(_("VOL^OFF"));
+       else if(autocvar_menu_snd_sliderscale == 3) // fake percent scale
+               return sprintf("%d %%", (v - me.valueMin) / (me.valueMax - me.valueMin) * 100);
+       else if(autocvar_menu_snd_sliderscale == 2) // 0..10 scale
+               return sprintf("%.1f", (v - me.valueMin) / (me.valueMax - me.valueMin) * 10);
+       else if(autocvar_menu_snd_sliderscale == 1) // real percent scale
+               return sprintf("%.2f %%", fromDecibelOfSquare(v, me.valueMin) * 100);
+       else // decibel scale
+               return sprintf(_("%s dB"), ftos_decimals(toDecibelOfSquare(fromDecibelOfSquare(v, me.valueMin), 0), me.valueDigits));
+}
+
+void _TEST_XonoticDecibelsSlider()
+{
+       float i;
+       for(i = -400; i < 0; ++i)
+       {
+               float db = i * 0.1;
+               float v = fromDecibelOfSquare(db, -40);
+               float dbv = toDecibelOfSquare(v, -40);
+               float d = dbv - db;
+               printf("%f -> %f -> %f (diff: %f)\n", db, v, dbv, d);
+               TEST_Check(fabs(d) > 0.02);
+       }
+       TEST_OK();
+}
+
+#endif
diff --git a/qcsrc/menu/xonotic/slider_particles.c b/qcsrc/menu/xonotic/slider_particles.c
deleted file mode 100644 (file)
index db29f55..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticParticlesSlider) EXTENDS(XonoticTextSlider)
-       METHOD(XonoticParticlesSlider, configureXonoticParticlesSlider, void(entity))
-       METHOD(XonoticParticlesSlider, loadCvars, void(entity))
-       METHOD(XonoticParticlesSlider, saveCvars, void(entity))
-ENDCLASS(XonoticParticlesSlider)
-entity makeXonoticParticlesSlider();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticParticlesSlider()
-{
-       entity me;
-       me = spawnXonoticParticlesSlider();
-       me.configureXonoticParticlesSlider(me);
-       return me;
-}
-void XonoticParticlesSlider_configureXonoticParticlesSlider(entity me)
-{
-       me.configureXonoticTextSlider(me, "cl_particles_quality");
-       if(cvar("developer")) { me.addValue(me, ZCTX(_("PART^OMG")),      "0.4 250 0"); }
-       me.addValue(me,                         ZCTX(_("PART^Low")),      "0.4 500 0");
-       me.addValue(me,                         ZCTX(_("PART^Medium")),   "0.8 750 0");
-       me.addValue(me,                         ZCTX(_("PART^Normal")),   "1.0 1000 1");
-       me.addValue(me,                         ZCTX(_("PART^High")),     "1.0 1500 1");
-       me.addValue(me,                         ZCTX(_("PART^Ultra")),    "1.0 2000 2");
-       if(cvar("developer")) { me.addValue(me, ZCTX(_("PART^Ultimate")), "1.0 3000 2"); }
-       me.configureXonoticTextSliderValues(me);
-}
-void XonoticParticlesSlider_loadCvars(entity me)
-{
-       me.setValueFromIdentifier(me, sprintf("%s %s %s",
-               cvar_string("cl_particles_quality"),
-               cvar_string("r_drawparticles_drawdistance"),
-               cvar_string("cl_damageeffect")
-       ));
-}
-void XonoticParticlesSlider_saveCvars(entity me)
-{
-       if(me.value >= 0 || me.value < me.nValues)
-       {
-               tokenize_console(me.getIdentifier(me));
-               cvar_set("cl_particles_quality", argv(0));
-               cvar_set("r_drawparticles_drawdistance", argv(1));
-               cvar_set("cl_damageeffect", argv(2)); 
-       }
-}
-#endif
diff --git a/qcsrc/menu/xonotic/slider_particles.qc b/qcsrc/menu/xonotic/slider_particles.qc
new file mode 100644 (file)
index 0000000..818dcb8
--- /dev/null
@@ -0,0 +1,48 @@
+#ifdef INTERFACE
+CLASS(XonoticParticlesSlider) EXTENDS(XonoticTextSlider)
+       METHOD(XonoticParticlesSlider, configureXonoticParticlesSlider, void(entity))
+       METHOD(XonoticParticlesSlider, loadCvars, void(entity))
+       METHOD(XonoticParticlesSlider, saveCvars, void(entity))
+ENDCLASS(XonoticParticlesSlider)
+entity makeXonoticParticlesSlider();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticParticlesSlider()
+{
+       entity me;
+       me = spawnXonoticParticlesSlider();
+       me.configureXonoticParticlesSlider(me);
+       return me;
+}
+void XonoticParticlesSlider_configureXonoticParticlesSlider(entity me)
+{
+       me.configureXonoticTextSlider(me, "cl_particles_quality");
+       if(cvar("developer")) { me.addValue(me, ZCTX(_("PART^OMG")),      "0.4 250 0"); }
+       me.addValue(me,                         ZCTX(_("PART^Low")),      "0.4 500 0");
+       me.addValue(me,                         ZCTX(_("PART^Medium")),   "0.8 750 0");
+       me.addValue(me,                         ZCTX(_("PART^Normal")),   "1.0 1000 1");
+       me.addValue(me,                         ZCTX(_("PART^High")),     "1.0 1500 1");
+       me.addValue(me,                         ZCTX(_("PART^Ultra")),    "1.0 2000 2");
+       if(cvar("developer")) { me.addValue(me, ZCTX(_("PART^Ultimate")), "1.0 3000 2"); }
+       me.configureXonoticTextSliderValues(me);
+}
+void XonoticParticlesSlider_loadCvars(entity me)
+{
+       me.setValueFromIdentifier(me, sprintf("%s %s %s",
+               cvar_string("cl_particles_quality"),
+               cvar_string("r_drawparticles_drawdistance"),
+               cvar_string("cl_damageeffect")
+       ));
+}
+void XonoticParticlesSlider_saveCvars(entity me)
+{
+       if(me.value >= 0 || me.value < me.nValues)
+       {
+               tokenize_console(me.getIdentifier(me));
+               cvar_set("cl_particles_quality", argv(0));
+               cvar_set("r_drawparticles_drawdistance", argv(1));
+               cvar_set("cl_damageeffect", argv(2));
+       }
+}
+#endif
diff --git a/qcsrc/menu/xonotic/slider_picmip.c b/qcsrc/menu/xonotic/slider_picmip.c
deleted file mode 100644 (file)
index ddedc4b..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticPicmipSlider) EXTENDS(XonoticTextSlider)
-       METHOD(XonoticPicmipSlider, configureXonoticPicmipSlider, void(entity))
-       METHOD(XonoticPicmipSlider, draw, void(entity))
-       METHOD(XonoticPicmipSlider, autofix, void(entity))
-       ATTRIB(XonoticPicmipSlider, have_s3tc, float, 0)
-ENDCLASS(XonoticPicmipSlider)
-entity makeXonoticPicmipSlider(); // note: you still need to call addValue and configureXonoticTextSliderValues!
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticPicmipSlider()
-{
-       entity me;
-       me = spawnXonoticPicmipSlider();
-       me.configureXonoticPicmipSlider(me);
-       return me;
-}
-void XonoticPicmipSlider_configureXonoticPicmipSlider(entity me)
-{
-       me.configureXonoticTextSlider(me, "gl_picmip");
-       me.autofix(me);
-       me.have_s3tc = GL_Have_TextureCompression();
-}
-float texmemsize(float s3tc)
-{
-       return
-       (
-                 2500 * pow(0.25, max(0, cvar("gl_picmip") + cvar("gl_picmip_other")))
-               + 1500 * pow(0.25, max(0, cvar("gl_picmip") + cvar("gl_picmip_world")))
-       ) * ((s3tc && (cvar("r_texture_dds_load") || cvar("gl_texturecompression"))) ? 0.2 : 1.0); // TC: normalmaps 50%, other 25%, few incompressible, guessing 40% as conservative average
-}
-void XonoticPicmipSlider_autofix(entity me)
-{
-       float max_hard, max_soft;
-       if(cvar("menu_picmip_bypass"))
-               return;
-       max_hard = cvar("sys_memsize_virtual");
-       max_soft = cvar("sys_memsize_physical");
-       if(max_hard > 0)
-       {
-               while(me.value > 0 && texmemsize(me.have_s3tc) > max_hard)
-                       me.setValue(me, me.value - 1);
-       }
-       // TODO also check the soft limit!
-       // TODO better handling than clamping the slider!
-}
-void XonoticPicmipSlider_draw(entity me)
-{
-       me.autofix(me);
-       SUPER(XonoticPicmipSlider).draw(me);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/slider_picmip.qc b/qcsrc/menu/xonotic/slider_picmip.qc
new file mode 100644 (file)
index 0000000..ddedc4b
--- /dev/null
@@ -0,0 +1,53 @@
+#ifdef INTERFACE
+CLASS(XonoticPicmipSlider) EXTENDS(XonoticTextSlider)
+       METHOD(XonoticPicmipSlider, configureXonoticPicmipSlider, void(entity))
+       METHOD(XonoticPicmipSlider, draw, void(entity))
+       METHOD(XonoticPicmipSlider, autofix, void(entity))
+       ATTRIB(XonoticPicmipSlider, have_s3tc, float, 0)
+ENDCLASS(XonoticPicmipSlider)
+entity makeXonoticPicmipSlider(); // note: you still need to call addValue and configureXonoticTextSliderValues!
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticPicmipSlider()
+{
+       entity me;
+       me = spawnXonoticPicmipSlider();
+       me.configureXonoticPicmipSlider(me);
+       return me;
+}
+void XonoticPicmipSlider_configureXonoticPicmipSlider(entity me)
+{
+       me.configureXonoticTextSlider(me, "gl_picmip");
+       me.autofix(me);
+       me.have_s3tc = GL_Have_TextureCompression();
+}
+float texmemsize(float s3tc)
+{
+       return
+       (
+                 2500 * pow(0.25, max(0, cvar("gl_picmip") + cvar("gl_picmip_other")))
+               + 1500 * pow(0.25, max(0, cvar("gl_picmip") + cvar("gl_picmip_world")))
+       ) * ((s3tc && (cvar("r_texture_dds_load") || cvar("gl_texturecompression"))) ? 0.2 : 1.0); // TC: normalmaps 50%, other 25%, few incompressible, guessing 40% as conservative average
+}
+void XonoticPicmipSlider_autofix(entity me)
+{
+       float max_hard, max_soft;
+       if(cvar("menu_picmip_bypass"))
+               return;
+       max_hard = cvar("sys_memsize_virtual");
+       max_soft = cvar("sys_memsize_physical");
+       if(max_hard > 0)
+       {
+               while(me.value > 0 && texmemsize(me.have_s3tc) > max_hard)
+                       me.setValue(me, me.value - 1);
+       }
+       // TODO also check the soft limit!
+       // TODO better handling than clamping the slider!
+}
+void XonoticPicmipSlider_draw(entity me)
+{
+       me.autofix(me);
+       SUPER(XonoticPicmipSlider).draw(me);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/slider_resolution.c b/qcsrc/menu/xonotic/slider_resolution.c
deleted file mode 100644 (file)
index 66f48f9..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticResolutionSlider) EXTENDS(XonoticTextSlider)
-       METHOD(XonoticResolutionSlider, configureXonoticResolutionSlider, void(entity))
-       METHOD(XonoticResolutionSlider, loadResolutions, void(entity, float))
-       METHOD(XonoticResolutionSlider, addResolution, void(entity, float, float, float))
-       METHOD(XonoticResolutionSlider, loadCvars, void(entity))
-       METHOD(XonoticResolutionSlider, saveCvars, void(entity))
-       METHOD(XonoticResolutionSlider, draw, void(entity))
-       ATTRIB(XonoticResolutionSlider, vid_fullscreen, float, -1)
-ENDCLASS(XonoticResolutionSlider)
-entity makeXonoticResolutionSlider();
-float updateConwidths(float width, float height, float pixelheight);
-#endif
-
-#ifdef IMPLEMENTATION
-
-/* private static */ float XonoticResolutionSlider_DataHasChanged;
-
-// Updates cvars (to be called by menu.qc at startup or on detected res change)
-float updateConwidths(float width, float height, float pixelheight)
-{
-       vector r, c;
-       float minfactor, maxfactor;
-       float sz, f;
-
-       sz = cvar("menu_vid_scale");
-       if (sz < -1)
-               return 0;  // No recalculation.
-
-       // Save off current settings.
-       cvar_set("_menu_vid_width", ftos(width));
-       cvar_set("_menu_vid_height", ftos(height));
-       cvar_set("_menu_vid_pixelheight", ftos(pixelheight));
-       cvar_set("_menu_vid_desktopfullscreen", cvar_string("vid_desktopfullscreen"));
-
-       r_x = width;
-       r_y = height;
-       r_z = pixelheight;
-
-       // calculate the base resolution
-       c_z = 0;
-       c_x = 800;
-       c_y = c_x * r_y * r_z / r_x;
-       if(c_y < 600)
-       {
-               c_y = 600;
-               c_x = c_y * r_x / (r_y * r_z);
-       }
-
-       f = min(r_x / c_x, r_y / c_y);
-       if(f < 1)
-               c = c * f; // ensures that c_x <= r_x and c_y <= r_y
-
-       minfactor = min(1, 640 / c_x);            // can be > 1 only if c_x is <640
-       maxfactor = max(1, r_x / c_x, r_y / c_y); // can be < 1 only if r_x < c_x and r_y < c_y
-       dprint("min factor: ", ftos(minfactor), "\n");
-       dprint("max factor: ", ftos(maxfactor), "\n");
-
-       if(sz < 0)
-               f = 1 - (maxfactor - 1) * sz;
-       else if(sz > 0)
-               f = 1 + (minfactor - 1) * sz;
-       else
-               f = 1;
-       c = c * f; // fteqcc fail
-
-       c_x = rint(c_x);
-       c_y = rint(c_y);
-
-       // Please reload resolutions list and such stuff.
-       XonoticResolutionSlider_DataHasChanged = TRUE;
-
-       if (c_x != cvar("vid_conwidth") || c_y != cvar("vid_conheight"))
-       {
-               cvar_set("vid_conwidth", ftos(c_x));
-               cvar_set("vid_conheight", ftos(c_y));
-               return 1;
-       }
-       return 0;
-}
-entity makeXonoticResolutionSlider()
-{
-       entity me;
-       me = spawnXonoticResolutionSlider();
-       me.configureXonoticResolutionSlider(me);
-       return me;
-}
-void XonoticResolutionSlider_addResolution(entity me, float w, float h, float pixelheight)
-{
-       float i;
-       for (i = 0; i < me.nValues; ++i)
-       {
-               tokenize_console(me.valueToIdentifier(me, i));
-               if (w > stof(argv(0))) continue;
-               if (w < stof(argv(0))) break;
-               if (h > stof(argv(1))) continue;
-               if (h < stof(argv(1))) break;
-               if (pixelheight > stof(argv(2)) + 0.01) continue;
-               if (pixelheight < stof(argv(2)) - 0.01) break;
-               return;  // already there
-       }
-       if (pixelheight != 1)
-       {
-               float aspect = w / (h * pixelheight);
-               float bestdenom = rint(aspect);
-               float bestnum = 1;
-               float denom;
-               for (denom = 2; denom < 10; ++denom) {
-                       float num = rint(aspect * denom);
-                       if (fabs(num / denom - aspect) < fabs(bestnum / bestdenom - aspect))
-                       {
-                               bestnum = num;
-                               bestdenom = denom;
-                       }
-               }
-               me.insertValue(me, i, strzone(sprintf(_("%dx%d (%d:%d)"), w, h, bestnum, bestdenom)), strzone(strcat(ftos(w), " ", ftos(h), " ", ftos(pixelheight))));
-       }
-       else
-               me.insertValue(me, i, strzone(sprintf(_("%dx%d"), w, h)), strzone(strcat(ftos(w), " ", ftos(h), " ", ftos(pixelheight))));
-}
-float autocvar_menu_vid_allowdualscreenresolution;
-void XonoticResolutionSlider_configureXonoticResolutionSlider(entity me)
-{
-       me.configureXonoticTextSlider(me, "_menu_vid_width");
-       me.loadResolutions(me, cvar("vid_fullscreen"));
-}
-void XonoticResolutionSlider_loadResolutions(entity me, float fullscreen)
-{
-       float i;
-       vector r;
-
-       // HACK: text slider assumes the strings are constants, so clearValues
-       // will not unzone them
-       for(i = 0; i < me.nValues; ++i)
-       {
-               strunzone(me.valueToIdentifier(me, i));
-               strunzone(me.valueToText(me, i));
-       }
-       // NOW we can safely clear.
-       me.clearValues(me);
-
-       if (fullscreen)
-       {
-               for(i = 0;; ++i)
-               {
-                       r = getresolution(i);
-                       if(r_x == 0 && r_y == 0)
-                               break;
-                       if(r_x < 640 || r_y < 480)
-                               continue;
-                       if(r_x > 2 * r_y) // likely dualscreen resolution, skip this one
-                               if(autocvar_menu_vid_allowdualscreenresolution <= 0)
-                                       continue;
-                       me.addResolution(me, r_x, r_y, r_z);
-               }
-               r = getresolution(-1);
-               if(r_x != 0 || r_y != 0)
-                       me.addResolution(me, r_x, r_y, r_z);
-               dprint("Added system resolutions.\n");
-       }
-
-       if(me.nValues == 0)
-       {
-               me.addResolution(me, 640, 480, 1); // pc res
-#if 0
-               me.addResolution(me, 720, 480, 1.125); // DVD NTSC 4:3
-               me.addResolution(me, 720, 576, 0.9375); // DVD PAL 4:3
-               me.addResolution(me, 720, 480, 0.84375); // DVD NTSC 16:9
-               me.addResolution(me, 720, 576, 0.703125); // DVD PAL 16:9
-#endif
-               me.addResolution(me, 800, 480, 1); // 480p at 1:1 pixel aspect
-               me.addResolution(me, 800, 600, 1); // pc res
-               me.addResolution(me, 1024, 600, 1); // notebook res
-               me.addResolution(me, 1024, 768, 1); // pc res
-               me.addResolution(me, 1280, 720, 1); // 720p
-               me.addResolution(me, 1280, 960, 1); // pc res
-               me.addResolution(me, 1280, 1024, 1); // pc res
-               me.addResolution(me, 1920, 1080, 1); // 1080p
-               dprint("Added default resolutions.\n");
-       }
-       dprint("Total number of resolutions detected: ", ftos(me.nValues), "\n");
-
-       me.vid_fullscreen = fullscreen;
-
-       me.configureXonoticTextSliderValues(me);
-}
-void XonoticResolutionSlider_loadCvars(entity me)
-{
-       me.setValueFromIdentifier(me, strcat(cvar_string("_menu_vid_width"), " ", cvar_string("_menu_vid_height"), " ", cvar_string("_menu_vid_pixelheight")));
-}
-void XonoticResolutionSlider_saveCvars(entity me)
-{
-       if(me.value >= 0 || me.value < me.nValues)
-       {
-               tokenize_console(me.getIdentifier(me));
-               cvar_set("_menu_vid_width", argv(0));
-               cvar_set("_menu_vid_height", argv(1));
-               cvar_set("_menu_vid_pixelheight", argv(2));
-               vector r = getresolution(-1);
-               if (stof(argv(0)) == r_x && stof(argv(1)) == r_y && fabs(stof(argv(2)) - r_z) < 0.01)
-                       cvar_set("_menu_vid_desktopfullscreen", "1");
-               else
-                       cvar_set("_menu_vid_desktopfullscreen", "0");
-       }
-}
-void XonoticResolutionSlider_draw(entity me)
-{
-       if (cvar("vid_fullscreen") != me.vid_fullscreen)
-       {
-               me.loadResolutions(me, cvar("vid_fullscreen"));
-               XonoticResolutionSlider_DataHasChanged = TRUE;
-       }
-       if (XonoticResolutionSlider_DataHasChanged)
-       {
-               XonoticResolutionSlider_DataHasChanged = FALSE;
-               me.loadCvars(me);
-       }
-       SUPER(XonoticResolutionSlider).draw(me);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/slider_resolution.qc b/qcsrc/menu/xonotic/slider_resolution.qc
new file mode 100644 (file)
index 0000000..c144362
--- /dev/null
@@ -0,0 +1,243 @@
+#ifdef INTERFACE
+CLASS(XonoticResolutionSlider) EXTENDS(XonoticTextSlider)
+       METHOD(XonoticResolutionSlider, configureXonoticResolutionSlider, void(entity))
+       METHOD(XonoticResolutionSlider, loadResolutions, void(entity, float))
+       METHOD(XonoticResolutionSlider, addResolution, void(entity, float, float, float))
+       METHOD(XonoticResolutionSlider, loadCvars, void(entity))
+       METHOD(XonoticResolutionSlider, saveCvars, void(entity))
+       METHOD(XonoticResolutionSlider, draw, void(entity))
+       ATTRIB(XonoticResolutionSlider, vid_fullscreen, float, -1)
+       ATTRIB(XonoticResolutionSlider, maxAllowedWidth, float, 0)
+       ATTRIB(XonoticResolutionSlider, maxAllowedHeight, float, 0)
+ENDCLASS(XonoticResolutionSlider)
+entity makeXonoticResolutionSlider();
+float updateConwidths(float width, float height, float pixelheight);
+#endif
+
+#ifdef IMPLEMENTATION
+
+/* private static */ float XonoticResolutionSlider_DataHasChanged;
+
+// Updates cvars (to be called by menu.qc at startup or on detected res change)
+float updateConwidths(float width, float height, float pixelheight)
+{
+       vector r, c;
+       float minfactor, maxfactor;
+       float sz, f;
+
+       sz = cvar("menu_vid_scale");
+       if (sz < -1)
+               return 0;  // No recalculation.
+
+       // Save off current settings.
+       cvar_set("_menu_vid_width", ftos(width));
+       cvar_set("_menu_vid_height", ftos(height));
+       cvar_set("_menu_vid_pixelheight", ftos(pixelheight));
+       cvar_set("_menu_vid_desktopfullscreen", cvar_string("vid_desktopfullscreen"));
+
+       r_x = width;
+       r_y = height;
+       r_z = pixelheight;
+
+       // calculate the base resolution
+       c_z = 0;
+       c_x = 800;
+       c_y = c.x * r.y * r.z / r.x;
+       if(c.y < 600)
+       {
+               c_y = 600;
+               c_x = c.y * r.x / (r.y * r.z);
+       }
+
+       f = min(r.x / c.x, r.y / c.y);
+       if(f < 1)
+               c = c * f; // ensures that c_x <= r_x and c_y <= r_y
+
+       minfactor = min(1, 640 / c.x);            // can be > 1 only if c_x is <640
+       maxfactor = max(1, r.x / c.x, r.y / c.y); // can be < 1 only if r_x < c_x and r_y < c_y
+       dprint("min factor: ", ftos(minfactor), "\n");
+       dprint("max factor: ", ftos(maxfactor), "\n");
+
+       if(sz < 0)
+               f = 1 - (maxfactor - 1) * sz;
+       else if(sz > 0)
+               f = 1 + (minfactor - 1) * sz;
+       else
+               f = 1;
+       c = c * f; // fteqcc fail
+
+       c_x = rint(c.x);
+       c_y = rint(c.y);
+
+       // Please reload resolutions list and such stuff.
+       XonoticResolutionSlider_DataHasChanged = true;
+
+       if (c.x != cvar("vid_conwidth") || c.y != cvar("vid_conheight"))
+       {
+               cvar_set("vid_conwidth", ftos(c.x));
+               cvar_set("vid_conheight", ftos(c.y));
+               return 1;
+       }
+       return 0;
+}
+entity makeXonoticResolutionSlider()
+{
+       entity me;
+       me = spawnXonoticResolutionSlider();
+       me.configureXonoticResolutionSlider(me);
+       return me;
+}
+void XonoticResolutionSlider_addResolution(entity me, float w, float h, float pixelheight)
+{
+       if (me.maxAllowedWidth && w > me.maxAllowedWidth)
+               return;
+       if (me.maxAllowedHeight && h > me.maxAllowedHeight)
+               return;
+       float i;
+       for (i = 0; i < me.nValues; ++i)
+       {
+               tokenize_console(me.valueToIdentifier(me, i));
+               if (w > stof(argv(0))) continue;
+               if (w < stof(argv(0))) break;
+               if (h > stof(argv(1))) continue;
+               if (h < stof(argv(1))) break;
+               if (pixelheight > stof(argv(2)) + 0.01) continue;
+               if (pixelheight < stof(argv(2)) - 0.01) break;
+               return;  // already there
+       }
+       if (pixelheight != 1)
+       {
+               float aspect = w / (h * pixelheight);
+               float bestdenom = rint(aspect);
+               float bestnum = 1;
+               float denom;
+               for (denom = 2; denom < 10; ++denom) {
+                       float num = rint(aspect * denom);
+                       if (fabs(num / denom - aspect) < fabs(bestnum / bestdenom - aspect))
+                       {
+                               bestnum = num;
+                               bestdenom = denom;
+                       }
+               }
+               me.insertValue(me, i, strzone(sprintf(_("%dx%d (%d:%d)"), w, h, bestnum, bestdenom)), strzone(strcat(ftos(w), " ", ftos(h), " ", ftos(pixelheight))));
+       }
+       else
+               me.insertValue(me, i, strzone(sprintf(_("%dx%d"), w, h)), strzone(strcat(ftos(w), " ", ftos(h), " ", ftos(pixelheight))));
+}
+float autocvar_menu_vid_allowdualscreenresolution;
+void XonoticResolutionSlider_configureXonoticResolutionSlider(entity me)
+{
+       me.configureXonoticTextSlider(me, "_menu_vid_width");
+       me.loadResolutions(me, cvar("vid_fullscreen"));
+}
+void XonoticResolutionSlider_loadResolutions(entity me, float fullscreen)
+{
+       float i;
+       vector r;
+
+       // HACK: text slider assumes the strings are constants, so clearValues
+       // will not unzone them
+       for(i = 0; i < me.nValues; ++i)
+       {
+               strunzone(me.valueToIdentifier(me, i));
+               strunzone(me.valueToText(me, i));
+       }
+       // NOW we can safely clear.
+       me.clearValues(me);
+       me.maxAllowedWidth = 0;
+       me.maxAllowedHeight = 0;
+
+       if (fullscreen)
+       {
+               for(i = 0;; ++i)
+               {
+                       r = getresolution(i);
+                       if(r_x == 0 && r_y == 0)
+                               break;
+                       if(r.x < 640 || r.y < 480)
+                               continue;
+                       if(r.x > 2 * r.y) // likely dualscreen resolution, skip this one
+                               if(autocvar_menu_vid_allowdualscreenresolution <= 0)
+                                       continue;
+                       me.addResolution(me, r.x, r.y, r.z);
+               }
+               r = getresolution(-1);
+               if(r.x != 0 || r.y != 0)
+                       me.addResolution(me, r.x, r.y, r.z);
+               dprint("Added system resolutions.\n");
+       }
+
+       if(me.nValues == 0)
+       {
+               // Get workarea.
+               r = getresolution(-2);
+               // If workarea is not supported, get desktop size.
+               if(r.x == 0 && r.y == 0)
+                       r = getresolution(-1);
+
+               // Add it, and limit all other resolutions to the workarea/desktop size.
+               if(r.x != 0 || r.y != 0)
+               {
+                       me.maxAllowedWidth = r.x;
+                       me.maxAllowedHeight = r.y;
+                       me.addResolution(me, r.x, r.y, r.z);
+               }
+
+               // Add nice hardcoded defaults.
+               me.addResolution(me, 640, 480, 1); // pc res
+#if 0
+               me.addResolution(me, 720, 480, 1.125); // DVD NTSC 4:3
+               me.addResolution(me, 720, 576, 0.9375); // DVD PAL 4:3
+               me.addResolution(me, 720, 480, 0.84375); // DVD NTSC 16:9
+               me.addResolution(me, 720, 576, 0.703125); // DVD PAL 16:9
+#endif
+               me.addResolution(me, 800, 480, 1); // 480p at 1:1 pixel aspect
+               me.addResolution(me, 800, 600, 1); // pc res
+               me.addResolution(me, 1024, 600, 1); // notebook res
+               me.addResolution(me, 1024, 768, 1); // pc res
+               me.addResolution(me, 1280, 720, 1); // 720p
+               me.addResolution(me, 1280, 960, 1); // pc res
+               me.addResolution(me, 1280, 1024, 1); // pc res
+               me.addResolution(me, 1920, 1080, 1); // 1080p
+               dprint("Added default resolutions.\n");
+       }
+       dprint("Total number of resolutions detected: ", ftos(me.nValues), "\n");
+
+       me.vid_fullscreen = fullscreen;
+
+       me.configureXonoticTextSliderValues(me);
+}
+void XonoticResolutionSlider_loadCvars(entity me)
+{
+       me.setValueFromIdentifier(me, strcat(cvar_string("_menu_vid_width"), " ", cvar_string("_menu_vid_height"), " ", cvar_string("_menu_vid_pixelheight")));
+}
+void XonoticResolutionSlider_saveCvars(entity me)
+{
+       if(me.value >= 0 || me.value < me.nValues)
+       {
+               tokenize_console(me.getIdentifier(me));
+               cvar_set("_menu_vid_width", argv(0));
+               cvar_set("_menu_vid_height", argv(1));
+               cvar_set("_menu_vid_pixelheight", argv(2));
+               vector r = getresolution(-1);
+               if (stof(argv(0)) == r.x && stof(argv(1)) == r.y && fabs(stof(argv(2)) - r.z) < 0.01)
+                       cvar_set("_menu_vid_desktopfullscreen", "1");
+               else
+                       cvar_set("_menu_vid_desktopfullscreen", "0");
+       }
+}
+void XonoticResolutionSlider_draw(entity me)
+{
+       if (cvar("vid_fullscreen") != me.vid_fullscreen)
+       {
+               me.loadResolutions(me, cvar("vid_fullscreen"));
+               XonoticResolutionSlider_DataHasChanged = true;
+       }
+       if (XonoticResolutionSlider_DataHasChanged)
+       {
+               XonoticResolutionSlider_DataHasChanged = false;
+               me.loadCvars(me);
+       }
+       SUPER(XonoticResolutionSlider).draw(me);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/slider_sbfadetime.c b/qcsrc/menu/xonotic/slider_sbfadetime.c
deleted file mode 100644 (file)
index 39f91f9..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticScoreboardFadeTimeSlider) EXTENDS(XonoticTextSlider)
-       METHOD(XonoticScoreboardFadeTimeSlider, configureXonoticScoreboardFadeTimeSlider, void(entity))
-       METHOD(XonoticScoreboardFadeTimeSlider, loadCvars, void(entity))
-       METHOD(XonoticScoreboardFadeTimeSlider, saveCvars, void(entity))
-ENDCLASS(XonoticScoreboardFadeTimeSlider)
-entity makeXonoticScoreboardFadeTimeSlider();
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticScoreboardFadeTimeSlider()
-{
-       entity me;
-       me = spawnXonoticScoreboardFadeTimeSlider();
-       me.configureXonoticScoreboardFadeTimeSlider(me);
-       return me;
-}
-void XonoticScoreboardFadeTimeSlider_configureXonoticScoreboardFadeTimeSlider(entity me)
-{
-       me.configureXonoticTextSlider(me, "scoreboard_fadeinspeed");
-       me.addValue(me, ZCTX(_("PART^Slow")),     "5 2.5");
-       me.addValue(me, ZCTX(_("PART^Normal")),   "10 5");
-       me.addValue(me, ZCTX(_("PART^Fast")),     "15 7.5");
-       me.addValue(me, ZCTX(_("PART^Instant")),  "0 0");
-       me.configureXonoticTextSliderValues(me);
-}
-void XonoticScoreboardFadeTimeSlider_loadCvars(entity me)
-{
-       me.setValueFromIdentifier(me, sprintf("%s %s",
-               cvar_string("scoreboard_fadeinspeed"),
-               cvar_string("scoreboard_fadeoutspeed")
-       ));
-}
-void XonoticScoreboardFadeTimeSlider_saveCvars(entity me)
-{
-       if(me.value >= 0 || me.value < me.nValues)
-       {
-               tokenize_console(me.getIdentifier(me));
-               cvar_set("scoreboard_fadeinspeed", argv(0));
-               cvar_set("scoreboard_fadeoutspeed", argv(1));
-       }
-}
-#endif
diff --git a/qcsrc/menu/xonotic/slider_sbfadetime.qc b/qcsrc/menu/xonotic/slider_sbfadetime.qc
new file mode 100644 (file)
index 0000000..39f91f9
--- /dev/null
@@ -0,0 +1,43 @@
+#ifdef INTERFACE
+CLASS(XonoticScoreboardFadeTimeSlider) EXTENDS(XonoticTextSlider)
+       METHOD(XonoticScoreboardFadeTimeSlider, configureXonoticScoreboardFadeTimeSlider, void(entity))
+       METHOD(XonoticScoreboardFadeTimeSlider, loadCvars, void(entity))
+       METHOD(XonoticScoreboardFadeTimeSlider, saveCvars, void(entity))
+ENDCLASS(XonoticScoreboardFadeTimeSlider)
+entity makeXonoticScoreboardFadeTimeSlider();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticScoreboardFadeTimeSlider()
+{
+       entity me;
+       me = spawnXonoticScoreboardFadeTimeSlider();
+       me.configureXonoticScoreboardFadeTimeSlider(me);
+       return me;
+}
+void XonoticScoreboardFadeTimeSlider_configureXonoticScoreboardFadeTimeSlider(entity me)
+{
+       me.configureXonoticTextSlider(me, "scoreboard_fadeinspeed");
+       me.addValue(me, ZCTX(_("PART^Slow")),     "5 2.5");
+       me.addValue(me, ZCTX(_("PART^Normal")),   "10 5");
+       me.addValue(me, ZCTX(_("PART^Fast")),     "15 7.5");
+       me.addValue(me, ZCTX(_("PART^Instant")),  "0 0");
+       me.configureXonoticTextSliderValues(me);
+}
+void XonoticScoreboardFadeTimeSlider_loadCvars(entity me)
+{
+       me.setValueFromIdentifier(me, sprintf("%s %s",
+               cvar_string("scoreboard_fadeinspeed"),
+               cvar_string("scoreboard_fadeoutspeed")
+       ));
+}
+void XonoticScoreboardFadeTimeSlider_saveCvars(entity me)
+{
+       if(me.value >= 0 || me.value < me.nValues)
+       {
+               tokenize_console(me.getIdentifier(me));
+               cvar_set("scoreboard_fadeinspeed", argv(0));
+               cvar_set("scoreboard_fadeoutspeed", argv(1));
+       }
+}
+#endif
diff --git a/qcsrc/menu/xonotic/soundlist.c b/qcsrc/menu/xonotic/soundlist.c
deleted file mode 100644 (file)
index e45e486..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticSoundList) EXTENDS(XonoticListBox)
-       METHOD(XonoticSoundList, configureXonoticSoundList, void(entity))
-       ATTRIB(XonoticSoundList, rowsPerItem, float, 1)
-       METHOD(XonoticSoundList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticSoundList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticSoundList, getSounds, void(entity))
-       METHOD(XonoticSoundList, soundName, string(entity, float))
-       METHOD(XonoticSoundList, clickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticSoundList, keyDown, float(entity, float, float, float))
-       METHOD(XonoticSoundList, destroy, void(entity))
-       METHOD(XonoticSoundList, showNotify, void(entity))
-
-       ATTRIB(XonoticSoundList, listSound, float, -1)
-       ATTRIB(XonoticSoundList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticSoundList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticSoundList, columnNameSize, float, 0)
-       ATTRIB(XonoticSoundList, columnNumberOrigin, float, 0)
-       ATTRIB(XonoticSoundList, columnNumberSize, float, 0)
-       ATTRIB(XonoticSoundList, realUpperMargin, float, 0)
-       ATTRIB(XonoticSoundList, origin, vector, '0 0 0')
-       ATTRIB(XonoticSoundList, itemAbsSize, vector, '0 0 0')
-
-       ATTRIB(XonoticSoundList, lastClickedSound, float, -1)
-       ATTRIB(XonoticSoundList, lastClickedTime, float, 0)
-       ATTRIB(XonoticSoundList, filterString, string, string_null)
-       ATTRIB(XonoticSoundList, playlist, entity, world)
-ENDCLASS(XonoticSoundList)
-
-entity makeXonoticSoundList();
-void SoundList_Filter_Change(entity box, entity me);
-void SoundList_Add(entity box, entity me);
-void SoundList_Add_All(entity box, entity me);
-void SoundList_Menu_Track_Change(entity box, entity me);
-void SoundList_Menu_Track_Reset(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-
-entity makeXonoticSoundList()
-{
-       entity me;
-       me = spawnXonoticSoundList();
-       me.configureXonoticSoundList(me);
-       return me;
-}
-
-void XonoticSoundList_configureXonoticSoundList(entity me)
-{
-       me.configureXonoticListBox(me);
-       me.getSounds(me);
-}
-
-string XonoticSoundList_soundName(entity me, float i )
-{
-       string s;
-       s = search_getfilename(me.listSound, i);
-       s = substring(s, 15, strlen(s) - 15 - 4);  // sound/cdtracks/, .ogg
-       return s;
-}
-
-
-void XonoticSoundList_getSounds(entity me)
-{
-       string s;
-
-       if(me.filterString)
-               //subdirectory in filterString allowed
-               s = strcat("sound/cdtracks/*", me.filterString, "*.ogg");
-       else
-               s = "sound/cdtracks/*.ogg";
-
-       if(me.listSound >= 0)
-               search_end(me.listSound);
-
-       me.listSound = search_begin(s, FALSE, TRUE);
-
-       if(me.listSound < 0)
-               me.nItems=0;
-       else
-               me.nItems=search_getsize(me.listSound);
-}
-
-void XonoticSoundList_destroy(entity me)
-{
-       if(me.listSound >= 0)
-               search_end(me.listSound);
-}
-
-void XonoticSoundList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.itemAbsSize = '0 0 0';
-       SUPER(XonoticSoundList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight));
-       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth)));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-
-       me.columnNumberOrigin = 0;
-       me.columnNumberSize = me.realFontSize_x * 3;
-
-       me.columnNameOrigin = me.columnNumberSize;
-       me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize_x;
-}
-
-void XonoticSoundList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       string s;
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
-       s = me.soundName(me,i);
-       if(s == cvar_string("menu_cdtrack")) // current menu track
-               draw_CenterText((me.columnNumberOrigin + 0.5 * me.columnNumberSize) * eX + me.realUpperMargin * eY, "[C]", me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
-       else if(s == cvar_defstring("menu_cdtrack")) // default menu track
-               draw_CenterText((me.columnNumberOrigin + 0.5 * me.columnNumberSize) * eX + me.realUpperMargin * eY, "[D]", me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
-
-       s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
-}
-
-void XonoticSoundList_showNotify(entity me)
-{
-       me.getSounds(me);
-}
-
-void SoundList_Menu_Track_Change(entity box, entity me)
-{
-       cvar_set("menu_cdtrack", me.soundName(me,me.selectedItem));
-}
-
-void SoundList_Menu_Track_Reset(entity box, entity me)
-{
-       cvar_set("menu_cdtrack", cvar_defstring("menu_cdtrack"));
-}
-
-void SoundList_Filter_Change(entity box, entity me)
-{
-       if(me.filterString)
-               strunzone(me.filterString);
-
-       if(box.text != "")
-               me.filterString = strzone(box.text);
-       else
-               me.filterString = string_null;
-
-       me.getSounds(me);
-}
-
-void SoundList_Add(entity box, entity me)
-{
-       me.playlist.addToPlayList(me.playlist, me.soundName(me, me.selectedItem));
-}
-
-void SoundList_Add_All(entity box, entity me)
-{
-       float i;
-       for(i = 0; i < me.nItems; ++i)
-               me.playlist.addToPlayList(me.playlist, me.soundName(me, i));
-}
-
-void XonoticSoundList_clickListBoxItem(entity me, float i, vector where)
-{
-       if(i == me.lastClickedSound)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       me.setSelected(me, i);
-                       me.playlist.addToPlayList(me.playlist, me.soundName(me, i));
-               }
-       me.lastClickedSound = i;
-       me.lastClickedTime = time;
-}
-
-float XonoticSoundList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       if(scan == K_ENTER || scan == K_KP_ENTER || scan == K_SPACE) {
-               me.playlist.addToPlayList(me.playlist, me.soundName(me, me.selectedItem));
-               return 1;
-       }
-       else
-               return SUPER(XonoticSoundList).keyDown(me, scan, ascii, shift);
-}
-#endif
-
diff --git a/qcsrc/menu/xonotic/soundlist.qc b/qcsrc/menu/xonotic/soundlist.qc
new file mode 100644 (file)
index 0000000..e443a53
--- /dev/null
@@ -0,0 +1,175 @@
+#ifdef INTERFACE
+CLASS(XonoticSoundList) EXTENDS(XonoticListBox)
+       METHOD(XonoticSoundList, configureXonoticSoundList, void(entity))
+       ATTRIB(XonoticSoundList, rowsPerItem, float, 1)
+       METHOD(XonoticSoundList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticSoundList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticSoundList, getSounds, void(entity))
+       METHOD(XonoticSoundList, soundName, string(entity, float))
+       METHOD(XonoticSoundList, doubleClickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticSoundList, keyDown, float(entity, float, float, float))
+       METHOD(XonoticSoundList, destroy, void(entity))
+       METHOD(XonoticSoundList, showNotify, void(entity))
+
+       ATTRIB(XonoticSoundList, listSound, float, -1)
+       ATTRIB(XonoticSoundList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticSoundList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticSoundList, columnNameSize, float, 0)
+       ATTRIB(XonoticSoundList, columnNumberOrigin, float, 0)
+       ATTRIB(XonoticSoundList, columnNumberSize, float, 0)
+       ATTRIB(XonoticSoundList, realUpperMargin, float, 0)
+       ATTRIB(XonoticSoundList, origin, vector, '0 0 0')
+       ATTRIB(XonoticSoundList, itemAbsSize, vector, '0 0 0')
+
+       ATTRIB(XonoticSoundList, filterString, string, string_null)
+       ATTRIB(XonoticSoundList, playlist, entity, world)
+ENDCLASS(XonoticSoundList)
+
+entity makeXonoticSoundList();
+void SoundList_Filter_Change(entity box, entity me);
+void SoundList_Add(entity box, entity me);
+void SoundList_Add_All(entity box, entity me);
+void SoundList_Menu_Track_Change(entity box, entity me);
+void SoundList_Menu_Track_Reset(entity box, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+
+entity makeXonoticSoundList()
+{
+       entity me;
+       me = spawnXonoticSoundList();
+       me.configureXonoticSoundList(me);
+       return me;
+}
+
+void XonoticSoundList_configureXonoticSoundList(entity me)
+{
+       me.configureXonoticListBox(me);
+       me.getSounds(me);
+}
+
+string XonoticSoundList_soundName(entity me, float i )
+{
+       string s;
+       s = search_getfilename(me.listSound, i);
+       s = substring(s, 15, strlen(s) - 15 - 4);  // sound/cdtracks/, .ogg
+       return s;
+}
+
+
+void XonoticSoundList_getSounds(entity me)
+{
+       string s;
+
+       if(me.filterString)
+               //subdirectory in filterString allowed
+               s = strcat("sound/cdtracks/*", me.filterString, "*.ogg");
+       else
+               s = "sound/cdtracks/*.ogg";
+
+       if(me.listSound >= 0)
+               search_end(me.listSound);
+
+       me.listSound = search_begin(s, false, true);
+
+       if(me.listSound < 0)
+               me.nItems=0;
+       else
+               me.nItems=search_getsize(me.listSound);
+}
+
+void XonoticSoundList_destroy(entity me)
+{
+       if(me.listSound >= 0)
+               search_end(me.listSound);
+}
+
+void XonoticSoundList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.itemAbsSize = '0 0 0';
+       SUPER(XonoticSoundList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
+       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+
+       me.columnNumberOrigin = 0;
+       me.columnNumberSize = me.realFontSize.x * 3;
+
+       me.columnNameOrigin = me.columnNumberSize;
+       me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize.x;
+}
+
+void XonoticSoundList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       string s;
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+
+       s = me.soundName(me,i);
+       if(s == cvar_string("menu_cdtrack")) // current menu track
+               draw_CenterText((me.columnNumberOrigin + 0.5 * me.columnNumberSize) * eX + me.realUpperMargin * eY, "[C]", me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+       else if(s == cvar_defstring("menu_cdtrack")) // default menu track
+               draw_CenterText((me.columnNumberOrigin + 0.5 * me.columnNumberSize) * eX + me.realUpperMargin * eY, "[D]", me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+
+       s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+}
+
+void XonoticSoundList_showNotify(entity me)
+{
+       me.getSounds(me);
+}
+
+void SoundList_Menu_Track_Change(entity box, entity me)
+{
+       cvar_set("menu_cdtrack", me.soundName(me,me.selectedItem));
+}
+
+void SoundList_Menu_Track_Reset(entity box, entity me)
+{
+       cvar_set("menu_cdtrack", cvar_defstring("menu_cdtrack"));
+}
+
+void SoundList_Filter_Change(entity box, entity me)
+{
+       if(me.filterString)
+               strunzone(me.filterString);
+
+       if(box.text != "")
+               me.filterString = strzone(box.text);
+       else
+               me.filterString = string_null;
+
+       me.getSounds(me);
+}
+
+void SoundList_Add(entity box, entity me)
+{
+       me.playlist.addToPlayList(me.playlist, me.soundName(me, me.selectedItem));
+}
+
+void SoundList_Add_All(entity box, entity me)
+{
+       float i;
+       for(i = 0; i < me.nItems; ++i)
+               me.playlist.addToPlayList(me.playlist, me.soundName(me, i));
+}
+
+void XonoticSoundList_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       me.playlist.addToPlayList(me.playlist, me.soundName(me, i));
+}
+
+float XonoticSoundList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       if(scan == K_ENTER || scan == K_KP_ENTER || scan == K_SPACE) {
+               me.playlist.addToPlayList(me.playlist, me.soundName(me, me.selectedItem));
+               return 1;
+       }
+       else
+               return SUPER(XonoticSoundList).keyDown(me, scan, ascii, shift);
+}
+#endif
+
diff --git a/qcsrc/menu/xonotic/statslist.c b/qcsrc/menu/xonotic/statslist.c
deleted file mode 100644 (file)
index 9882448..0000000
+++ /dev/null
@@ -1,362 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticStatsList) EXTENDS(XonoticListBox)
-       METHOD(XonoticStatsList, configureXonoticStatsList, void(entity))
-       ATTRIB(XonoticStatsList, rowsPerItem, float, 1.4)
-       METHOD(XonoticStatsList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticStatsList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticStatsList, getStats, void(entity))
-       METHOD(XonoticStatsList, clickListBoxItem, void(entity, float, vector))
-       METHOD(XonoticStatsList, keyDown, float(entity, float, float, float))
-       METHOD(XonoticStatsList, destroy, void(entity))
-       METHOD(XonoticStatsList, showNotify, void(entity))
-
-       ATTRIB(XonoticStatsList, listStats, float, -1)
-       ATTRIB(XonoticStatsList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticStatsList, realUpperMargin, float, 0)
-       ATTRIB(XonoticStatsList, columnNameOrigin, float, 0)
-       ATTRIB(XonoticStatsList, columnNameSize, float, 0)
-
-       ATTRIB(XonoticStatsList, lastClickedDemo, float, -1)
-       ATTRIB(XonoticStatsList, lastClickedTime, float, 0)
-ENDCLASS(XonoticStatsList)
-
-entity statslist; // for reference elsewhere
-entity makeXonoticStatsList();
-#endif
-
-#ifdef IMPLEMENTATION
-
-entity makeXonoticStatsList()
-{
-       entity me;
-       me = spawnXonoticStatsList();
-       me.configureXonoticStatsList(me);
-       return me;
-}
-
-void XonoticStatsList_configureXonoticStatsList(entity me)
-{
-       me.configureXonoticListBox(me);
-       me.getStats(me);
-}
-
-string XonoticStatsList_convertDate(string input)
-{
-       // 2013-12-21
-       // 0123456789
-       if(strlen(input) != 10)
-               return input;
-
-       string monthname = "";
-
-       switch(stof(substring(input, 5, 2)))
-       {
-               case 1:  monthname = _("January");    break;
-               case 2:  monthname = _("February");   break;
-               case 3:  monthname = _("March");      break;
-               case 4:  monthname = _("April");      break;
-               case 5:  monthname = _("May");        break;
-               case 6:  monthname = _("June");       break;
-               case 7:  monthname = _("July");       break;
-               case 8:  monthname = _("August");     break;
-               case 9:  monthname = _("September");  break;
-               case 10: monthname = _("October");    break;
-               case 11: monthname = _("November");   break;
-               case 12: monthname = _("December");   break;
-               default: return input; // failed, why?
-       }
-
-       return sprintf(
-               "%s %s, %d",
-               monthname,
-               count_ordinal(stof(substring(input, 8, 2))),
-               stof(substring(input, 0, 4))
-       );
-}
-
-void XonoticStatsList_getStats(entity me)
-{
-       dprint("XonoticStatsList_getStats() at time: ", ftos(time), "\n");
-       // delete the old buffer if it exists
-       if(me.listStats >= 0)
-               buf_del(me.listStats);
-
-       // create the new buffer if we have a stats buffer
-       if(PS_D_IN_DB >= 0)
-               me.listStats = buf_create();
-
-       // now confirmation, if we didn't create a buffer then just return now
-       if(me.listStats < 0)
-       {
-               me.nItems = 0;
-               return;
-       }
-
-       float order = 0;
-       string e = "", en = "", data = "";
-
-       string outstr = ""; // NOTE: out string MUST use underscores for spaces here, we'll replace them later
-       string orderstr = "";
-
-       float out_total_matches = -1;
-       float out_total_wins = -1;
-       float out_total_losses = -1;
-
-       float out_total_kills = -1;
-       float out_total_deaths = -1;
-
-       for(e = PS_D_IN_EVL; (en = db_get(PS_D_IN_DB, e)) != ""; e = en)
-       {
-               order = 0;
-               outstr = "";
-               orderstr = "";
-               data = db_get(PS_D_IN_DB, sprintf("#%s", e));
-
-               // non-gamemode specific stuff
-               switch(e)
-               {
-                       case "overall/joined_dt":
-                       {
-                               order = 1;
-                               outstr = _("Joined:");
-                               data = XonoticStatsList_convertDate(car(data));
-                               break;
-                       }
-                       case "overall/last_seen_dt":
-                       {
-                               order = 1;
-                               outstr = _("Last_Seen:");
-                               data = XonoticStatsList_convertDate(car(data));
-                               break;
-                       }
-                       case "overall/alivetime":
-                       {
-                               order = 1;
-                               outstr = _("Time_Played:");
-                               data = process_time(3, stof(data));
-                               break;
-                       }
-                       case "overall/favorite-map":
-                       {
-                               order = 2;
-                               outstr = _("Favorite_Map:");
-                               data = car(data);
-                               break;
-                       }
-                       case "overall/matches":
-                       {
-                               order = -1;
-                               out_total_matches = stof(data);
-                               break;
-                       }
-                       case "overall/wins":
-                       {
-                               order = -1;
-                               out_total_wins = stof(data);
-                               break;
-                       }
-                       case "overall/total-kills":
-                       {
-                               order = -1;
-                               out_total_kills = stof(data);
-                               break;
-                       }
-                       case "overall/total-deaths":
-                       {
-                               order = -1;
-                               out_total_deaths = stof(data);
-                               break;
-                       }
-               }
-
-               if((order == -1) && (out_total_matches >= 0) && (out_total_wins >= 0))
-               {
-                       bufstr_add(me.listStats, sprintf("003Matches: %d", out_total_matches), TRUE);
-                       
-                       if(out_total_matches > 0) // don't show extra info if there are no matches played
-                       {
-                               out_total_losses = max(0, (out_total_matches - out_total_wins));
-                               bufstr_add(me.listStats, sprintf("003Wins/Losses: %d/%d", out_total_wins, out_total_losses), TRUE);
-                               bufstr_add(me.listStats, sprintf("004Win_Percentage: %d%%", ((out_total_wins / out_total_matches) * 100)), TRUE);
-                       }
-
-                       out_total_matches = -1;
-                       out_total_wins = -1;
-                       out_total_losses = -1;
-                       continue;
-               }
-
-               if((order == -1) && (out_total_kills >= 0) && (out_total_deaths >= 0))
-               {
-                       bufstr_add(me.listStats, sprintf("005Kills/Deaths: %d/%d", out_total_kills, out_total_deaths), TRUE);
-
-                       // if there are no deaths, just show kill count 
-                       if(out_total_deaths > 0)
-                               bufstr_add(me.listStats, sprintf("006Kill_Ratio: %.2f", (out_total_kills / out_total_deaths)), TRUE);
-                       else
-                               bufstr_add(me.listStats, sprintf("006Kill_Ratio: %.2f", out_total_kills), TRUE);
-
-                       out_total_kills = -1;
-                       out_total_deaths = -1;
-                       continue;
-               }
-
-               // game mode specific stuff
-               if(order > 0)
-               {
-                       orderstr = sprintf("%03d", order);
-               }
-               else
-               {
-                       float dividerpos = strstrofs(e, "/", 0);
-                       
-                       string gametype = substring(e, 0, dividerpos);
-                       if(gametype == "overall") { continue; }
-                       
-                       string event = substring(e, (dividerpos + 1), strlen(e) - (dividerpos + 1));
-
-                       // if we are ranked, read these sets of possible options
-                       if(stof(db_get(PS_D_IN_DB, sprintf("#%s/rank", gametype))))
-                       {
-                               switch(event)
-                               {
-                                       case "matches":
-                                       {
-                                               order = 1;
-                                               outstr = sprintf(_("%s_Matches:"), strtoupper(gametype));
-                                               //data = sprintf(_("%d (unranked)"), data);
-                                               break;
-                                       }
-                                       case "elo":
-                                       {
-                                               order = 2;
-                                               outstr = sprintf(_("%s_ELO:"), strtoupper(gametype));
-                                               data = sprintf("%d", stof(data));
-                                               break;
-                                       }
-                                       case "rank":
-                                       {
-                                               order = 3;
-                                               outstr = sprintf(_("%s_Rank:"), strtoupper(gametype));
-                                               data = sprintf("%d", stof(data));
-                                               break;
-                                       }
-                                       case "percentile":
-                                       {
-                                               order = 4;
-                                               outstr = sprintf(_("%s_Percentile:"), strtoupper(gametype));
-                                               data = sprintf("%d%%", stof(data));
-                                               break;
-                                       }
-                                       
-                                       #if 0
-                                       case "favorite-map":
-                                       {
-                                               order = 5;
-                                               outstr = sprintf(_("%s_Favorite_Map:"), strtoupper(gametype));
-                                               //data = sprintf(_("%d (unranked)"), data);
-                                               break;
-                                       }
-                                       #endif
-                                       
-                                       default: continue; // nothing to see here
-                               }
-
-                               // now set up order for sorting later
-                               orderstr = sprintf("%2.2s%d", gametype, order);
-                       }
-                       else if(event == "matches")
-                       {
-                               outstr = sprintf(_("%s_Matches:"), strtoupper(gametype));
-                               data = sprintf(_("%d (unranked)"), stof(data));
-
-                               // unranked game modes ALWAYS get put last
-                               orderstr = "zzz";
-                       }
-                       else { continue; }
-               }
-
-               bufstr_add(me.listStats, sprintf("%s%s %s", orderstr, outstr, data), TRUE);
-       }
-
-       me.nItems = buf_getsize(me.listStats);
-       if(me.nItems > 0)
-               buf_sort(me.listStats, 128, FALSE);
-}
-
-void XonoticStatsList_destroy(entity me)
-{
-       if(me.nItems > 0)
-               buf_del(me.listStats);
-}
-
-void XonoticStatsList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.itemAbsSize = '0 0 0';
-       SUPER(XonoticStatsList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize_y * me.itemHeight));
-       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize_x * (1 - me.controlWidth)));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-
-#if 0
-       me.columnNameOrigin = me.realFontSize_x;
-       me.columnNameSize = 0.5 - me.realFontSize_x; // end halfway at maximum length
-       me.columnDataOrigin = me.columnNameOrigin + me.columnNameSize;
-       me.columnDataSize = 1 - me.columnNameSize - me.realFontSize_x; // fill the rest of the control
-#else
-       me.columnNameOrigin = me.realFontSize_x;
-       me.columnNameSize = 1 - 2 * me.realFontSize_x;
-#endif
-}
-
-void XonoticStatsList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-
-       string data = bufstr_get(me.listStats, i);
-       string s = car(data);
-       string d = cdr(data);
-       
-       s = substring(s, 3, strlen(s) - 3);
-       s = strreplace("_", " ", s);
-       s = draw_TextShortenToWidth(s, 0.5 * me.columnNameSize, 0, me.realFontSize);
-       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 1);
-
-       d = draw_TextShortenToWidth(d, me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize), 0, me.realFontSize);
-       draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 1 * (me.columnNameSize - draw_TextWidth(d, 0, me.realFontSize))) * eX, d, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 1);
-}
-
-void XonoticStatsList_showNotify(entity me)
-{
-       PlayerStats_PlayerDetail_CheckUpdate();
-}
-
-void XonoticStatsList_clickListBoxItem(entity me, float i, vector where)
-{
-       if(i == me.lastClickedDemo)
-               if(time < me.lastClickedTime + 0.3)
-               {
-                       // DOUBLE CLICK!
-                       me.setSelected(me, i);
-                       //DemoConfirm_ListClick_Check_Gamestatus(me);
-               }
-       me.lastClickedDemo = i;
-       me.lastClickedTime = time;
-}
-
-float XonoticStatsList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       if(scan == K_ENTER || scan == K_KP_ENTER)
-       {
-               //DemoConfirm_ListClick_Check_Gamestatus(me);
-               return 1;
-       }
-       else
-       {
-               return SUPER(XonoticStatsList).keyDown(me, scan, ascii, shift);
-       }
-}
-#endif
-
diff --git a/qcsrc/menu/xonotic/statslist.qc b/qcsrc/menu/xonotic/statslist.qc
new file mode 100644 (file)
index 0000000..99c850f
--- /dev/null
@@ -0,0 +1,357 @@
+#include "../../common/counting.qh"
+#include "../../common/playerstats.qh"
+
+#ifdef INTERFACE
+CLASS(XonoticStatsList) EXTENDS(XonoticListBox)
+       METHOD(XonoticStatsList, configureXonoticStatsList, void(entity))
+       ATTRIB(XonoticStatsList, rowsPerItem, float, 1.4)
+       METHOD(XonoticStatsList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticStatsList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticStatsList, getStats, void(entity))
+       METHOD(XonoticStatsList, doubleClickListBoxItem, void(entity, float, vector))
+       METHOD(XonoticStatsList, keyDown, float(entity, float, float, float))
+       METHOD(XonoticStatsList, destroy, void(entity))
+       METHOD(XonoticStatsList, showNotify, void(entity))
+
+       ATTRIB(XonoticStatsList, listStats, float, -1)
+       ATTRIB(XonoticStatsList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticStatsList, realUpperMargin, float, 0)
+       ATTRIB(XonoticStatsList, columnNameOrigin, float, 0)
+       ATTRIB(XonoticStatsList, columnNameSize, float, 0)
+ENDCLASS(XonoticStatsList)
+
+#ifndef IMPLEMENTATION
+// public:
+entity statslist; // for reference elsewhere
+#endif
+entity makeXonoticStatsList();
+#endif
+
+#ifdef IMPLEMENTATION
+
+entity makeXonoticStatsList()
+{
+       entity me;
+       me = spawnXonoticStatsList();
+       me.configureXonoticStatsList(me);
+       return me;
+}
+
+void XonoticStatsList_configureXonoticStatsList(entity me)
+{
+       me.configureXonoticListBox(me);
+       me.getStats(me);
+}
+
+string XonoticStatsList_convertDate(string input)
+{
+       // 2013-12-21
+       // 0123456789
+       if(strlen(input) != 10)
+               return input;
+
+       string monthname = "";
+
+       switch(stof(substring(input, 5, 2)))
+       {
+               case 1:  monthname = _("January");    break;
+               case 2:  monthname = _("February");   break;
+               case 3:  monthname = _("March");      break;
+               case 4:  monthname = _("April");      break;
+               case 5:  monthname = _("May");        break;
+               case 6:  monthname = _("June");       break;
+               case 7:  monthname = _("July");       break;
+               case 8:  monthname = _("August");     break;
+               case 9:  monthname = _("September");  break;
+               case 10: monthname = _("October");    break;
+               case 11: monthname = _("November");   break;
+               case 12: monthname = _("December");   break;
+               default: return input; // failed, why?
+       }
+
+       return sprintf(
+               "%s %s, %d",
+               monthname,
+               count_ordinal(stof(substring(input, 8, 2))),
+               stof(substring(input, 0, 4))
+       );
+}
+
+void XonoticStatsList_getStats(entity me)
+{
+       dprint("XonoticStatsList_getStats() at time: ", ftos(time), "\n");
+       // delete the old buffer if it exists
+       if(me.listStats >= 0)
+               buf_del(me.listStats);
+
+       // create the new buffer if we have a stats buffer
+       if(PS_D_IN_DB >= 0)
+               me.listStats = buf_create();
+
+       // now confirmation, if we didn't create a buffer then just return now
+       if(me.listStats < 0)
+       {
+               me.nItems = 0;
+               return;
+       }
+
+       float order = 0;
+       string e = "", en = "", data = "";
+
+       string outstr = ""; // NOTE: out string MUST use underscores for spaces here, we'll replace them later
+       string orderstr = "";
+
+       float out_total_matches = -1;
+       float out_total_wins = -1;
+       float out_total_losses = -1;
+
+       float out_total_kills = -1;
+       float out_total_deaths = -1;
+
+       for(e = PS_D_IN_EVL; (en = db_get(PS_D_IN_DB, e)) != ""; e = en)
+       {
+               order = 0;
+               outstr = "";
+               orderstr = "";
+               data = db_get(PS_D_IN_DB, sprintf("#%s", e));
+
+               // non-gamemode specific stuff
+               switch(e)
+               {
+                       case "overall/joined_dt":
+                       {
+                               order = 1;
+                               outstr = _("Joined:");
+                               data = XonoticStatsList_convertDate(car(data));
+                               break;
+                       }
+                       case "overall/last_seen_dt":
+                       {
+                               order = 1;
+                               outstr = _("Last_Seen:");
+                               data = XonoticStatsList_convertDate(car(data));
+                               break;
+                       }
+                       case "overall/alivetime":
+                       {
+                               order = 1;
+                               outstr = _("Time_Played:");
+                               data = process_time(3, stof(data));
+                               break;
+                       }
+                       case "overall/favorite-map":
+                       {
+                               order = 2;
+                               outstr = _("Favorite_Map:");
+                               data = car(data);
+                               break;
+                       }
+                       case "overall/matches":
+                       {
+                               order = -1;
+                               out_total_matches = stof(data);
+                               break;
+                       }
+                       case "overall/wins":
+                       {
+                               order = -1;
+                               out_total_wins = stof(data);
+                               break;
+                       }
+                       case "overall/total-kills":
+                       {
+                               order = -1;
+                               out_total_kills = stof(data);
+                               break;
+                       }
+                       case "overall/total-deaths":
+                       {
+                               order = -1;
+                               out_total_deaths = stof(data);
+                               break;
+                       }
+               }
+
+               if((order == -1) && (out_total_matches >= 0) && (out_total_wins >= 0))
+               {
+                       bufstr_add(me.listStats, sprintf("003Matches: %d", out_total_matches), true);
+
+                       if(out_total_matches > 0) // don't show extra info if there are no matches played
+                       {
+                               out_total_losses = max(0, (out_total_matches - out_total_wins));
+                               bufstr_add(me.listStats, sprintf("003Wins/Losses: %d/%d", out_total_wins, out_total_losses), true);
+                               bufstr_add(me.listStats, sprintf("004Win_Percentage: %d%%", ((out_total_wins / out_total_matches) * 100)), true);
+                       }
+
+                       out_total_matches = -1;
+                       out_total_wins = -1;
+                       out_total_losses = -1;
+                       continue;
+               }
+
+               if((order == -1) && (out_total_kills >= 0) && (out_total_deaths >= 0))
+               {
+                       bufstr_add(me.listStats, sprintf("005Kills/Deaths: %d/%d", out_total_kills, out_total_deaths), true);
+
+                       // if there are no deaths, just show kill count
+                       if(out_total_deaths > 0)
+                               bufstr_add(me.listStats, sprintf("006Kill_Ratio: %.2f", (out_total_kills / out_total_deaths)), true);
+                       else
+                               bufstr_add(me.listStats, sprintf("006Kill_Ratio: %.2f", out_total_kills), true);
+
+                       out_total_kills = -1;
+                       out_total_deaths = -1;
+                       continue;
+               }
+
+               // game mode specific stuff
+               if(order > 0)
+               {
+                       orderstr = sprintf("%03d", order);
+               }
+               else
+               {
+                       float dividerpos = strstrofs(e, "/", 0);
+
+                       string gametype = substring(e, 0, dividerpos);
+                       if(gametype == "overall") { continue; }
+
+                       string event = substring(e, (dividerpos + 1), strlen(e) - (dividerpos + 1));
+
+                       // if we are ranked, read these sets of possible options
+                       if(stof(db_get(PS_D_IN_DB, sprintf("#%s/rank", gametype))))
+                       {
+                               switch(event)
+                               {
+                                       case "matches":
+                                       {
+                                               order = 1;
+                                               outstr = sprintf(_("%s_Matches:"), strtoupper(gametype));
+                                               //data = sprintf(_("%d (unranked)"), data);
+                                               break;
+                                       }
+                                       case "elo":
+                                       {
+                                               order = 2;
+                                               outstr = sprintf(_("%s_ELO:"), strtoupper(gametype));
+                                               data = sprintf("%d", stof(data));
+                                               break;
+                                       }
+                                       case "rank":
+                                       {
+                                               order = 3;
+                                               outstr = sprintf(_("%s_Rank:"), strtoupper(gametype));
+                                               data = sprintf("%d", stof(data));
+                                               break;
+                                       }
+                                       case "percentile":
+                                       {
+                                               order = 4;
+                                               outstr = sprintf(_("%s_Percentile:"), strtoupper(gametype));
+                                               data = sprintf("%d%%", stof(data));
+                                               break;
+                                       }
+
+                                       #if 0
+                                       case "favorite-map":
+                                       {
+                                               order = 5;
+                                               outstr = sprintf(_("%s_Favorite_Map:"), strtoupper(gametype));
+                                               //data = sprintf(_("%d (unranked)"), data);
+                                               break;
+                                       }
+                                       #endif
+
+                                       default: continue; // nothing to see here
+                               }
+
+                               // now set up order for sorting later
+                               orderstr = sprintf("%2.2s%d", gametype, order);
+                       }
+                       else if(event == "matches")
+                       {
+                               outstr = sprintf(_("%s_Matches:"), strtoupper(gametype));
+                               data = sprintf(_("%d (unranked)"), stof(data));
+
+                               // unranked game modes ALWAYS get put last
+                               orderstr = "zzz";
+                       }
+                       else { continue; }
+               }
+
+               bufstr_add(me.listStats, sprintf("%s%s %s", orderstr, outstr, data), true);
+       }
+
+       me.nItems = buf_getsize(me.listStats);
+       if(me.nItems > 0)
+               buf_sort(me.listStats, 128, false);
+}
+
+void XonoticStatsList_destroy(entity me)
+{
+       if(me.nItems > 0)
+               buf_del(me.listStats);
+}
+
+void XonoticStatsList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       me.itemAbsSize = '0 0 0';
+       SUPER(XonoticStatsList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
+       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+
+#if 0
+       me.columnNameOrigin = me.realFontSize.x;
+       me.columnNameSize = 0.5 - me.realFontSize.x; // end halfway at maximum length
+       me.columnDataOrigin = me.columnNameOrigin + me.columnNameSize;
+       me.columnDataSize = 1 - me.columnNameSize - me.realFontSize.x; // fill the rest of the control
+#else
+       me.columnNameOrigin = me.realFontSize.x;
+       me.columnNameSize = 1 - 2 * me.realFontSize.x;
+#endif
+}
+
+void XonoticStatsList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+
+       string data = bufstr_get(me.listStats, i);
+       string s = car(data);
+       string d = cdr(data);
+
+       s = substring(s, 3, strlen(s) - 3);
+       s = strreplace("_", " ", s);
+       s = draw_TextShortenToWidth(s, 0.5 * me.columnNameSize, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 1);
+
+       d = draw_TextShortenToWidth(d, me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize), 0, me.realFontSize);
+       draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + 1 * (me.columnNameSize - draw_TextWidth(d, 0, me.realFontSize))) * eX, d, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 1);
+}
+
+void XonoticStatsList_showNotify(entity me)
+{
+       PlayerStats_PlayerDetail_CheckUpdate();
+}
+
+void XonoticStatsList_doubleClickListBoxItem(entity me, float i, vector where)
+{
+       //DemoConfirm_ListClick_Check_Gamestatus(me);
+}
+
+float XonoticStatsList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       if(scan == K_ENTER || scan == K_KP_ENTER)
+       {
+               //DemoConfirm_ListClick_Check_Gamestatus(me);
+               return 1;
+       }
+       else
+       {
+               return SUPER(XonoticStatsList).keyDown(me, scan, ascii, shift);
+       }
+}
+#endif
+
diff --git a/qcsrc/menu/xonotic/tab.c b/qcsrc/menu/xonotic/tab.c
deleted file mode 100644 (file)
index d1a867a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticTab) EXTENDS(Tab)
-       // still to be customized by user
-       /*
-       ATTRIB(XonoticTab, intendedWidth, float, 0)
-       ATTRIB(XonoticTab, rows, float, 3)
-       ATTRIB(XonoticTab, columns, float, 2)
-       */
-       METHOD(XonoticTab, showNotify, void(entity))
-
-       ATTRIB(XonoticTab, marginTop, float, 0) // pixels
-       ATTRIB(XonoticTab, marginBottom, float, 0) // pixels
-       ATTRIB(XonoticTab, marginLeft, float, 0) // pixels
-       ATTRIB(XonoticTab, marginRight, float, 0) // pixels
-       ATTRIB(XonoticTab, columnSpacing, float, SKINMARGIN_COLUMNS) // pixels
-       ATTRIB(XonoticTab, rowSpacing, float, SKINMARGIN_ROWS) // pixels
-       ATTRIB(XonoticTab, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
-       ATTRIB(XonoticTab, titleHeight, float, SKINFONTSIZE_TITLE * SKINHEIGHT_TITLE) // pixels
-
-       ATTRIB(XonoticTab, backgroundImage, string, string_null)
-ENDCLASS(XonoticTab)
-#endif
-
-#ifdef IMPLEMENTATION
-void XonoticTab_showNotify(entity me)
-{
-       loadAllCvars(me);
-       SUPER(XonoticTab).showNotify(me);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/tab.qc b/qcsrc/menu/xonotic/tab.qc
new file mode 100644 (file)
index 0000000..d1a867a
--- /dev/null
@@ -0,0 +1,30 @@
+#ifdef INTERFACE
+CLASS(XonoticTab) EXTENDS(Tab)
+       // still to be customized by user
+       /*
+       ATTRIB(XonoticTab, intendedWidth, float, 0)
+       ATTRIB(XonoticTab, rows, float, 3)
+       ATTRIB(XonoticTab, columns, float, 2)
+       */
+       METHOD(XonoticTab, showNotify, void(entity))
+
+       ATTRIB(XonoticTab, marginTop, float, 0) // pixels
+       ATTRIB(XonoticTab, marginBottom, float, 0) // pixels
+       ATTRIB(XonoticTab, marginLeft, float, 0) // pixels
+       ATTRIB(XonoticTab, marginRight, float, 0) // pixels
+       ATTRIB(XonoticTab, columnSpacing, float, SKINMARGIN_COLUMNS) // pixels
+       ATTRIB(XonoticTab, rowSpacing, float, SKINMARGIN_ROWS) // pixels
+       ATTRIB(XonoticTab, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
+       ATTRIB(XonoticTab, titleHeight, float, SKINFONTSIZE_TITLE * SKINHEIGHT_TITLE) // pixels
+
+       ATTRIB(XonoticTab, backgroundImage, string, string_null)
+ENDCLASS(XonoticTab)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticTab_showNotify(entity me)
+{
+       loadAllCvars(me);
+       SUPER(XonoticTab).showNotify(me);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/tabcontroller.c b/qcsrc/menu/xonotic/tabcontroller.c
deleted file mode 100644 (file)
index 1faa625..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticTabController) EXTENDS(ModalController)
-       METHOD(XonoticTabController, configureXonoticTabController, void(entity, float))
-       METHOD(XonoticTabController, makeTabButton, entity(entity, string, entity))
-       ATTRIB(XonoticTabController, rows, float, 0)
-       ATTRIB(XonoticTabController, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticTabController, image, string, SKINGFX_BUTTON)
-ENDCLASS(XonoticTabController)
-entity makeXonoticTabController(float theRows);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticTabController(float theRows)
-{
-       entity me;
-       me = spawnXonoticTabController();
-       me.configureXonoticTabController(me, theRows);
-       return me;
-}
-void XonoticTabController_configureXonoticTabController(entity me, float theRows)
-{
-       me.rows = theRows;
-}
-entity XonoticTabController_makeTabButton(entity me, string theTitle, entity tab)
-{
-       entity b;
-       if(me.rows != tab.rows)
-               error("Tab dialog height mismatch!");
-       b = makeXonoticButton(theTitle, '0 0 0');
-               me.addTab(me, tab, b);
-       // TODO make this real tab buttons (with color parameters, and different gfx)
-       return b;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/tabcontroller.qc b/qcsrc/menu/xonotic/tabcontroller.qc
new file mode 100644 (file)
index 0000000..1faa625
--- /dev/null
@@ -0,0 +1,34 @@
+#ifdef INTERFACE
+CLASS(XonoticTabController) EXTENDS(ModalController)
+       METHOD(XonoticTabController, configureXonoticTabController, void(entity, float))
+       METHOD(XonoticTabController, makeTabButton, entity(entity, string, entity))
+       ATTRIB(XonoticTabController, rows, float, 0)
+       ATTRIB(XonoticTabController, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticTabController, image, string, SKINGFX_BUTTON)
+ENDCLASS(XonoticTabController)
+entity makeXonoticTabController(float theRows);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticTabController(float theRows)
+{
+       entity me;
+       me = spawnXonoticTabController();
+       me.configureXonoticTabController(me, theRows);
+       return me;
+}
+void XonoticTabController_configureXonoticTabController(entity me, float theRows)
+{
+       me.rows = theRows;
+}
+entity XonoticTabController_makeTabButton(entity me, string theTitle, entity tab)
+{
+       entity b;
+       if(me.rows != tab.rows)
+               error("Tab dialog height mismatch!");
+       b = makeXonoticButton(theTitle, '0 0 0');
+               me.addTab(me, tab, b);
+       // TODO make this real tab buttons (with color parameters, and different gfx)
+       return b;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/textlabel.c b/qcsrc/menu/xonotic/textlabel.c
deleted file mode 100644 (file)
index c0e0806..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticTextLabel) EXTENDS(Label)
-       METHOD(XonoticTextLabel, configureXonoticTextLabel, void(entity, float, string))
-       METHOD(XonoticTextLabel, draw, void(entity))
-       ATTRIB(XonoticTextLabel, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticTextLabel, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticTextLabel, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticTextLabel)
-entity makeXonoticTextLabel(float theAlign, string theText);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticTextLabel(float theAlign, string theText)
-{
-       entity me;
-       me = spawnXonoticTextLabel();
-       me.configureXonoticTextLabel(me, theAlign, theText);
-       return me;
-}
-entity makeXonoticHeaderLabel(string theText)
-{
-       entity me;
-       me = makeXonoticTextLabel(0.5, theText);
-       me.colorL = SKINCOLOR_HEADER;
-       me.alpha = SKINALPHA_HEADER;
-       me.isBold = TRUE;
-       return me;
-}
-void XonoticTextLabel_configureXonoticTextLabel(entity me, float theAlign, string theText)
-{
-       me.configureLabel(me, theText, me.fontSize, theAlign);
-}
-void XonoticTextLabel_draw(entity me)
-{
-       SUPER(XonoticTextLabel).draw(me);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/textlabel.qc b/qcsrc/menu/xonotic/textlabel.qc
new file mode 100644 (file)
index 0000000..cb54da1
--- /dev/null
@@ -0,0 +1,37 @@
+#ifdef INTERFACE
+CLASS(XonoticTextLabel) EXTENDS(Label)
+       METHOD(XonoticTextLabel, configureXonoticTextLabel, void(entity, float, string))
+       METHOD(XonoticTextLabel, draw, void(entity))
+       ATTRIB(XonoticTextLabel, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticTextLabel, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticTextLabel, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticTextLabel)
+entity makeXonoticTextLabel(float theAlign, string theText);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticTextLabel(float theAlign, string theText)
+{
+       entity me;
+       me = spawnXonoticTextLabel();
+       me.configureXonoticTextLabel(me, theAlign, theText);
+       return me;
+}
+entity makeXonoticHeaderLabel(string theText)
+{
+       entity me;
+       me = makeXonoticTextLabel(0.5, theText);
+       me.colorL = SKINCOLOR_HEADER;
+       me.alpha = SKINALPHA_HEADER;
+       me.isBold = true;
+       return me;
+}
+void XonoticTextLabel_configureXonoticTextLabel(entity me, float theAlign, string theText)
+{
+       me.configureLabel(me, theText, me.fontSize, theAlign);
+}
+void XonoticTextLabel_draw(entity me)
+{
+       SUPER(XonoticTextLabel).draw(me);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/textslider.c b/qcsrc/menu/xonotic/textslider.c
deleted file mode 100644 (file)
index 844b3ef..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticTextSlider) EXTENDS(TextSlider)
-       METHOD(XonoticTextSlider, configureXonoticTextSlider, void(entity, string))
-       METHOD(XonoticTextSlider, setValue, void(entity, float))
-       METHOD(XonoticTextSlider, configureXonoticTextSliderValues, void(entity))
-       ATTRIB(XonoticTextSlider, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticTextSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
-       ATTRIB(XonoticTextSlider, image, string, SKINGFX_SLIDER)
-       ATTRIB(XonoticTextSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
-       ATTRIB(XonoticTextSlider, align, float, 0.5)
-       ATTRIB(XonoticTextSlider, color, vector, SKINCOLOR_SLIDER_N)
-       ATTRIB(XonoticTextSlider, colorC, vector, SKINCOLOR_SLIDER_C)
-       ATTRIB(XonoticTextSlider, colorF, vector, SKINCOLOR_SLIDER_F)
-       ATTRIB(XonoticTextSlider, colorD, vector, SKINCOLOR_SLIDER_D)
-       ATTRIB(XonoticTextSlider, color2, vector, SKINCOLOR_SLIDER_S)
-
-       ATTRIB(XonoticTextSlider, cvarName, string, string_null)
-       METHOD(XonoticTextSlider, loadCvars, void(entity))
-       METHOD(XonoticTextSlider, saveCvars, void(entity))
-       ATTRIB(XonoticTextSlider, sendCvars, float, 0)
-
-       ATTRIB(XonoticTextSlider, alpha, float, SKINALPHA_TEXT)
-       ATTRIB(XonoticTextSlider, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticTextSlider)
-entity makeXonoticTextSlider(string); // note: you still need to call addValue and configureXonoticTextSliderValues!
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticTextSlider(string theCvar)
-{
-       entity me;
-       me = spawnXonoticTextSlider();
-       me.configureXonoticTextSlider(me, theCvar);
-       return me;
-}
-void XonoticTextSlider_configureXonoticTextSlider(entity me, string theCvar)
-{
-       me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
-       if(theCvar)
-       {
-               me.cvarName = theCvar;
-               me.tooltip = getZonedTooltipForIdentifier(theCvar);
-               // don't load it yet
-       }
-}
-void XonoticTextSlider_setValue(entity me, float val)
-{
-       if(val != me.value)
-       {
-               SUPER(XonoticTextSlider).setValue( me, val );
-               me.saveCvars(me);
-       }
-}
-void XonoticTextSlider_loadCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       var float n = tokenize_console(me.cvarName);
-       var string s = cvar_string(argv(0));
-       float i;
-       for(i = 1; i < n; ++i)
-               s = strcat(s, " ", cvar_string(argv(i)));
-       me.setValueFromIdentifier(me, s);
-       if(me.value < 0 && n > 1)
-       {
-               // if it failed: check if all cvars have the same value
-               // if yes, try its value as 1-word identifier
-               for(i = 1; i < n; ++i)
-                       if(cvar_string(argv(i)) != cvar_string(argv(i-1)))
-                               break;
-               if(i >= n)
-                       me.setValueFromIdentifier(me, cvar_string(argv(0)));
-       }
-}
-void XonoticTextSlider_saveCvars(entity me)
-{
-       if (!me.cvarName)
-               return;
-
-       if(me.value >= 0 && me.value < me.nValues)
-       {
-               var float n = tokenize_console(me.cvarName);
-               if(n == 1)
-               {
-                       // this is a special case to allow spaces in the identifiers
-                       cvar_set(argv(0), me.getIdentifier(me));
-                       CheckSendCvars(me, argv(0));
-               }
-               else
-               {
-                       float i;
-                       var float m = tokenize_console(strcat(me.cvarName, " ", me.getIdentifier(me)));
-                       if(m == n + 1)
-                       {
-                               for(i = 0; i < n; ++i)
-                               {
-                                       cvar_set(argv(i), argv(n));
-                                       CheckSendCvars(me, argv(i));
-                               }
-                       }
-                       else if(m == n * 2)
-                       {
-                               for(i = 0; i < n; ++i)
-                               {
-                                       cvar_set(argv(i), argv(i + n));
-                                       CheckSendCvars(me, argv(i));
-                               }
-                       }
-                       else
-                               error("XonoticTextSlider: invalid identifier ", me.getIdentifier(me), " does not match cvar list ", me.cvarName);
-               }
-       }
-}
-void XonoticTextSlider_configureXonoticTextSliderValues(entity me)
-{
-       me.configureTextSliderValues(me, string_null);
-       me.loadCvars(me);
-}
-#endif
diff --git a/qcsrc/menu/xonotic/textslider.qc b/qcsrc/menu/xonotic/textslider.qc
new file mode 100644 (file)
index 0000000..dabd1b1
--- /dev/null
@@ -0,0 +1,120 @@
+#ifdef INTERFACE
+CLASS(XonoticTextSlider) EXTENDS(TextSlider)
+       METHOD(XonoticTextSlider, configureXonoticTextSlider, void(entity, string))
+       METHOD(XonoticTextSlider, setValue, void(entity, float))
+       METHOD(XonoticTextSlider, configureXonoticTextSliderValues, void(entity))
+       ATTRIB(XonoticTextSlider, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticTextSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
+       ATTRIB(XonoticTextSlider, image, string, SKINGFX_SLIDER)
+       ATTRIB(XonoticTextSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
+       ATTRIB(XonoticTextSlider, align, float, 0.5)
+       ATTRIB(XonoticTextSlider, color, vector, SKINCOLOR_SLIDER_N)
+       ATTRIB(XonoticTextSlider, colorC, vector, SKINCOLOR_SLIDER_C)
+       ATTRIB(XonoticTextSlider, colorF, vector, SKINCOLOR_SLIDER_F)
+       ATTRIB(XonoticTextSlider, colorD, vector, SKINCOLOR_SLIDER_D)
+       ATTRIB(XonoticTextSlider, color2, vector, SKINCOLOR_SLIDER_S)
+
+       ATTRIB(XonoticTextSlider, cvarName, string, string_null)
+       METHOD(XonoticTextSlider, loadCvars, void(entity))
+       METHOD(XonoticTextSlider, saveCvars, void(entity))
+       ATTRIB(XonoticTextSlider, sendCvars, float, 0)
+
+       ATTRIB(XonoticTextSlider, alpha, float, SKINALPHA_TEXT)
+       ATTRIB(XonoticTextSlider, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticTextSlider)
+entity makeXonoticTextSlider(string); // note: you still need to call addValue and configureXonoticTextSliderValues!
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticTextSlider(string theCvar)
+{
+       entity me;
+       me = spawnXonoticTextSlider();
+       me.configureXonoticTextSlider(me, theCvar);
+       return me;
+}
+void XonoticTextSlider_configureXonoticTextSlider(entity me, string theCvar)
+{
+       me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
+       if(theCvar)
+       {
+               me.cvarName = theCvar;
+               me.tooltip = getZonedTooltipForIdentifier(theCvar);
+               // don't load it yet
+       }
+}
+void XonoticTextSlider_setValue(entity me, float val)
+{
+       if(val != me.value)
+       {
+               SUPER(XonoticTextSlider).setValue( me, val );
+               me.saveCvars(me);
+       }
+}
+void XonoticTextSlider_loadCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       float n = tokenize_console(me.cvarName);
+       string s = cvar_string(argv(0));
+       float i;
+       for(i = 1; i < n; ++i)
+               s = strcat(s, " ", cvar_string(argv(i)));
+       me.setValueFromIdentifier(me, s);
+       if(me.value < 0 && n > 1)
+       {
+               // if it failed: check if all cvars have the same value
+               // if yes, try its value as 1-word identifier
+               for(i = 1; i < n; ++i)
+                       if(cvar_string(argv(i)) != cvar_string(argv(i-1)))
+                               break;
+               if(i >= n)
+                       me.setValueFromIdentifier(me, cvar_string(argv(0)));
+       }
+}
+void XonoticTextSlider_saveCvars(entity me)
+{
+       if (!me.cvarName)
+               return;
+
+       if(me.value >= 0 && me.value < me.nValues)
+       {
+               float n = tokenize_console(me.cvarName);
+               if(n == 1)
+               {
+                       // this is a special case to allow spaces in the identifiers
+                       cvar_set(argv(0), me.getIdentifier(me));
+                       CheckSendCvars(me, argv(0));
+               }
+               else
+               {
+                       float i;
+                       float m = tokenize_console(strcat(me.cvarName, " ", me.getIdentifier(me)));
+                       if(m == n + 1)
+                       {
+                               for(i = 0; i < n; ++i)
+                               {
+                                       cvar_set(argv(i), argv(n));
+                                       CheckSendCvars(me, argv(i));
+                               }
+                       }
+                       else if(m == n * 2)
+                       {
+                               for(i = 0; i < n; ++i)
+                               {
+                                       cvar_set(argv(i), argv(i + n));
+                                       CheckSendCvars(me, argv(i));
+                               }
+                       }
+                       else
+                               error("XonoticTextSlider: invalid identifier ", me.getIdentifier(me), " does not match cvar list ", me.cvarName);
+               }
+       }
+}
+void XonoticTextSlider_configureXonoticTextSliderValues(entity me)
+{
+       me.configureTextSliderValues(me, string_null);
+       me.loadCvars(me);
+}
+#endif
index cf4139fdeea9c51582fecfdd7d710fb9782b2abb..330b2bb726a0e89ccc19822ee8c8af0182b82e0e 100644 (file)
@@ -1,3 +1,5 @@
+#include "../../common/urllib.qh"
+
 float GL_CheckExtension(string ext)
 {
        return (strstrofs(strcat(" ", cvar_string("gl_info_extensions"), " "), strcat(" ", ext, " "), 0) >= 0);
@@ -327,8 +329,8 @@ void UpdateNotification_URI_Get_Callback(float id, float status, string data)
                n = tokenizebyseparator(data, "\n");
 
        float i;
-       string s; 
-       
+       string s;
+
        string un_version = "";
        string un_download = "";
        string un_url = "";
@@ -337,12 +339,12 @@ void UpdateNotification_URI_Get_Callback(float id, float status, string data)
        string un_promoted = "";
        string un_recommended = "";
        string un_compatexpire = "";
-       
+
        for(i = 0; i < n; ++i)
        {
                s = substring(argv(i), 2, -1);
                if(s == "") { continue; } // ignore empty lines
-               
+
                switch(substring(argv(i), 0, 1))
                {
                        case "V":
@@ -403,13 +405,13 @@ void UpdateNotification_URI_Get_Callback(float id, float status, string data)
                {
                        if(un_compatexpire != "")
                        {
-                               string curdate = strftime(FALSE, "%Y%m%d%H%M%S");
+                               string curdate = strftime(false, "%Y%m%d%H%M%S");
                                if (strcmp(curdate, un_compatexpire) >= 0)
                                        DisableServerBackwardsCompatibility();
                        }
                }
        }
-       
+
        if(un_emergency_pk3s != "")
        {
                _Nex_ExtResponseSystem_Packs = strzone(un_emergency_pk3s);
@@ -455,12 +457,12 @@ void updateCheck()
                float n, i;
                float allgood;
                n = tokenize_console(_Nex_ExtResponseSystem_Packs);
-               allgood = TRUE;
+               allgood = true;
                for(i = 0; i+1 < n; i += 2)
                {
                        if(fexists(argv(i+1)))
                                continue;
-                       allgood = FALSE;
+                       allgood = false;
                        if(_Nex_ExtResponseSystem_PacksStep == 1) // first run
                                localcmd("\ncurl --pak \"", argv(i), "\"\n");
                }
@@ -494,11 +496,11 @@ float preMenuInit()
        {
                draw_reset_cropped();
 
-               sz = eX * 0.025 + eY * 0.025 * (draw_scale_x / draw_scale_y);
-               draw_CenterText('0.5 0.5 0' - 1.25 * sz_y * eY, _("Autogenerating mapinfo for newly added maps..."), sz, '1 1 1', 1, 0);
+               sz = eX * 0.025 + eY * 0.025 * (draw_scale.x / draw_scale.y);
+               draw_CenterText('0.5 0.5 0' - 1.25 * sz.y * eY, _("Autogenerating mapinfo for newly added maps..."), sz, '1 1 1', 1, 0);
 
-               boxA = '0.05 0.5 0' + 0.25 * sz_y * eY;
-               boxB = '0.95 0.5 0' + 1.25 * sz_y * eY;
+               boxA = '0.05 0.5 0' + 0.25 * sz.y * eY;
+               boxB = '0.95 0.5 0' + 1.25 * sz.y * eY;
                draw_Fill(boxA, boxB - boxA, '1 1 1', 1);
 
                boxA += sz * 0.1;
@@ -508,17 +510,17 @@ float preMenuInit()
                boxB_x = boxA_x * (1 - MapInfo_progress) + boxB_x * MapInfo_progress;
                draw_Fill(boxA, boxB - boxA, '0 0 1', 1);
 
-               return FALSE;
+               return false;
        }
-       return TRUE;
+       return true;
 }
 
 string campaign_name_previous;
 float campaign_won_previous;
 #ifdef WATERMARK
-var string autocvar_menu_watermark = WATERMARK;
+string autocvar_menu_watermark = WATERMARK;
 #else
-var string autocvar_menu_watermark = "";
+string autocvar_menu_watermark = "";
 #endif
 void postMenuDraw()
 {
@@ -536,8 +538,8 @@ void preMenuDraw()
        if(_Nex_ExtResponseSystem_UpdateTo != "")
        {
                // TODO rather turn this into a dialog
-               fs = ((1/draw_scale_x) * eX + (1/draw_scale_y) * eY) * 12;
-               line = eY * fs_y;
+               fs = ((1/draw_scale.x) * eX + (1/draw_scale.y) * eY) * 12;
+               line = eY * fs.y;
                string l1, l2;
                l1 = sprintf(_("Update to %s now!"), _Nex_ExtResponseSystem_UpdateTo);
                l2 = "http://www.xonotic.org/";
@@ -548,11 +550,11 @@ void preMenuDraw()
                                draw_TextWidth(l1, 0, fs),
                                draw_TextWidth(l2, 0, fs)
                        );
-               sz_y = 3 * fs_y;
+               sz_y = 3 * fs.y;
 
                draw_alpha = bound(0, sin(time * 0.112 - 0.3) * 10, 1);
-               mid = eX * (0.5 + 0.5 * (1 - sz_x) * cos(time * 0.071))
-                   + eY * (0.5 + 0.5 * (1 - sz_y) * sin(time * 0.071));
+               mid = eX * (0.5 + 0.5 * (1 - sz.x) * cos(time * 0.071))
+                   + eY * (0.5 + 0.5 * (1 - sz.y) * sin(time * 0.071));
 
                draw_Fill(mid - 0.5 * sz, sz, '1 1 0', 1);
                draw_CenterText(mid - 1 * line, l1, fs, '1 0 0', 1, 0);
@@ -663,12 +665,11 @@ float updateCompression()
        //GAMETYPE(MAPINFO_TYPE_INVASION) \
        /* nothing */
 
-float GameType_GetID(float cnt)
+int GameType_GetID(int cnt)
 {
-       float i;
-       i = 0;
+       int i = 0;
 
-       #define GAMETYPE(id) { if(i++ == cnt) return id; }
+       #define GAMETYPE(id) { if (i++ == cnt) return id; }
        GAMETYPES
        #undef GAMETYPE
 
@@ -677,10 +678,9 @@ float GameType_GetID(float cnt)
        return 0;
 }
 
-float GameType_GetCount()
+int GameType_GetCount()
 {
-       float i;
-       i = 0;
+       int i = 0;
 
        #define GAMETYPE(id) ++i;
        GAMETYPES
@@ -689,9 +689,9 @@ float GameType_GetCount()
        return i;
 }
 
-string GameType_GetName(float cnt)
+string GameType_GetName(int cnt)
 {
-       float i = GameType_GetID(cnt);
+       int i = GameType_GetID(cnt);
 
        if(i)
                return MapInfo_Type_ToText(i);
@@ -699,9 +699,9 @@ string GameType_GetName(float cnt)
        return "";
 }
 
-string GameType_GetIcon(float cnt)
+string GameType_GetIcon(int cnt)
 {
-       float i = GameType_GetID(cnt);
+       int i = GameType_GetID(cnt);
 
        if(i)
                return strcat("gametype_", MapInfo_Type_ToString(i));
index 33ecb8c4d4c984754975c1b3ea1d5a8267da1c77..80803f8544df735f4363112b466441da3ad34f35 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef MENU_UTIL_H
+#define MENU_UTIL_H
+
 float GL_CheckExtension(string ext);
 float GL_Have_TextureCompression();
 
@@ -16,24 +19,26 @@ void setDependentAND3(entity e, string theCvarName, float theCvarMin, float theC
 void setDependentStringNotEqual(entity e, string theCvarName, string theCvarValue);
 void setDependentWeird(entity e, float(entity) func);
 
-float tooltipdb;
+int tooltipdb;
 void loadTooltips();
 void unloadTooltips();
 string getZonedTooltipForIdentifier(string s);
 
 string resolvemod(string m);
 
+float updateCompression();
+
 void UpdateNotification_URI_Get_Callback(float id, float status, string data);
 
 void URI_Get_Callback(float id, float status, string data);
 
 // game type list box stuff (does not NEED to contain all game types, other
 // types stay available via console)
-float GameType_GetID(float cnt);
-string GameType_GetName(float cnt);
-string GameType_GetIcon(float cnt);
+int GameType_GetID(int cnt);
+string GameType_GetName(int cnt);
+string GameType_GetIcon(int cnt);
 //string GameType_GetTeams(float cnt);
-float GameType_GetCount();
+int GameType_GetCount();
 
 void dialog_hudpanel_common_notoggle(entity me, string panelname);
 #define DIALOG_HUDPANEL_COMMON_NOTOGGLE() \
@@ -51,3 +56,4 @@ string _Nex_ExtResponseSystem_RecommendedServers;
 float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh;
 
 void CheckSendCvars(entity me, string cvarnamestring);
+#endif
diff --git a/qcsrc/menu/xonotic/weaponarenacheckbox.c b/qcsrc/menu/xonotic/weaponarenacheckbox.c
deleted file mode 100644 (file)
index 163f9c6..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticWeaponarenaCheckBox) EXTENDS(CheckBox)
-       METHOD(XonoticWeaponarenaCheckBox, configureXonoticWeaponarenaCheckBox, void(entity, string, string))
-       METHOD(XonoticWeaponarenaCheckBox, setChecked, void(entity, float))
-       ATTRIB(XonoticWeaponarenaCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticWeaponarenaCheckBox, image, string, SKINGFX_CHECKBOX)
-       ATTRIB(XonoticWeaponarenaCheckBox, netname, string, string_null)
-
-       METHOD(XonoticWeaponarenaCheckBox, loadCvars, void(entity))
-       METHOD(XonoticWeaponarenaCheckBox, saveCvars, void(entity))
-ENDCLASS(XonoticWeaponarenaCheckBox)
-entity makeXonoticWeaponarenaCheckBox(string, string);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticWeaponarenaCheckBox(string theWeapon, string theText)
-{
-       entity me;
-       me = spawnXonoticWeaponarenaCheckBox();
-       me.configureXonoticWeaponarenaCheckBox(me, theWeapon, theText);
-       return me;
-}
-void XonoticWeaponarenaCheckBox_configureXonoticWeaponarenaCheckBox(entity me, string theWeapon, string theText)
-{
-       me.netname = theWeapon;
-       me.checked = FALSE;
-       me.loadCvars(me);
-       me.configureCheckBox(me, theText, me.fontSize, me.image);
-}
-void XonoticWeaponarenaCheckBox_setChecked(entity me, float foo)
-{
-       me.checked = !me.checked;
-       me.saveCvars(me);
-}
-void XonoticWeaponarenaCheckBox_loadCvars(entity me)
-{
-       float n = tokenize_console(cvar_string("menu_weaponarena"));
-       float i;
-       for(i=0; i<n; ++i)
-       {
-               if(argv(i) == me.netname)
-               {
-                       me.checked = TRUE;
-                       break;
-               }
-       }
-}
-
-void XonoticWeaponarenaCheckBox_saveCvars(entity me)
-{
-       if(me.checked)
-               localcmd(strcat("\nmenu_cmd addtolist menu_weaponarena ", me.netname, "\n"));
-       else
-               localcmd(strcat("\nmenu_cmd removefromlist menu_weaponarena ", me.netname, "\n"));
-       localcmd("\ng_weaponarena \"$menu_weaponarena\"\n");
-}
-#endif
diff --git a/qcsrc/menu/xonotic/weaponarenacheckbox.qc b/qcsrc/menu/xonotic/weaponarenacheckbox.qc
new file mode 100644 (file)
index 0000000..a7d71f0
--- /dev/null
@@ -0,0 +1,57 @@
+#ifdef INTERFACE
+CLASS(XonoticWeaponarenaCheckBox) EXTENDS(CheckBox)
+       METHOD(XonoticWeaponarenaCheckBox, configureXonoticWeaponarenaCheckBox, void(entity, string, string))
+       METHOD(XonoticWeaponarenaCheckBox, setChecked, void(entity, float))
+       ATTRIB(XonoticWeaponarenaCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
+       ATTRIB(XonoticWeaponarenaCheckBox, image, string, SKINGFX_CHECKBOX)
+       ATTRIB(XonoticWeaponarenaCheckBox, netname, string, string_null)
+
+       METHOD(XonoticWeaponarenaCheckBox, loadCvars, void(entity))
+       METHOD(XonoticWeaponarenaCheckBox, saveCvars, void(entity))
+ENDCLASS(XonoticWeaponarenaCheckBox)
+entity makeXonoticWeaponarenaCheckBox(string, string);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticWeaponarenaCheckBox(string theWeapon, string theText)
+{
+       entity me;
+       me = spawnXonoticWeaponarenaCheckBox();
+       me.configureXonoticWeaponarenaCheckBox(me, theWeapon, theText);
+       return me;
+}
+void XonoticWeaponarenaCheckBox_configureXonoticWeaponarenaCheckBox(entity me, string theWeapon, string theText)
+{
+       me.netname = theWeapon;
+       me.checked = false;
+       me.loadCvars(me);
+       me.configureCheckBox(me, theText, me.fontSize, me.image);
+}
+void XonoticWeaponarenaCheckBox_setChecked(entity me, float foo)
+{
+       me.checked = !me.checked;
+       me.saveCvars(me);
+}
+void XonoticWeaponarenaCheckBox_loadCvars(entity me)
+{
+       float n = tokenize_console(cvar_string("menu_weaponarena"));
+       float i;
+       for(i=0; i<n; ++i)
+       {
+               if(argv(i) == me.netname)
+               {
+                       me.checked = true;
+                       break;
+               }
+       }
+}
+
+void XonoticWeaponarenaCheckBox_saveCvars(entity me)
+{
+       if(me.checked)
+               localcmd(strcat("\nmenu_cmd addtolist menu_weaponarena ", me.netname, "\n"));
+       else
+               localcmd(strcat("\nmenu_cmd removefromlist menu_weaponarena ", me.netname, "\n"));
+       localcmd("\ng_weaponarena \"$menu_weaponarena\"\n");
+}
+#endif
diff --git a/qcsrc/menu/xonotic/weaponslist.c b/qcsrc/menu/xonotic/weaponslist.c
deleted file mode 100644 (file)
index 8e573b8..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-#ifdef INTERFACE
-CLASS(XonoticWeaponsList) EXTENDS(XonoticListBox)
-       METHOD(XonoticWeaponsList, configureXonoticWeaponsList, void(entity))
-       METHOD(XonoticWeaponsList, toString, string(entity))
-       ATTRIB(XonoticWeaponsList, rowsPerItem, float, 1)
-       METHOD(XonoticWeaponsList, draw, void(entity))
-       METHOD(XonoticWeaponsList, drawListBoxItem, void(entity, float, vector, float))
-       METHOD(XonoticWeaponsList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticWeaponsList, keyDown, float(entity, float, float, float))
-       ATTRIB(XonoticWeaponsList, realFontSize, vector, '0 0 0')
-       ATTRIB(XonoticWeaponsList, realUpperMargin, float, 0)
-       METHOD(XonoticWeaponsList, mouseDrag, float(entity, vector))
-ENDCLASS(XonoticWeaponsList)
-entity makeXonoticWeaponsList();
-void WeaponsList_MoveUp_Click(entity btn, entity me);
-void WeaponsList_MoveDown_Click(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
-entity makeXonoticWeaponsList()
-{
-       entity me;
-       me = spawnXonoticWeaponsList();
-       me.configureXonoticWeaponsList(me);
-       return me;
-}
-void XonoticWeaponsList_configureXonoticWeaponsList(entity me)
-{
-       me.configureXonoticListBox(me);
-}
-void XonoticWeaponsList_draw(entity me)
-{
-       // read in cvar?
-       string s, t;
-       s = W_NumberWeaponOrder(cvar_string("cl_weaponpriority"));
-       t = W_FixWeaponOrder(s, 1);
-       if(t != s)
-               cvar_set("cl_weaponpriority", W_NameWeaponOrder(t));
-       me.nItems = tokenize_console(t);
-       SUPER(XonoticWeaponsList).draw(me);
-}
-void WeaponsList_MoveUp_Click(entity box, entity me)
-{
-       if(me.selectedItem > 0)
-       {
-               cvar_set("cl_weaponpriority", swapInPriorityList(cvar_string("cl_weaponpriority"), me.selectedItem - 1, me.selectedItem));
-               me.selectedItem -= 1;
-       }
-}
-void WeaponsList_MoveDown_Click(entity box, entity me)
-{
-       if(me.selectedItem < me.nItems - 1)
-       {
-               cvar_set("cl_weaponpriority", swapInPriorityList(cvar_string("cl_weaponpriority"), me.selectedItem, me.selectedItem + 1));
-               me.selectedItem += 1;
-       }
-}
-void XonoticWeaponsList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       SUPER(XonoticWeaponsList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
-
-       me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight);
-       me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth));
-       me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
-}
-float XonoticWeaponsList_mouseDrag(entity me, vector pos)
-{
-       float f, i;
-       i = me.selectedItem;
-       f = SUPER(XonoticWeaponsList).mouseDrag(me, pos);
-
-       if(me.pressed != 1) // don't change priority if the person is just scrolling
-       {
-               if(me.selectedItem != i)
-                       cvar_set("cl_weaponpriority", swapInPriorityList(cvar_string("cl_weaponpriority"), me.selectedItem, i));
-       }
-
-       return f;
-}
-string XonoticWeaponsList_toString(entity me)
-{
-       float n, i;
-       string s;
-       entity e;
-       n = tokenize_console(W_NumberWeaponOrder(cvar_string("cl_weaponpriority")));
-       s = "";
-       for(i = 0; i < n; ++i)
-       {
-               e = get_weaponinfo(stof(argv(i)));
-               s = strcat(s, e.message, ", ");
-       }
-       return substring(s, 0, strlen(s) - 2);
-}
-void XonoticWeaponsList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
-{
-       entity e;
-       if(isSelected)
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
-       e = get_weaponinfo(stof(argv(i)));
-       string msg = e.message;
-       if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
-               msg = sprintf(_("%s (mutator weapon)"), msg);
-
-       vector save_fontscale = draw_fontscale;
-       float f = draw_CondensedFontFactor(msg, FALSE, me.realFontSize, 1);
-       draw_fontscale_x *= f;
-       vector fs = me.realFontSize;
-       fs_x *= f;
-       draw_Text(me.realUpperMargin * eY, msg, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0);
-       draw_fontscale = save_fontscale;
-}
-
-float XonoticWeaponsList_keyDown(entity me, float scan, float ascii, float shift)
-{
-       if(ascii == 43) // +
-       {
-               WeaponsList_MoveUp_Click(NULL, me);
-               return 1;
-       }
-       else if(scan == 45) // -
-       {
-               WeaponsList_MoveDown_Click(NULL, me);
-               return 1;
-       }
-       else if(SUPER(XonoticWeaponsList).keyDown(me, scan, ascii, shift))
-               return 1;
-       return 0;
-}
-#endif
diff --git a/qcsrc/menu/xonotic/weaponslist.qc b/qcsrc/menu/xonotic/weaponslist.qc
new file mode 100644 (file)
index 0000000..1d3b897
--- /dev/null
@@ -0,0 +1,129 @@
+#ifdef INTERFACE
+CLASS(XonoticWeaponsList) EXTENDS(XonoticListBox)
+       METHOD(XonoticWeaponsList, configureXonoticWeaponsList, void(entity))
+       METHOD(XonoticWeaponsList, toString, string(entity))
+       ATTRIB(XonoticWeaponsList, rowsPerItem, float, 1)
+       METHOD(XonoticWeaponsList, draw, void(entity))
+       METHOD(XonoticWeaponsList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticWeaponsList, resizeNotify, void(entity, vector, vector, vector, vector))
+       METHOD(XonoticWeaponsList, keyDown, float(entity, float, float, float))
+       ATTRIB(XonoticWeaponsList, realFontSize, vector, '0 0 0')
+       ATTRIB(XonoticWeaponsList, realUpperMargin, float, 0)
+       METHOD(XonoticWeaponsList, mouseDrag, float(entity, vector))
+ENDCLASS(XonoticWeaponsList)
+entity makeXonoticWeaponsList();
+void WeaponsList_MoveUp_Click(entity btn, entity me);
+void WeaponsList_MoveDown_Click(entity box, entity me);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticWeaponsList()
+{
+       entity me;
+       me = spawnXonoticWeaponsList();
+       me.configureXonoticWeaponsList(me);
+       return me;
+}
+void XonoticWeaponsList_configureXonoticWeaponsList(entity me)
+{
+       me.configureXonoticListBox(me);
+}
+void XonoticWeaponsList_draw(entity me)
+{
+       // read in cvar?
+       string s, t;
+       s = W_NumberWeaponOrder(cvar_string("cl_weaponpriority"));
+       t = W_FixWeaponOrder(s, 1);
+       if(t != s)
+               cvar_set("cl_weaponpriority", W_NameWeaponOrder(t));
+       me.nItems = tokenize_console(t);
+       SUPER(XonoticWeaponsList).draw(me);
+}
+void WeaponsList_MoveUp_Click(entity box, entity me)
+{
+       if(me.selectedItem > 0)
+       {
+               cvar_set("cl_weaponpriority", swapInPriorityList(cvar_string("cl_weaponpriority"), me.selectedItem - 1, me.selectedItem));
+               me.selectedItem -= 1;
+       }
+}
+void WeaponsList_MoveDown_Click(entity box, entity me)
+{
+       if(me.selectedItem < me.nItems - 1)
+       {
+               cvar_set("cl_weaponpriority", swapInPriorityList(cvar_string("cl_weaponpriority"), me.selectedItem, me.selectedItem + 1));
+               me.selectedItem += 1;
+       }
+}
+void XonoticWeaponsList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(XonoticWeaponsList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+
+       me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight);
+       me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+}
+float XonoticWeaponsList_mouseDrag(entity me, vector pos)
+{
+       float f, i;
+       i = me.selectedItem;
+       f = SUPER(XonoticWeaponsList).mouseDrag(me, pos);
+
+       if(me.pressed != 1) // don't change priority if the person is just scrolling
+       {
+               if(me.selectedItem != i)
+                       cvar_set("cl_weaponpriority", swapInPriorityList(cvar_string("cl_weaponpriority"), me.selectedItem, i));
+       }
+
+       return f;
+}
+string XonoticWeaponsList_toString(entity me)
+{
+       float n, i;
+       string s;
+       entity e;
+       n = tokenize_console(W_NumberWeaponOrder(cvar_string("cl_weaponpriority")));
+       s = "";
+       for(i = 0; i < n; ++i)
+       {
+               e = get_weaponinfo(stof(argv(i)));
+               s = strcat(s, e.message, ", ");
+       }
+       return substring(s, 0, strlen(s) - 2);
+}
+void XonoticWeaponsList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+{
+       entity e;
+       if(isSelected)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       e = get_weaponinfo(stof(argv(i)));
+       string msg = e.message;
+       if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
+               msg = sprintf(_("%s (mutator weapon)"), msg);
+
+       vector save_fontscale = draw_fontscale;
+       float f = draw_CondensedFontFactor(msg, false, me.realFontSize, 1);
+       draw_fontscale.x *= f;
+       vector fs = me.realFontSize;
+       fs.x *= f;
+       draw_Text(me.realUpperMargin * eY, msg, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0);
+       draw_fontscale = save_fontscale;
+}
+
+float XonoticWeaponsList_keyDown(entity me, float scan, float ascii, float shift)
+{
+       if(ascii == 43) // +
+       {
+               WeaponsList_MoveUp_Click(NULL, me);
+               return 1;
+       }
+       else if(ascii == 45) // -
+       {
+               WeaponsList_MoveDown_Click(NULL, me);
+               return 1;
+       }
+       else if(SUPER(XonoticWeaponsList).keyDown(me, scan, ascii, shift))
+               return 1;
+       return 0;
+}
+#endif
index 33c82913116b2b350ba1ff0ea1c3917a09da76df..dab5fa30087248413d00907f4fea25b483bfffd7 100644 (file)
@@ -1,3 +1,17 @@
+#include "anticheat.qh"
+
+#include "antilag.qh"
+#include "autocvars.qh"
+#include "defs.qh"
+#include "miscfunctions.qh"
+
+#include "../dpdefs/progsdefs.qh"
+#include "../dpdefs/dpextensions.qh"
+
+#include "../warpzonelib/mathlib.qh"
+
+#include "command/common.qh"
+
 .float anticheat_jointime;
 
 void mean_accumulate(entity e, .float a, .float c, float mean, float value, float weight)
index e46dcce7b2051a8af3e8e847975d76e41b5079f3..6b9e4e3858c8ddd8ade6a24a913f6b7c43e8717a 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef ANTICHEAT_H
+#define ANTICHEAT_H
+
 void anticheat_init();
 void anticheat_report();
 void anticheat_shutdown();
@@ -12,3 +15,4 @@ void anticheat_startframe();
 void anticheat_endframe();
 
 void anticheat_fixangle();
+#endif
index c53452ab78b352836a0614970259a54be27be59d..6f8f0f487e0c7e811cd425d7ceb9da8dcc93ec63 100644 (file)
@@ -1,7 +1,16 @@
-#define ANTILAG_MAX_ORIGINS 64
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "vehicles/vehicles_def.qh"
+    #include "antilag.qh"
+#endif
+
+const int ANTILAG_MAX_ORIGINS = 64;
 .vector antilag_origins[ANTILAG_MAX_ORIGINS];
 .float antilag_times[ANTILAG_MAX_ORIGINS];
-.float antilag_index;
+.int antilag_index;
 .vector antilag_saved_origin;
 .float antilag_takenback;
 
@@ -31,9 +40,7 @@ void antilag_record(entity e, float t)
 // finds the index BEFORE t
 float antilag_find(entity e, float t)
 {
-       float i;
-
-       for(i = e.antilag_index; i > 0; --i)
+       for(int i = e.antilag_index; i > 0; --i)
                if(e.(antilag_times[i]) >= t)
                        if(e.(antilag_times[i - 1]) < t)
                                return i - 1;
@@ -42,7 +49,7 @@ float antilag_find(entity e, float t)
                if(e.(antilag_times[ANTILAG_MAX_ORIGINS - 1]) < t)
                        return ANTILAG_MAX_ORIGINS - 1;
 
-       for(i = ANTILAG_MAX_ORIGINS - 1; i > e.antilag_index + 1; --i)
+       for(int i = ANTILAG_MAX_ORIGINS - 1; i > e.antilag_index + 1; --i)
                if(e.(antilag_times[i]) >= t)
                        if(e.(antilag_times[i - 1]) < t)
                                return i - 1;
@@ -100,7 +107,7 @@ void antilag_takeback(entity e, float t)
                e.antilag_saved_origin = e.origin;
 
        setorigin(e, antilag_takebackorigin(e, t));
-       e.antilag_takenback = TRUE;
+       e.antilag_takenback = true;
 }
 
 void antilag_restore(entity e)
@@ -115,7 +122,7 @@ void antilag_restore(entity e)
                return;
 
        setorigin(e, e.antilag_saved_origin);
-       e.antilag_takenback = FALSE;
+       e.antilag_takenback = false;
 }
 
 void antilag_clear(entity e)
index b89f12bb153ec852d01a6f8553af37644d2d1345..e1123e786e6db126f17ff0923f5a891d94fc6fde 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef ANTILAG_H
+#define ANTILAG_H
+
 void antilag_record(entity e, float t);
 vector antilag_takebackorigin(entity e, float t);
 vector antilag_takebackavgvelocity(entity e, float t0, float t1);
@@ -9,3 +12,4 @@ void antilag_clear(entity e);
 
 #define ANTILAG_LATENCY(e) min(0.4, e.ping * 0.001)
 // add one ticrate?
+#endif
index f960c4220c59f99d9ee5840ce2c0b9a934573d2a..69e523c0c45e578610db294ed907da49690576e0 100644 (file)
@@ -1,9 +1,12 @@
-float autocvar__notarget;
-float autocvar__independent_players;
-float autocvar__campaign_testrun;
-float autocvar__campaign_index;
+#ifndef SERVER_AUTOCVARS_H
+#define SERVER_AUTOCVARS_H
+
+bool autocvar__notarget;
+bool autocvar__independent_players;
+bool autocvar__campaign_testrun;
+int autocvar__campaign_index;
 string autocvar__campaign_name;
-float autocvar__sv_init;
+bool autocvar__sv_init;
 float autocvar_bot_ai_aimskill_blendrate;
 float autocvar_bot_ai_aimskill_firetolerance_distdegrees;
 float autocvar_bot_ai_aimskill_firetolerance_maxdegrees;
@@ -43,63 +46,63 @@ float autocvar_bot_ai_navigation_jetpack;
 float autocvar_bot_ai_navigation_jetpack_mindistance;
 float autocvar_bot_ai_strategyinterval;
 float autocvar_bot_ai_thinkinterval;
-float autocvar_bot_ai_weapon_combo;
+bool autocvar_bot_ai_weapon_combo;
 float autocvar_bot_ai_weapon_combo_threshold;
 string autocvar_bot_config_file;
-float autocvar_bot_god;
-float autocvar_bot_ignore_bots;
-float autocvar_bot_join_empty;
-float autocvar_bot_navigation_ignoreplayers;
-float autocvar_bot_nofire;
+bool autocvar_bot_god;
+bool autocvar_bot_ignore_bots;
+bool autocvar_bot_join_empty;
+bool autocvar_bot_navigation_ignoreplayers;
+bool autocvar_bot_nofire;
 #define autocvar_bot_number cvar("bot_number")
 #define autocvar_bot_prefix cvar_string("bot_prefix")
-float autocvar_bot_sound_monopoly;
+bool autocvar_bot_sound_monopoly;
 #define autocvar_bot_suffix cvar_string("bot_suffix")
-float autocvar_bot_usemodelnames;
-float autocvar_bot_vs_human;
-float autocvar_bot_debug;
-float autocvar_bot_debug_tracewalk;
-float autocvar_bot_debug_goalstack;
-float autocvar_bot_wander_enable;
-float autocvar_captureleadlimit_override;
+bool autocvar_bot_usemodelnames;
+int autocvar_bot_vs_human;
+int autocvar_bot_debug;
+bool autocvar_bot_debug_tracewalk;
+bool autocvar_bot_debug_goalstack;
+bool autocvar_bot_wander_enable;
+int autocvar_captureleadlimit_override;
 #define autocvar_capturelimit_override cvar("capturelimit_override")
 #define autocvar_developer cvar("developer")
 float autocvar_ekg;
 #define autocvar_fraglimit cvar("fraglimit")
 #define autocvar_fraglimit_override cvar("fraglimit_override")
-float autocvar_g_allow_oldvortexbeam;
-float autocvar_g_antilag;
+bool autocvar_g_allow_oldvortexbeam;
+int autocvar_g_antilag;
 float autocvar_g_antilag_nudge;
 float autocvar_g_balance_armor_blockpercent;
-float autocvar_g_balance_armor_limit;
+int autocvar_g_balance_armor_limit;
 float autocvar_g_balance_armor_regen;
-float autocvar_g_balance_armor_regenlinear;
-float autocvar_g_balance_armor_regenstable;
+float autocvar_g_balance_armor_regenlinear; // TODO: int/bool?
+int autocvar_g_balance_armor_regenstable;
 float autocvar_g_balance_armor_rot;
 float autocvar_g_balance_armor_rotlinear;
-float autocvar_g_balance_armor_rotstable;
-float autocvar_g_balance_armor_start;
+int autocvar_g_balance_armor_rotstable;
+int autocvar_g_balance_armor_start;
 float autocvar_g_balance_cloaked_alpha;
 float autocvar_g_balance_contents_damagerate;
 float autocvar_g_balance_contents_drowndelay;
-float autocvar_g_balance_contents_playerdamage_drowning;
-float autocvar_g_balance_contents_playerdamage_lava;
-float autocvar_g_balance_contents_playerdamage_slime;
-float autocvar_g_balance_contents_projectiledamage;
+int autocvar_g_balance_contents_playerdamage_drowning;
+int autocvar_g_balance_contents_playerdamage_lava;
+int autocvar_g_balance_contents_playerdamage_slime;
+int autocvar_g_balance_contents_projectiledamage;
 float autocvar_g_balance_damagepush_speedfactor;
 float autocvar_g_balance_falldamage_deadminspeed;
 float autocvar_g_balance_falldamage_factor;
-float autocvar_g_balance_falldamage_maxdamage;
+int autocvar_g_balance_falldamage_maxdamage;
 float autocvar_g_balance_falldamage_minspeed;
-float autocvar_g_balance_firetransfer_damage;
-float autocvar_g_balance_firetransfer_time;
+int autocvar_g_balance_firetransfer_damage;
+int autocvar_g_balance_firetransfer_time;
 float autocvar_g_balance_fuel_limit;
 float autocvar_g_balance_fuel_regen;
 float autocvar_g_balance_fuel_regenlinear;
-float autocvar_g_balance_fuel_regenstable;
+int autocvar_g_balance_fuel_regenstable;
 float autocvar_g_balance_fuel_rot;
 float autocvar_g_balance_fuel_rotlinear;
-float autocvar_g_balance_fuel_rotstable;
+int autocvar_g_balance_fuel_rotstable;
 float autocvar_g_balance_grapplehook_airfriction;
 float autocvar_g_balance_grapplehook_force_rubber;
 float autocvar_g_balance_grapplehook_force_rubber_overstretch;
@@ -400,7 +403,7 @@ float autocvar_g_instagib_invis_alpha;
 #define autocvar_g_mirrordamage cvar("g_mirrordamage")
 #define autocvar_g_mirrordamage_virtual cvar("g_mirrordamage_virtual")
 
-var float autocvar_g_movement_highspeed = 1;
+float autocvar_g_movement_highspeed = 1;
 float autocvar_g_multijump;
 float autocvar_g_multijump_add;
 float autocvar_g_multijump_speed;
@@ -548,7 +551,7 @@ float autocvar_snd_soundradius;
 float autocvar_spawn_debug;
 float autocvar_speedmeter;
 float autocvar_sv_accelerate;
-var float autocvar_sv_accuracy_data_share = 1;
+float autocvar_sv_accuracy_data_share = 1;
 string autocvar_sv_adminnick;
 float autocvar_sv_airaccel_qw;
 float autocvar_sv_airaccel_qw_stretchfactor;
@@ -747,6 +750,7 @@ float autocvar_g_random_gravity_positive;
 float autocvar_g_random_gravity_negative;
 float autocvar_g_random_gravity_delay;
 float autocvar_g_nades;
+vector autocvar_g_nades_throw_offset;
 float autocvar_g_nades_spawn;
 float autocvar_g_nades_spawn_count;
 float autocvar_g_nades_client_select;
@@ -760,7 +764,7 @@ float autocvar_g_nades_nade_edgedamage;
 float autocvar_g_nades_nade_radius;
 float autocvar_g_nades_nade_force;
 float autocvar_g_nades_nade_newton_style;
-float autocvar_g_nades_napalm_ball_count;
+int autocvar_g_nades_napalm_ball_count;
 float autocvar_g_nades_napalm_ball_spread;
 float autocvar_g_nades_napalm_ball_damage;
 float autocvar_g_nades_napalm_ball_damageforcescale;
@@ -844,4 +848,4 @@ float autocvar_g_buffs_vampire_damage_steal;
 float autocvar_g_buffs_invisible_alpha;
 float autocvar_g_buffs_flight_gravity;
 float autocvar_g_buffs_jump_height;
-
+#endif
index 0ae33124717ba894248ec42f55b928117baf8b4c..b529ed1c32f2899650b7dd498024f2b5b6bb0929 100644 (file)
@@ -1,17 +1,16 @@
 
-entity ka_ball;
 // traces multiple trajectories to find one that will impact the target
 // 'end' vector is the place it aims for,
-// returns TRUE only if it hit targ (don't target non-solid entities)
+// returns true only if it hit targ (don't target non-solid entities)
 
 float findtrajectorywithleading(vector org, vector m1, vector m2, entity targ, float shotspeed, float shotspeedupward, float maxtime, float shotdelay, entity ignore)
 {
        float c, savesolid, shottime;
        vector dir, end, v, o;
        if (shotspeed < 1)
-               return FALSE; // could cause division by zero if calculated
+               return false; // could cause division by zero if calculated
        if (targ.solid < SOLID_BBOX) // SOLID_NOT and SOLID_TRIGGER
-               return FALSE; // could never hit it
+               return false; // could never hit it
        if (!tracetossent)
                tracetossent = spawn();
        tracetossent.owner = ignore;
@@ -21,14 +20,14 @@ float findtrajectorywithleading(vector org, vector m1, vector m2, entity targ, f
        o = (targ.absmin + targ.absmax) * 0.5;
        shottime = ((vlen(o - org) / shotspeed) + shotdelay);
        v = targ.velocity * shottime + o;
-       tracebox(o, targ.mins, targ.maxs, v, FALSE, targ);
+       tracebox(o, targ.mins, targ.maxs, v, false, targ);
        v = trace_endpos;
        end = v + (targ.mins + targ.maxs) * 0.5;
        if ((vlen(end - org) / shotspeed + 0.2) > maxtime)
        {
                // out of range
                targ.solid = savesolid;
-               return FALSE;
+               return false;
        }
 
        if (!tracetossfaketarget)
@@ -60,9 +59,9 @@ float findtrajectorywithleading(vector org, vector m1, vector m2, entity targ, f
                        // relink to remove it from physics considerations
                        setorigin(tracetossfaketarget, v);
 
-                       return TRUE;
+                       return true;
                }
-               dir_z = dir_z + 0.1; // aim up a little more
+               dir.z = dir.z + 0.1; // aim up a little more
                c = c + 1;
        }
        targ.solid = savesolid;
@@ -77,7 +76,7 @@ float findtrajectorywithleading(vector org, vector m1, vector m2, entity targ, f
 
        // leave a valid one even if it won't reach
        findtrajectory_velocity = normalize(end - org) * shotspeed + shotspeedupward * '0 0 1';
-       return FALSE;
+       return false;
 }
 
 void lag_update()
@@ -91,13 +90,13 @@ void lag_update()
 
 float lag_additem(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4)
 {
-       if (self.lag1_time == 0) {self.lag1_time = t;self.lag1_float1 = f1;self.lag1_float2 = f2;self.lag1_entity1 = e1;self.lag1_vec1 = v1;self.lag1_vec2 = v2;self.lag1_vec3 = v3;self.lag1_vec4 = v4;return TRUE;}
-       if (self.lag2_time == 0) {self.lag2_time = t;self.lag2_float1 = f1;self.lag2_float2 = f2;self.lag2_entity1 = e1;self.lag2_vec1 = v1;self.lag2_vec2 = v2;self.lag2_vec3 = v3;self.lag2_vec4 = v4;return TRUE;}
-       if (self.lag3_time == 0) {self.lag3_time = t;self.lag3_float1 = f1;self.lag3_float2 = f2;self.lag3_entity1 = e1;self.lag3_vec1 = v1;self.lag3_vec2 = v2;self.lag3_vec3 = v3;self.lag3_vec4 = v4;return TRUE;}
-       if (self.lag4_time == 0) {self.lag4_time = t;self.lag4_float1 = f1;self.lag4_float2 = f2;self.lag4_entity1 = e1;self.lag4_vec1 = v1;self.lag4_vec2 = v2;self.lag4_vec3 = v3;self.lag4_vec4 = v4;return TRUE;}
-       if (self.lag5_time == 0) {self.lag5_time = t;self.lag5_float1 = f1;self.lag5_float2 = f2;self.lag5_entity1 = e1;self.lag5_vec1 = v1;self.lag5_vec2 = v2;self.lag5_vec3 = v3;self.lag5_vec4 = v4;return TRUE;}
+       if (self.lag1_time == 0) {self.lag1_time = t;self.lag1_float1 = f1;self.lag1_float2 = f2;self.lag1_entity1 = e1;self.lag1_vec1 = v1;self.lag1_vec2 = v2;self.lag1_vec3 = v3;self.lag1_vec4 = v4;return true;}
+       if (self.lag2_time == 0) {self.lag2_time = t;self.lag2_float1 = f1;self.lag2_float2 = f2;self.lag2_entity1 = e1;self.lag2_vec1 = v1;self.lag2_vec2 = v2;self.lag2_vec3 = v3;self.lag2_vec4 = v4;return true;}
+       if (self.lag3_time == 0) {self.lag3_time = t;self.lag3_float1 = f1;self.lag3_float2 = f2;self.lag3_entity1 = e1;self.lag3_vec1 = v1;self.lag3_vec2 = v2;self.lag3_vec3 = v3;self.lag3_vec4 = v4;return true;}
+       if (self.lag4_time == 0) {self.lag4_time = t;self.lag4_float1 = f1;self.lag4_float2 = f2;self.lag4_entity1 = e1;self.lag4_vec1 = v1;self.lag4_vec2 = v2;self.lag4_vec3 = v3;self.lag4_vec4 = v4;return true;}
+       if (self.lag5_time == 0) {self.lag5_time = t;self.lag5_float1 = f1;self.lag5_float2 = f2;self.lag5_entity1 = e1;self.lag5_vec1 = v1;self.lag5_vec2 = v2;self.lag5_vec3 = v3;self.lag5_vec4 = v4;return true;}
        // no room for it (what is the best thing to do here??)
-       return FALSE;
+       return false;
 }
 
 float bot_shouldattack(entity e)
@@ -105,44 +104,44 @@ float bot_shouldattack(entity e)
        if (e.team == self.team)
        {
                if (e == self)
-                       return FALSE;
+                       return false;
                if (teamplay)
                if (e.team != 0)
-                       return FALSE;
+                       return false;
        }
 
        if(e.frozen)
-               return FALSE;
+               return false;
 
        // If neither player has ball then don't attack unless the ball is on the
        // ground.
        if (g_keepaway)
                if (!e.ballcarried && !self.ballcarried && ka_ball.owner)
-                       return FALSE;
+                       return false;
 
        if(teamplay)
        {
                if(e.team==0)
-                       return FALSE;
+                       return false;
        }
        else if(bot_ignore_bots)
                if(IS_BOT_CLIENT(e))
-                       return FALSE;
+                       return false;
 
        if (!e.takedamage)
-               return FALSE;
+               return false;
        if (e.deadflag)
-               return FALSE;
+               return false;
        if (e.BUTTON_CHAT)
-               return FALSE;
+               return false;
        if(e.flags & FL_NOTARGET)
-               return FALSE;
+               return false;
 
        checkentity = e;
        if(MUTATOR_CALLHOOK(BotShouldAttack))
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 void bot_lagfunc(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4)
@@ -175,7 +174,7 @@ float bot_aimdir(vector v, float maxfiredeviation)
 
        //dprint("aim ", self.netname, ": old:", vtos(self.v_angle));
        // make sure v_angle is sane first
-       self.v_angle_y = self.v_angle_y - floor(self.v_angle_y / 360) * 360;
+       self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360;
        self.v_angle_z = 0;
 
        // get the desired angles to aim at
@@ -189,10 +188,10 @@ float bot_aimdir(vector v, float maxfiredeviation)
        }
        desiredang = vectoangles(v) + self.bot_badaimoffset;
        //dprint(" desired:", vtos(desiredang));
-       if (desiredang_x >= 180)
-               desiredang_x = desiredang_x - 360;
-       desiredang_x = bound(-90, 0 - desiredang_x, 90);
-       desiredang_z = self.v_angle_z;
+       if (desiredang.x >= 180)
+               desiredang.x = desiredang.x - 360;
+       desiredang.x = bound(-90, 0 - desiredang.x, 90);
+       desiredang.z = self.v_angle.z;
        //dprint(" / ", vtos(desiredang));
 
        //// pain throws off aim
@@ -205,9 +204,9 @@ float bot_aimdir(vector v, float maxfiredeviation)
        // calculate turn angles
        diffang = (desiredang - self.bot_olddesiredang);
        // wrap yaw turn
-       diffang_y = diffang_y - floor(diffang_y / 360) * 360;
-       if (diffang_y >= 180)
-               diffang_y = diffang_y - 360;
+       diffang.y = diffang.y - floor(diffang.y / 360) * 360;
+       if (diffang.y >= 180)
+               diffang.y = diffang.y - 360;
        self.bot_olddesiredang = desiredang;
        //dprint(" diff:", vtos(diffang));
 
@@ -239,9 +238,9 @@ float bot_aimdir(vector v, float maxfiredeviation)
        // calculate turn angles
        diffang = desiredang - self.bot_mouseaim;
        // wrap yaw turn
-       diffang_y = diffang_y - floor(diffang_y / 360) * 360;
-       if (diffang_y >= 180)
-               diffang_y = diffang_y - 360;
+       diffang.y = diffang.y - floor(diffang.y / 360) * 360;
+       if (diffang.y >= 180)
+               diffang.y = diffang.y - 360;
        //dprint(" diff:", vtos(diffang));
 
        if (time >= self.bot_aimthinktime)
@@ -254,17 +253,17 @@ float bot_aimdir(vector v, float maxfiredeviation)
 
        diffang = self.bot_mouseaim - desiredang;
        // wrap yaw turn
-       diffang_y = diffang_y - floor(diffang_y / 360) * 360;
-       if (diffang_y >= 180)
-               diffang_y = diffang_y - 360;
+       diffang.y = diffang.y - floor(diffang.y / 360) * 360;
+       if (diffang.y >= 180)
+               diffang.y = diffang.y - 360;
        desiredang = desiredang + diffang * bound(0,autocvar_bot_ai_aimskill_think,1);
 
        // calculate turn angles
        diffang = desiredang - self.v_angle;
        // wrap yaw turn
-       diffang_y = diffang_y - floor(diffang_y / 360) * 360;
-       if (diffang_y >= 180)
-               diffang_y = diffang_y - 360;
+       diffang.y = diffang.y - floor(diffang.y / 360) * 360;
+       if (diffang.y >= 180)
+               diffang.y = diffang.y - 360;
        //dprint(" diff:", vtos(diffang));
 
        // jitter tracking
@@ -282,7 +281,7 @@ float bot_aimdir(vector v, float maxfiredeviation)
        //self.v_angle = self.v_angle + diffang * bound(0, r * frametime * (skill * 0.5 + 2), 1);
        //self.v_angle = self.v_angle + diffang * (1/ blendrate);
        self.v_angle_z = 0;
-       self.v_angle_y = self.v_angle_y - floor(self.v_angle_y / 360) * 360;
+       self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360;
        //dprint(" turn:", vtos(self.v_angle));
 
        makevectors(self.v_angle);
@@ -306,7 +305,7 @@ float bot_aimdir(vector v, float maxfiredeviation)
        if ((normalize(v) * shotdir) >= cos(maxfiredeviation * (3.14159265358979323846 / 180)))
        if (vlen(trace_endpos-shotorg) < 500+500*bound(0, skill+self.bot_aggresskill, 10) || random()*random()>bound(0,(skill+self.bot_aggresskill)*0.05,1))
                self.bot_firetimer = time + bound(0.1, 0.5-(skill+self.bot_aggresskill)*0.05, 0.5);
-       //traceline(shotorg,shotorg+shotdir*1000,FALSE,world);
+       //traceline(shotorg,shotorg+shotdir*1000,false,world);
        //dprint(ftos(maxfiredeviation),"\n");
        //dprint(" diff:", vtos(diffang), "\n");
 
@@ -360,7 +359,7 @@ float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float a
                if (!findtrajectorywithleading(shotorg, '0 0 0', '0 0 0', self.bot_aimtarg, shotspeed, shotspeedupward, maxshottime, 0, self))
                {
                        self.dphitcontentsmask = hf;
-                       return FALSE;
+                       return false;
                }
 
                f = bot_aimdir(findtrajectory_velocity - shotspeedupward * '0 0 1', r);
@@ -369,23 +368,23 @@ float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float a
        {
                f = bot_aimdir(v - shotorg, r);
                //dprint("AIM: ");dprint(vtos(self.bot_aimtargorigin));dprint(" + ");dprint(vtos(self.bot_aimtargvelocity));dprint(" * ");dprint(ftos(self.bot_aimlatency + vlen(self.bot_aimtargorigin - shotorg) / shotspeed));dprint(" = ");dprint(vtos(v));dprint(" : aimdir = ");dprint(vtos(normalize(v - shotorg)));dprint(" : ");dprint(vtos(shotdir));dprint("\n");
-               //traceline(shotorg, shotorg + shotdir * 10000, FALSE, self);
+               //traceline(shotorg, shotorg + shotdir * 10000, false, self);
                //if (trace_ent.takedamage)
                //if (trace_fraction < 1)
                //if (!bot_shouldattack(trace_ent))
-               //      return FALSE;
-               traceline(shotorg, self.bot_aimtargorigin, FALSE, self);
+               //      return false;
+               traceline(shotorg, self.bot_aimtargorigin, false, self);
                if (trace_fraction < 1)
                if (trace_ent != self.enemy)
                if (!bot_shouldattack(trace_ent))
                {
                        self.dphitcontentsmask = hf;
-                       return FALSE;
+                       return false;
                }
        }
 
        //if (r > maxshottime * shotspeed)
-       //      return FALSE;
+       //      return false;
        self.dphitcontentsmask = hf;
-       return TRUE;
+       return true;
 }
index 8442aa0fedfb5bb424675d0b2994ac75eccd907b..fb191a91cce7e61f9f0c930d78c85a988bfd979b 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef AIM_H
+#define AIM_H
 /*
  * Globals and Fields
  */
@@ -95,3 +97,4 @@ float findtrajectorywithleading(vector org, vector m1, vector m2, entity targ, f
 vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, float shotdelay);
 
 .void(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4) lag_func;
+#endif
index 40b769ddd3fb4a78f3b156995a2cf53153800869..0acd32993595139f9a777ba74b527a1c574ee7a2 100644 (file)
@@ -1,3 +1,26 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../warpzonelib/common.qh"
+    #include "../../warpzonelib/util_server.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/teams.qh"
+    #include "../../common/util.qh"
+    #include "../../common/weapons/weapons.qh"
+    #include "../weapons/accuracy.qh"
+    #include "../t_items.qh"
+    #include "../autocvars.qh"
+    #include "../constants.qh"
+    #include "../defs.qh"
+    #include "../mutators/mutators_include.qh"
+    #include "../campaign.qh"
+    #include "../../common/mapinfo.qh"
+    #include "../../csqcmodellib/sv_model.qh"
+    #include "../antilag.qh"
+#endif
+
 #include "bot.qh"
 #include "aim.qh"
 #include "navigation.qh"
@@ -53,7 +76,7 @@ void bot_think()
        {
                self.v_angle = self.angles;
                self.v_angle_z = 0;
-               self.fixangle = FALSE;
+               self.fixangle = false;
        }
 
        self.dmg_take = 0;
@@ -201,7 +224,7 @@ void bot_setnameandstuff()
        READSKILL(bot_thinkskill, 1, 0.5); // think skill
        READSKILL(bot_aiskill, 2, 0); // "ai" skill
 
-       self.bot_config_loaded = TRUE;
+       self.bot_config_loaded = true;
 
        // this is really only a default, JoinBestTeam is called later
        setcolor(self, stof(bot_shirt) * 16 + stof(bot_pants));
@@ -241,9 +264,9 @@ void bot_setnameandstuff()
 
 void bot_custom_weapon_priority_setup()
 {
-       float tokens, i, c, w;
+       float tokens, i, w;
 
-       bot_custom_weapon = FALSE;
+       bot_custom_weapon = false;
 
        if(     autocvar_bot_ai_custom_weapon_priority_far == "" ||
                autocvar_bot_ai_custom_weapon_priority_mid == "" ||
@@ -274,7 +297,7 @@ void bot_custom_weapon_priority_setup()
        // Parse far distance weapon priorities
        tokens = tokenizebyseparator(W_NumberWeaponOrder(autocvar_bot_ai_custom_weapon_priority_far)," ");
 
-       c = 0;
+       int c = 0;
        for(i=0; i < tokens && c < WEP_COUNT; ++i){
                w = stof(argv(i));
                if ( w >= WEP_FIRST && w <= WEP_LAST) {
@@ -313,7 +336,7 @@ void bot_custom_weapon_priority_setup()
        if(c < WEP_COUNT)
                bot_weapons_close[c] = -1;
 
-       bot_custom_weapon = TRUE;
+       bot_custom_weapon = true;
 }
 
 void bot_endgame()
@@ -358,7 +381,7 @@ void bot_relinkplayerlist()
        }
        dprint(strcat("relink: ", ftos(currentbots), " bots seen.\n"));
        bot_strategytoken = bot_list;
-       bot_strategytoken_taken = TRUE;
+       bot_strategytoken_taken = true;
 }
 
 void bot_clientdisconnect()
@@ -391,7 +414,7 @@ void bot_clientconnect()
        self.bot_preferredcolors = self.clientcolors;
        self.bot_nextthink = time - random();
        self.lag_func = bot_lagfunc;
-       self.isbot = TRUE;
+       self.isbot = true;
        self.createdtime = self.bot_nextthink;
 
        if(!self.bot_config_loaded) // This is needed so team overrider doesn't break between matches
@@ -406,7 +429,7 @@ void bot_clientconnect()
        else if(self.bot_forced_team==4)
                self.team = NUM_TEAM_4;
        else
-               JoinBestTeam(self, FALSE, TRUE);
+               JoinBestTeam(self, false, true);
 
        havocbot_setupbot();
 }
@@ -417,7 +440,7 @@ void bot_removefromlargestteam()
        entity best, head;
        CheckAllowedTeams(world);
        GetTeamCounts(world);
-       head = findchainfloat(isbot, TRUE);
+       head = findchainfloat(isbot, true);
        if (!head)
                return;
        best = head;
@@ -463,7 +486,7 @@ void bot_removenewest()
                return;
        }
 
-       head = findchainfloat(isbot, TRUE);
+       head = findchainfloat(isbot, true);
        if (!head)
                return;
        best = head;
@@ -560,7 +583,7 @@ float bot_fixcount()
        // minplayers+bot_number, or remove all bots if no one is playing
        // But don't remove bots immediately on level change, as the real players
        // usually haven't rejoined yet
-       bots_would_leave = FALSE;
+       bots_would_leave = false;
        if (teamplay && autocvar_bot_vs_human && (c3==-1 && c4==-1))
                bots = min(ceil(fabs(autocvar_bot_vs_human) * activerealplayers), maxclients - realplayers);
        else if ((realplayers || autocvar_bot_join_empty || (currentbots > 0 && time < 5)))
@@ -575,7 +598,7 @@ float bot_fixcount()
 
                bots = min(max(minbots, minplayers - activerealplayers), maxclients - realplayers);
                if(bots > minbots)
-                       bots_would_leave = TRUE;
+                       bots_would_leave = true;
        }
        else
        {
@@ -592,14 +615,14 @@ float bot_fixcount()
                        if (bot_spawn() == world)
                        {
                                bprint("Can not add bot, server full.\n");
-                               return FALSE;
+                               return false;
                        }
                }
                while (currentbots > bots)
                        bot_removenewest();
        }
 
-       return TRUE;
+       return true;
 }
 
 void bot_serverframe()
@@ -654,7 +677,7 @@ void bot_serverframe()
        }
        else
        {
-               botframe_spawnedwaypoints = TRUE;
+               botframe_spawnedwaypoints = true;
                waypoint_loadall();
                if(!waypoint_load_links())
                        waypoint_schedulerelinkall();
@@ -667,7 +690,7 @@ void bot_serverframe()
                //  frame, which causes choppy framerates)
                if (bot_strategytoken_taken)
                {
-                       bot_strategytoken_taken = FALSE;
+                       bot_strategytoken_taken = false;
                        if (bot_strategytoken)
                                bot_strategytoken = bot_strategytoken.nextbot;
                        if (!bot_strategytoken)
index 043f8332c9c1fe47b2bc3b086526eb64a457a8de..bcae58dc181e0c89b9db7ef02e729d2660516e04 100644 (file)
@@ -1,22 +1,24 @@
+#ifndef BOT_H
+#define BOT_H
 /*
  * Globals and Fields
  */
 
-const float AI_STATUS_ROAMING                                          = 1;    // Bot is just crawling the map. No enemies at sight
-const float AI_STATUS_ATTACKING                                        = 2;    // There are enemies at sight
-const float AI_STATUS_RUNNING                                          = 4;    // Bot is bunny hopping
-const float AI_STATUS_DANGER_AHEAD                             = 8;    // There is lava/slime/trigger_hurt ahead
-const float AI_STATUS_OUT_JUMPPAD                                      = 16;   // Trying to get out of a "vertical" jump pad
-const float AI_STATUS_OUT_WATER                                        = 32;   // Trying to get out of water
-const float AI_STATUS_WAYPOINT_PERSONAL_LINKING        = 64;   // Waiting for the personal waypoint to be linked
-const float AI_STATUS_WAYPOINT_PERSONAL_GOING          = 128;  // Going to a personal waypoint
-const float AI_STATUS_WAYPOINT_PERSONAL_REACHED        = 256;  // Personal waypoint reached
-const float AI_STATUS_JETPACK_FLYING                           = 512;
-const float AI_STATUS_JETPACK_LANDING                          = 1024;
-const float AI_STATUS_STUCK                                            = 2048; // Cannot reach any goal
+const int AI_STATUS_ROAMING                                            = 1;    // Bot is just crawling the map. No enemies at sight
+const int AI_STATUS_ATTACKING                                  = 2;    // There are enemies at sight
+const int AI_STATUS_RUNNING                                            = 4;    // Bot is bunny hopping
+const int AI_STATUS_DANGER_AHEAD                               = 8;    // There is lava/slime/trigger_hurt ahead
+const int AI_STATUS_OUT_JUMPPAD                                        = 16;   // Trying to get out of a "vertical" jump pad
+const int AI_STATUS_OUT_WATER                                  = 32;   // Trying to get out of water
+const int AI_STATUS_WAYPOINT_PERSONAL_LINKING  = 64;   // Waiting for the personal waypoint to be linked
+const int AI_STATUS_WAYPOINT_PERSONAL_GOING            = 128;  // Going to a personal waypoint
+const int AI_STATUS_WAYPOINT_PERSONAL_REACHED  = 256;  // Personal waypoint reached
+const int AI_STATUS_JETPACK_FLYING                             = 512;
+const int AI_STATUS_JETPACK_LANDING                            = 1024;
+const int AI_STATUS_STUCK                                              = 2048; // Cannot reach any goal
 
 .float isbot; // true if this client is actually a bot
-.float aistatus;
+.int aistatus;
 
 // Skill system
 float skill;
@@ -111,8 +113,9 @@ void bot_serverframe();
 
 void() havocbot_setupbot;
 
-float c1, c2, c3, c4;
+//float c1, c2, c3, c4;
 void CheckAllowedTeams(entity for_whom); void GetTeamCounts(entity other);
 float JoinBestTeam(entity pl, float only_return_best, float forcebestteam);
 
 void bot_calculate_stepheightvec(void);
+#endif
index e58e6709730282677350265c9c55a953c8945850..0ecafaf1e87c7aa62fda4892d2c38ef300e05683 100644 (file)
@@ -16,7 +16,7 @@ void havocbot_ai()
        {
                if(self.havocbot_blockhead)
                {
-                       self.havocbot_blockhead = FALSE;
+                       self.havocbot_blockhead = false;
                }
                else
                {
@@ -42,16 +42,16 @@ void havocbot_ai()
                                if(distance>10000)
                                        continue;
 
-                               if(head.origin_z < self.origin_z)
+                               if(head.origin.z < self.origin.z)
                                        continue;
 
-                               if(head.origin_z - self.origin_z - self.view_ofs_z > 100)
+                               if(head.origin.z - self.origin.z - self.view_ofs.z > 100)
                                        continue;
 
                                if (pointcontents(head.origin + head.maxs + '0 0 1') != CONTENT_EMPTY)
                                        continue;
 
-                               traceline(self.origin + self.view_ofs , head.origin, TRUE, head);
+                               traceline(self.origin + self.view_ofs , head.origin, true, head);
 
                                if(trace_fraction<1)
                                        continue;
@@ -71,7 +71,7 @@ void havocbot_ai()
                }
 
                // token has been used this frame
-               bot_strategytoken_taken = TRUE;
+               bot_strategytoken_taken = true;
        }
 
        if(self.deadflag != DEAD_NO)
@@ -95,8 +95,8 @@ void havocbot_ai()
                        WEP_ACTION(self.weapon, WR_AIM);
                        if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
                        {
-                               self.BUTTON_ATCK = FALSE;
-                               self.BUTTON_ATCK2 = FALSE;
+                               self.BUTTON_ATCK = false;
+                               self.BUTTON_ATCK2 = false;
                        }
                        else
                        {
@@ -138,7 +138,7 @@ void havocbot_ai()
                //dprint(vtos(now), ":", vtos(next), "=", vtos(v), " (blend ", ftos(blend), ")\n");
                //v = now * (distanceblend) + next * (1-distanceblend);
                if (self.waterlevel < WATERLEVEL_SWIMMING)
-                       v_z = 0;
+                       v.z = 0;
                //dprint("walk at:", vtos(v), "\n");
                //te_lightning2(world, self.origin, self.goalcurrent.origin);
                bot_aimdir(v, -1);
@@ -202,43 +202,43 @@ void havocbot_keyboard_movement(vector destorg)
        // at skill < 2.5 only individual directions
        // at skill < 4.5 only individual directions, and forward diagonals
        // at skill >= 4.5, all cases allowed
-       if (keyboard_x > trigger)
+       if (keyboard.x > trigger)
        {
-               keyboard_x = 1;
+               keyboard.x = 1;
                if (sk < 2.5)
-                       keyboard_y = 0;
+                       keyboard.y = 0;
        }
-       else if (keyboard_x < trigger1 && sk > 1.5)
+       else if (keyboard.x < trigger1 && sk > 1.5)
        {
-               keyboard_x = -1;
+               keyboard.x = -1;
                if (sk < 4.5)
-                       keyboard_y = 0;
+                       keyboard.y = 0;
        }
        else
        {
-               keyboard_x = 0;
+               keyboard.x = 0;
                if (sk < 1.5)
-                       keyboard_y = 0;
+                       keyboard.y = 0;
        }
        if (sk < 4.5)
-               keyboard_z = 0;
+               keyboard.z = 0;
 
-       if (keyboard_y > trigger)
-               keyboard_y = 1;
-       else if (keyboard_y < trigger1)
-               keyboard_y = -1;
+       if (keyboard.y > trigger)
+               keyboard.y = 1;
+       else if (keyboard.y < trigger1)
+               keyboard.y = -1;
        else
-               keyboard_y = 0;
+               keyboard.y = 0;
 
-       if (keyboard_z > trigger)
-               keyboard_z = 1;
-       else if (keyboard_z < trigger1)
-               keyboard_z = -1;
+       if (keyboard.z > trigger)
+               keyboard.z = 1;
+       else if (keyboard.z < trigger1)
+               keyboard.z = -1;
        else
-               keyboard_z = 0;
+               keyboard.z = 0;
 
        self.havocbot_keyboard = keyboard * maxspeed;
-       if (self.havocbot_ducktime>time) self.BUTTON_CROUCH=TRUE;
+       if (self.havocbot_ducktime>time) self.BUTTON_CROUCH=true;
 
        keyboard = self.havocbot_keyboard;
        blend = bound(0,vlen(destorg-self.origin)/autocvar_bot_ai_keyboard_distance,1); // When getting close move with 360 degree
@@ -265,7 +265,7 @@ void havocbot_bunnyhop(vector dir)
        if(self.aistatus & AI_STATUS_DANGER_AHEAD)
        {
                self.aistatus &= ~AI_STATUS_RUNNING;
-               self.BUTTON_JUMP = FALSE;
+               self.BUTTON_JUMP = false;
                self.bot_canruntogoal = 0;
                self.bot_timelastseengoal = 0;
                return;
@@ -300,7 +300,7 @@ void havocbot_bunnyhop(vector dir)
                                if(time - self.bot_timelastseengoal > autocvar_bot_ai_bunnyhop_firstjumpdelay)
                                {
                                        float checkdistance;
-                                       checkdistance = TRUE;
+                                       checkdistance = true;
 
                                        // don't run if it is too close
                                        if(self.bot_canruntogoal==0)
@@ -317,22 +317,22 @@ void havocbot_bunnyhop(vector dir)
                                        if(self.aistatus & AI_STATUS_ROAMING)
                                        if(self.goalcurrent.classname=="waypoint")
                                        if (!(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL))
-                                       if(fabs(gco_z - self.origin_z) < self.maxs_z - self.mins_z)
+                                       if(fabs(gco.z - self.origin.z) < self.maxs.z - self.mins.z)
                                        if(self.goalstack01!=world)
                                        {
                                                gno = (self.goalstack01.absmin + self.goalstack01.absmax) * 0.5;
                                                deviation = vectoangles(gno - self.origin) - vectoangles(gco - self.origin);
-                                               while (deviation_y < -180) deviation_y = deviation_y + 360;
-                                               while (deviation_y > 180) deviation_y = deviation_y - 360;
+                                               while (deviation.y < -180) deviation.y = deviation.y + 360;
+                                               while (deviation.y > 180) deviation.y = deviation.y - 360;
 
-                                               if(fabs(deviation_y) < 20)
+                                               if(fabs(deviation.y) < 20)
                                                if(bunnyhopdistance < vlen(self.origin - gno))
-                                               if(fabs(gno_z - gco_z) < self.maxs_z - self.mins_z)
+                                               if(fabs(gno.z - gco.z) < self.maxs.z - self.mins.z)
                                                {
                                                        if(vlen(gco - gno) > autocvar_bot_ai_bunnyhop_startdistance)
                                                        if(checkpvs(self.origin + self.view_ofs, self.goalstack01))
                                                        {
-                                                               checkdistance = FALSE;
+                                                               checkdistance = false;
                                                        }
                                                }
                                        }
@@ -341,12 +341,12 @@ void havocbot_bunnyhop(vector dir)
                                        {
                                                self.aistatus &= ~AI_STATUS_RUNNING;
                                                if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_stopdistance)
-                                                       self.BUTTON_JUMP = TRUE;
+                                                       self.BUTTON_JUMP = true;
                                        }
                                        else
                                        {
                                                self.aistatus |= AI_STATUS_RUNNING;
-                                               self.BUTTON_JUMP = TRUE;
+                                               self.BUTTON_JUMP = true;
                                        }
                                }
                        }
@@ -365,23 +365,23 @@ void havocbot_bunnyhop(vector dir)
        if(!cvar("sv_pogostick"))
        if((self.flags & FL_ONGROUND) == 0)
        {
-               if(self.velocity_z < 0 || vlen(self.velocity)<maxspeed)
-                       self.BUTTON_JUMP = FALSE;
+               if(self.velocity.z < 0 || vlen(self.velocity)<maxspeed)
+                       self.BUTTON_JUMP = false;
 
                // Strafe
                if(self.aistatus & AI_STATUS_RUNNING)
                if(vlen(self.velocity)>maxspeed)
                {
                        deviation = vectoangles(dir) - vectoangles(self.velocity);
-                       while (deviation_y < -180) deviation_y = deviation_y + 360;
-                       while (deviation_y > 180) deviation_y = deviation_y - 360;
+                       while (deviation.y < -180) deviation.y = deviation.y + 360;
+                       while (deviation.y > 180) deviation.y = deviation.y - 360;
 
-                       if(fabs(deviation_y)>10)
+                       if(fabs(deviation.y)>10)
                                self.movement_x = 0;
 
-                       if(deviation_y>10)
+                       if(deviation.y>10)
                                self.movement_y = maxspeed * -1;
-                       else if(deviation_y<10)
+                       else if(deviation.y<10)
                                self.movement_y = maxspeed;
 
                }
@@ -430,7 +430,7 @@ void havocbot_movetogoal()
                        self.aistatus |= AI_STATUS_JETPACK_FLYING;
                }
 
-               makevectors(self.v_angle_y * '0 1 0');
+               makevectors(self.v_angle.y * '0 1 0');
                dir = normalize(self.navigation_jetpack_point - self.origin);
 
                // Landing
@@ -440,15 +440,15 @@ void havocbot_movetogoal()
                        float db, v, d;
                        vector dxy;
 
-                       dxy = self.origin - ( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ); dxy_z = 0;
+                       dxy = self.origin - ( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ); dxy.z = 0;
                        d = vlen(dxy);
-                       v = vlen(self.velocity -  self.velocity_z * '0 0 1');
+                       v = vlen(self.velocity -  self.velocity.z * '0 0 1');
                        db = (pow(v,2) / (autocvar_g_jetpack_acceleration_side * 2)) + 100;
                //      dprint("distance ", ftos(ceil(d)), " velocity ", ftos(ceil(v)), " brake at ", ftos(ceil(db)), "\n");
                        if(d < db || d < 500)
                        {
                                // Brake
-                               if(fabs(self.velocity_x)>maxspeed*0.3)
+                               if(fabs(self.velocity.x)>maxspeed*0.3)
                                {
                                        self.movement_x = dir * v_forward * -maxspeed;
                                        return;
@@ -469,8 +469,8 @@ void havocbot_movetogoal()
                }
 
                // Flying
-               self.BUTTON_HOOK = TRUE;
-               if(self.navigation_jetpack_point_z - PL_MAX_z + PL_MIN_z < self.origin_z)
+               self.BUTTON_HOOK = true;
+               if(self.navigation_jetpack_point.z - PL_MAX_z + PL_MIN_z < self.origin.z)
                {
                        self.movement_x = dir * v_forward * maxspeed;
                        self.movement_y = dir * v_right * maxspeed;
@@ -484,7 +484,7 @@ void havocbot_movetogoal()
                // If got stuck on the jump pad try to reach the farthest visible waypoint
                if(self.aistatus & AI_STATUS_OUT_JUMPPAD)
                {
-                       if(fabs(self.velocity_z)<50)
+                       if(fabs(self.velocity.z)<50)
                        {
                                entity head, newgoal = world;
                                float distance, bestdistance = 0;
@@ -496,7 +496,7 @@ void havocbot_movetogoal()
                                        if(distance>1000)
                                                continue;
 
-                                       traceline(self.origin + self.view_ofs , ( ( head.absmin + head.absmax ) * 0.5 ), TRUE, world);
+                                       traceline(self.origin + self.view_ofs , ( ( head.absmin + head.absmax ) * 0.5 ), true, world);
 
                                        if(trace_fraction<1)
                                                continue;
@@ -522,7 +522,7 @@ void havocbot_movetogoal()
                }
                else
                {
-                       if(self.velocity_z>0)
+                       if(self.velocity.z>0)
                        {
                                float threshold, sxy;
                                vector velxy = self.velocity; velxy_z = 0;
@@ -555,13 +555,13 @@ void havocbot_movetogoal()
                        tracebox(self.origin, self.mins, self.maxs, self.origin + '0 0 65536', MOVE_NOMONSTERS, self);
                        if(tracebox_hits_trigger_hurt(self.origin, self.mins, self.maxs, trace_endpos + '0 0 1' ))
                        {
-                               if(self.velocity_z<0)
+                               if(self.velocity.z<0)
                                {
-                                       self.BUTTON_HOOK = TRUE;
+                                       self.BUTTON_HOOK = true;
                                }
                        }
                        else
-                               self.BUTTON_HOOK = TRUE;
+                               self.BUTTON_HOOK = true;
 
                        // If there is no goal try to move forward
 
@@ -575,7 +575,7 @@ void havocbot_movetogoal()
 
                        if(xyspeed < (maxspeed / 2))
                        {
-                               makevectors(self.v_angle_y * '0 1 0');
+                               makevectors(self.v_angle.y * '0 1 0');
                                tracebox(self.origin, self.mins, self.maxs, self.origin + (dir * maxspeed * 3), MOVE_NOMONSTERS, self);
                                if(trace_fraction==1)
                                {
@@ -586,14 +586,14 @@ void havocbot_movetogoal()
                                }
                        }
 
-                       self.havocbot_blockhead = TRUE;
+                       self.havocbot_blockhead = true;
 
                        return;
                }
                else if(self.health>WEP_CVAR(devastator, damage)*0.5)
                {
-                       if(self.velocity_z < 0)
-                       if(client_hasweapon(self, WEP_DEVASTATOR, TRUE, FALSE))
+                       if(self.velocity.z < 0)
+                       if(client_hasweapon(self, WEP_DEVASTATOR, true, false))
                        {
                                self.movement_x = maxspeed;
 
@@ -601,7 +601,7 @@ void havocbot_movetogoal()
                                {
                                        if(time > self.rocketjumptime)
                                        {
-                                               self.BUTTON_ATCK2 = TRUE;
+                                               self.BUTTON_ATCK2 = true;
                                                self.rocketjumptime = 0;
                                        }
                                        return;
@@ -609,7 +609,7 @@ void havocbot_movetogoal()
 
                                self.switchweapon = WEP_DEVASTATOR;
                                self.v_angle_x = 90;
-                               self.BUTTON_ATCK = TRUE;
+                               self.BUTTON_ATCK = true;
                                self.rocketjumptime = time + WEP_CVAR(devastator, detonatedelay);
                                return;
                        }
@@ -628,12 +628,12 @@ void havocbot_movetogoal()
        {
                dir = '0 0 0';
                if(self.waterlevel>WATERLEVEL_SWIMMING)
-                       dir_z = 1;
-               else if(self.velocity_z >= 0 && !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER))
-                       self.BUTTON_JUMP = TRUE;
+                       dir.z = 1;
+               else if(self.velocity.z >= 0 && !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER))
+                       self.BUTTON_JUMP = true;
                else
-                       self.BUTTON_JUMP = FALSE;
-               makevectors(self.v_angle_y * '0 1 0');
+                       self.BUTTON_JUMP = false;
+               makevectors(self.v_angle.y * '0 1 0');
                self.movement_x = dir * v_forward * maxspeed;
                self.movement_y = dir * v_right * maxspeed;
                self.movement_z = dir * v_up * maxspeed;
@@ -660,13 +660,13 @@ void havocbot_movetogoal()
        m1 = self.goalcurrent.origin + self.goalcurrent.mins;
        m2 = self.goalcurrent.origin + self.goalcurrent.maxs;
        destorg = self.origin;
-       destorg_x = bound(m1_x, destorg_x, m2_x);
-       destorg_y = bound(m1_y, destorg_y, m2_y);
-       destorg_z = bound(m1_z, destorg_z, m2_z);
+       destorg.x = bound(m1_x, destorg.x, m2_x);
+       destorg.y = bound(m1_y, destorg.y, m2_y);
+       destorg.z = bound(m1_z, destorg.z, m2_z);
        diff = destorg - self.origin;
        //dist = vlen(diff);
        dir = normalize(diff);
-       flatdir = diff;flatdir_z = 0;
+       flatdir = diff;flatdir.z = 0;
        flatdir = normalize(flatdir);
        gco = (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5;
 
@@ -686,14 +686,14 @@ void havocbot_movetogoal()
                        }
                        else
                        {
-                               if(self.velocity_z >= 0 && !(self.watertype == CONTENT_WATER && gco_z < self.origin_z) &&
+                               if(self.velocity.z >= 0 && !(self.watertype == CONTENT_WATER && gco.z < self.origin.z) &&
                                        ( !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER) || self.aistatus & AI_STATUS_OUT_WATER))
-                                       self.BUTTON_JUMP = TRUE;
+                                       self.BUTTON_JUMP = true;
                                else
-                                       self.BUTTON_JUMP = FALSE;
+                                       self.BUTTON_JUMP = false;
                        }
                        dir = normalize(flatdir);
-                       makevectors(self.v_angle_y * '0 1 0');
+                       makevectors(self.v_angle.y * '0 1 0');
                }
                else
                {
@@ -702,17 +702,17 @@ void havocbot_movetogoal()
 
                        // jump if going toward an obstacle that doesn't look like stairs we
                        // can walk up directly
-                       tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.2, FALSE, self);
+                       tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.2, false, self);
                        if (trace_fraction < 1)
-                       if (trace_plane_normal_z < 0.7)
+                       if (trace_plane_normal.z < 0.7)
                        {
                                s = trace_fraction;
-                               tracebox(self.origin + stepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + stepheightvec, FALSE, self);
+                               tracebox(self.origin + stepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + stepheightvec, false, self);
                                if (trace_fraction < s + 0.01)
-                               if (trace_plane_normal_z < 0.7)
+                               if (trace_plane_normal.z < 0.7)
                                {
                                        s = trace_fraction;
-                                       tracebox(self.origin + jumpstepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + jumpstepheightvec, FALSE, self);
+                                       tracebox(self.origin + jumpstepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + jumpstepheightvec, false, self);
                                        if (trace_fraction > s)
                                                self.BUTTON_JUMP = 1;
                                }
@@ -720,17 +720,17 @@ void havocbot_movetogoal()
 
                        // avoiding dangers and obstacles
                        vector dst_ahead, dst_down;
-                       makevectors(self.v_angle_y * '0 1 0');
+                       makevectors(self.v_angle.y * '0 1 0');
                        dst_ahead = self.origin + self.view_ofs + (self.velocity * 0.4) + (v_forward * 32 * 3);
                        dst_down = dst_ahead - '0 0 1500';
 
                        // Look ahead
-                       traceline(self.origin + self.view_ofs, dst_ahead, TRUE, world);
+                       traceline(self.origin + self.view_ofs, dst_ahead, true, world);
 
                        // Check head-banging against walls
                        if(vlen(self.origin + self.view_ofs - trace_endpos) < 25 && !(self.aistatus & AI_STATUS_OUT_WATER))
                        {
-                               self.BUTTON_JUMP = TRUE;
+                               self.BUTTON_JUMP = true;
                                if(self.facingwalltime && time > self.facingwalltime)
                                {
                                        self.ignoregoal = self.goalcurrent;
@@ -759,13 +759,13 @@ void havocbot_movetogoal()
                        self.aistatus &= ~AI_STATUS_DANGER_AHEAD;
 
                        if(trace_fraction == 1 && self.jumppadcount == 0 && !self.goalcurrent.wphardwired )
-                       if((self.flags & FL_ONGROUND) || (self.aistatus & AI_STATUS_RUNNING) || self.BUTTON_JUMP == TRUE)
+                       if((self.flags & FL_ONGROUND) || (self.aistatus & AI_STATUS_RUNNING) || self.BUTTON_JUMP == true)
                        {
                                // Look downwards
-                               traceline(dst_ahead , dst_down, TRUE, world);
+                               traceline(dst_ahead , dst_down, true, world);
                        //      te_lightning2(world, self.origin, dst_ahead);   // Draw "ahead" look
                        //      te_lightning2(world, dst_ahead, dst_down);              // Draw "downwards" look
-                               if(trace_endpos_z < self.origin_z + self.mins_z)
+                               if(trace_endpos.z < self.origin.z + self.mins.z)
                                {
                                        s = pointcontents(trace_endpos + '0 0 1');
                                        if (s != CONTENT_SOLID)
@@ -790,9 +790,9 @@ void havocbot_movetogoal()
                        }
 
                        dir = flatdir;
-                       evadeobstacle_z = 0;
-                       evadelava_z = 0;
-                       makevectors(self.v_angle_y * '0 1 0');
+                       evadeobstacle.z = 0;
+                       evadelava.z = 0;
+                       makevectors(self.v_angle.y * '0 1 0');
 
                        if(evadeobstacle!='0 0 0'||evadelava!='0 0 0')
                                self.aistatus |= AI_STATUS_DANGER_AHEAD;
@@ -801,7 +801,7 @@ void havocbot_movetogoal()
                dodge = havocbot_dodge();
                dodge = dodge * bound(0,0.5+(skill+self.bot_dodgeskill)*0.1,1);
                evadelava = evadelava * bound(1,3-(skill+self.bot_dodgeskill),3); //Noobs fear lava a lot and take more distance from it
-               traceline(self.origin, ( ( self.enemy.absmin + self.enemy.absmax ) * 0.5 ), TRUE, world);
+               traceline(self.origin, ( ( self.enemy.absmin + self.enemy.absmax ) * 0.5 ), true, world);
                if(IS_PLAYER(trace_ent))
                        dir = dir * bound(0,(skill+self.bot_dodgeskill)/7,1);
 
@@ -812,15 +812,15 @@ void havocbot_movetogoal()
 
        if(time < self.ladder_time)
        {
-               if(self.goalcurrent.origin_z + self.goalcurrent.mins_z > self.origin_z + self.mins_z)
+               if(self.goalcurrent.origin.z + self.goalcurrent.mins.z > self.origin.z + self.mins.z)
                {
-                       if(self.origin_z + self.mins_z  < self.ladder_entity.origin_z + self.ladder_entity.maxs_z)
-                               dir_z = 1;
+                       if(self.origin.z + self.mins.z  < self.ladder_entity.origin.z + self.ladder_entity.maxs.z)
+                               dir.z = 1;
                }
                else
                {
-                       if(self.origin_z + self.mins_z  > self.ladder_entity.origin_z + self.ladder_entity.mins_z)
-                               dir_z = -1;
+                       if(self.origin.z + self.mins.z  > self.ladder_entity.origin.z + self.ladder_entity.mins.z)
+                               dir.z = -1;
                }
        }
 
@@ -842,7 +842,7 @@ void havocbot_movetogoal()
                havocbot_bunnyhop(dir);
 
        if ((dir * v_up) >= autocvar_sv_jumpvelocity*0.5 && (self.flags & FL_ONGROUND)) self.BUTTON_JUMP=1;
-       if (((dodge * v_up) > 0) && random()*frametime >= 0.2*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) self.BUTTON_JUMP=TRUE;
+       if (((dodge * v_up) > 0) && random()*frametime >= 0.2*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) self.BUTTON_JUMP=true;
        if (((dodge * v_up) < 0) && random()*frametime >= 0.5*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) self.havocbot_ducktime=time+0.3/bound(0.1,skill+self.bot_dodgeskill,10);
 }
 
@@ -871,7 +871,7 @@ void havocbot_chooseenemy()
                        // and not really really far away
                        // and we're not severely injured
                        // then keep tracking for a half second into the future
-                       traceline(self.origin+self.view_ofs, ( self.enemy.absmin + self.enemy.absmax ) * 0.5,FALSE,world);
+                       traceline(self.origin+self.view_ofs, ( self.enemy.absmin + self.enemy.absmax ) * 0.5,false,world);
                        if (trace_ent == self.enemy || trace_fraction == 1)
                        if (vlen((( self.enemy.absmin + self.enemy.absmax ) * 0.5) - self.origin) < 1000)
                        if (self.health > 30)
@@ -892,7 +892,7 @@ void havocbot_chooseenemy()
        eye = self.origin + self.view_ofs;
        best = world;
        bestrating = 100000000;
-       head = head2 = findchainfloat(bot_attack, TRUE);
+       head = head2 = findchainfloat(bot_attack, true);
 
        // Backup hit flags
        hf = self.dphitcontentsmask;
@@ -911,7 +911,7 @@ void havocbot_chooseenemy()
                        if (bestrating > rating)
                        if (bot_shouldattack(head))
                        {
-                               traceline(eye, v, TRUE, self);
+                               traceline(eye, v, true, self);
                                if (trace_ent == head || trace_fraction >= 1)
                                {
                                        best = head;
@@ -938,37 +938,37 @@ void havocbot_chooseenemy()
        self.dphitcontentsmask = hf;
 
        self.enemy = best;
-       self.havocbot_stickenemy = TRUE;
+       self.havocbot_stickenemy = true;
 }
 
-float havocbot_chooseweapon_checkreload(float new_weapon)
+float havocbot_chooseweapon_checkreload(int new_weapon)
 {
        // bots under this skill cannot find unloaded weapons to reload idly when not in combat,
        // so skip this for them, or they'll never get to reload their weapons at all.
        // this also allows bots under this skill to be more stupid, and reload more often during combat :)
        if(skill < 5)
-               return FALSE;
+               return false;
 
        // if this weapon is scheduled for reloading, don't switch to it during combat
        if (self.weapon_load[new_weapon] < 0)
        {
-               float i, other_weapon_available = FALSE;
+               float i, other_weapon_available = false;
                for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                {
                        // if we are out of ammo for all other weapons, it's an emergency to switch to anything else
                        if (WEP_ACTION(i, WR_CHECKAMMO1) + WEP_ACTION(i, WR_CHECKAMMO2))
-                               other_weapon_available = TRUE;
+                               other_weapon_available = true;
                }
                if(other_weapon_available)
-                       return TRUE;
+                       return true;
        }
 
-       return FALSE;
+       return false;
 }
 
 void havocbot_chooseweapon()
 {
-       float i;
+       int i;
 
        // ;)
        if(g_weaponarena_weapons == WEPSET_TUBA)
@@ -984,7 +984,7 @@ void havocbot_chooseweapon()
                if(self.weapon==0)
                for(i = WEP_FIRST; i <= WEP_LAST; ++i) if(i != WEP_BLASTER)
                {
-                       if(client_hasweapon(self, i, TRUE, FALSE))
+                       if(client_hasweapon(self, i, true, false))
                        {
                                self.switchweapon = i;
                                return;
@@ -994,8 +994,8 @@ void havocbot_chooseweapon()
        }
 
        // Do not change weapon during the next second after a combo
-       i = time - self.lastcombotime;
-       if(i < 1)
+       float f = time - self.lastcombotime;
+       if(f < 1)
                return;
 
        float w;
@@ -1011,13 +1011,13 @@ void havocbot_chooseweapon()
        // Ideally this 4 should be calculated as longest_weapon_refire / bot_ai_weapon_combo_threshold
        combo_time = time + ct + (ct * ((-0.3*(skill+self.bot_weaponskill))+3));
 
-       combo = FALSE;
+       combo = false;
 
        if(autocvar_bot_ai_weapon_combo)
        if(self.weapon == self.lastfiredweapon)
        if(af > combo_time)
        {
-               combo = TRUE;
+               combo = true;
                self.lastcombotime = time;
        }
 
@@ -1030,7 +1030,7 @@ void havocbot_chooseweapon()
                if ( distance > bot_distance_far ) {
                        for(i=0; i < WEP_COUNT && bot_weapons_far[i] != -1 ; ++i){
                                w = bot_weapons_far[i];
-                               if ( client_hasweapon(self, w, TRUE, FALSE) )
+                               if ( client_hasweapon(self, w, true, false) )
                                {
                                        if ((self.weapon == w && combo) || havocbot_chooseweapon_checkreload(w))
                                                continue;
@@ -1044,7 +1044,7 @@ void havocbot_chooseweapon()
                if ( distance > bot_distance_close) {
                        for(i=0; i < WEP_COUNT && bot_weapons_mid[i] != -1 ; ++i){
                                w = bot_weapons_mid[i];
-                               if ( client_hasweapon(self, w, TRUE, FALSE) )
+                               if ( client_hasweapon(self, w, true, false) )
                                {
                                        if ((self.weapon == w && combo) || havocbot_chooseweapon_checkreload(w))
                                                continue;
@@ -1057,7 +1057,7 @@ void havocbot_chooseweapon()
                // Choose weapons for close distance
                for(i=0; i < WEP_COUNT && bot_weapons_close[i] != -1 ; ++i){
                        w = bot_weapons_close[i];
-                       if ( client_hasweapon(self, w, TRUE, FALSE) )
+                       if ( client_hasweapon(self, w, true, false) )
                        {
                                if ((self.weapon == w && combo) || havocbot_chooseweapon_checkreload(w))
                                        continue;
@@ -1078,12 +1078,12 @@ void havocbot_aim()
        self.nextaim = time + 0.1;
        selfvel = self.velocity;
        if (!self.waterlevel)
-               selfvel_z = 0;
+               selfvel.z = 0;
        if (self.enemy)
        {
                enemyvel = self.enemy.velocity;
                if (!self.enemy.waterlevel)
-                       enemyvel_z = 0;
+                       enemyvel.z = 0;
                lag_additem(time + self.ping, 0, 0, self.enemy, self.origin, selfvel, (self.enemy.absmin + self.enemy.absmax) * 0.5, enemyvel);
        }
        else
@@ -1118,7 +1118,7 @@ float havocbot_moveto(vector pos)
                if (!bot_strategytoken_taken)
                if(self.havocbot_personal_waypoint_searchtime<time)
                {
-                       bot_strategytoken_taken = TRUE;
+                       bot_strategytoken_taken = true;
                        if(havocbot_moveto_refresh_route())
                        {
                                dprint(self.netname, " walking to its personal waypoint (after ", ftos(self.havocbot_personal_waypoint_failcounter), " failed attempts)\n");
@@ -1146,7 +1146,7 @@ float havocbot_moveto(vector pos)
 
                // Heading
                vector dir = ( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ) - (self.origin + self.view_ofs);
-               dir_z = 0;
+               dir.z = 0;
                bot_aimdir(dir, -1);
 
                // Go!
@@ -1243,7 +1243,7 @@ vector havocbot_dodge()
        dodge = '0 0 0';
        bestdanger = -20;
        // check for dangerous objects near bot or approaching bot
-       head = findchainfloat(bot_dodge, TRUE);
+       head = findchainfloat(bot_dodge, true);
        while(head)
        {
                if (head.owner != self)
index de94691822e902631b6bbe732162d5bb22270d92..2d3d3291320201437aa034ee666420ce0807fe0d 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef HAVOCBOT_H
+#define HAVOCBOT_H
+
 /*
  * Globals and Fields
  */
@@ -60,4 +63,4 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplay
 .entity draggedby;
 .float ladder_time;
 .entity ladder_entity;
-
+#endif
index dc942a38212fc4bbb0d47f77a3508df42798e517..119ea83c81b77c90b659518bf03a601d49f2f360 100644 (file)
@@ -1,9 +1,9 @@
-#define HAVOCBOT_ONS_ROLE_NONE                 0
-#define HAVOCBOT_ONS_ROLE_DEFENSE      2
-#define HAVOCBOT_ONS_ROLE_ASSISTANT    4
-#define HAVOCBOT_ONS_ROLE_OFFENSE      8
+const int HAVOCBOT_ONS_ROLE_NONE               = 0;
+const int HAVOCBOT_ONS_ROLE_DEFENSE    = 2;
+const int HAVOCBOT_ONS_ROLE_ASSISTANT  = 4;
+const int HAVOCBOT_ONS_ROLE_OFFENSE    = 8;
 
-.float havocbot_role_flags;
+.int havocbot_role_flags;
 .float havocbot_attack_time;
 
 .void() havocbot_role;
@@ -28,11 +28,11 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplay
 void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float sradius)
 {
        entity head;
-       float t, i, c, needarmor = FALSE, needweapons = FALSE;
+       float t, i, c, needarmor = false, needweapons = false;
 
        // Needs armor/health?
        if(self.health<100)
-               needarmor = TRUE;
+               needarmor = true;
 
        // Needs weapons?
        c = 0;
@@ -45,7 +45,7 @@ void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float s
        }
 
        if(c<4)
-               needweapons = TRUE;
+               needweapons = true;
 
        if(!needweapons && !needarmor)
                return;
@@ -54,7 +54,7 @@ void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float s
 //     dprint(self.netname, " needs armor ", ftos(needarmor) , "\n");
 
        // See what is around
-       head = findchainfloat(bot_pickup, TRUE);
+       head = findchainfloat(bot_pickup, true);
        while (head)
        {
                // gather health and armor only
@@ -97,7 +97,7 @@ void havocbot_role_ons_setrole(entity bot, float role)
        dprint("\n");
 }
 
-float havocbot_ons_teamcount(entity bot, float role)
+float havocbot_ons_teamcount(entity bot, int role)
 {
        float c = 0;
        entity head;
@@ -121,7 +121,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
        for (; cp2; cp2 = cp2.chain)
        {
                cp2.wpcost = c = 0;
-               cp2.wpconsidered = FALSE;
+               cp2.wpconsidered = false;
 
                if(cp2.isshielded)
                        continue;
@@ -148,7 +148,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
 
                // NOTE: probably decrease the cost of attackable control points
                cp2.wpcost = c;
-               cp2.wpconsidered = TRUE;
+               cp2.wpconsidered = true;
        }
 
        // We'll consider only the best case
@@ -176,7 +176,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
        {
                // Should be attacked
                // Rate waypoints near it
-               found = FALSE;
+               found = false;
                best = world;
                bestvalue = 99999999999;
                for(radius=0; radius<1000 && !found; radius+=500)
@@ -187,7 +187,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
                                if(wp.classname=="waypoint")
                                if(checkpvs(wp.origin,cp))
                                {
-                                       found = TRUE;
+                                       found = true;
                                        if(wp.cnt<bestvalue)
                                        {
                                                best = wp;
@@ -217,7 +217,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
        {
                // Should be touched
                // dprint(self.netname, " found a touchable controlpoint at ", vtos(cp.origin) ,"\n");
-               found = FALSE;
+               found = false;
 
                // Look for auto generated waypoint
                if (!bot_waypoints_for_items)
@@ -226,7 +226,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
                        if(wp.classname=="waypoint")
                        {
                                navigation_routerating(wp, ratingscale, 10000);
-                               found = TRUE;
+                               found = true;
                        }
                }
 
@@ -248,7 +248,7 @@ float havocbot_goalrating_ons_generator_attack(float ratingscale)
 
                // Should be attacked
                // Rate waypoints near it
-               found = FALSE;
+               found = false;
                bestwp = world;
                best = 99999999999;
 
@@ -257,7 +257,7 @@ float havocbot_goalrating_ons_generator_attack(float ratingscale)
                        if(wp.classname=="waypoint")
                        if(checkpvs(wp.origin,g))
                        {
-                               found = TRUE;
+                               found = true;
                                if(wp.cnt<best)
                                {
                                        bestwp = wp;
@@ -277,7 +277,7 @@ float havocbot_goalrating_ons_generator_attack(float ratingscale)
                        if(checkpvs(self.view_ofs,bestwp))
                                self.havocbot_attack_time = time + 5;
 
-                       return TRUE;
+                       return true;
                }
                else
                {
@@ -285,10 +285,10 @@ float havocbot_goalrating_ons_generator_attack(float ratingscale)
                        // if there aren't waypoints near the generator go straight to it
                        navigation_routerating(g, ratingscale, 10000);
                        self.havocbot_attack_time = 0;
-                       return TRUE;
+                       return true;
                }
        }
-       return FALSE;
+       return false;
 }
 
 void havocbot_role_ons_offense()
index 7e3ddbb4340dd820253fccc87b5d2d2449ae2af1..af219b8ec730272f85f334402ea9c8cc4dc229f4 100644 (file)
@@ -12,7 +12,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
        float rating, d, discard, distance, friend_distance, enemy_distance;
        vector o;
        ratingscale = ratingscale * 0.0001; // items are rated around 10000 already
-       head = findchainfloat(bot_pickup, TRUE);
+       head = findchainfloat(bot_pickup, true);
 
        while (head)
        {
@@ -30,7 +30,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
                // Check if the item can be picked up safely
                if(head.classname == "droppedweapon")
                {
-                       traceline(o, o + '0 0 -1500', TRUE, world);
+                       traceline(o, o + '0 0 -1500', true, world);
 
                        d = pointcontents(trace_endpos + '0 0 1');
                        if(d & CONTENT_WATER || d & CONTENT_SLIME || d & CONTENT_LAVA)
@@ -57,7 +57,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
 
                if(teamplay)
                {
-                       discard = FALSE;
+                       discard = false;
 
                        FOR_EACH_PLAYER(player)
                        {
@@ -77,7 +77,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
 
                                        friend_distance = d;
 
-                                       discard = TRUE;
+                                       discard = true;
 
                                        if( head.health && player.health > self.health )
                                                continue;
@@ -104,7 +104,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
                                        if (head.ammo_plasma && player.ammo_plasma > self.ammo_plasma)
                                                continue;
 
-                                       discard = FALSE;
+                                       discard = false;
                                }
                                else
                                {
@@ -152,8 +152,9 @@ void havocbot_goalrating_controlpoints(float ratingscale, vector org, float srad
 void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius)
 {
        entity head;
-       float t, noteam, distance;
-       noteam = ((self.team == 0) || !teamplay); // fteqcc sucks
+       int t;
+       float distance;
+       noref bool noteam = ((self.team == 0) || !teamplay);
 
        if (autocvar_bot_nofire)
                return;
@@ -184,7 +185,7 @@ void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradi
                        // not falling
                        if((head.flags & FL_ONGROUND) == 0)
                        {
-                               traceline(head.origin, head.origin + '0 0 -1500', TRUE, world);
+                               traceline(head.origin, head.origin + '0 0 -1500', true, world);
                                t = pointcontents(trace_endpos + '0 0 1');
                                if( t != CONTENT_SOLID )
                                if(t & CONTENT_WATER || t & CONTENT_SLIME || t & CONTENT_LAVA)
index 0f4c330ed8882b2037a6e99bb5f7652d76a421bb..d80f8336c8ba179bd52e862bc2807181d92efebc 100644 (file)
@@ -29,25 +29,25 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
        }
 
        move = end - start;
-       move_z = 0;
+       move.z = 0;
        org = start;
        dist = totaldist = vlen(move);
        dir = normalize(move);
        stepdist = 32;
-       ignorehazards = FALSE;
-       swimming = FALSE;
+       ignorehazards = false;
+       swimming = false;
 
        // Analyze starting point
        traceline(start, start, MOVE_NORMAL, e);
        if (trace_dpstartcontents & (DPCONTENTS_SLIME | DPCONTENTS_LAVA))
-               ignorehazards = TRUE;
+               ignorehazards = true;
        else
        {
                traceline( start, start + '0 0 -65536', MOVE_NORMAL, e);
                if (trace_dpstartcontents & (DPCONTENTS_SLIME | DPCONTENTS_LAVA))
                {
-                       ignorehazards = TRUE;
-                       swimming = TRUE;
+                       ignorehazards = true;
+                       swimming = true;
                }
        }
        tracebox(start, m1, m2, start, MOVE_NOMONSTERS, e);
@@ -58,7 +58,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                        debugnodestatus(start, DEBUG_NODE_FAIL);
 
                //print("tracewalk: ", vtos(start), " is a bad start\n");
-               return FALSE;
+               return false;
        }
 
        // Movement loop
@@ -73,7 +73,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                                debugnodestatus(org, DEBUG_NODE_SUCCESS);
 
                        //print("tracewalk: ", vtos(start), " can reach ", vtos(end), "\n");
-                       return TRUE;
+                       return true;
                }
                if(autocvar_bot_debug_tracewalk)
                        debugnode(org);
@@ -93,7 +93,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                                        debugnodestatus(org, DEBUG_NODE_FAIL);
 
                                //print("tracewalk: ", vtos(start), " hits a hazard when trying to reach ", vtos(end), "\n");
-                               return FALSE;
+                               return false;
                        }
                }
                if (trace_dpstartcontents & DPCONTENTS_LIQUIDSMASK)
@@ -106,9 +106,9 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
 
                        if (trace_fraction < 1)
                        {
-                               swimming = TRUE;
+                               swimming = true;
                                org = trace_endpos - normalize(org - trace_endpos) * stepdist;
-                               for(; org_z < end_z + self.maxs_z; org_z += stepdist)
+                               for (; org.z < end.z + self.maxs.z; org.z += stepdist)
                                {
                                                if(autocvar_bot_debug_tracewalk)
                                                        debugnode(org);
@@ -122,7 +122,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                                        if(autocvar_bot_debug_tracewalk)
                                                debugnodestatus(org, DEBUG_NODE_FAIL);
 
-                                       return FALSE;
+                                       return false;
                                        //print("tracewalk: ", vtos(start), " failed under water\n");
                                }
                                continue;
@@ -173,7 +173,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                                                        //print("tracewalk: ", vtos(start), " hit something when trying to reach ", vtos(end), "\n");
                                                        //te_explosion(trace_endpos);
                                                        //print(ftos(e.dphitcontentsmask), "\n");
-                                                       return FALSE; // failed
+                                                       return false; // failed
                                                }
                                        }
                                        else
@@ -197,7 +197,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                                float c;
                                c = pointcontents(org + '0 0 1');
                                if (!(c == CONTENT_WATER || c == CONTENT_LAVA || c == CONTENT_SLIME))
-                                       swimming = FALSE;
+                                       swimming = false;
                                else
                                        continue;
                        }
@@ -212,7 +212,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
        if(autocvar_bot_debug_tracewalk)
                debugnodestatus(org, DEBUG_NODE_FAIL);
 
-       return FALSE;
+       return false;
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -223,7 +223,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
 void navigation_clearroute()
 {
        //print("bot ", etos(self), " clear\n");
-       self.navigation_hasgoals = FALSE;
+       self.navigation_hasgoals = false;
        self.goalcurrent = world;
        self.goalstack01 = world;
        self.goalstack02 = world;
@@ -347,22 +347,22 @@ float navigation_waypoint_will_link(vector v, vector org, entity ent, float walk
        dist = vlen(v - org);
        if (bestdist > dist)
        {
-               traceline(v, org, TRUE, ent);
+               traceline(v, org, true, ent);
                if (trace_fraction == 1)
                {
                        if (walkfromwp)
                        {
                                if (tracewalk(ent, v, PL_MIN, PL_MAX, org, bot_navigation_movemode))
-                                       return TRUE;
+                                       return true;
                        }
                        else
                        {
                                if (tracewalk(ent, org, PL_MIN, PL_MAX, v, bot_navigation_movemode))
-                                       return TRUE;
+                                       return true;
                        }
                }
        }
-       return FALSE;
+       return false;
 }
 
 // find the spawnfunc_waypoint near a dynamic goal such as a dropped weapon
@@ -387,7 +387,7 @@ entity navigation_findnearestwaypoint_withdist_except(entity ent, float walkfrom
        }
 
        org = ent.origin + 0.5 * (ent.mins + ent.maxs);
-       org_z = ent.origin_z + ent.mins_z - PL_MIN_z; // player height
+       org.z = ent.origin.z + ent.mins.z - PL_MIN_z; // player height
        // TODO possibly make other code have the same support for bboxes
        if(ent.tag_entity)
                org = org + ent.tag_entity.origin;
@@ -408,9 +408,9 @@ entity navigation_findnearestwaypoint_withdist_except(entity ent, float walkfrom
                                vector wm1, wm2;
                                wm1 = w.origin + w.mins;
                                wm2 = w.origin + w.maxs;
-                               v_x = bound(wm1_x, org_x, wm2_x);
-                               v_y = bound(wm1_y, org_y, wm2_y);
-                               v_z = bound(wm1_z, org_z, wm2_z);
+                               v.x = bound(wm1_x, org.x, wm2_x);
+                               v.y = bound(wm1_y, org.y, wm2_y);
+                               v.z = bound(wm1_z, org.z, wm2_z);
                        }
                        else
                                v = w.origin;
@@ -442,7 +442,7 @@ float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist)
        entity head;
        vector v, m1, m2, diff;
        float c;
-//     navigation_testtracewalk = TRUE;
+//     navigation_testtracewalk = true;
        c = 0;
        head = waylist;
        while (head)
@@ -454,17 +454,17 @@ float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist)
                                m1 = head.origin + head.mins;
                                m2 = head.origin + head.maxs;
                                v = self.origin;
-                               v_x = bound(m1_x, v_x, m2_x);
-                               v_y = bound(m1_y, v_y, m2_y);
-                               v_z = bound(m1_z, v_z, m2_z);
+                               v.x = bound(m1_x, v.x, m2_x);
+                               v.y = bound(m1_y, v.y, m2_y);
+                               v.z = bound(m1_z, v.z, m2_z);
                        }
                        else
                                v = head.origin;
                        diff = v - self.origin;
-                       diff_z = max(0, diff_z);
+                       diff.z = max(0, diff.z);
                        if (vlen(diff) < maxdist)
                        {
-                               head.wpconsidered = TRUE;
+                               head.wpconsidered = true;
                                if (tracewalk(self, self.origin, self.mins, self.maxs, v, bot_navigation_movemode))
                                {
                                        head.wpnearestpoint = v;
@@ -477,7 +477,7 @@ float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist)
                }
                head = head.chain;
        }
-       //navigation_testtracewalk = FALSE;
+       //navigation_testtracewalk = false;
        return c;
 }
 
@@ -491,9 +491,9 @@ void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vecto
        {
                m1 = wp.absmin;
                m2 = wp.absmax;
-               v_x = bound(m1_x, p_x, m2_x);
-               v_y = bound(m1_y, p_y, m2_y);
-               v_z = bound(m1_z, p_z, m2_z);
+               v.x = bound(m1_x, p.x, m2_x);
+               v.y = bound(m1_y, p.y, m2_y);
+               v.z = bound(m1_z, p.z, m2_z);
        }
        else
                v = wp.origin;
@@ -516,7 +516,7 @@ void navigation_markroutes(entity fixed_source_waypoint)
        w = waylist = findchain(classname, "waypoint");
        while (w)
        {
-               w.wpconsidered = FALSE;
+               w.wpconsidered = false;
                w.wpnearestpoint = '0 0 0';
                w.wpcost = 10000000;
                w.wpfire = 0;
@@ -526,7 +526,7 @@ void navigation_markroutes(entity fixed_source_waypoint)
 
        if(fixed_source_waypoint)
        {
-               fixed_source_waypoint.wpconsidered = TRUE;
+               fixed_source_waypoint.wpconsidered = true;
                fixed_source_waypoint.wpnearestpoint = fixed_source_waypoint.origin + 0.5 * (fixed_source_waypoint.mins + fixed_source_waypoint.maxs);
                fixed_source_waypoint.wpcost = fixed_source_waypoint.dmg;
                fixed_source_waypoint.wpfire = 1;
@@ -551,16 +551,16 @@ void navigation_markroutes(entity fixed_source_waypoint)
                for(i=increment;!navigation_markroutes_nearestwaypoints(waylist, i)&&i<maxdistance;i+=increment);
        }
 
-       searching = TRUE;
+       searching = true;
        while (searching)
        {
-               searching = FALSE;
+               searching = false;
                w = waylist;
                while (w)
                {
                        if (w.wpfire)
                        {
-                               searching = TRUE;
+                               searching = true;
                                w.wpfire = 0;
                                cost = w.wpcost;
                                p = w.wpnearestpoint;
@@ -612,7 +612,7 @@ void navigation_markroutes_inverted(entity fixed_source_waypoint)
        w = waylist = findchain(classname, "waypoint");
        while (w)
        {
-               w.wpconsidered = FALSE;
+               w.wpconsidered = false;
                w.wpnearestpoint = '0 0 0';
                w.wpcost = 10000000;
                w.wpfire = 0;
@@ -622,7 +622,7 @@ void navigation_markroutes_inverted(entity fixed_source_waypoint)
 
        if(fixed_source_waypoint)
        {
-               fixed_source_waypoint.wpconsidered = TRUE;
+               fixed_source_waypoint.wpconsidered = true;
                fixed_source_waypoint.wpnearestpoint = fixed_source_waypoint.origin + 0.5 * (fixed_source_waypoint.mins + fixed_source_waypoint.maxs);
                fixed_source_waypoint.wpcost = fixed_source_waypoint.dmg; // the cost to get from X to fixed_source_waypoint
                fixed_source_waypoint.wpfire = 1;
@@ -633,16 +633,16 @@ void navigation_markroutes_inverted(entity fixed_source_waypoint)
                error("need to start with a waypoint\n");
        }
 
-       searching = TRUE;
+       searching = true;
        while (searching)
        {
-               searching = FALSE;
+               searching = false;
                w = waylist;
                while (w)
                {
                        if (w.wpfire)
                        {
-                               searching = TRUE;
+                               searching = true;
                                w.wpfire = 0;
                                cost = w.wpcost; // cost to walk from w to home
                                p = w.wpnearestpoint;
@@ -716,10 +716,10 @@ void navigation_routerating(entity e, float f, float rangebias)
                                npa = pointa + down;
                                npb = pointb + down;
 
-                               if(npa_z<=self.absmax_z)
+                               if(npa.z<=self.absmax.z)
                                        break;
 
-                               if(npb_z<=e.absmax_z)
+                               if(npb.z<=e.absmax.z)
                                        break;
 
                                traceline(npa, npb, MOVE_NORMAL, self);
@@ -735,7 +735,7 @@ void navigation_routerating(entity e, float f, float rangebias)
                        // Rough estimation of fuel consumption
                        // (ignores acceleration and current xyz velocity)
                        xydistance = vlen(pointa - pointb);
-                       zdistance = fabs(pointa_z - self.origin_z);
+                       zdistance = fabs(pointa.z - self.origin.z);
 
                        t = zdistance / autocvar_g_jetpack_maxspeed_up;
                        t += xydistance / autocvar_g_jetpack_maxspeed_side;
@@ -782,25 +782,25 @@ void navigation_routerating(entity e, float f, float rangebias)
        {
                float search;
 
-               search = TRUE;
+               search = true;
 
                if(e.flags & FL_ITEM)
                {
                        if (!(e.flags & FL_WEAPON))
                        if(e.nearestwaypoint)
-                               search = FALSE;
+                               search = false;
                }
                else if (e.flags & FL_WEAPON)
                {
                        if(e.classname != "droppedweapon")
                        if(e.nearestwaypoint)
-                               search = FALSE;
+                               search = false;
                }
 
                if(search)
                if (time > e.nearestwaypointtimeout)
                {
-                       nwp = navigation_findnearestwaypoint(e, TRUE);
+                       nwp = navigation_findnearestwaypoint(e, true);
                        if(nwp)
                                e.nearestwaypoint = nwp;
                        else
@@ -808,11 +808,11 @@ void navigation_routerating(entity e, float f, float rangebias)
                                bot_debug(strcat("FAILED to find a nearest waypoint to '", e.classname, "' #", etos(e), "\n"));
 
                                if(e.flags & FL_ITEM)
-                                       e.blacklisted = TRUE;
+                                       e.blacklisted = true;
                                else if (e.flags & FL_WEAPON)
                                {
                                        if(e.classname != "droppedweapon")
-                                               e.blacklisted = TRUE;
+                                               e.blacklisted = true;
                                }
 
                                if(e.blacklisted)
@@ -855,9 +855,9 @@ float navigation_routetogoal(entity e, vector startposition)
 
        // if there is no goal, just exit
        if (!e)
-               return FALSE;
+               return false;
 
-       self.navigation_hasgoals = TRUE;
+       self.navigation_hasgoals = true;
 
        // put the entity on the goal stack
        //print("routetogoal ", etos(e), "\n");
@@ -865,11 +865,11 @@ float navigation_routetogoal(entity e, vector startposition)
 
        if(g_jetpack)
        if(e==self.navigation_jetpack_goal)
-               return TRUE;
+               return true;
 
        // if it can reach the goal there is nothing more to do
        if (tracewalk(self, startposition, PL_MIN, PL_MAX, (e.absmin + e.absmax) * 0.5, bot_navigation_movemode))
-               return TRUE;
+               return true;
 
        // see if there are waypoints describing a path to the item
        if(e.classname != "waypoint" || (e.wpflags & WAYPOINTFLAG_PERSONAL))
@@ -878,7 +878,7 @@ float navigation_routetogoal(entity e, vector startposition)
                e = e.enemy; // we already have added it, so...
 
        if(e == world)
-               return FALSE;
+               return false;
 
        for (;;)
        {
@@ -890,7 +890,7 @@ float navigation_routetogoal(entity e, vector startposition)
                        break;
        }
 
-       return FALSE;
+       return false;
 }
 
 // removes any currently touching waypoints from the goal stack
@@ -950,7 +950,7 @@ void navigation_poptouchedgoals()
        {
                if(vlen(self.origin - self.goalcurrent.origin)<150)
                {
-                       traceline(self.origin + self.view_ofs , self.goalcurrent.origin, TRUE, world);
+                       traceline(self.origin + self.view_ofs , self.goalcurrent.origin, true, world);
                        if(trace_fraction==1)
                        {
                                // Detect personal waypoints
@@ -988,7 +988,7 @@ void navigation_goalrating_start()
 
        self.navigation_jetpack_goal = world;
        navigation_bestrating = -1;
-       self.navigation_hasgoals = FALSE;
+       self.navigation_hasgoals = false;
        navigation_clearroute();
        navigation_bestgoal = world;
        navigation_markroutes(world);
@@ -1013,7 +1013,7 @@ void navigation_goalrating_end()
                        self.aistatus |= AI_STATUS_STUCK;
                }
 
-               self.navigation_hasgoals = FALSE; // Reset this value
+               self.navigation_hasgoals = false; // Reset this value
        }
 }
 
@@ -1023,7 +1023,7 @@ void botframe_updatedangerousobjects(float maxupdate)
        vector m1, m2, v, o;
        float c, d, danger;
        c = 0;
-       bot_dodgelist = findchainfloat(bot_dodge, TRUE);
+       bot_dodgelist = findchainfloat(bot_dodge, true);
        botframe_dangerwaypoint = find(botframe_dangerwaypoint, classname, "waypoint");
        while (botframe_dangerwaypoint != world)
        {
@@ -1034,14 +1034,14 @@ void botframe_updatedangerousobjects(float maxupdate)
                while (head)
                {
                        v = head.origin;
-                       v_x = bound(m1_x, v_x, m2_x);
-                       v_y = bound(m1_y, v_y, m2_y);
-                       v_z = bound(m1_z, v_z, m2_z);
+                       v.x = bound(m1_x, v.x, m2_x);
+                       v.y = bound(m1_y, v.y, m2_y);
+                       v.z = bound(m1_z, v.z, m2_z);
                        o = (head.absmin + head.absmax) * 0.5;
                        d = head.bot_dodgerating - vlen(o - v);
                        if (d > 0)
                        {
-                               traceline(o, v, TRUE, world);
+                               traceline(o, v, true, world);
                                if (trace_fraction == 1)
                                        danger = danger + d;
                        }
index 24d01c7c44f9adfee93013c0ca34fd3e496f61c5..08e1c53ac88d4fb8304076157bd4a95e88ea8f9b 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef NAVIGATION_H
+#define NAVIGATION_H
 /*
  * Globals and Fields
  */
@@ -74,3 +76,4 @@ void navigation_unstuck();
 void botframe_updatedangerousobjects(float maxupdate);
 
 entity navigation_findnearestwaypoint(entity ent, float walkfromwp);
+#endif
index f984f29b6b4facf819418946c15c6bfd8152d639..ead8ceac9ec5c3adba637e35df67207f6abc6391 100644 (file)
@@ -8,7 +8,7 @@ void bot_clearqueue(entity bot)
        if(!bot.bot_cmdqueuebuf_allocated)
                return;
        buf_del(bot.bot_cmdqueuebuf);
-       bot.bot_cmdqueuebuf_allocated = FALSE;
+       bot.bot_cmdqueuebuf_allocated = false;
        dprint("bot ", bot.netname, " queue cleared\n");
 }
 
@@ -17,7 +17,7 @@ void bot_queuecommand(entity bot, string cmdstring)
        if(!bot.bot_cmdqueuebuf_allocated)
        {
                bot.bot_cmdqueuebuf = buf_create();
-               bot.bot_cmdqueuebuf_allocated = TRUE;
+               bot.bot_cmdqueuebuf_allocated = true;
                bot.bot_cmdqueuebuf_start = 0;
                bot.bot_cmdqueuebuf_end = 0;
        }
@@ -39,7 +39,7 @@ void bot_queuecommand(entity bot, string cmdstring)
                        if(cmdstr == "sound")
                        {
                                // find the LAST word
-                               for(;;)
+                               for (;;)
                                {
                                        sp = strstrofs(parm, " ", 0);
                                        if(sp < 0)
@@ -91,7 +91,7 @@ float bot_havecommand(entity bot, float idx)
        return 1;
 }
 
-#define MAX_BOT_PLACES 4
+const int MAX_BOT_PLACES = 4;
 .float bot_places_count;
 .entity bot_places[MAX_BOT_PLACES];
 .string bot_placenames[MAX_BOT_PLACES];
@@ -100,7 +100,7 @@ entity bot_getplace(string placename)
        entity e;
        if(substring(placename, 0, 1) == "@")
        {
-               float i, p;
+               int i, p;
                placename = substring(placename, 1, -1);
                string s, s2;
                for(i = 0; i < self.bot_places_count; ++i)
@@ -138,35 +138,35 @@ entity bot_getplace(string placename)
 
 
 // NOTE: New commands should be added here. Do not forget to update BOT_CMD_COUNTER
-#define BOT_CMD_NULL                   0
-#define BOT_CMD_PAUSE                  1
-#define BOT_CMD_CONTINUE               2
-#define BOT_CMD_WAIT                   3
-#define BOT_CMD_TURN                   4
-#define BOT_CMD_MOVETO                 5
-#define BOT_CMD_RESETGOAL              6       // Not implemented yet
-#define BOT_CMD_CC                     7
-#define BOT_CMD_IF                     8
-#define BOT_CMD_ELSE                   9
-#define BOT_CMD_FI                     10
-#define BOT_CMD_RESETAIM               11
-#define BOT_CMD_AIM                    12
-#define BOT_CMD_PRESSKEY               13
-#define BOT_CMD_RELEASEKEY             14
-#define BOT_CMD_SELECTWEAPON           15
-#define BOT_CMD_IMPULSE                        16
-#define BOT_CMD_WAIT_UNTIL             17
-#define BOT_CMD_MOVETOTARGET    18
-#define BOT_CMD_AIMTARGET       19
-#define BOT_CMD_BARRIER         20
-#define BOT_CMD_CONSOLE                        21
-#define BOT_CMD_SOUND                  22
-#define BOT_CMD_DEBUG_ASSERT_CANFIRE 23
-#define BOT_CMD_WHILE                  24      // TODO: Not implemented yet
-#define BOT_CMD_WEND                   25      // TODO: Not implemented yet
-#define BOT_CMD_CHASE                  26      // TODO: Not implemented yet
-
-#define BOT_CMD_COUNTER                        24      // Update this value if you add/remove a command
+const int BOT_CMD_NULL                         = 0;
+const int BOT_CMD_PAUSE                = 1;
+const int BOT_CMD_CONTINUE             = 2;
+const int BOT_CMD_WAIT                         = 3;
+const int BOT_CMD_TURN                         = 4;
+const int BOT_CMD_MOVETO               = 5;
+const int BOT_CMD_RESETGOAL    = 6;    // Not implemented yet
+const int BOT_CMD_CC                   = 7;
+const int BOT_CMD_IF                   = 8;
+const int BOT_CMD_ELSE                         = 9;
+const int BOT_CMD_FI                   = 10;
+const int BOT_CMD_RESETAIM             = 11;
+const int BOT_CMD_AIM                  = 12;
+const int BOT_CMD_PRESSKEY             = 13;
+const int BOT_CMD_RELEASEKEY   = 14;
+const int BOT_CMD_SELECTWEAPON         = 15;
+const int BOT_CMD_IMPULSE              = 16;
+const int BOT_CMD_WAIT_UNTIL   = 17;
+const int BOT_CMD_MOVETOTARGET         = 18;
+const int BOT_CMD_AIMTARGET    = 19;
+const int BOT_CMD_BARRIER              = 20;
+const int BOT_CMD_CONSOLE              = 21;
+const int BOT_CMD_SOUND                = 22;
+const int BOT_CMD_DEBUG_ASSERT_CANFIRE = 23;
+const int BOT_CMD_WHILE                = 24;   // TODO: Not implemented yet
+const int BOT_CMD_WEND                         = 25;   // TODO: Not implemented yet
+const int BOT_CMD_CHASE                = 26;   // TODO: Not implemented yet
+
+const int BOT_CMD_COUNTER              = 24;   // Update this value if you add/remove a command
 
 // NOTE: Following commands should be implemented on the bot ai
 //              If a new command should be handled by the target ai(s) please declare it here
@@ -174,13 +174,13 @@ entity bot_getplace(string placename)
 .float() cmd_resetgoal;
 
 //
-#define BOT_CMD_PARAMETER_NONE         0
-#define BOT_CMD_PARAMETER_FLOAT                1
-#define BOT_CMD_PARAMETER_STRING       2
-#define BOT_CMD_PARAMETER_VECTOR       3
+const int BOT_CMD_PARAMETER_NONE = 0;
+const int BOT_CMD_PARAMETER_FLOAT = 1;
+const int BOT_CMD_PARAMETER_STRING = 2;
+const int BOT_CMD_PARAMETER_VECTOR = 3;
 
 float bot_cmds_initialized;
-float bot_cmd_parm_type[BOT_CMD_COUNTER];
+int bot_cmd_parm_type[BOT_CMD_COUNTER];
 string bot_cmd_string[BOT_CMD_COUNTER];
 
 // Bots command queue
@@ -189,7 +189,7 @@ entity bot_cmd;     // global current command
 
 .float is_bot_cmd;                     // Tells if the entity is a bot command
 .float bot_cmd_index;                  // Position of the command in the queue
-.float bot_cmd_type;                   // If of command (see the BOT_CMD_* defines)
+.int bot_cmd_type;                     // If of command (see the BOT_CMD_* defines)
 .float bot_cmd_parm_float;             // Field to store a float parameter
 .string bot_cmd_parm_string;           // Field to store a string parameter
 .vector bot_cmd_parm_vector;           // Field to store a vector parameter
@@ -275,7 +275,7 @@ void bot_commands_init()
        bot_cmd_string[BOT_CMD_DEBUG_ASSERT_CANFIRE] = "debug_assert_canfire";
        bot_cmd_parm_type[BOT_CMD_DEBUG_ASSERT_CANFIRE] = BOT_CMD_PARAMETER_FLOAT;
 
-       bot_cmds_initialized = TRUE;
+       bot_cmds_initialized = true;
 }
 
 // Returns first bot with matching name
@@ -321,7 +321,7 @@ entity find_bot_by_number(float number)
 
 float bot_decodecommand(string cmdstring)
 {
-       float cmd_parm_type, i;
+       float cmd_parm_type;
        float sp;
        string parm;
 
@@ -339,6 +339,7 @@ float bot_decodecommand(string cmdstring)
        if(!bot_cmds_initialized)
                bot_commands_init();
 
+       int i;
        for(i=1;i<BOT_CMD_COUNTER;++i)
        {
                if(bot_cmd_string[i]!=cmdstring)
@@ -380,7 +381,7 @@ float bot_decodecommand(string cmdstring)
 
 void bot_cmdhelp(string scmd)
 {
-       float i, ntype;
+       int i, ntype;
        string stype;
 
        if(!bot_cmds_initialized)
@@ -495,7 +496,7 @@ void bot_cmdhelp(string scmd)
 
 void bot_list_commands()
 {
-       float i;
+       int i;
        string ptype;
 
        if(!bot_cmds_initialized)
@@ -526,7 +527,7 @@ void bot_list_commands()
 }
 
 // Commands code
-.float bot_exec_status;
+.int bot_exec_status;
 
 #define BOT_EXEC_STATUS_IDLE   0
 #define BOT_EXEC_STATUS_PAUSED 1
@@ -626,8 +627,8 @@ float bot_cmd_barrier()
 
 float bot_cmd_turn()
 {
-       self.v_angle_y = self.v_angle_y + bot_cmd.bot_cmd_parm_float;
-       self.v_angle_y = self.v_angle_y - floor(self.v_angle_y / 360) * 360;
+       self.v_angle_y = self.v_angle.y + bot_cmd.bot_cmd_parm_float;
+       self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360;
        return CMD_STATUS_FINISHED;
 }
 
@@ -640,7 +641,7 @@ float bot_cmd_select_weapon()
        if(id < WEP_FIRST || id > WEP_LAST)
                return CMD_STATUS_ERROR;
 
-       if(client_hasweapon(self, id, TRUE, FALSE))
+       if(client_hasweapon(self, id, true, false))
                self.switchweapon = id;
        else
                return CMD_STATUS_ERROR;
@@ -648,13 +649,13 @@ float bot_cmd_select_weapon()
        return CMD_STATUS_FINISHED;
 }
 
-.float bot_cmd_condition_status;
+.int bot_cmd_condition_status;
 
-#define CMD_CONDITION_NONE             0
-#define CMD_CONDITION_TRUE             1
-#define CMD_CONDITION_FALSE            2
-#define CMD_CONDITION_TRUE_BLOCK       4
-#define CMD_CONDITION_FALSE_BLOCK      8
+const int CMD_CONDITION_NONE = 0;
+const int CMD_CONDITION_true = 1;
+const int CMD_CONDITION_false = 2;
+const int CMD_CONDITION_true_BLOCK = 4;
+const int CMD_CONDITION_false_BLOCK = 8;
 
 float bot_cmd_eval(string expr)
 {
@@ -698,7 +699,7 @@ float bot_cmd_if()
                return CMD_STATUS_ERROR;
        }
 
-       self.bot_cmd_condition_status |= CMD_CONDITION_TRUE_BLOCK;
+       self.bot_cmd_condition_status |= CMD_CONDITION_true_BLOCK;
 
        // search for operators
        expr = bot_cmd.bot_cmd_parm_string;
@@ -711,9 +712,9 @@ float bot_cmd_if()
                val_b = substring(expr,cmpofs+1,strlen(expr));
 
                if(bot_cmd_eval(val_a)==bot_cmd_eval(val_b))
-                       self.bot_cmd_condition_status |= CMD_CONDITION_TRUE;
+                       self.bot_cmd_condition_status |= CMD_CONDITION_true;
                else
-                       self.bot_cmd_condition_status |= CMD_CONDITION_FALSE;
+                       self.bot_cmd_condition_status |= CMD_CONDITION_false;
 
                return CMD_STATUS_FINISHED;
        }
@@ -726,9 +727,9 @@ float bot_cmd_if()
                val_b = substring(expr,cmpofs+1,strlen(expr));
 
                if(bot_cmd_eval(val_a)>bot_cmd_eval(val_b))
-                       self.bot_cmd_condition_status |= CMD_CONDITION_TRUE;
+                       self.bot_cmd_condition_status |= CMD_CONDITION_true;
                else
-                       self.bot_cmd_condition_status |= CMD_CONDITION_FALSE;
+                       self.bot_cmd_condition_status |= CMD_CONDITION_false;
 
                return CMD_STATUS_FINISHED;
        }
@@ -741,25 +742,25 @@ float bot_cmd_if()
                val_b = substring(expr,cmpofs+1,strlen(expr));
 
                if(bot_cmd_eval(val_a)<bot_cmd_eval(val_b))
-                       self.bot_cmd_condition_status |= CMD_CONDITION_TRUE;
+                       self.bot_cmd_condition_status |= CMD_CONDITION_true;
                else
-                       self.bot_cmd_condition_status |= CMD_CONDITION_FALSE;
+                       self.bot_cmd_condition_status |= CMD_CONDITION_false;
 
                return CMD_STATUS_FINISHED;
        }
 
        if(bot_cmd_eval(expr))
-               self.bot_cmd_condition_status |= CMD_CONDITION_TRUE;
+               self.bot_cmd_condition_status |= CMD_CONDITION_true;
        else
-               self.bot_cmd_condition_status |= CMD_CONDITION_FALSE;
+               self.bot_cmd_condition_status |= CMD_CONDITION_false;
 
        return CMD_STATUS_FINISHED;
 }
 
 float bot_cmd_else()
 {
-       self.bot_cmd_condition_status &= ~CMD_CONDITION_TRUE_BLOCK;
-       self.bot_cmd_condition_status |= CMD_CONDITION_FALSE_BLOCK;
+       self.bot_cmd_condition_status &= ~CMD_CONDITION_true_BLOCK;
+       self.bot_cmd_condition_status |= CMD_CONDITION_false_BLOCK;
        return CMD_STATUS_FINISHED;
 }
 
@@ -821,8 +822,8 @@ float bot_cmd_aim()
 
        self.bot_cmd_aim_begin = self.v_angle;
 
-       self.bot_cmd_aim_end_x = self.v_angle_x - stof(argv(1));
-       self.bot_cmd_aim_end_y = self.v_angle_y + stof(argv(0));
+       self.bot_cmd_aim_end_x = self.v_angle.x - stof(argv(1));
+       self.bot_cmd_aim_end_y = self.v_angle.y + stof(argv(0));
        self.bot_cmd_aim_end_z = 0;
 
        self.bot_cmd_aim_begintime = time;
@@ -856,7 +857,7 @@ float bot_cmd_aimtarget()
        if(tokens==1)
        {
                self.v_angle = vectoangles(v - (self.origin + self.view_ofs));
-               self.v_angle_x = -self.v_angle_x;
+               self.v_angle_x = -self.v_angle.x;
                return CMD_STATUS_FINISHED;
        }
 
@@ -867,7 +868,7 @@ float bot_cmd_aimtarget()
 
        self.bot_cmd_aim_begin = self.v_angle;
        self.bot_cmd_aim_end = vectoangles(v - (self.origin + self.view_ofs));
-       self.bot_cmd_aim_end_x = -self.bot_cmd_aim_end_x;
+       self.bot_cmd_aim_end_x = -self.bot_cmd_aim_end.x;
 
        self.bot_cmd_aim_begintime = time;
        self.bot_cmd_aim_endtime = time + step;
@@ -875,34 +876,34 @@ float bot_cmd_aimtarget()
        return CMD_STATUS_EXECUTING;
 }
 
-.float bot_cmd_keys;
-
-#define BOT_CMD_KEY_NONE       0
-#define BOT_CMD_KEY_FORWARD    1
-#define BOT_CMD_KEY_BACKWARD   2
-#define BOT_CMD_KEY_RIGHT      4
-#define BOT_CMD_KEY_LEFT       8
-#define BOT_CMD_KEY_JUMP       16
-#define BOT_CMD_KEY_ATTACK1    32
-#define BOT_CMD_KEY_ATTACK2    64
-#define BOT_CMD_KEY_USE                128
-#define BOT_CMD_KEY_HOOK       256
-#define BOT_CMD_KEY_CROUCH     512
-#define BOT_CMD_KEY_CHAT       1024
+.int bot_cmd_keys;
+
+const int BOT_CMD_KEY_NONE             = 0;
+const int BOT_CMD_KEY_FORWARD  = 1;
+const int BOT_CMD_KEY_BACKWARD         = 2;
+const int BOT_CMD_KEY_RIGHT    = 4;
+const int BOT_CMD_KEY_LEFT             = 8;
+const int BOT_CMD_KEY_JUMP             = 16;
+const int BOT_CMD_KEY_ATTACK1  = 32;
+const int BOT_CMD_KEY_ATTACK2  = 64;
+const int BOT_CMD_KEY_USE              = 128;
+const int BOT_CMD_KEY_HOOK             = 256;
+const int BOT_CMD_KEY_CROUCH   = 512;
+const int BOT_CMD_KEY_CHAT             = 1024;
 
 float bot_presskeys()
 {
        self.movement = '0 0 0';
-       self.BUTTON_JUMP = FALSE;
-       self.BUTTON_CROUCH = FALSE;
-       self.BUTTON_ATCK = FALSE;
-       self.BUTTON_ATCK2 = FALSE;
-       self.BUTTON_USE = FALSE;
-       self.BUTTON_HOOK = FALSE;
-       self.BUTTON_CHAT = FALSE;
+       self.BUTTON_JUMP = false;
+       self.BUTTON_CROUCH = false;
+       self.BUTTON_ATCK = false;
+       self.BUTTON_ATCK2 = false;
+       self.BUTTON_USE = false;
+       self.BUTTON_HOOK = false;
+       self.BUTTON_CHAT = false;
 
        if(self.bot_cmd_keys == BOT_CMD_KEY_NONE)
-               return FALSE;
+               return false;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_FORWARD)
                self.movement_x = autocvar_sv_maxspeed;
@@ -915,27 +916,27 @@ float bot_presskeys()
                self.movement_y = -autocvar_sv_maxspeed;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_JUMP)
-               self.BUTTON_JUMP = TRUE;
+               self.BUTTON_JUMP = true;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_CROUCH)
-               self.BUTTON_CROUCH = TRUE;
+               self.BUTTON_CROUCH = true;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_ATTACK1)
-               self.BUTTON_ATCK = TRUE;
+               self.BUTTON_ATCK = true;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_ATTACK2)
-               self.BUTTON_ATCK2 = TRUE;
+               self.BUTTON_ATCK2 = true;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_USE)
-               self.BUTTON_USE = TRUE;
+               self.BUTTON_USE = true;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_HOOK)
-               self.BUTTON_HOOK = TRUE;
+               self.BUTTON_HOOK = true;
 
        if(self.bot_cmd_keys & BOT_CMD_KEY_CHAT)
-               self.BUTTON_CHAT = TRUE;
+               self.BUTTON_CHAT = true;
 
-       return TRUE;
+       return true;
 }
 
 
@@ -1039,7 +1040,7 @@ float bot_cmd_presskey()
 
        key = bot_cmd.bot_cmd_parm_string;
 
-       bot_cmd_keypress_handler(key,TRUE);
+       bot_cmd_keypress_handler(key,true);
 
        return CMD_STATUS_FINISHED;
 }
@@ -1050,7 +1051,7 @@ float bot_cmd_releasekey()
 
        key = bot_cmd.bot_cmd_parm_string;
 
-       return bot_cmd_keypress_handler(key,FALSE);
+       return bot_cmd_keypress_handler(key,false);
 }
 
 float bot_cmd_pause()
@@ -1247,7 +1248,7 @@ float bot_execute_commands_once()
        // (namely, it means you cannot make a bot "normal" ever again)
        // to keep a bot walking for a while, use the "wait" bot command
        if(bot_cmd == world)
-               return FALSE;
+               return false;
 
        // Ignore all commands except continue when the bot is paused
        if(self.bot_exec_status & BOT_EXEC_STATUS_PAUSED)
@@ -1255,7 +1256,7 @@ float bot_execute_commands_once()
        {
                if(bot_cmd.bot_cmd_type!=BOT_CMD_NULL)
                {
-                       bot_command_executed(TRUE);
+                       bot_command_executed(true);
                        print( "WARNING: Commands are ignored while the bot is paused. Use the command 'continue' instead.\n");
                }
                return 1;
@@ -1266,14 +1267,14 @@ float bot_execute_commands_once()
 
        // Handle conditions
        if (!(bot_cmd.bot_cmd_type==BOT_CMD_FI||bot_cmd.bot_cmd_type==BOT_CMD_ELSE))
-       if(self.bot_cmd_condition_status & CMD_CONDITION_TRUE && self.bot_cmd_condition_status & CMD_CONDITION_FALSE_BLOCK)
+       if(self.bot_cmd_condition_status & CMD_CONDITION_true && self.bot_cmd_condition_status & CMD_CONDITION_false_BLOCK)
        {
-               bot_command_executed(TRUE);
+               bot_command_executed(true);
                return -1;
        }
-       else if(self.bot_cmd_condition_status & CMD_CONDITION_FALSE && self.bot_cmd_condition_status & CMD_CONDITION_TRUE_BLOCK)
+       else if(self.bot_cmd_condition_status & CMD_CONDITION_false && self.bot_cmd_condition_status & CMD_CONDITION_true_BLOCK)
        {
-               bot_command_executed(TRUE);
+               bot_command_executed(true);
                return -1;
        }
 
@@ -1390,7 +1391,7 @@ float bot_execute_commands_once()
                        clientcommand(self,strcat("say ^7", bot_cmd_string[bot_cmd.bot_cmd_type]," ",parms,"\n"));
                }
 
-               bot_command_executed(TRUE);
+               bot_command_executed(true);
        }
 
        if(status == CMD_STATUS_FINISHED)
index 870a558c579d3b270f8f160376fbcecb084d7db6..23e7af3f9242061e5ffeadd5a0d0d924c569052d 100644 (file)
@@ -22,7 +22,7 @@ entity waypoint_spawn(vector m1, vector m2, float f)
        setorigin(w, (m1 + m2) * 0.5);
        setsize(w, m1 - w.origin, m2 - w.origin);
        if (vlen(w.size) > 0)
-               w.wpisbox = TRUE;
+               w.wpisbox = true;
 
        if(!w.wpisbox)
        {
@@ -177,17 +177,17 @@ void waypoint_think()
                                continue;
                        }
                        sv = e.origin;
-                       sv_x = bound(sm1_x, sv_x, sm2_x);
-                       sv_y = bound(sm1_y, sv_y, sm2_y);
-                       sv_z = bound(sm1_z, sv_z, sm2_z);
+                       sv.x = bound(sm1_x, sv.x, sm2_x);
+                       sv.y = bound(sm1_y, sv.y, sm2_y);
+                       sv.z = bound(sm1_z, sv.z, sm2_z);
                        ev = self.origin;
                        em1 = e.origin + e.mins;
                        em2 = e.origin + e.maxs;
-                       ev_x = bound(em1_x, ev_x, em2_x);
-                       ev_y = bound(em1_y, ev_y, em2_y);
-                       ev_z = bound(em1_z, ev_z, em2_z);
+                       ev.x = bound(em1_x, ev.x, em2_x);
+                       ev.y = bound(em1_y, ev.y, em2_y);
+                       ev.z = bound(em1_z, ev.z, em2_z);
                        dv = ev - sv;
-                       dv_z = 0;
+                       dv.z = 0;
                        if (vlen(dv) >= 1050) // max search distance in XY
                        {
                                ++relink_lengthculled;
@@ -196,7 +196,7 @@ void waypoint_think()
                        navigation_testtracewalk = 0;
                        if (!self.wpisbox)
                        {
-                               tracebox(sv - PL_MIN_z * '0 0 1', PL_MIN, PL_MAX, sv, FALSE, self);
+                               tracebox(sv - PL_MIN_z * '0 0 1', PL_MIN, PL_MAX, sv, false, self);
                                if (!trace_startsolid)
                                {
                                        //dprint("sv deviation", vtos(trace_endpos - sv), "\n");
@@ -205,14 +205,14 @@ void waypoint_think()
                        }
                        if (!e.wpisbox)
                        {
-                               tracebox(ev - PL_MIN_z * '0 0 1', PL_MIN, PL_MAX, ev, FALSE, e);
+                               tracebox(ev - PL_MIN_z * '0 0 1', PL_MIN, PL_MAX, ev, false, e);
                                if (!trace_startsolid)
                                {
                                        //dprint("ev deviation", vtos(trace_endpos - ev), "\n");
                                        ev = trace_endpos + '0 0 1';
                                }
                        }
-                       //traceline(self.origin, e.origin, FALSE, world);
+                       //traceline(self.origin, e.origin, false, world);
                        //if (trace_fraction == 1)
                        if (!self.wpisbox && tracewalk(self, sv, PL_MIN, PL_MAX, ev, MOVE_NOMONSTERS))
                                waypoint_addlink(self, e);
@@ -225,7 +225,7 @@ void waypoint_think()
                }
        }
        navigation_testtracewalk = 0;
-       self.wplinked = TRUE;
+       self.wplinked = true;
 }
 
 void waypoint_clearlinks(entity wp)
@@ -243,7 +243,7 @@ void waypoint_clearlinks(entity wp)
        wp.wp16mincost = wp.wp17mincost = wp.wp18mincost = wp.wp19mincost = wp.wp20mincost = wp.wp21mincost = wp.wp22mincost = wp.wp23mincost = f;
        wp.wp24mincost = wp.wp25mincost = wp.wp26mincost = wp.wp27mincost = wp.wp28mincost = wp.wp29mincost = wp.wp30mincost = wp.wp31mincost = f;
 
-       wp.wplinked = FALSE;
+       wp.wplinked = false;
 }
 
 // tell a spawnfunc_waypoint to relink
@@ -372,7 +372,7 @@ float waypoint_load_links()
                dprint("waypoint links load from ");
                dprint(filename);
                dprint(" failed\n");
-               return FALSE;
+               return false;
        }
 
        while ((s = fgets(file)))
@@ -383,7 +383,7 @@ float waypoint_load_links()
                {
                        // bad file format
                        fclose(file);
-                       return FALSE;
+                       return false;
                }
 
                wp_from_pos     = stov(argv(0));
@@ -393,13 +393,13 @@ float waypoint_load_links()
                if(!wp_from || wp_from.origin!=wp_from_pos)
                {
                        wp_from = findradius(wp_from_pos, 1);
-                       found = FALSE;
+                       found = false;
                        while(wp_from)
                        {
                                if(vlen(wp_from.origin-wp_from_pos)<1)
                                if(wp_from.classname == "waypoint")
                                {
-                                       found = TRUE;
+                                       found = true;
                                        break;
                                }
                                wp_from = wp_from.chain;
@@ -415,13 +415,13 @@ float waypoint_load_links()
 
                // Search "to" waypoint
                wp_to = findradius(wp_to_pos, 1);
-               found = FALSE;
+               found = false;
                while(wp_to)
                {
                        if(vlen(wp_to.origin-wp_to_pos)<1)
                        if(wp_to.classname == "waypoint")
                        {
-                               found = TRUE;
+                               found = true;
                                break;
                        }
                        wp_to = wp_to.chain;
@@ -445,8 +445,8 @@ float waypoint_load_links()
        dprint(mapname);
        dprint(".waypoints.cache\n");
 
-       botframe_cachedwaypointlinks = TRUE;
-       return TRUE;
+       botframe_cachedwaypointlinks = true;
+       return true;
 }
 
 void waypoint_load_links_hardwired()
@@ -459,7 +459,7 @@ void waypoint_load_links_hardwired()
        filename = strcat(filename, ".waypoints.hardwired");
        file = fopen(filename, FILE_READ);
 
-       botframe_loadedforcedlinks = TRUE;
+       botframe_loadedforcedlinks = true;
 
        if (file < 0)
        {
@@ -489,13 +489,13 @@ void waypoint_load_links_hardwired()
                if(!wp_from || wp_from.origin!=wp_from_pos)
                {
                        wp_from = findradius(wp_from_pos, 5);
-                       found = FALSE;
+                       found = false;
                        while(wp_from)
                        {
                                if(vlen(wp_from.origin-wp_from_pos)<5)
                                if(wp_from.classname == "waypoint")
                                {
-                                       found = TRUE;
+                                       found = true;
                                        break;
                                }
                                wp_from = wp_from.chain;
@@ -510,13 +510,13 @@ void waypoint_load_links_hardwired()
 
                // Search "to" waypoint
                wp_to = findradius(wp_to_pos, 5);
-               found = FALSE;
+               found = false;
                while(wp_to)
                {
                        if(vlen(wp_to.origin-wp_to_pos)<5)
                        if(wp_to.classname == "waypoint")
                        {
-                               found = TRUE;
+                               found = true;
                                break;
                        }
                        wp_to = wp_to.chain;
@@ -530,8 +530,8 @@ void waypoint_load_links_hardwired()
 
                ++c;
                waypoint_addlink(wp_from, wp_to);
-               wp_from.wphardwired = TRUE;
-               wp_to.wphardwired = TRUE;
+               wp_from.wphardwired = true;
+               wp_to.wphardwired = true;
        }
 
        fclose(file);
@@ -616,7 +616,7 @@ void waypoint_save_links()
                w = w.chain;
        }
        fclose(file);
-       botframe_cachedwaypointlinks = TRUE;
+       botframe_cachedwaypointlinks = true;
 
        print("saved ");
        print(ftos(c));
@@ -666,7 +666,7 @@ void waypoint_saveall()
                bprint(" failed\n");
        }
        waypoint_save_links();
-       botframe_loadedforcedlinks = FALSE;
+       botframe_loadedforcedlinks = false;
 }
 
 // load waypoints from file
@@ -826,10 +826,10 @@ void botframe_showwaypointlinks()
                if (!player.isbot)
                if (player.flags & FL_ONGROUND || player.waterlevel > WATERLEVEL_NONE)
                {
-                       //navigation_testtracewalk = TRUE;
-                       head = navigation_findnearestwaypoint(player, FALSE);
+                       //navigation_testtracewalk = true;
+                       head = navigation_findnearestwaypoint(player, false);
                //      print("currently selected WP is ", etos(head), "\n");
-                       //navigation_testtracewalk = FALSE;
+                       //navigation_testtracewalk = false;
                        if (head)
                        {
                                w = head     ;if (w) te_lightning2(world, w.origin, player.origin);
@@ -985,7 +985,7 @@ float botframe_autowaypoints_fix_from(entity p, float walkfromwp, entity wp, .en
 
        tmin = 0;
        tmax = 1;
-       for(;;)
+       for (;;)
        {
                if(tmax - tmin < 0.001)
                {
@@ -1061,12 +1061,12 @@ void botframe_deleteuselesswaypoints()
 {
        entity w, w1, w2;
        float i, j, k;
-       for (w = world; (w = findfloat(w, bot_pickup, TRUE)); )
+       for (w = world; (w = findfloat(w, bot_pickup, true)); )
        {
                // NOTE: this protects waypoints if they're the ONLY nearest
                // waypoint. That's the intention.
-               navigation_findnearestwaypoint(w, FALSE);  // Walk TO item.
-               navigation_findnearestwaypoint(w, TRUE);  // Walk FROM item.
+               navigation_findnearestwaypoint(w, false);  // Walk TO item.
+               navigation_findnearestwaypoint(w, true);  // Walk FROM item.
        }
        for (w = world; (w = find(w, classname, "waypoint")); )
        {
@@ -1147,8 +1147,8 @@ void botframe_autowaypoints()
                if(p.deadflag)
                        continue;
                // going back is broken, so only fix waypoints to walk TO the player
-               //botframe_autowaypoints_fix(p, FALSE, botframe_autowaypoints_lastwp0);
-               botframe_autowaypoints_fix(p, TRUE, botframe_autowaypoints_lastwp1);
+               //botframe_autowaypoints_fix(p, false, botframe_autowaypoints_lastwp0);
+               botframe_autowaypoints_fix(p, true, botframe_autowaypoints_lastwp1);
                //te_explosion(p.botframe_autowaypoints_lastwp0.origin);
        }
 
index c43b66de66724a21fd54acafec34d8a42f68ecc3..87141c4bc35a48e26efb00468edc748aaf74d620 100644 (file)
@@ -1,15 +1,17 @@
+#ifndef WAYPOINTS_H
+#define WAYPOINTS_H
 /*
  * Globals and Fields
  */
 
-const float WAYPOINTFLAG_GENERATED = 8388608;
-const float WAYPOINTFLAG_ITEM = 4194304;
-const float WAYPOINTFLAG_TELEPORT = 2097152;
-const float WAYPOINTFLAG_NORELINK = 1048576;
-const float WAYPOINTFLAG_PERSONAL = 524288;
-const float WAYPOINTFLAG_PROTECTED = 262144;  // Useless WP detection never kills these.
-const float WAYPOINTFLAG_USEFUL = 131072;  // Useless WP detection temporary flag.
-const float WAYPOINTFLAG_DEAD_END = 65536;  // Useless WP detection temporary flag.
+const int WAYPOINTFLAG_GENERATED = 8388608;
+const int WAYPOINTFLAG_ITEM = 4194304;
+const int WAYPOINTFLAG_TELEPORT = 2097152;
+const int WAYPOINTFLAG_NORELINK = 1048576;
+const int WAYPOINTFLAG_PERSONAL = 524288;
+const int WAYPOINTFLAG_PROTECTED = 262144;  // Useless WP detection never kills these.
+const int WAYPOINTFLAG_USEFUL = 131072;  // Useless WP detection temporary flag.
+const int WAYPOINTFLAG_DEAD_END = 65536;  // Useless WP detection temporary flag.
 
 // fields you can query using prvm_global server to get some statistics about waypoint linking culling
 float relink_total, relink_walkculled, relink_pvsculled, relink_lengthculled;
@@ -27,7 +29,8 @@ float botframe_cachedwaypointlinks;
 .float wp16mincost, wp17mincost, wp18mincost, wp19mincost, wp20mincost, wp21mincost, wp22mincost, wp23mincost;
 .float wp24mincost, wp25mincost, wp26mincost, wp27mincost, wp28mincost, wp29mincost, wp30mincost, wp31mincost;
 
-.float wpfire, wpcost, wpconsidered, wpisbox, wpflags, wplinked, wphardwired;
+.float wpfire, wpcost, wpconsidered, wpisbox, wplinked, wphardwired;
+.int wpflags;
 
 .vector wpnearestpoint;
 
@@ -51,6 +54,7 @@ void waypoint_saveall();
 void waypoint_spawnforitem_force(entity e, vector org);
 void waypoint_spawnforitem(entity e);
 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken);
+void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken);
 void botframe_showwaypointlinks();
 
 float waypoint_loadall();
@@ -62,3 +66,4 @@ entity waypoint_spawnpersonal(vector position);
 vector waypoint_fixorigin(vector position);
 
 void botframe_autowaypoints();
+#endif
index b6a39ee6744686ae5465f06a47ce05724cf8e3fc..2c091d56e15f19bed4cda5890861ef29fae33db2 100644 (file)
@@ -1,3 +1,10 @@
+#include "campaign.qh"
+#include "cheats.qh"
+#include "miscfunctions.qh"
+#include "g_world.qh"
+
+#include "../common/campaign_common.qh"
+
 // campaign cvars:
 //   _campaign_index: index of CURRENT map
 //   _campaign_name: name of the current campaign
@@ -7,7 +14,7 @@
 float campaign_level;
 float campaign_won;
 string campaign_index_var;
-float checkrules_equality;
+//float checkrules_equality;
 
 float CampaignBailout(string s)
 {
index 487deb9820af2fa049c42421cae4d8ad38317489..f5228c269338cd146e6c4656a45044185e59c56b 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef CAMPAIGN_H
+#define CAMPAIGN_H
+
 // this must be included BEFORE campaign_common.h to make this a memory saving
 #define CAMPAIGN_MAX_ENTRIES 2
 
@@ -13,3 +16,4 @@ void CampaignLevelWarp(float n);
 float campaign_bots_may_start;
 // campaign mode: bots shall spawn but wait for the player to spawn before they do anything
 // in other game modes, this is ignored
+#endif
index c1a637514275849c26b573a565e8fb499d9db86b..657ec4d7fd3c0e15f6477c5a56c766b5a5effcb1 100644 (file)
@@ -1,3 +1,27 @@
+#include "cheats.qh"
+#include "g_damage.qh"
+#include "race.qh"
+#include "t_teleporters.qh"
+
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../warpzonelib/anglestransform.qh"
+    #include "../warpzonelib/util_server.qh"
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "../common/monsters/monsters.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "weapons/tracing.qh"
+    #include "autocvars.qh"
+    #include "defs.qh"
+    #include "../common/deathtypes.qh"
+    #include "mutators/mutators_include.qh"
+    #include "../csqcmodellib/sv_model.qh"
+#endif
+
 void CopyBody(float keepvelocity);
 
 #ifdef NOCHEATS
@@ -16,15 +40,15 @@ void Drag_MoveDrag(entity from, entity to) { }
 .float maycheat;
 float gamestart_sv_cheats;
 
-#define CHIMPULSE_SPEEDRUN_INIT 30
-#define CHIMPULSE_GIVE_ALL 99
-#define CHIMPULSE_CLONE_MOVING 140
-#define CHIMPULSE_SPEEDRUN 141
-#define CHIMPULSE_CLONE_STANDING 142
-#define CHIMPULSE_TELEPORT 143
-#define CHIMPULSE_R00T 148
+const float CHIMPULSE_SPEEDRUN_INIT = 30;
+const float CHIMPULSE_GIVE_ALL = 99;
+const float CHIMPULSE_CLONE_MOVING = 140;
+const float CHIMPULSE_SPEEDRUN = 141;
+const float CHIMPULSE_CLONE_STANDING = 142;
+const float CHIMPULSE_TELEPORT = 143;
+const float CHIMPULSE_R00T = 148;
 
-#define CHRAME_DRAG 8
+const float CHRAME_DRAG = 8;
 
 void CheatInit()
 {
@@ -103,9 +127,9 @@ void info_autoscreenshot_findtarget()
                return;
        }
        vector a = vectoangles(e.origin - self.origin);
-       a_x = -a_x; // don't ask
-       self.angles_x = a_x;
-       self.angles_y = a_y;
+       a.x = -a.x; // don't ask
+       self.angles_x = a.x;
+       self.angles_y = a.y;
        // we leave Rick Roll alone
 }
 void spawnfunc_info_autoscreenshot()
@@ -178,7 +202,7 @@ float CheatImpulse(float i)
                        IS_CHEAT(i, 0, 0);
                        if(self.personal)
                        {
-                               self.speedrunning = TRUE;
+                               self.speedrunning = true;
                                tracebox(self.personal.origin, self.mins, self.maxs, self.personal.origin, MOVE_WORLDONLY, self);
                                if(trace_startsolid)
                                {
@@ -190,7 +214,7 @@ float CheatImpulse(float i)
                                        setorigin(self, self.personal.origin);
                                        self.oldvelocity = self.velocity = self.personal.velocity;
                                        self.angles = self.personal.v_angle;
-                                       self.fixangle = TRUE;
+                                       self.fixangle = true;
 
                                        MUTATOR_CALLHOOK(AbortSpeedrun);
                                }
@@ -232,7 +256,7 @@ float CheatImpulse(float i)
                                        self.angles = e.angles;
                                        remove(e);
                                        // should we? self.angles_x = -self.angles_x;
-                                       self.fixangle = TRUE;
+                                       self.fixangle = true;
                                        self.velocity = '0 0 0';
                                        DID_CHEAT();
                                        break;
@@ -241,8 +265,8 @@ float CheatImpulse(float i)
                        if(MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, ((gamestart_sv_cheats < 2) ? 100 : 100000), 384, 384))
                        {
                                sprint(self, "Emergency teleport used random location\n");
-                               self.angles_x = -self.angles_x;
-                               self.fixangle = TRUE;
+                               self.angles_x = -self.angles.x;
+                               self.fixangle = true;
                                self.velocity = '0 0 0';
                                DID_CHEAT();
                                break;
@@ -319,7 +343,7 @@ float CheatCommand(float argc)
                                // arguments:
                                //   effectname
                                effectnum = particleeffectnum(argv(1));
-                               W_SetupShot(self, FALSE, FALSE, "", CH_WEAPON_A, 0);
+                               W_SetupShot(self, false, false, "", CH_WEAPON_A, 0);
                                traceline(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, MOVE_NORMAL, self);
                                trailparticles(self, effectnum, w_shotorg, trace_endpos);
                                DID_CHEAT();
@@ -334,7 +358,7 @@ float CheatCommand(float argc)
                                // arguments:
                                //   modelname mode
                                f = stof(argv(2));
-                               W_SetupShot(self, FALSE, FALSE, "", CH_WEAPON_A, 0);
+                               W_SetupShot(self, false, false, "", CH_WEAPON_A, 0);
                                traceline(w_shotorg, w_shotorg + w_shotdir * 2048, MOVE_NORMAL, self);
                                if((trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) || trace_fraction == 1)
                                {
@@ -420,9 +444,9 @@ float CheatCommand(float argc)
                        e.enemy.skin = 1;
                        setsize(e.enemy, '0 0 0', '0 0 0');
                        end = normalize(self.origin + self.view_ofs - e.aiment.origin);
-                       end_x = (end_x > 0) * 2 - 1;
-                       end_y = (end_y > 0) * 2 - 1;
-                       end_z = (end_z > 0) * 2 - 1;
+                       end.x = (end.x > 0) * 2 - 1;
+                       end.y = (end.y > 0) * 2 - 1;
+                       end.z = (end.z > 0) * 2 - 1;
                        if(argc == 4)
                                setorigin(e.enemy, stov(argv(3)));
                        else
@@ -546,8 +570,8 @@ float CheatCommand(float argc)
                                {
                                        fputs(f, "{\n");
                                        fputs(f, "\"classname\" \"trigger_race_checkpoint\"\n");
-                                       fputs(f, strcat("\"origin\" \"", ftos(e.absmin_x), " ", ftos(e.absmin_y), " ", ftos(e.absmin_z), "\"\n"));
-                                       fputs(f, strcat("\"maxs\" \"", ftos(e.absmax_x - e.absmin_x), " ", ftos(e.absmax_y - e.absmin_y), " ", ftos(e.absmax_z - e.absmin_z), "\"\n"));
+                                       fputs(f, strcat("\"origin\" \"", ftos(e.absmin.x), " ", ftos(e.absmin.y), " ", ftos(e.absmin.z), "\"\n"));
+                                       fputs(f, strcat("\"maxs\" \"", ftos(e.absmax.x - e.absmin.x), " ", ftos(e.absmax.y - e.absmin.y), " ", ftos(e.absmax.z - e.absmin.z), "\"\n"));
                                        fputs(f, strcat("\"cnt\" \"", ftos(e.cnt), "\"\n"));
                                        fputs(f, strcat("\"targetname\" \"checkpoint", ftos(e.cnt), "\"\n"));
                                        fputs(f, "}\n");
@@ -568,7 +592,7 @@ float CheatCommand(float argc)
                                        fputs(f, "{\n");
                                        fputs(f, "\"classname\" \"info_player_race\"\n");
                                        fputs(f, strcat("\"angle\" \"", ftos(vectoyaw(start - e.origin)), "\"\n"));
-                                       fputs(f, strcat("\"origin\" \"", ftos(e.origin_x), " ", ftos(e.origin_y), " ", ftos(e.origin_z), "\"\n"));
+                                       fputs(f, strcat("\"origin\" \"", ftos(e.origin.x), " ", ftos(e.origin.y), " ", ftos(e.origin.z), "\"\n"));
                                        if(e.cnt == -2)
                                        {
                                                fputs(f, "\"target\" \"checkpoint0\"\n");
@@ -750,11 +774,11 @@ float CheatFrame()
                        {
                                // use cheat dragging if cheats are enabled
                                crosshair_trace_plusvisibletriggers(self);
-                               Drag(TRUE, TRUE);
+                               Drag(true, true);
                        }
                        else
                        {
-                               Drag(FALSE, FALSE); // execute dragging
+                               Drag(false, false); // execute dragging
                        }
                        break;
        }
@@ -768,13 +792,23 @@ float CheatFrame()
 
 // ENTITY DRAGGING
 
+// on dragger:
+.float draggravity;
+.float dragspeed; // speed of mouse wheel action
+.float dragdistance; // distance of dragentity's draglocalvector from view_ofs
+.vector draglocalvector; // local attachment vector of the dragentity
+.float draglocalangle;
+// on draggee:
+.entity draggedby;
+.float dragmovetype;
+
 float Drag(float force_allow_pick, float ischeat)
 {
        BEGIN_CHEAT_FUNCTION();
 
-       // returns TRUE when an entity has been picked up
-       // If pick is TRUE, the object can also be picked up if it's not being held already
-       // If pick is FALSE, only keep dragging the object if it's already being held
+       // returns true when an entity has been picked up
+       // If pick is true, the object can also be picked up if it's not being held already
+       // If pick is false, only keep dragging the object if it's already being held
 
        switch(0)
        {
@@ -820,7 +854,7 @@ float Drag(float force_allow_pick, float ischeat)
                                                float pick = force_allow_pick;
                                                if (e && !pick)
                                                {
-                                                       // pick is TRUE if the object can be picked up. While an object is being carried, the Drag() function
+                                                       // pick is true if the object can be picked up. While an object is being carried, the Drag() function
                                                        // must execute for it either way, otherwise it would cause bugs if it went out of the player's trace.
                                                        // 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.
@@ -833,14 +867,14 @@ float Drag(float force_allow_pick, float ischeat)
                                                                                break;
                                                                        case 1: // owner can grab
                                                                                if(e.owner == self || e.realowner == self)
-                                                                                       pick = TRUE;
+                                                                                       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)
-                                                                                       pick = TRUE;
+                                                                                       pick = true;
                                                                                break;
                                                                        case 3: // anyone can grab
-                                                                               pick = TRUE;
+                                                                               pick = true;
                                                                                break;
                                                                        default:
                                                                                break;
@@ -860,24 +894,15 @@ float Drag(float force_allow_pick, float ischeat)
                                                                Drag_Begin(self, e, trace_endpos);
                                                                if(ischeat)
                                                                        DID_CHEAT();
-                                                               return TRUE;
+                                                               return true;
                                                        }
                                        }
                        }
                        break;
        }
-       return FALSE;
+       return false;
 }
 
-// on dragger:
-.float draggravity;
-.float dragspeed; // speed of mouse wheel action
-.float dragdistance; // distance of dragentity's draglocalvector from view_ofs
-.vector draglocalvector; // local attachment vector of the dragentity
-.float draglocalangle;
-// on draggee:
-.entity draggedby;
-.float dragmovetype;
 void Drag_Begin(entity dragger, entity draggee, vector touchpoint)
 {
        float tagscale;
@@ -892,7 +917,7 @@ void Drag_Begin(entity dragger, entity draggee, vector touchpoint)
        dragger.dragentity = draggee;
 
        dragger.dragdistance = vlen(touchpoint - dragger.origin - dragger.view_ofs);
-       dragger.draglocalangle = draggee.angles_y - dragger.v_angle_y;
+       dragger.draglocalangle = draggee.angles.y - dragger.v_angle.y;
        touchpoint = touchpoint - gettaginfo(draggee, 0);
        tagscale = pow(vlen(v_forward), -2);
        dragger.draglocalvector_x = touchpoint * v_forward * tagscale;
@@ -938,35 +963,35 @@ float Drag_IsDraggable(entity draggee)
 {
        // TODO add more checks for bad stuff here
        if(draggee == world)
-               return FALSE;
+               return false;
        if(draggee.classname == "func_bobbing")
-               return FALSE;
+               return false;
        if(draggee.classname == "door") // FIXME find out why these must be excluded, or work around the problem (trying to drag these causes like 4 fps)
-               return FALSE;
+               return false;
        if(draggee.classname == "plat")
-               return FALSE;
+               return false;
        if(draggee.classname == "func_button")
-               return FALSE;
+               return false;
 //     if(draggee.model == "")
-//             return FALSE;
+//             return false;
        if(IS_SPEC(draggee))
-               return FALSE;
+               return false;
        if(IS_OBSERVER(draggee))
-               return FALSE;
+               return false;
        if(draggee.classname == "exteriorweaponentity")
-               return FALSE;
+               return false;
        if(draggee.classname == "weaponentity")
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 float Drag_MayChangeAngles(entity draggee)
 {
        // TODO add more checks for bad stuff here
        if(substring(draggee.model, 0, 1) == "*")
-               return FALSE;
-       return TRUE;
+               return false;
+       return true;
 }
 
 void Drag_MoveForward(entity dragger)
@@ -994,21 +1019,21 @@ void Drag_Update(entity dragger)
        draggee.flags &= ~FL_ONGROUND;
 
        curorigin = gettaginfo(draggee, 0);
-       curorigin = curorigin + v_forward * dragger.draglocalvector_x + v_right * dragger.draglocalvector_y + v_up * dragger.draglocalvector_z;
+       curorigin = curorigin + v_forward * dragger.draglocalvector.x + v_right * dragger.draglocalvector.y + v_up * dragger.draglocalvector.z;
        makevectors(dragger.v_angle);
        neworigin = dragger.origin + dragger.view_ofs + v_forward * dragger.dragdistance;
        goodvelocity = (neworigin - curorigin) * (1 / frametime);
 
-       while(draggee.angles_y - dragger.v_angle_y - dragger.draglocalangle > 180)
+       while(draggee.angles.y - dragger.v_angle.y - dragger.draglocalangle > 180)
                dragger.draglocalangle += 360;
-       while(draggee.angles_y - dragger.v_angle_y - dragger.draglocalangle <= -180)
+       while(draggee.angles.y - dragger.v_angle.y - dragger.draglocalangle <= -180)
                dragger.draglocalangle -= 360;
 
        f = min(frametime * 10, 1);
        draggee.velocity = draggee.velocity * (1 - f) + goodvelocity * f;
 
        if(Drag_MayChangeAngles(draggee))
-               draggee.angles_y = draggee.angles_y * (1 - f) + (dragger.v_angle_y + dragger.draglocalangle) * f;
+               draggee.angles_y = draggee.angles.y * (1 - f) + (dragger.v_angle.y + dragger.draglocalangle) * f;
 
        draggee.ltime = max(servertime + serverframetime, draggee.ltime); // fixes func_train breakage
 
@@ -1023,18 +1048,18 @@ float Drag_CanDrag(entity dragger)
 float Drag_IsDragging(entity dragger)
 {
        if(!dragger.dragentity)
-               return FALSE;
+               return false;
        if(wasfreed(dragger.dragentity) || dragger.dragentity.draggedby != dragger)
        {
                dragger.dragentity = world;
-               return FALSE;
+               return false;
        }
        if(!Drag_CanDrag(dragger) || !Drag_IsDraggable(dragger.dragentity))
        {
                Drag_Finish(dragger);
-               return FALSE;
+               return false;
        }
-       return TRUE;
+       return true;
 }
 
 void Drag_MoveDrag(entity from, entity to)
@@ -1051,12 +1076,12 @@ void DragBox_Think()
 {
        if(self.aiment && self.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.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
        }
index 8c276919c51082206169b6050dd44335d7d1fc84..625a304bd51f99ce3539942cd58d5a47f3c4aff3 100644 (file)
@@ -1,4 +1,7 @@
-float autocvar_sv_cheats; // must... declare... global
+#ifndef CHEATS_H
+#define CHEATS_H
+
+//float autocvar_sv_cheats; // must... declare... global
 
 float cheatcount_total;
 .float cheatcount;
@@ -11,3 +14,4 @@ float CheatCommand(float argc);
 float CheatFrame();
 
 void Drag_MoveDrag(entity from, entity to); // call this from CopyBody
+#endif
index 03ab777b941c151ce93fe5cccc92e87cd1d9248e..3bc5cc762f231b2e92f8df7dfdfe4b05e9d55bb1 100644 (file)
@@ -1,14 +1,41 @@
+#include "waypointsprites.qh"
+
+#include "cl_impulse.qh"
+#include "cl_player.qh"
+#include "ent_cs.qh"
+#include "g_subs.qh"
+#include "ipban.qh"
+#include "miscfunctions.qh"
+#include "portals.qh"
+#include "teamplay.qh"
+#include "playerdemo.qh"
+#include "secret.qh"
+
+#include "bot/bot.qh"
+#include "bot/navigation.qh"
+
+#include "weapons/hitplot.qh"
+#include "weapons/weaponsystem.qh"
+
+#include "../common/net_notice.qh"
+
+#include "../common/monsters/sv_monsters.qh"
+
+#include "../warpzonelib/server.qh"
+
+float c1, c2, c3, c4;
+
 void send_CSQC_teamnagger() {
        WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
        WriteByte(MSG_BROADCAST, TE_CSQC_TEAMNAGGER);
 }
 
-float ClientData_Send(entity to, float sf)
+float ClientData_Send(entity to, int sf)
 {
        if(to != self.owner)
        {
                error("wtf");
-               return FALSE;
+               return false;
        }
 
        entity e;
@@ -36,16 +63,16 @@ float ClientData_Send(entity to, float sf)
 
        if(sf & 8)
        {
-               WriteAngle(MSG_ENTITY, e.v_angle_x);
-               WriteAngle(MSG_ENTITY, e.v_angle_y);
+               WriteAngle(MSG_ENTITY, e.v_angle.x);
+               WriteAngle(MSG_ENTITY, e.v_angle.y);
        }
 
-       return TRUE;
+       return true;
 }
 
 void ClientData_Attach()
 {
-       Net_LinkEntity(self.clientdata = spawn(), FALSE, 0, ClientData_Send);
+       Net_LinkEntity(self.clientdata = spawn(), false, 0, ClientData_Send);
        self.clientdata.drawonlytoclient = self;
        self.clientdata.owner = self;
 }
@@ -142,7 +169,7 @@ void PutObserverInServer (void)
 
        if(IS_PLAYER(self)) { pointparticles(particleeffectnum("spawn_event_neutral"), self.origin, '0 0 0', 1); }
 
-       spot = SelectSpawnPoint (TRUE);
+       spot = SelectSpawnPoint (true);
        if(!spot)
                error("No spawnpoints for observers?!?\n");
        RemoveGrapplingHook(self); // Wazat's Grappling Hook
@@ -183,10 +210,10 @@ void PutObserverInServer (void)
                if(autocvar_g_chat_nospectators == 1 || (cvar("g_warmup") && !(warmup_stage || gameover) && autocvar_g_chat_nospectators == 2))
                        Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_CHAT_NOSPECTATORS);
 
-               if(self.just_joined == FALSE) {
+               if(self.just_joined == false) {
                        LogTeamchange(self.playerid, -1, 4);
                } else
-                       self.just_joined = FALSE;
+                       self.just_joined = false;
        }
 
        PlayerScore_Clear(self); // clear scores when needed
@@ -196,9 +223,9 @@ void PutObserverInServer (void)
        self.spectatortime = time;
 
        self.classname = "observer";
-       self.iscreature = FALSE;
+       self.iscreature = false;
        self.teleportable = TELEPORT_SIMPLE;
-       self.damagedbycontents = FALSE;
+       self.damagedbycontents = false;
        self.health = -666;
        self.takedamage = DAMAGE_NO;
        self.solid = SOLID_NOT;
@@ -231,8 +258,8 @@ void PutObserverInServer (void)
        self.deadflag = DEAD_NO;
        self.angles = spot.angles;
        self.angles_z = 0;
-       self.fixangle = TRUE;
-       self.crouch = FALSE;
+       self.fixangle = true;
+       self.crouch = false;
        self.revival_time = 0;
 
        setorigin (self, (spot.origin + PL_VIEW_OFS)); // offset it so that the spectator spawns higher off the ground, looks better this way
@@ -272,7 +299,7 @@ void FixPlayermodel()
 
        defaultmodel = "";
        defaultskin = 0;
-       chmdl = FALSE;
+       chmdl = false;
 
        if(autocvar_sv_defaultcharacter == 1)
        {
@@ -319,7 +346,7 @@ void FixPlayermodel()
                        m2 = self.maxs;
                        setplayermodel (self, defaultmodel);
                        setsize (self, m1, m2);
-                       chmdl = TRUE;
+                       chmdl = true;
                }
 
                oldskin = self.skin;
@@ -332,7 +359,7 @@ void FixPlayermodel()
                        m2 = self.maxs;
                        setplayermodel (self, self.playermodel);
                        setsize (self, m1, m2);
-                       chmdl = TRUE;
+                       chmdl = true;
                }
 
                oldskin = self.skin;
@@ -387,9 +414,9 @@ void PutClientInServer (void)
                accuracy_resend(self);
 
                if(self.team < 0)
-                       JoinBestTeam(self, FALSE, TRUE);
+                       JoinBestTeam(self, false, true);
 
-               spot = SelectSpawnPoint (FALSE);
+               spot = SelectSpawnPoint (false);
                if(!spot)
                {
                        Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_JOIN_NOSPAWNS);
@@ -402,10 +429,10 @@ void PutClientInServer (void)
                        vehicles_exit(VHEF_RELESE);
 
                self.classname = "player";
-               self.wasplayer = TRUE;
-               self.iscreature = TRUE;
+               self.wasplayer = true;
+               self.iscreature = true;
                self.teleportable = TELEPORT_NORMAL;
-               self.damagedbycontents = TRUE;
+               self.damagedbycontents = true;
                self.movetype = MOVETYPE_WALK;
                self.solid = SOLID_SLIDEBOX;
                self.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
@@ -512,7 +539,7 @@ void PutClientInServer (void)
                self.angles_z = 0; // never spawn tilted even if the spot says to
                if(IS_BOT_CLIENT(self))
                        self.v_angle = self.angles;
-               self.fixangle = TRUE; // turn this way immediately
+               self.fixangle = true; // turn this way immediately
                self.velocity = '0 0 0';
                self.avelocity = '0 0 0';
                self.punchangle = '0 0 0';
@@ -523,7 +550,7 @@ void PutClientInServer (void)
 
                entity spawnevent = spawn();
                spawnevent.owner = self;
-               Net_LinkEntity(spawnevent, FALSE, 0.5, SpawnEvent_Send);
+               Net_LinkEntity(spawnevent, false, 0.5, SpawnEvent_Send);
 
                // Cut off any still running player sounds.
                stopsound(self, CH_PLAYER_SINGLE);
@@ -532,11 +559,11 @@ void PutClientInServer (void)
                FixPlayermodel();
                self.drawonlytoclient = world;
 
-               self.crouch = FALSE;
+               self.crouch = false;
                self.view_ofs = PL_VIEW_OFS;
                setsize (self, PL_MIN, PL_MAX);
                self.spawnorigin = spot.origin;
-               setorigin (self, spot.origin + '0 0 1' * (1 - self.mins_z - 24));
+               setorigin (self, spot.origin + '0 0 1' * (1 - self.mins.z - 24));
                // don't reset back to last position, even if new position is stuck in solid
                self.oldorigin = self.origin;
                self.prevorigin = self.origin;
@@ -546,9 +573,9 @@ void PutClientInServer (void)
 
                self.event_damage = PlayerDamage;
 
-               self.bot_attack = TRUE;
-               self.monster_attack = TRUE;
-               
+               self.bot_attack = true;
+               self.monster_attack = true;
+
                self.spider_slowness = 0;
 
                self.BUTTON_ATCK = self.BUTTON_JUMP = self.BUTTON_ATCK2 = 0;
@@ -563,7 +590,7 @@ void PutClientInServer (void)
                self.colormod = '1 1 1' * autocvar_g_player_brightness;
                self.exteriorweaponentity.alpha = default_weapon_alpha;
 
-               self.speedrunning = FALSE;
+               self.speedrunning = false;
 
                //stuffcmd(self, "chase_active 0");
                //stuffcmd(self, "set viewsize $tmpviewsize \n");
@@ -576,8 +603,7 @@ void PutClientInServer (void)
                        WEP_ACTION(j, WR_RESETPLAYER);
 
                        // all weapons must be fully loaded when we spawn
-                       entity e;
-                       e = get_weaponinfo(j);
+                       entity e = get_weaponinfo(j);
                        if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
                                self.(weapon_load[j]) = e.reloading_ammo;
                }
@@ -654,7 +680,7 @@ float ClientInit_SendEntity(entity to, float sf)
        WriteByte(MSG_ENTITY, WEP_CVAR_SEC(hagar, load_max)); // hagar max loadable rockets // WEAPONTODO
        WriteCoord(MSG_ENTITY, autocvar_g_trueaim_minrange);
        WriteByte(MSG_ENTITY, WEP_CVAR(porto, secondary)); // WEAPONTODO
-       return TRUE;
+       return true;
 }
 
 void ClientInit_CheckUpdate()
@@ -694,7 +720,7 @@ void ClientInit_Spawn()
        e = spawn();
        e.classname = "clientinit";
        e.think = ClientInit_CheckUpdate;
-       Net_LinkEntity(e, FALSE, 0, ClientInit_SendEntity);
+       Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
 
        o = self;
        self = e;
@@ -753,7 +779,7 @@ void ClientKill_Now_TeamChange()
 {
        if(self.killindicator_teamchange == -1)
        {
-               JoinBestTeam( self, FALSE, TRUE );
+               JoinBestTeam( self, false, true );
        }
        else if(self.killindicator_teamchange == -2)
        {
@@ -974,7 +1000,7 @@ float PlayerInIDList(entity p, string idlist)
        float n, i;
        string s;
 
-       // NOTE: we do NOT check crypto_keyfp here, an unsigned ID is fine too for this
+       // NOTE: we do NOT check crypto_idfp_signed here, an unsigned ID is fine too for this
        if (!p.crypto_idfp)
                return 0;
 
@@ -990,6 +1016,27 @@ float PlayerInIDList(entity p, string idlist)
        return 0;
 }
 
+#ifdef DP_EXT_PRECONNECT
+/*
+=============
+ClientPreConnect
+
+Called once (not at each match start) when a client begins a connection to the server
+=============
+*/
+void ClientPreConnect (void)
+{
+       if(autocvar_sv_eventlog)
+       {
+               GameLogEcho(sprintf(":connect:%d:%d:%s",
+                       self.playerid,
+                       num_for_edict(self),
+                       ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot")
+               ));
+       }
+}
+#endif
+
 /*
 =============
 ClientConnect
@@ -1084,7 +1131,7 @@ void ClientConnect (void)
                if(self.team_forced > 0)
                        self.team_forced = 0;
 
-       JoinBestTeam(self, FALSE, FALSE); // if the team number is valid, keep it
+       JoinBestTeam(self, false, false); // if the team number is valid, keep it
 
        if((autocvar_sv_spectate == 1) || autocvar_g_campaign || self.team_forced < 0) {
                self.classname = "observer";
@@ -1120,7 +1167,7 @@ void ClientConnect (void)
 
        LogTeamchange(self.playerid, self.team, 1);
 
-       self.just_joined = TRUE;  // stop spamming the eventlog with additional lines when the client connects
+       self.just_joined = true;  // stop spamming the eventlog with additional lines when the client connects
 
        self.netname_previous = strzone(self.netname);
 
@@ -1202,6 +1249,13 @@ void ClientConnect (void)
        if(IS_REAL_CLIENT(self))
                sv_notice_join();
 
+       for (entity e = world; (e = findfloat(e, init_for_player_needed, 1)); ) {
+               entity oldself = self;
+               self = e;
+               e.init_for_player(oldself);
+               self = oldself;
+       }
+
        MUTATOR_CALLHOOK(ClientConnect);
 }
 /*
@@ -1327,7 +1381,7 @@ void UpdateChatBubble()
                self.chatbubbleentity.nextthink = time;
                setmodel(self.chatbubbleentity, "models/misc/chatbubble.spr"); // 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');
+               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 = "";
@@ -1607,12 +1661,12 @@ void SetZoomState(float z)
 
 void GetPressedKeys(void) {
        MUTATOR_CALLHOOK(GetPressedKeys);
-       if (self.movement_x > 0) // get if movement keys are pressed
+       if (self.movement.x > 0) // get if movement keys are pressed
        {       // forward key pressed
                self.pressedkeys |= KEY_FORWARD;
                self.pressedkeys &= ~KEY_BACKWARD;
        }
-       else if (self.movement_x < 0)
+       else if (self.movement.x < 0)
        {       // backward key pressed
                self.pressedkeys |= KEY_BACKWARD;
                self.pressedkeys &= ~KEY_FORWARD;
@@ -1623,12 +1677,12 @@ void GetPressedKeys(void) {
                self.pressedkeys &= ~KEY_BACKWARD;
        }
 
-       if (self.movement_y > 0)
+       if (self.movement.y > 0)
        {       // right key pressed
                self.pressedkeys |= KEY_RIGHT;
                self.pressedkeys &= ~KEY_LEFT;
        }
-       else if (self.movement_y < 0)
+       else if (self.movement.y < 0)
        {       // left key pressed
                self.pressedkeys |= KEY_LEFT;
                self.pressedkeys &= ~KEY_RIGHT;
@@ -1707,7 +1761,7 @@ void SpectateCopy(entity spectatee) {
        self.frozen = spectatee.frozen;
        self.revive_progress = spectatee.revive_progress;
        if(!self.BUTTON_USE)
-               self.fixangle = TRUE;
+               self.fixangle = true;
        setorigin(self, spectatee.origin);
        setsize(self, spectatee.mins, spectatee.maxs);
        SetZoomState(spectatee.zoomstate);
@@ -1716,7 +1770,7 @@ void SpectateCopy(entity spectatee) {
        self.hud = spectatee.hud;
        if(spectatee.vehicle)
     {
-        self.fixangle = FALSE;
+        self.fixangle = false;
         //self.velocity = spectatee.vehicle.velocity;
         self.vehicle_health = spectatee.vehicle_health;
         self.vehicle_shield = spectatee.vehicle_shield;
@@ -1729,9 +1783,9 @@ void SpectateCopy(entity spectatee) {
         msg_entity = self;
 
         WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
-            WriteAngle(MSG_ONE,  spectatee.v_angle_x);
-            WriteAngle(MSG_ONE,  spectatee.v_angle_y);
-            WriteAngle(MSG_ONE,  spectatee.v_angle_z);
+            WriteAngle(MSG_ONE,  spectatee.v_angle.x);
+            WriteAngle(MSG_ONE,  spectatee.v_angle.y);
+            WriteAngle(MSG_ONE,  spectatee.v_angle.z);
 
         //WriteByte (MSG_ONE, SVC_SETVIEW);
         //    WriteEntity(MSG_ONE, self);
@@ -1759,7 +1813,7 @@ float SpectateUpdate()
 float SpectateSet()
 {
        if(self.enemy.classname != "player")
-               return FALSE;
+               return false;
        /*if(self.enemy.vehicle)
        {
 
@@ -1783,7 +1837,7 @@ float SpectateSet()
                if(!SpectateUpdate())
                        PutObserverInServer();
        //}
-       return TRUE;
+       return true;
 }
 
 void SetSpectator(entity player, entity spectatee)
@@ -1854,7 +1908,7 @@ float SpectatePrev()
        // NOTE: chain order is from the highest to the lower entnum (unlike find)
        other = findchain(classname, "player");
        if (!other) // no player
-               return FALSE;
+               return false;
 
        entity first = other;
        // skip players until current spectated player
@@ -1873,7 +1927,7 @@ float SpectatePrev()
                        while(other.team != self.team)
                                other = other.chain;
                        if(other == self.enemy)
-                               return TRUE;
+                               return true;
                }
        }
        else
@@ -1925,7 +1979,7 @@ void LeaveSpectatorMode()
                        nades_RemoveBonus(self);
 
                        if(autocvar_g_campaign || autocvar_g_balance_teams)
-                               { JoinBestTeam(self, FALSE, TRUE); }
+                               { JoinBestTeam(self, false, true); }
 
                        if(autocvar_g_campaign)
                                { campaign_bots_may_start = 1; }
@@ -1948,7 +2002,7 @@ void LeaveSpectatorMode()
 
 /**
  * Determines whether the player is allowed to join. This depends on cvar
- * g_maxplayers, if it isn't used this function always return TRUE, otherwise
+ * g_maxplayers, if it isn't used this function always return true, otherwise
  * it checks whether the number of currently playing players exceeds g_maxplayers.
  * @return int number of free slots for players, 0 if none
  */
@@ -2159,16 +2213,16 @@ float isInvisibleString(string s)
                        case 192: // charmap space
                                if (!autocvar_utf8_enable)
                                        break;
-                               return FALSE;
+                               return false;
                        case 160: // space in unicode fonts
                        case 0xE000 + 192: // utf8 charmap space
                                if (autocvar_utf8_enable)
                                        break;
                        default:
-                               return FALSE;
+                               return false;
                }
        }
-       return TRUE;
+       return true;
 }
 
 /*
@@ -2180,7 +2234,7 @@ Called every frame for each client before the physics are run
 */
 .float usekeypressed;
 void() nexball_setstatus;
-.float items_added;
+.int items_added;
 void PlayerPreThink (void)
 {
        WarpZone_PlayerPhysics_FixVAngle();
@@ -2280,7 +2334,7 @@ void PlayerPreThink (void)
        {
                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 );
-               
+
                if(self.health < 1)
                {
                        if(self.vehicle)
@@ -2319,7 +2373,7 @@ void PlayerPreThink (void)
                        // FIXME turn this into CSQC stuff
                        self.v_angle = self.lastV_angle;
                        self.angles = self.lastV_angle;
-                       self.fixangle = TRUE;
+                       self.fixangle = true;
                }
 
                if(frametime)
@@ -2332,13 +2386,13 @@ void PlayerPreThink (void)
 
                                if(self.vortex_charge > WEP_CVAR(vortex, charge_animlimit))
                                {
-                                       self.weaponentity_glowmod_x = self.weaponentity_glowmod_x + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit));
-                                       self.weaponentity_glowmod_y = self.weaponentity_glowmod_y + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit));
-                                       self.weaponentity_glowmod_z = self.weaponentity_glowmod_z + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit));
+                                       self.weaponentity_glowmod_x = self.weaponentity_glowmod.x + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit));
+                                       self.weaponentity_glowmod_y = self.weaponentity_glowmod.y + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit));
+                                       self.weaponentity_glowmod_z = self.weaponentity_glowmod.z + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (self.vortex_charge - WEP_CVAR(vortex, charge_animlimit)) / (1 - WEP_CVAR(vortex, charge_animlimit));
                                }
                        }
                        else
-                               self.weaponentity_glowmod = colormapPaletteColor(self.clientcolors & 0x0F, TRUE) * 2;
+                               self.weaponentity_glowmod = colormapPaletteColor(self.clientcolors & 0x0F, true) * 2;
 
                        player_powerups();
                }
@@ -2419,7 +2473,7 @@ void PlayerPreThink (void)
                        do_crouch = 0;
 
                // WEAPONTODO: THIS SHIT NEEDS TO GO EVENTUALLY
-               // It cannot be predicted by the engine! 
+               // It cannot be predicted by the engine!
                if((self.weapon == WEP_SHOCKWAVE || self.weapon == WEP_SHOTGUN) && self.weaponentity.wframe == WFRAME_FIRE2 && time < self.weapon_nextthink)
                        do_crouch = 0;
 
@@ -2427,20 +2481,20 @@ void PlayerPreThink (void)
                {
                        if (!self.crouch)
                        {
-                               self.crouch = TRUE;
+                               self.crouch = true;
                                self.view_ofs = PL_CROUCH_VIEW_OFS;
                                setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX);
-                               // setanim(self, self.anim_duck, FALSE, TRUE, TRUE); // this anim is BROKEN anyway
+                               // setanim(self, self.anim_duck, false, true, true); // this anim is BROKEN anyway
                        }
                }
                else
                {
                        if (self.crouch)
                        {
-                               tracebox(self.origin, PL_MIN, PL_MAX, self.origin, FALSE, self);
+                               tracebox(self.origin, PL_MIN, PL_MAX, self.origin, false, self);
                                if (!trace_startsolid)
                                {
-                                       self.crouch = FALSE;
+                                       self.crouch = false;
                                        self.view_ofs = PL_VIEW_OFS;
                                        setsize (self, PL_MIN, PL_MAX);
                                }
@@ -2468,7 +2522,7 @@ void PlayerPreThink (void)
 
                player_regen();
 
-               // WEAPONTODO: Add a weapon request for this 
+               // 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);
index 7446b7022a229c2c46589d7cfc9c1d92423a05c2..2cc8e0215bb8c1b1f0be9620c2b484326f4acde0 100644 (file)
@@ -1,3 +1,11 @@
+#include "round_handler.qh"
+
+#include "bot/waypoints.qh"
+
+#include "weapons/throwing.qh"
+
+#include "../common/weapons/weapons.qh"
+
 /*
  * Impulse map:
  *
@@ -35,7 +43,7 @@
 
 void ImpulseCommands (void)
 {
-       float imp;
+       int imp;
        vector org;
        float i;
        float m;
@@ -99,7 +107,7 @@ void ImpulseCommands (void)
                                        W_PreviousWeapon(2);
                                        break;
                                case 17:
-                                       W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750, FALSE), '0 0 0', TRUE);
+                                       W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750, false), '0 0 0', true);
                                        break;
                                case 18:
                                        W_NextWeapon(1);
@@ -171,7 +179,7 @@ void ImpulseCommands (void)
                                {
                                        if (!MUTATOR_CALLHOOK(HelpMePing))
                                        {
-                                               wp = WaypointSprite_Attach("helpme", TRUE, RADARICON_HELPME, '1 0.5 0');
+                                               wp = WaypointSprite_Attach("helpme", true, RADARICON_HELPME, '1 0.5 0');
                                                if(!wp)
                                                        WaypointSprite_HelpMePing(self.waypointsprite_attachedforcarrier);
                                                else
@@ -181,14 +189,14 @@ void ImpulseCommands (void)
                                }
                                break;
                        case 34:
-                               wp = WaypointSprite_DeployFixed("here", FALSE, self.origin, RADARICON_HERE, '0 1 0');
+                               wp = WaypointSprite_DeployFixed("here", false, self.origin, RADARICON_HERE, '0 1 0');
                                if(wp)
                                        WaypointSprite_Ping(wp);
                                sprint(self, "HERE spawned at location\n");
                                break;
                        case 35:
                                WarpZone_crosshair_trace(self);
-                               wp = WaypointSprite_DeployFixed("here", FALSE, trace_endpos, RADARICON_HERE, '0 1 0');
+                               wp = WaypointSprite_DeployFixed("here", false, trace_endpos, RADARICON_HERE, '0 1 0');
                                if(wp)
                                        WaypointSprite_Ping(wp);
                                sprint(self, "HERE spawned at crosshair\n");
@@ -196,21 +204,21 @@ void ImpulseCommands (void)
                        case 36:
                                if(vlen(self.death_origin))
                                {
-                                       wp = WaypointSprite_DeployFixed("here", FALSE, self.death_origin, RADARICON_HERE, '0 1 0');
+                                       wp = WaypointSprite_DeployFixed("here", false, self.death_origin, RADARICON_HERE, '0 1 0');
                                        if(wp)
                                                WaypointSprite_Ping(wp);
                                        sprint(self, "HERE spawned at death location\n");
                                }
                                break;
                        case 37:
-                               wp = WaypointSprite_DeployFixed("danger", FALSE, self.origin, RADARICON_DANGER, '1 0.5 0');
+                               wp = WaypointSprite_DeployFixed("danger", false, self.origin, RADARICON_DANGER, '1 0.5 0');
                                if(wp)
                                        WaypointSprite_Ping(wp);
                                sprint(self, "DANGER spawned at location\n");
                                break;
                        case 38:
                                WarpZone_crosshair_trace(self);
-                               wp = WaypointSprite_DeployFixed("danger", FALSE, trace_endpos, RADARICON_DANGER, '1 0.5 0');
+                               wp = WaypointSprite_DeployFixed("danger", false, trace_endpos, RADARICON_DANGER, '1 0.5 0');
                                if(wp)
                                        WaypointSprite_Ping(wp);
                                sprint(self, "DANGER spawned at crosshair\n");
@@ -218,7 +226,7 @@ void ImpulseCommands (void)
                        case 39:
                                if(vlen(self.death_origin))
                                {
-                                       wp = WaypointSprite_DeployFixed("danger", FALSE, self.death_origin, RADARICON_DANGER, '1 0.5 0');
+                                       wp = WaypointSprite_DeployFixed("danger", false, self.death_origin, RADARICON_DANGER, '1 0.5 0');
                                        if(wp)
                                                WaypointSprite_Ping(wp);
                                        sprint(self, "DANGER spawned at death location\n");
@@ -255,7 +263,7 @@ void ImpulseCommands (void)
                                        bprint(strcat("Waypoint spawned at ",vtos(self.origin),"\n"));
                                        break;
                                case 104:
-                                       e = navigation_findnearestwaypoint(self, FALSE);
+                                       e = navigation_findnearestwaypoint(self, false);
                                        if (e)
                                        if (!(e.wpflags & WAYPOINTFLAG_GENERATED))
                                        {
@@ -275,7 +283,7 @@ void ImpulseCommands (void)
                                                e.colormod = '0.5 0.5 0.5';
                                                e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
                                        }
-                                       e2 = navigation_findnearestwaypoint(self, FALSE);
+                                       e2 = navigation_findnearestwaypoint(self, false);
                                        navigation_markroutes(e2);
                                        i = 0;
                                        m = 0;
@@ -316,7 +324,7 @@ void ImpulseCommands (void)
                                                org = e.origin;
                                                tracebox(e.origin, PL_MIN, PL_MAX, e.origin - '0 0 512', MOVE_NOMONSTERS, world);
                                                setorigin(e, trace_endpos);
-                                               if(navigation_findnearestwaypoint(e, FALSE))
+                                               if(navigation_findnearestwaypoint(e, false))
                                                {
                                                        setorigin(e, org);
                                                        e.effects &= ~EF_NODEPTHTEST;
@@ -347,7 +355,7 @@ void ImpulseCommands (void)
                                        }
                                        for(e = start; e; e = e.chain)
                                        {
-                                               if(navigation_findnearestwaypoint(e, FALSE))
+                                               if(navigation_findnearestwaypoint(e, false))
                                                {
                                                }
                                                else
@@ -364,7 +372,7 @@ void ImpulseCommands (void)
                                        for(e = start; e; e = e.chain)
                                        {
                                                org = e.origin;
-                                               if(navigation_findnearestwaypoint(e, TRUE))
+                                               if(navigation_findnearestwaypoint(e, true))
                                                {
                                                }
                                                else
diff --git a/qcsrc/server/cl_impulse.qh b/qcsrc/server/cl_impulse.qh
new file mode 100644 (file)
index 0000000..ced8119
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef CL_IMPULSE_H
+#define CL_IMPULSE_H
+
+/*
+ * Impulse map:
+ *
+ * 0 reserved (no input)
+ * 1 to 9, 14: weapon shortcuts
+ * 10: next weapon according to linear list
+ * 11: most recently used weapon
+ * 12: previous weapon according to linear list
+ * 13: best weapon according to priority list
+ * 15: next weapon according to priority list
+ * 16: previous weapon according to priority list
+ * 17: throw weapon
+ * 18: next weapon according to sbar_hudselector 1 list
+ * 19: previous weapon according to sbar_hudselector 1 list
+ * 20: reload if needed
+ *
+ * 30 to 39: create waypoints
+ * 47: clear personal waypoints
+ * 48: clear team waypoints
+ *
+ * 99: loaded
+ *
+ * 140: moving clone
+ * 141: ctf speedrun
+ * 142: fixed clone
+ * 143: emergency teleport
+ * 148: unfairly eliminate
+ *
+ * TODO:
+ * 200 to 209: prev weapon shortcuts
+ * 210 to 219: best weapon shortcuts
+ * 220 to 229: next weapon shortcuts
+ * 230 to 253: individual weapons (up to 24)
+ */
+
+void ImpulseCommands (void);
+#endif
index bf555d4fcd173d4fa245f1635d7c610594c7d45e..337342333c0b0230b6d2362d5c1a4119b79d350a 100644 (file)
@@ -1,3 +1,29 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../warpzonelib/mathlib.qh"
+    #include "../warpzonelib/server.qh"
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "../common/animdecide.qh"
+    #include "../common/monsters/sv_monsters.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "t_items.qh"
+    #include "autocvars.qh"
+    #include "defs.qh"
+    #include "../common/notifications.qh"
+    #include "mutators/mutators_include.qh"
+    #include "../common/mapinfo.qh"
+    #include "../csqcmodellib/sv_model.qh"
+    #include "anticheat.qh"
+    #include "cheats.qh"
+    #include "g_hook.qh"
+    #include "race.qh"
+    #include "playerdemo.qh"
+#endif
+
 .float race_penalty;
 .float restart_jump;
 
@@ -5,7 +31,7 @@
 .entity ladder_entity;
 .float gravity;
 .float swamp_slowdown;
-.float lastflags;
+.int lastflags;
 .float lastground;
 .float wasFlying;
 .float spectatorspeed;
 PlayerJump
 
 When you press the jump key
-returns TRUE if handled
+returns true if handled
 =============
 */
 float PlayerJump (void)
 {
        if(self.frozen)
-               return TRUE; // no jumping in freezetag when frozen
+               return true; // no jumping in freezetag when frozen
 
        if(self.player_blocked)
-               return TRUE; // no jumping while blocked
+               return true; // no jumping while blocked
 
-       float doublejump = FALSE;
+       float doublejump = false;
        float mjumpheight = autocvar_sv_jumpvelocity;
 
        player_multijump = doublejump;
        player_jumpheight = mjumpheight;
        if(MUTATOR_CALLHOOK(PlayerJump))
-               return TRUE;
+               return true;
 
        doublejump = player_multijump;
        mjumpheight = player_jumpheight;
@@ -40,9 +66,9 @@ float PlayerJump (void)
        if (autocvar_sv_doublejump)
        {
                tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
-               if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
+               if (trace_fraction < 1 && trace_plane_normal.z > 0.7)
                {
-                       doublejump = TRUE;
+                       doublejump = true;
 
                        // we MUST clip velocity here!
                        float f;
@@ -55,7 +81,7 @@ float PlayerJump (void)
        if (self.waterlevel >= WATERLEVEL_SWIMMING)
        {
                self.velocity_z = self.stat_sv_maxspeed * 0.7;
-               return TRUE;
+               return true;
        }
 
        if (!doublejump)
@@ -64,7 +90,7 @@ float PlayerJump (void)
 
        if(self.cvar_cl_movement_track_canjump)
                if (!(self.flags & FL_JUMPRELEASED))
-                       return TRUE;
+                       return true;
 
        // sv_jumpspeedcap_min/sv_jumpspeedcap_max act as baseline
        // velocity bounds.  Final velocity is bound between (jumpheight *
@@ -76,8 +102,8 @@ float PlayerJump (void)
 
                minjumpspeed = mjumpheight * stof(autocvar_sv_jumpspeedcap_min);
 
-               if (self.velocity_z < minjumpspeed)
-                       mjumpheight += minjumpspeed - self.velocity_z;
+               if (self.velocity.z < minjumpspeed)
+                       mjumpheight += minjumpspeed - self.velocity.z;
        }
 
        if(autocvar_sv_jumpspeedcap_max != "")
@@ -85,14 +111,14 @@ float PlayerJump (void)
                // don't do jump speedcaps on ramps to preserve old xonotic ramjump style
                tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
 
-               if(!(trace_fraction < 1 && trace_plane_normal_z < 0.98 && autocvar_sv_jumpspeedcap_max_disable_on_ramps))
+               if(!(trace_fraction < 1 && trace_plane_normal.z < 0.98 && autocvar_sv_jumpspeedcap_max_disable_on_ramps))
                {
                        float maxjumpspeed;
 
                        maxjumpspeed = mjumpheight * stof(autocvar_sv_jumpspeedcap_max);
 
-                       if (self.velocity_z > maxjumpspeed)
-                               mjumpheight -= self.velocity_z - maxjumpspeed;
+                       if (self.velocity.z > maxjumpspeed)
+                               mjumpheight -= self.velocity.z - maxjumpspeed;
                }
        }
 
@@ -110,20 +136,20 @@ float PlayerJump (void)
                self.jumppadcount = 0;
        }
 
-       self.velocity_z = self.velocity_z + mjumpheight;
-       self.oldvelocity_z = self.velocity_z;
+       self.velocity_z = self.velocity.z + mjumpheight;
+       self.oldvelocity_z = self.velocity.z;
 
        self.flags &= ~FL_ONGROUND;
        self.flags &= ~FL_JUMPRELEASED;
 
-       animdecide_setaction(self, ANIMACTION_JUMP, TRUE);
+       animdecide_setaction(self, ANIMACTION_JUMP, true);
 
        if(autocvar_g_jump_grunt)
                PlayerSound(playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND);
 
        self.restart_jump = -1; // restart jump anim next time
        // value -1 is used to not use the teleport bit (workaround for tiny hitch when re-jumping)
-       return TRUE;
+       return true;
 }
 void CheckWaterJump()
 {
@@ -132,17 +158,17 @@ void CheckWaterJump()
 // check for a jump-out-of-water
        makevectors (self.angles);
        start = self.origin;
-       start_z = start_z + 8;
-       v_forward_z = 0;
+       start.z = start.z + 8;
+       v_forward.z = 0;
        normalize(v_forward);
        end = start + v_forward*24;
-       traceline (start, end, TRUE, self);
+       traceline (start, end, true, self);
        if (trace_fraction < 1)
        {       // solid at waist
-               start_z = start_z + self.maxs_z - 8;
+               start.z = start.z + self.maxs.z - 8;
                end = start + v_forward*24;
                self.movedir = trace_plane_normal * -50;
-               traceline (start, end, TRUE, self);
+               traceline (start, end, true, self);
                if (trace_fraction == 1)
                {       // open at eye level
                        self.flags |= FL_WATERJUMP;
@@ -177,7 +203,7 @@ void CheckPlayerJump()
                                Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
                        else if (activate)
                                Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
-                       self.jetpack_stopped = TRUE;
+                       self.jetpack_stopped = true;
                        self.items &= ~IT_USING_JETPACK;
                }
                else if (activate && !self.frozen)
@@ -185,7 +211,7 @@ void CheckPlayerJump()
        }
        else
        {
-               self.jetpack_stopped = FALSE;
+               self.jetpack_stopped = false;
                self.items &= ~IT_USING_JETPACK;
        }
        if (!self.BUTTON_JUMP)
@@ -224,8 +250,8 @@ void RaceCarPhysics()
        vector angles_save, rigvel;
 
        angles_save = self.angles;
-       accel = bound(-1, self.movement_x / self.stat_sv_maxspeed, 1);
-       steer = bound(-1, self.movement_y / self.stat_sv_maxspeed, 1);
+       accel = bound(-1, self.movement.x / self.stat_sv_maxspeed, 1);
+       steer = bound(-1, self.movement.y / self.stat_sv_maxspeed, 1);
 
        if(g_bugrigs_reverse_speeding)
        {
@@ -325,7 +351,7 @@ void RaceCarPhysics()
                vector rigvel_xy, neworigin, up;
                float mt;
 
-               rigvel_z -= frametime * autocvar_sv_gravity; // 4x gravity plays better
+               rigvel.z -= frametime * autocvar_sv_gravity; // 4x gravity plays better
                rigvel_xy = vec2(rigvel);
 
                if(g_bugrigs_planar_movement_car_jumping)
@@ -341,7 +367,7 @@ void RaceCarPhysics()
                tracebox(trace_endpos, self.mins, self.maxs, trace_endpos + rigvel_xy * frametime, mt, self);
 
                // align to surface
-               tracebox(trace_endpos, self.mins, self.maxs, trace_endpos - up + '0 0 1' * rigvel_z * frametime, mt, self);
+               tracebox(trace_endpos, self.mins, self.maxs, trace_endpos - up + '0 0 1' * rigvel.z * frametime, mt, self);
 
                if(trace_fraction < 0.5)
                {
@@ -355,11 +381,11 @@ void RaceCarPhysics()
                {
                        // now set angles_x so that the car points parallel to the surface
                        self.angles = vectoangles(
-                                       '1 0 0' * v_forward_x * trace_plane_normal_z
+                                       '1 0 0' * v_forward.x * trace_plane_normal.z
                                        +
-                                       '0 1 0' * v_forward_y * trace_plane_normal_z
+                                       '0 1 0' * v_forward.y * trace_plane_normal.z
                                        +
-                                       '0 0 1' * -(v_forward_x * trace_plane_normal_x + v_forward_y * trace_plane_normal_y)
+                                       '0 0 1' * -(v_forward.x * trace_plane_normal.x + v_forward.y * trace_plane_normal.y)
                                        );
                        self.flags |= FL_ONGROUND;
                }
@@ -374,7 +400,7 @@ void RaceCarPhysics()
        }
        else
        {
-               rigvel_z -= frametime * autocvar_sv_gravity; // 4x gravity plays better
+               rigvel.z -= frametime * autocvar_sv_gravity; // 4x gravity plays better
                self.velocity = rigvel;
                self.movetype = MOVETYPE_FLY;
        }
@@ -384,11 +410,11 @@ void RaceCarPhysics()
        if(trace_fraction != 1)
        {
                self.angles = vectoangles2(
-                               '1 0 0' * v_forward_x * trace_plane_normal_z
+                               '1 0 0' * v_forward.x * trace_plane_normal.z
                                +
-                               '0 1 0' * v_forward_y * trace_plane_normal_z
+                               '0 1 0' * v_forward.y * trace_plane_normal.z
                                +
-                               '0 0 1' * -(v_forward_x * trace_plane_normal_x + v_forward_y * trace_plane_normal_y),
+                               '0 0 1' * -(v_forward.x * trace_plane_normal.x + v_forward.y * trace_plane_normal.y),
                                trace_plane_normal
                                );
        }
@@ -396,12 +422,12 @@ void RaceCarPhysics()
        {
                vector vel_local;
 
-               vel_local_x = v_forward * self.velocity;
-               vel_local_y = v_right * self.velocity;
-               vel_local_z = v_up * self.velocity;
+               vel_local.x = v_forward * self.velocity;
+               vel_local.y = v_right * self.velocity;
+               vel_local.z = v_up * self.velocity;
 
-               self.angles_x = racecar_angle(vel_local_x, vel_local_z);
-               self.angles_z = racecar_angle(-vel_local_y, vel_local_z);
+               self.angles_x = racecar_angle(vel_local.x, vel_local.z);
+               self.angles_z = racecar_angle(-vel_local.y, vel_local.z);
        }
 
        // smooth the angles
@@ -416,15 +442,15 @@ void RaceCarPhysics()
        vf1 = vf1 + v_forward * (1 - f);
        vu1 = vu1 + v_up * (1 - f);
        smoothangles = vectoangles2(vf1, vu1);
-       self.angles_x = -smoothangles_x;
-       self.angles_z =  smoothangles_z;
+       self.angles_x = -smoothangles.x;
+       self.angles_z =  smoothangles.z;
 }
 
 float IsMoveInDirection(vector mv, float angle) // key mix factor
 {
-       if(mv_x == 0 && mv_y == 0)
+       if(mv.x == 0 && mv.y == 0)
                return 0; // avoid division by zero
-       angle -= RAD2DEG * atan2(mv_y, mv_x);
+       angle -= RAD2DEG * atan2(mv.y, mv.x);
        angle = remainder(angle, 360) / 45;
        if(angle >  1)
                return 0;
@@ -458,7 +484,7 @@ void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
 
 #if 0
        // this doesn't play well with analog input
-       if(self.movement_x == 0 || self.movement_y != 0)
+       if(self.movement_x == 0 || self.movement.y != 0)
                return; // can't control movement if not moving forward or backward
        k = 32;
 #else
@@ -469,7 +495,7 @@ void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
 
        k *= bound(0, wishspeed / autocvar_sv_maxairspeed, 1);
 
-       zspeed = self.velocity_z;
+       zspeed = self.velocity.z;
        self.velocity_z = 0;
        xyspeed = vlen(self.velocity); self.velocity = normalize(self.velocity);
 
@@ -500,7 +526,7 @@ float AdjustAirAccelQW(float accelqw, float factor)
 void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float accel, float accelqw, float stretchfactor, float sidefric, float speedlimit)
 {
        float vel_straight;
-       float vel_z;
+       float velZ;
        vector vel_perpend;
        float step;
 
@@ -523,7 +549,7 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce
                wishspeed0 = wishspeed;
 
        vel_straight = self.velocity * wishdir;
-       vel_z = self.velocity_z;
+       velZ = self.velocity.z;
        vel_xy = vec2(self.velocity);
        vel_perpend = vel_xy - vel_straight * wishdir;
 
@@ -571,7 +597,7 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce
                }
        }
 
-       self.velocity = vel_xy + vel_z * '0 0 1';
+       self.velocity = vel_xy + velZ * '0 0 1';
 }
 
 void PM_AirAccelerate(vector wishdir, float wishspeed)
@@ -584,7 +610,7 @@ void PM_AirAccelerate(vector wishdir, float wishspeed)
                return;
 
        curvel = self.velocity;
-       curvel_z = 0;
+       curvel.z = 0;
        curspeed = vlen(curvel);
 
        if(wishspeed > curspeed * 1.01)
@@ -667,7 +693,7 @@ void SV_PlayerPhysics()
        vector wishvel, wishdir, v;
        float wishspeed, f, maxspd_mod, spd, maxairspd, airaccel, swampspd_mod, buttons;
        string temps;
-       float buttons_prev;
+       int buttons_prev;
        float not_allowed_to_move;
        string c;
 
@@ -702,7 +728,7 @@ void SV_PlayerPhysics()
 
        anticheat_physics();
 
-       buttons = self.BUTTON_ATCK + 2 * self.BUTTON_JUMP + 4 * self.BUTTON_ATCK2 + 8 * self.BUTTON_ZOOM + 16 * self.BUTTON_CROUCH + 32 * self.BUTTON_HOOK + 64 * self.BUTTON_USE + 128 * (self.movement_x < 0) + 256 * (self.movement_x > 0) + 512 * (self.movement_y < 0) + 1024 * (self.movement_y > 0);
+       buttons = self.BUTTON_ATCK + 2 * self.BUTTON_JUMP + 4 * self.BUTTON_ATCK2 + 8 * self.BUTTON_ZOOM + 16 * self.BUTTON_CROUCH + 32 * self.BUTTON_HOOK + 64 * self.BUTTON_USE + 128 * (self.movement.x < 0) + 256 * (self.movement.x > 0) + 512 * (self.movement.y < 0) + 1024 * (self.movement.y > 0);
 
        if(!buttons)
                c = "x";
@@ -756,7 +782,7 @@ void SV_PlayerPhysics()
                        self.angles_x = random() * 360;
                        self.angles_y = random() * 360;
                        // at least I'm not forcing retardedview by also assigning to angles_z
-                       self.fixangle = TRUE;
+                       self.fixangle = true;
                }
        }
 
@@ -794,7 +820,6 @@ void SV_PlayerPhysics()
                not_allowed_to_move = 0;
                if(self.race_penalty)
                        not_allowed_to_move = 1;
-               if(!autocvar_sv_ready_restart_after_countdown)
                if(time < game_starttime)
                        not_allowed_to_move = 1;
 
@@ -830,9 +855,9 @@ void SV_PlayerPhysics()
        {
                if(autocvar_sv_dodging_frozen && IS_REAL_CLIENT(self))
                {
-                       self.movement_x = bound(-5, self.movement_x, 5);
-                       self.movement_y = bound(-5, self.movement_y, 5);
-                       self.movement_z = bound(-5, self.movement_z, 5);
+                       self.movement_x = bound(-5, self.movement.x, 5);
+                       self.movement_y = bound(-5, self.movement.y, 5);
+                       self.movement_z = bound(-5, self.movement.z, 5);
                }
                else
                        self.movement = '0 0 0';
@@ -911,7 +936,7 @@ void SV_PlayerPhysics()
        if (!self.fixangle && !g_bugrigs)
        {
                self.angles_x = 0;
-               self.angles_y = self.v_angle_y;
+               self.angles_y = self.v_angle.y;
                self.angles_z = 0;
        }
 
@@ -946,8 +971,8 @@ void SV_PlayerPhysics()
 
        if (self.flags & FL_WATERJUMP )
        {
-               self.velocity_x = self.movedir_x;
-               self.velocity_y = self.movedir_y;
+               self.velocity_x = self.movedir.x;
+               self.velocity_y = self.movedir.y;
                if (time > self.teleport_time || self.waterlevel == WATERLEVEL_NONE)
                {
                        self.flags &= ~FL_WATERJUMP;
@@ -966,7 +991,7 @@ void SV_PlayerPhysics()
                self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction);
                makevectors(self.v_angle);
                //wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z;
-               wishvel = v_forward * self.movement_x + v_right * self.movement_y + '0 0 1' * self.movement_z;
+               wishvel = v_forward * self.movement.x + v_right * self.movement.y + '0 0 1' * self.movement.z;
                // acceleration
                wishdir = normalize(wishvel);
                wishspeed = vlen(wishvel);
@@ -982,7 +1007,7 @@ void SV_PlayerPhysics()
 
                makevectors(self.v_angle);
                //wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z;
-               wishvel = v_forward * self.movement_x + v_right * self.movement_y + '0 0 1' * self.movement_z;
+               wishvel = v_forward * self.movement.x + v_right * self.movement.y + '0 0 1' * self.movement.z;
                if (wishvel == '0 0 0')
                        wishvel = '0 0 -60'; // drift towards bottom
 
@@ -1016,7 +1041,7 @@ void SV_PlayerPhysics()
                self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction);
                makevectors(self.v_angle);
                //wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z;
-               wishvel = v_forward * self.movement_x + v_right * self.movement_y + '0 0 1' * self.movement_z;
+               wishvel = v_forward * self.movement.x + v_right * self.movement.y + '0 0 1' * self.movement.z;
                self.velocity_z += g;
                if (self.ladder_entity.classname == "func_water")
                {
@@ -1025,12 +1050,12 @@ void SV_PlayerPhysics()
                                wishvel = wishvel * (self.ladder_entity.speed / f);
 
                        self.watertype = self.ladder_entity.skin;
-                       f = self.ladder_entity.origin_z + self.ladder_entity.maxs_z;
-                       if ((self.origin_z + self.view_ofs_z) < f)
+                       f = self.ladder_entity.origin.z + self.ladder_entity.maxs.z;
+                       if ((self.origin.z + self.view_ofs.z) < f)
                                self.waterlevel = WATERLEVEL_SUBMERGED;
-                       else if ((self.origin_z + (self.mins_z + self.maxs_z) * 0.5) < f)
+                       else if ((self.origin.z + (self.mins.z + self.maxs.z) * 0.5) < f)
                                self.waterlevel = WATERLEVEL_SWIMMING;
-                       else if ((self.origin_z + self.mins_z + 1) < f)
+                       else if ((self.origin.z + self.mins.z + 1) < f)
                                self.waterlevel = WATERLEVEL_WETFEET;
                        else
                        {
@@ -1053,16 +1078,16 @@ void SV_PlayerPhysics()
        {
                //makevectors(self.v_angle_y * '0 1 0');
                makevectors(self.v_angle);
-               wishvel = v_forward * self.movement_x + v_right * self.movement_y;
+               wishvel = v_forward * self.movement.x + v_right * self.movement.y;
                // add remaining speed as Z component
                maxairspd = autocvar_sv_maxairspeed*max(1, maxspd_mod);
                // fix speedhacks :P
                wishvel = normalize(wishvel) * min(vlen(wishvel) / maxairspd, 1);
                // add the unused velocity as up component
-               wishvel_z = 0;
+               wishvel.z = 0;
 
                // if(self.BUTTON_JUMP)
-                       wishvel_z = sqrt(max(0, 1 - wishvel * wishvel));
+                       wishvel.z = sqrt(max(0, 1 - wishvel * wishvel));
 
                // it is now normalized, so...
                float a_side, a_up, a_add, a_diff;
@@ -1070,10 +1095,10 @@ void SV_PlayerPhysics()
                a_up = autocvar_g_jetpack_acceleration_up;
                a_add = autocvar_g_jetpack_antigravity * autocvar_sv_gravity;
 
-               wishvel_x *= a_side;
-               wishvel_y *= a_side;
-               wishvel_z *= a_up;
-               wishvel_z += a_add;
+               wishvel.x *= a_side;
+               wishvel.y *= a_side;
+               wishvel.z *= a_up;
+               wishvel.z += a_add;
 
                float best;
                best = 0;
@@ -1116,15 +1141,15 @@ void SV_PlayerPhysics()
                //print("best possible acceleration: ", ftos(best), "\n");
 
                float fxy, fz;
-               fxy = bound(0, 1 - (self.velocity * normalize(wishvel_x * '1 0 0' + wishvel_y * '0 1 0')) / autocvar_g_jetpack_maxspeed_side, 1);
-               if(wishvel_z - autocvar_sv_gravity > 0)
-                       fz = bound(0, 1 - self.velocity_z / autocvar_g_jetpack_maxspeed_up, 1);
+               fxy = bound(0, 1 - (self.velocity * normalize(wishvel.x * '1 0 0' + wishvel.y * '0 1 0')) / autocvar_g_jetpack_maxspeed_side, 1);
+               if(wishvel.z - autocvar_sv_gravity > 0)
+                       fz = bound(0, 1 - self.velocity.z / autocvar_g_jetpack_maxspeed_up, 1);
                else
-                       fz = bound(0, 1 + self.velocity_z / autocvar_g_jetpack_maxspeed_up, 1);
+                       fz = bound(0, 1 + self.velocity.z / autocvar_g_jetpack_maxspeed_up, 1);
 
-               wishvel_x *= fxy;
-               wishvel_y *= fxy;
-               wishvel_z = (wishvel_z - autocvar_sv_gravity) * fz + autocvar_sv_gravity;
+               wishvel.x *= fxy;
+               wishvel.y *= fxy;
+               wishvel.z = (wishvel.z - autocvar_sv_gravity) * fz + autocvar_sv_gravity;
 
                float fvel;
                fvel = min(1, vlen(wishvel) / best);
@@ -1154,8 +1179,8 @@ void SV_PlayerPhysics()
                        Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
 
                // walking
-               makevectors(self.v_angle_y * '0 1 0');
-               wishvel = v_forward * self.movement_x + v_right * self.movement_y;
+               makevectors(self.v_angle.y * '0 1 0');
+               wishvel = v_forward * self.movement.x + v_right * self.movement.y;
 
                if(!(self.lastflags & FL_ONGROUND))
                {
@@ -1169,7 +1194,7 @@ void SV_PlayerPhysics()
                }
 
                v = self.velocity;
-               v_z = 0;
+               v.z = 0;
                f = vlen(v);
                if(f > 0)
                {
@@ -1233,8 +1258,8 @@ void SV_PlayerPhysics()
                        airaccel = autocvar_sv_airaccelerate;
                }
                // airborn
-               makevectors(self.v_angle_y * '0 1 0');
-               wishvel = v_forward * self.movement_x + v_right * self.movement_y;
+               makevectors(self.v_angle.y * '0 1 0');
+               wishvel = v_forward * self.movement.x + v_right * self.movement.y;
                // acceleration
                wishdir = normalize(wishvel);
                wishspeed = wishspeed0 = vlen(wishvel);
@@ -1260,7 +1285,7 @@ void SV_PlayerPhysics()
                        {
                                vector curdir;
                                curdir = self.velocity;
-                               curdir_z = 0;
+                               curdir.z = 0;
                                curdir = normalize(curdir);
                                airaccel = airaccel + (autocvar_sv_airstopaccelerate*maxspd_mod - airaccel) * max(0, -(curdir * wishdir));
                        }
@@ -1281,7 +1306,7 @@ void SV_PlayerPhysics()
                                airaccelqw = copysign(1-GeomLerp(1-fabs(self.stat_sv_airaccel_qw), strafity, 1-fabs(self.stat_sv_airstrafeaccel_qw)), ((strafity > 0.5) ? self.stat_sv_airstrafeaccel_qw : self.stat_sv_airaccel_qw));
                        // !CPM
 
-                       if(autocvar_sv_warsowbunny_turnaccel && accelerating && self.movement_y == 0 && self.movement_x != 0)
+                       if(autocvar_sv_warsowbunny_turnaccel && accelerating && self.movement_y == 0 && self.movement.x != 0)
                                PM_AirAccelerate(wishdir, wishspeed);
                        else
                                PM_Accelerate(wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, autocvar_sv_airaccel_qw_stretchfactor, autocvar_sv_airaccel_sideways_friction / maxairspd, self.stat_sv_airspeedlimit_nonqw);
@@ -1293,9 +1318,9 @@ void SV_PlayerPhysics()
 
        if((g_cts || g_race) && !IS_OBSERVER(self))
        {
-               if(vlen(self.velocity - self.velocity_z * '0 0 1') > speedaward_speed)
+               if(vlen(self.velocity - self.velocity.z * '0 0 1') > speedaward_speed)
                {
-                       speedaward_speed = vlen(self.velocity - self.velocity_z * '0 0 1');
+                       speedaward_speed = vlen(self.velocity - self.velocity.z * '0 0 1');
                        speedaward_holder = self.netname;
                        speedaward_uid = self.crypto_idfp;
                        speedaward_lastupdate = time;
@@ -1319,7 +1344,7 @@ void SV_PlayerPhysics()
 
        // WEAPONTODO
        float xyspeed;
-       xyspeed = vlen('1 0 0' * self.velocity_x + '0 1 0' * self.velocity_y);
+       xyspeed = vlen('1 0 0' * self.velocity.x + '0 1 0' * self.velocity.y);
        if(self.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
index d899b3db3a8f85587c1c9ab152f043b2db29f93e..49d1c1b4691c3136f11c4fd3aa87c27a816c9ea9 100644 (file)
@@ -1,9 +1,10 @@
-.entity pusher;
-.float pushltime;
-.float istypefrag;
+#include "cl_player.qh"
+#include "g_triggers.qh"
+#include "g_violence.qh"
+#include "miscfunctions.qh"
+
+#include "weapons/weaponstats.qh"
 
-.float CopyBody_nextthink;
-.void(void) CopyBody_think;
 void CopyBody_Think(void)
 {
        if(self.CopyBody_nextthink && time > self.CopyBody_nextthink)
@@ -92,7 +93,7 @@ void CopyBody(float keepvelocity)
        self.think = CopyBody_Think;
        // "bake" the current animation frame for clones (they don't get clientside animation)
        animdecide_load_if_needed(self);
-       animdecide_setframes(self, FALSE, frame, frame1time, frame2, frame2time);
+       animdecide_setframes(self, false, frame, frame1time, frame2, frame2time);
 
        self = oldself;
 }
@@ -112,12 +113,12 @@ void player_setupanimsformodel()
 {
        // load animation info
        animdecide_load_if_needed(self);
-       animdecide_setstate(self, 0, FALSE);
+       animdecide_setstate(self, 0, false);
 }
 
 void player_anim (void)
 {
-       float deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
+       int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
        if(self.deadflag) {
                if (!deadbits) {
                        // Decide on which death animation to use.
@@ -130,19 +131,19 @@ void player_anim (void)
                // Clear a previous death animation.
                deadbits = 0;
        }
-       float animbits = deadbits;
+       int animbits = deadbits;
        if(self.frozen)
                animbits |= ANIMSTATE_FROZEN;
        if(self.crouch)
                animbits |= ANIMSTATE_DUCK;
-       animdecide_setstate(self, animbits, FALSE);
+       animdecide_setstate(self, animbits, false);
        animdecide_setimplicitstate(self, (self.flags & FL_ONGROUND));
 
        if (self.weaponentity)
        {
                updateanim(self.weaponentity);
                if (!self.weaponentity.animstate_override)
-                       setanim(self.weaponentity, self.weaponentity.anim_idle, TRUE, FALSE, FALSE);
+                       setanim(self.weaponentity, self.weaponentity.anim_idle, true, false, false);
        }
 }
 
@@ -156,8 +157,8 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float
        damage = max(damage - 5, 1);
 
        v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
-       take = v_x;
-       save = v_y;
+       take = v.x;
+       save = v.y;
 
        if(sound_allowed(MSG_BROADCAST, attacker))
        {
@@ -194,22 +195,10 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float
                self.alpha = -1;
                self.solid = SOLID_NOT; // restore later
                self.takedamage = DAMAGE_NO; // restore later
-               self.damagedbycontents = FALSE;
+               self.damagedbycontents = false;
        }
 }
 
-// g_<gametype>_str:
-// If 0, default is used.
-// If <0, 0 is used.
-// Otherwise, g_str (default value) is used.
-// For consistency, negative values there are mapped to zero too.
-#define GAMETYPE_DEFAULTED_SETTING(str) \
-       ((gametype_setting_tmp = cvar(strcat("g_", GetGametype(), "_" #str))), \
-        (gametype_setting_tmp < 0) ? 0 : \
-        (gametype_setting_tmp == 0) ? max(0, autocvar_g_##str) : \
-        gametype_setting_tmp)
-
-
 void calculate_player_respawn_time()
 {
        if(g_ca)
@@ -297,11 +286,10 @@ void calculate_player_respawn_time()
                self.respawn_flags = self.respawn_flags | RESPAWN_FORCE;
 }
 
-void ClientKill_Now_TeamChange();
-
-void PlayerDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
-       float take, save, dh, da, j;
+       float take, save, dh, da;
+       int j;
        vector v;
        float valid_damage_for_weaponstats;
        float excess;
@@ -323,7 +311,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                vector d;
                float f;
                ear1 = self.origin;
-               ear1_z += 0.125 * self.view_ofs_z + 0.875 * self.maxs_z; // 7/8
+               ear1_z += 0.125 * self.view_ofs.z + 0.875 * self.maxs.z; // 7/8
                ear2 = ear1;
                makevectors(self.angles);
                ear1 += v_right * -10;
@@ -352,8 +340,8 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
 
 
        v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
-       take = v_x;
-       save = v_y;
+       take = v.x;
+       save = v.y;
 
        if(attacker == self)
        {
@@ -426,9 +414,9 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                                                if (!self.animstate_override)
                                                {
                                                        if (random() > 0.5)
-                                                               animdecide_setaction(self, ANIMACTION_PAIN1, TRUE);
+                                                               animdecide_setaction(self, ANIMACTION_PAIN1, true);
                                                        else
-                                                               animdecide_setaction(self, ANIMACTION_PAIN2, TRUE);
+                                                               animdecide_setaction(self, ANIMACTION_PAIN2, true);
                                                }
                                        }
 
@@ -456,9 +444,9 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                        if(IS_BOT_CLIENT(self) && self.health >= 1)
                        {
                                shake = damage * 5 / (bound(0,skill,100) + 1);
-                               self.v_angle_x = self.v_angle_x + (random() * 2 - 1) * shake;
-                               self.v_angle_y = self.v_angle_y + (random() * 2 - 1) * shake;
-                               self.v_angle_x = bound(-90, self.v_angle_x, 90);
+                               self.v_angle_x = self.v_angle.x + (random() * 2 - 1) * shake;
+                               self.v_angle_y = self.v_angle.y + (random() * 2 - 1) * shake;
+                               self.v_angle_x = bound(-90, self.v_angle.x, 90);
                        }
                }
                else
@@ -497,7 +485,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
        if (self.health < 1)
        {
                float defer_ClientKill_Now_TeamChange;
-               defer_ClientKill_Now_TeamChange = FALSE;
+               defer_ClientKill_Now_TeamChange = false;
 
                if(self.alivetime)
                {
@@ -523,7 +511,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                        remove(self.killindicator);
                        self.killindicator = world;
                        if(self.killindicator_teamchange)
-                               defer_ClientKill_Now_TeamChange = TRUE;
+                               defer_ClientKill_Now_TeamChange = true;
 
                        if(self.classname == "body")
                        if(deathtype == DEATH_KILL)
@@ -538,8 +526,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                        Obituary (attacker, inflictor, self, deathtype);
 
         // increment frag counter for used weapon type
-        float w;
-        w = DEATH_WEAPONOF(deathtype);
+        int w = DEATH_WEAPONOF(deathtype);
         if(WEP_VALID(w))
        if(accuracy_isgooddamage(attacker, self))
         attacker.accuracy.(accuracy_frags[w-1]) += 1;
@@ -556,7 +543,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
 
                Portal_ClearAllLater(self);
 
-               self.fixangle = TRUE;
+               self.fixangle = true;
 
                if(defer_ClientKill_Now_TeamChange)
                        ClientKill_Now_TeamChange(); // can turn player into spectator
@@ -600,10 +587,10 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
 
                self.death_time = time;
                if (random() < 0.5)
-                       animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD1, TRUE);
+                       animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD1, true);
                else
-                       animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD2, TRUE);
-               if (self.maxs_z > 5)
+                       animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD2, true);
+               if (self.maxs.z > 5)
                {
                        self.maxs_z = 5;
                        setsize(self, self.mins, self.maxs);
@@ -638,7 +625,6 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
        }
 }
 
-.float muted; // to be used by prvm_edictset server playernumber muted 1
 float Say(entity source, float teamsay, entity privatesay, string msgin, float floodcontrol)
 // message "": do not say, just test flood control
 // return value:
@@ -666,11 +652,11 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f
        else
        {
                colorstr = "";
-               teamsay = FALSE;
+               teamsay = false;
        }
 
        if(intermission_running)
-               teamsay = FALSE;
+               teamsay = false;
 
        if(msgin != "")
                msgin = trigger_magicear_processmessage_forallears(source, teamsay, privatesay, msgin);
@@ -920,7 +906,6 @@ float GetVoiceMessageVoiceType(string type)
        return VOICETYPE_TEAMRADIO;
 }
 
-string allvoicesamples;
 .string GetVoiceMessageSampleField(string type)
 {
        GetPlayerSoundSampleField_notFound = 0;
@@ -1026,8 +1011,6 @@ float LoadPlayerSounds(string f, float first)
        return 1;
 }
 
-.float modelindex_for_playersound;
-.float skin_for_playersound;
 void UpdatePlayerSounds()
 {
        if(self.modelindex == self.modelindex_for_playersound)
@@ -1096,7 +1079,7 @@ void FakeGlobalSound(string sample, float chan, float voicetype)
                case VOICETYPE_TAUNT:
                        if(IS_PLAYER(self))
                                if(self.deadflag == DEAD_NO)
-                                       animdecide_setaction(self, ANIMACTION_TAUNT, TRUE);
+                                       animdecide_setaction(self, ANIMACTION_TAUNT, true);
                        if(!sv_taunt)
                                break;
                        if(autocvar_sv_gentle)
@@ -1193,7 +1176,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                case VOICETYPE_TAUNT:
                        if(IS_PLAYER(self))
                                if(self.deadflag == DEAD_NO)
-                                       animdecide_setaction(self, ANIMACTION_TAUNT, TRUE);
+                                       animdecide_setaction(self, ANIMACTION_TAUNT, true);
                        if(!sv_taunt)
                                break;
                        if(autocvar_sv_gentle)
diff --git a/qcsrc/server/cl_player.qh b/qcsrc/server/cl_player.qh
new file mode 100644 (file)
index 0000000..cf5ec0a
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef CL_PLAYER_H
+#define CL_PLAYER_H
+
+.entity pusher;
+.float pushltime;
+.float istypefrag;
+
+.float CopyBody_nextthink;
+.void(void) CopyBody_think;
+void CopyBody_Think(void);
+void CopyBody(float keepvelocity);
+
+float player_getspecies();
+
+void player_setupanimsformodel();
+
+void player_anim (void);
+
+void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
+
+// g_<gametype>_str:
+// If 0, default is used.
+// If <0, 0 is used.
+// Otherwise, g_str (default value) is used.
+// For consistency, negative values there are mapped to zero too.
+#define GAMETYPE_DEFAULTED_SETTING(str) \
+       ((gametype_setting_tmp = cvar(strcat("g_", GetGametype(), "_" #str))), \
+        (gametype_setting_tmp < 0) ? 0 : \
+        (gametype_setting_tmp == 0) ? max(0, autocvar_g_##str) : \
+        gametype_setting_tmp)
+
+
+void calculate_player_respawn_time();
+
+void ClientKill_Now_TeamChange();
+
+void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
+
+.float muted; // to be used by prvm_edictset server playernumber muted 1
+float Say(entity source, float teamsay, entity privatesay, string msgin, float floodcontrol);
+// message "": do not say, just test flood control
+// return value:
+//   1 = accept
+//   0 = reject
+//  -1 = fake accept
+
+float GetVoiceMessageVoiceType(string type);
+
+string allvoicesamples;
+.string GetVoiceMessageSampleField(string type);
+
+.string GetPlayerSoundSampleField(string type);
+
+void PrecacheGlobalSound(string samplestring);
+
+void PrecachePlayerSounds(string f);
+
+void ClearPlayerSounds();
+
+float LoadPlayerSounds(string f, float first);
+
+.int modelindex_for_playersound;
+.int skin_for_playersound;
+void UpdatePlayerSounds();
+
+void FakeGlobalSound(string sample, float chan, float voicetype);
+
+void GlobalSound(string sample, float chan, float voicetype);
+
+void PlayerSound(.string samplefield, float chan, float voicetype);
+
+void VoiceMessage(string type, string msg);
+
+void MoveToTeam(entity client, float team_colour, float type);
+#endif
index 794854deddf1daa3b6e9b35b316f0d7fb1d3e443..9091ae0b783b65953aa4abef156b4e3203ce8040 100644 (file)
@@ -1,3 +1,14 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/dpextensions.qh"
+    #include "../../common/util.qh"
+    #include "../../common/command/shared_defs.qh"
+    #include "../autocvars.qh"
+    #include "common.qh"
+    #include "banning.qh"
+    #include "../ipban.qh"
+#endif
 // =====================================================
 //  Banning and kicking command code, written by Samual
 //  Last updated: December 29th, 2011
@@ -69,7 +80,7 @@ void BanCommand_kickban(float request, float argc, string command)
                        if(argc >= 2)
                        {
                                entity client = GetIndexedEntity(argc, 1);
-                               float accepted = VerifyClientEntity(client, TRUE, FALSE);
+                               float accepted = VerifyKickableEntity(client);
                                float reason_arg, bantime, masksize;
                                string reason;
 
@@ -116,11 +127,11 @@ void BanCommand_mute(float request, float argc, string command) // TODO: Add a s
                        if(argc >= 2)
                        {
                                entity client = GetFilteredEntity(argv(1));
-                               float accepted = VerifyClientEntity(client, TRUE, FALSE);
+                               float accepted = VerifyClientEntity(client, true, false);
 
                                if(accepted > 0)
                                {
-                                       client.muted = TRUE;
+                                       client.muted = true;
                                        return;
                                }
                                else
@@ -204,11 +215,11 @@ void BanCommand_unmute(float request, float argc)
                        if(argc >= 2)
                        {
                                entity client = GetFilteredEntity(argv(1));
-                               float accepted = VerifyClientEntity(client, TRUE, FALSE);
+                               float accepted = VerifyClientEntity(client, true, false);
 
                                if(accepted > 0)
                                {
-                                       client.muted = FALSE;
+                                       client.muted = false;
                                        return;
                                }
                                else
@@ -273,7 +284,7 @@ void BanCommand_macro_help()
        #define BAN_COMMAND(name,function,description) \
                { if(strtolower(description) != "") { print("  ^2", name, "^7: ", description, "\n"); } }
 
-       BAN_COMMANDS(0, 0, "")
+       BAN_COMMANDS(0, 0, "");
        #undef BAN_COMMAND
 
        return;
@@ -282,23 +293,23 @@ void BanCommand_macro_help()
 float BanCommand_macro_command(float argc, string command)
 {
        #define BAN_COMMAND(name,function,description) \
-               { if(name == strtolower(argv(0))) { function; return TRUE; } }
+               { if(name == strtolower(argv(0))) { function; return true; } }
 
-       BAN_COMMANDS(CMD_REQUEST_COMMAND, argc, command)
+       BAN_COMMANDS(CMD_REQUEST_COMMAND, argc, command);
        #undef BAN_COMMAND
 
-       return FALSE;
+       return false;
 }
 
 float BanCommand_macro_usage(float argc)
 {
        #define BAN_COMMAND(name,function,description) \
-               { if(name == strtolower(argv(1))) { function; return TRUE; } }
+               { if(name == strtolower(argv(1))) { function; return true; } }
 
-       BAN_COMMANDS(CMD_REQUEST_USAGE, argc, "")
+       BAN_COMMANDS(CMD_REQUEST_USAGE, argc, "");
        #undef BAN_COMMAND
 
-       return FALSE;
+       return false;
 }
 
 void BanCommand_macro_write_aliases(float fh)
@@ -306,7 +317,7 @@ void BanCommand_macro_write_aliases(float fh)
        #define BAN_COMMAND(name,function,description) \
                { if(strtolower(description) != "") { CMD_Write_Alias("qc_cmd_sv", name, description); } }
 
-       BAN_COMMANDS(0, 0, "")
+       BAN_COMMANDS(0, 0, "");
        #undef BAN_COMMAND
 
        return;
@@ -323,8 +334,8 @@ float BanCommand(string command)
 
        if(BanCommand_macro_command(argc, command)) // continue as usual and scan for normal commands
        {
-               return TRUE; // handled by one of the above GenericCommand_* functions
+               return true; // handled by one of the above GenericCommand_* functions
        }
 
-       return FALSE;
+       return false;
 }
index 8c71af1793bcb92eab965927e6ce9d53813920ef..70daacc87ea98d6152b183dc6ea97b6fc0b30ef2 100644 (file)
@@ -1,10 +1,13 @@
+#ifndef BANNING_H
+#define BANNING_H
+
 // ====================================
 //  Declarations for kick/ban commands
 //  Last updated: December 29th, 2011
 // =====================================
 
-#define GET_BAN_ARG(v,d) if(argc > reason_arg) { if((v = stof(argv(reason_arg))) != 0) ++reason_arg; else v = d; } else v = d
-#define GET_BAN_REASON(v,d) if(argc > reason_arg) v = substring(command, argv_start_index(reason_arg), strlen(command) - argv_start_index(reason_arg)); else v = d
+#define GET_BAN_ARG(v,d) if(argc > reason_arg) { if((v = stof(argv(reason_arg))) != 0) ++reason_arg; else v = d; } else { v = d; }
+#define GET_BAN_REASON(v,d) if(argc > reason_arg) v = substring(command, argv_start_index(reason_arg), strlen(command) - argv_start_index(reason_arg)); else v = d;
 
 void Ban_KickBanClient(entity client, float bantime, float masksize, string reason);
 void Ban_View();
@@ -13,3 +16,4 @@ float Ban_Delete(float i);
 
 // used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
 void BanCommand_macro_write_aliases(float fh);
+#endif
index 898e7db18faf59a78afe5988320a8a21baa02ccb..14e0f201c0f7bb029d4f4363a8ba50e7b7ea39c3 100644 (file)
@@ -1,3 +1,32 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../warpzonelib/common.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/teams.qh"
+    #include "../../common/util.qh"
+    #include "../../common/command/shared_defs.qh"
+    #include "../../common/monsters/monsters.qh"
+    #include "../../common/monsters/sv_monsters.qh"
+    #include "../../common/monsters/spawn.qh"
+    #include "../autocvars.qh"
+    #include "../defs.qh"
+    #include "../../common/notifications.qh"
+    #include "../../common/deathtypes.qh"
+    #include "../mutators/mutators_include.qh"
+    #include "../vehicles/vehicles_def.qh"
+    #include "../campaign.qh"
+    #include "../../common/mapinfo.qh"
+    #include "common.qh"
+    #include "vote.qh"
+    #include "cmd.qh"
+    #include "../cheats.qh"
+    #include "../scores.qh"
+    #include "../ipban.qh"
+#endif
+
 // =========================================================
 //  Server side networked commands code, reworked by Samual
 //  Last updated: December 28th, 2011
@@ -10,7 +39,7 @@ float SV_ParseClientCommand_floodcheck()
                if(time <= (self.cmd_floodtime + autocvar_sv_clientcommand_antispam_time))
                {
                        self.cmd_floodcount += 1;
-                       if(self.cmd_floodcount > autocvar_sv_clientcommand_antispam_count) { return FALSE; } // too much spam, halt
+                       if(self.cmd_floodcount > autocvar_sv_clientcommand_antispam_count) { return false; } // too much spam, halt
                }
                else
                {
@@ -18,7 +47,7 @@ float SV_ParseClientCommand_floodcheck()
                        self.cmd_floodcount = 1;
                }
        }
-       return TRUE; // continue, as we're not flooding yet
+       return true; // continue, as we're not flooding yet
 }
 
 
@@ -92,7 +121,7 @@ void ClientCommand_clientversion(float request, float argc) // internal command,
                                        }
                                        else if(autocvar_g_campaign || autocvar_g_balance_teams)
                                        {
-                                               //JoinBestTeam(self, FALSE, TRUE);
+                                               //JoinBestTeam(self, false, true);
                                        }
                                        else if(teamplay && !autocvar_sv_spectate && !(self.team_forced > 0))
                                        {
@@ -194,7 +223,7 @@ void ClientCommand_mobedit(float request, float argc)
                        {
                                makevectors(self.v_angle);
                                WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 100, MOVE_NORMAL, self);
-                               
+
                                if(!autocvar_g_monsters_edit) { sprint(self, "Monster property editing is not enabled.\n"); return; }
                                if(trace_ent.flags & FL_MONSTER)
                                {
@@ -236,7 +265,7 @@ void ClientCommand_mobkill(float request)
                {
                        makevectors(self.v_angle);
                        WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 100, MOVE_NORMAL, self);
-                       
+
                        if(trace_ent.flags & FL_MONSTER)
                        {
                                if(trace_ent.realowner != self)
@@ -249,7 +278,7 @@ void ClientCommand_mobkill(float request)
                                return;
                        }
                }
-       
+
                default:
                        sprint(self, "Incorrect parameters for ^2mobkill^7\n");
                case CMD_REQUEST_USAGE:
@@ -270,22 +299,22 @@ void ClientCommand_mobspawn(float request, float argc)
                        entity e;
                        string tospawn;
                        float moveflag, monstercount = 0;
-                       
+
                        moveflag = (argv(2) ? stof(argv(2)) : 1); // follow owner if not defined
                        tospawn = strtolower(argv(1));
-                       
+
                        if(tospawn == "list")
                        {
                                sprint(self, monsterlist_reply);
                                return;
                        }
-                       
+
                        FOR_EACH_MONSTER(e)
                        {
                                if(e.realowner == self)
                                        ++monstercount;
                        }
-                       
+
                        if(autocvar_g_monsters_max <= 0 || autocvar_g_monsters_max_perplayer <= 0) { sprint(self, "Monster spawning is disabled.\n"); return; }
                        else if(!IS_PLAYER(self)) { sprint(self, "You can't spawn monsters while spectating.\n"); return; }
                        else if(MUTATOR_CALLHOOK(AllowMobSpawning)) { sprint(self, "Monster spawning is currently disabled by a mutator.\n"); return; }
@@ -300,13 +329,13 @@ void ClientCommand_mobspawn(float request, float argc)
                        {
                                float found = 0, i;
                                entity mon;
-                               
+
                                for(i = MON_FIRST; i <= MON_LAST; ++i)
                                {
                                        mon = get_monsterinfo(i);
                                        if(mon.netname == tospawn)
                                        {
-                                               found = TRUE;
+                                               found = true;
                                                break;
                                        }
                                }
@@ -314,20 +343,20 @@ void ClientCommand_mobspawn(float request, float argc)
                                if(found || tospawn == "random")
                                {
                                        totalspawned += 1;
-                               
+
                                        makevectors(self.v_angle);
-                                       WarpZone_TraceBox (CENTER_OR_VIEWOFS(self), PL_MIN, PL_MAX, CENTER_OR_VIEWOFS(self) + v_forward * 150, TRUE, self);
+                                       WarpZone_TraceBox (CENTER_OR_VIEWOFS(self), PL_MIN, PL_MAX, CENTER_OR_VIEWOFS(self) + v_forward * 150, true, self);
                                        //WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 150, MOVE_NORMAL, self);
-                               
-                                       e = spawnmonster(tospawn, 0, self, self, trace_endpos, FALSE, FALSE, moveflag);
-                                       
+
+                                       e = spawnmonster(tospawn, 0, self, self, trace_endpos, false, false, moveflag);
+
                                        sprint(self, strcat("Spawned ", e.monster_name, "\n"));
-                                       
+
                                        return;
                                }
                        }
                }
-       
+
                default:
                        sprint(self, "Incorrect parameters for ^2mobspawn^7\n");
                case CMD_REQUEST_USAGE:
@@ -357,12 +386,12 @@ void ClientCommand_ready(float request) // todo: anti-spam for toggling readynes
                                                        return;
                                                if (self.ready) // toggle
                                                {
-                                                       self.ready = FALSE;
+                                                       self.ready = false;
                                                        bprint(self.netname, "^2 is ^1NOT^2 ready\n");
                                                }
                                                else
                                                {
-                                                       self.ready = TRUE;
+                                                       self.ready = true;
                                                        bprint(self.netname, "^2 is ready\n");
                                                }
 
@@ -393,7 +422,7 @@ void ClientCommand_say(float request, float argc, string command)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if(argc >= 2) { Say(self, FALSE, world, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1); }
+                       if(argc >= 2) { Say(self, false, world, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1); }
                        return; // never fall through to usage
                }
 
@@ -413,7 +442,7 @@ void ClientCommand_say_team(float request, float argc, string command)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if(argc >= 2) { Say(self, TRUE, world, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1); }
+                       if(argc >= 2) { Say(self, true, world, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1); }
                        return; // never fall through to usage
                }
 
@@ -635,13 +664,13 @@ void ClientCommand_tell(float request, float argc, string command)
                        if(argc >= 3)
                        {
                                entity tell_to = GetIndexedEntity(argc, 1);
-                               float tell_accepted = VerifyClientEntity(tell_to, TRUE, FALSE);
+                               float tell_accepted = VerifyClientEntity(tell_to, true, false);
 
                                if(tell_accepted > 0) // the target is a real client
                                {
                                        if(tell_to != self) // and we're allowed to send to them :D
                                        {
-                                               Say(self, FALSE, tell_to, substring(command, argv_start_index(next_token), argv_end_index(-1) - argv_start_index(next_token)), TRUE);
+                                               Say(self, false, tell_to, substring(command, argv_start_index(next_token), argv_end_index(-1) - argv_start_index(next_token)), true);
                                                return;
                                        }
                                        else { print_to(self, "You can't ^2tell^7 a message to yourself."); return; }
@@ -750,7 +779,7 @@ void ClientCommand_macro_help()
        #define CLIENT_COMMAND(name,function,description) \
                { sprint(self, "  ^2", name, "^7: ", description, "\n"); }
 
-       CLIENT_COMMANDS(0, 0, "")
+       CLIENT_COMMANDS(0, 0, "");
        #undef CLIENT_COMMAND
 
        return;
@@ -759,23 +788,23 @@ void ClientCommand_macro_help()
 float ClientCommand_macro_command(float argc, string command)
 {
        #define CLIENT_COMMAND(name,function,description) \
-               { if(name == strtolower(argv(0))) { function; return TRUE; } }
+               { if(name == strtolower(argv(0))) { function; return true; } }
 
-       CLIENT_COMMANDS(CMD_REQUEST_COMMAND, argc, command)
+       CLIENT_COMMANDS(CMD_REQUEST_COMMAND, argc, command);
        #undef CLIENT_COMMAND
 
-       return FALSE;
+       return false;
 }
 
 float ClientCommand_macro_usage(float argc)
 {
        #define CLIENT_COMMAND(name,function,description) \
-               { if(name == strtolower(argv(1))) { function; return TRUE; } }
+               { if(name == strtolower(argv(1))) { function; return true; } }
 
-       CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc, "")
+       CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc, "");
        #undef CLIENT_COMMAND
 
-       return FALSE;
+       return false;
 }
 
 void ClientCommand_macro_write_aliases(float fh)
@@ -783,7 +812,7 @@ void ClientCommand_macro_write_aliases(float fh)
        #define CLIENT_COMMAND(name,function,description) \
                { CMD_Write_Alias("qc_cmd_cmd", name, description); }
 
-       CLIENT_COMMANDS(0, 0, "")
+       CLIENT_COMMANDS(0, 0, "");
        #undef CLIENT_COMMAND
 
        return;
@@ -796,6 +825,15 @@ void ClientCommand_macro_write_aliases(float fh)
 
 void SV_ParseClientCommand(string command)
 {
+       // If invalid UTF-8, don't even parse it
+       string command2 = "";
+       float len = strlen(command);
+       float i;
+       for (i = 0; i < len; ++i)
+               command2 = strcat(command2, chr2str(str2chr(command, i)));
+       if (command != command2)
+               return;
+
        // if we're banned, don't even parse the command
        if(Ban_MaybeEnforceBanOnce(self))
                return;
@@ -826,9 +864,9 @@ void SV_ParseClientCommand(string command)
 
                default:
                        if(SV_ParseClientCommand_floodcheck())
-                               break; // "TRUE": continue, as we're not flooding yet
+                               break; // "true": continue, as we're not flooding yet
                        else
-                               return; // "FALSE": not allowed to continue, halt // print("^1ERROR: ^7ANTISPAM CAUGHT: ", command, ".\n");
+                               return; // "false": not allowed to continue, halt // print("^1ERROR: ^7ANTISPAM CAUGHT: ", command, ".\n");
        }
 
        /* NOTE: should this be disabled? It can be spammy perhaps, but hopefully it's okay for now */
index 120bf3e02ebfd3a4ab0154490d5d2114d8b60ae4..3eabab763342053c83c5dfc7a2e1e3e8d0ffb703 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef CMD_H
+#define CMD_H
+
 // =================================================
 //  Declarations for server side networked commands
 //  Last updated: December 26th, 2011
@@ -15,3 +18,4 @@ string MapVote_Suggest(string m);
 
 // used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
 void ClientCommand_macro_write_aliases(float fh);
+#endif
index c5ae7c7be069798f4cc0eff048f4d50e5633e7ac..5b7e761b7879077a18d841119ca0e0e2e4092c93 100644 (file)
@@ -1,3 +1,8 @@
+#include "common.qh"
+
+#include "../../common/counting.qh"
+
+
 // ====================================================
 //  Shared code for server commands, written by Samual
 //  Last updated: December 27th, 2011
@@ -21,6 +26,14 @@ string GetCallerName(entity caller)
                return admin_name(); //((autocvar_sv_adminnick != "") ? autocvar_sv_adminnick : autocvar_hostname);
 }
 
+// verify that the client provided is acceptable for kicking
+float VerifyKickableEntity(entity client)
+{
+       if (!IS_REAL_CLIENT(client))
+               return CLIENT_NOT_REAL;
+       return CLIENT_ACCEPTABLE;
+}
+
 // verify that the client provided is acceptable for use
 float VerifyClientEntity(entity client, float must_be_real, float must_be_bots)
 {
@@ -35,13 +48,13 @@ float VerifyClientEntity(entity client, float must_be_real, float must_be_bots)
 }
 
 // if the client is not acceptable, return a string to be used for error messages
-string GetClientErrorString(float clienterror, string original_input)
+string GetClientErrorString_color(float clienterror, string original_input, string col)
 {
        switch(clienterror)
        {
-               case CLIENT_DOESNT_EXIST: { return strcat("Client '", original_input, "' doesn't exist"); }
-               case CLIENT_NOT_REAL: { return strcat("Client '", original_input, "' is not real"); }
-               case CLIENT_NOT_BOT: { return strcat("Client '", original_input, "' is not a bot"); }
+               case CLIENT_DOESNT_EXIST: { return strcat(col, "Client '", original_input, col, "' doesn't exist"); }
+               case CLIENT_NOT_REAL: { return strcat(col, "Client '", original_input, col, "' is not real"); }
+               case CLIENT_NOT_BOT: { return strcat(col, "Client '", original_input, col, "' is not a bot"); }
                default: { return "Incorrect usage of GetClientErrorString"; }
        }
 }
@@ -50,9 +63,9 @@ string GetClientErrorString(float clienterror, string original_input)
 float VerifyClientNumber(float tmp_number)
 {
        if((tmp_number < 1) || (tmp_number > maxclients))
-               return FALSE;
+               return false;
        else
-               return TRUE;
+               return true;
 }
 
 entity GetIndexedEntity(float argc, float start_index)
@@ -196,7 +209,7 @@ void timeout_handler_think()
 
                                // unlock the view for players so they can move around again
                                FOR_EACH_REALPLAYER(tmp_player)
-                                       tmp_player.fixangle = FALSE;
+                                       tmp_player.fixangle = false;
 
                                timeout_handler_reset();
                        }
@@ -406,9 +419,7 @@ void CommonCommand_records(float request, entity caller)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       float i;
-
-                       for(i = 0; i < 10; ++i)
+                       for(int i = 0; i < 10; ++i)
                                if(records_reply[i] != "")
                                        print_to(caller, records_reply[i]);
 
@@ -456,8 +467,8 @@ void CommonCommand_time(float request, entity caller)
                        print_to(caller, strcat("realtime = ", ftos(gettime(GETTIME_REALTIME))));
                        print_to(caller, strcat("hires = ", ftos(gettime(GETTIME_HIRES))));
                        print_to(caller, strcat("uptime = ", ftos(gettime(GETTIME_UPTIME))));
-                       print_to(caller, strcat("localtime = ", strftime(TRUE, "%a %b %e %H:%M:%S %Z %Y")));
-                       print_to(caller, strcat("gmtime = ", strftime(FALSE, "%a %b %e %H:%M:%S %Z %Y")));
+                       print_to(caller, strcat("localtime = ", strftime(true, "%a %b %e %H:%M:%S %Z %Y")));
+                       print_to(caller, strcat("gmtime = ", strftime(false, "%a %b %e %H:%M:%S %Z %Y")));
                        return;
                }
 
@@ -660,70 +671,3 @@ void CommonCommand_(float request, entity caller)
        }
 }
 */
-
-
-// ==================================
-//  Macro system for common commands
-// ==================================
-
-// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-#define COMMON_COMMANDS(request,caller,arguments,command) \
-       COMMON_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, caller), "Prints a list of all changed server cvars") \
-       COMMON_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, caller), "Prints a list of all changed gameplay cvars") \
-       COMMON_COMMAND("info", CommonCommand_info(request, caller, arguments), "Request for unique server information set up by admin") \
-       COMMON_COMMAND("ladder", CommonCommand_ladder(request, caller), "Get information about top players if supported") \
-       COMMON_COMMAND("lsmaps", CommonCommand_lsmaps(request, caller), "List maps which can be used with the current game mode") \
-       COMMON_COMMAND("printmaplist", CommonCommand_printmaplist(request, caller), "Display full server maplist reply") \
-       COMMON_COMMAND("rankings", CommonCommand_rankings(request, caller), "Print information about rankings") \
-       COMMON_COMMAND("records", CommonCommand_records(request, caller), "List top 10 records for the current map") \
-       COMMON_COMMAND("teamstatus", CommonCommand_teamstatus(request, caller), "Show information about player and team scores") \
-       COMMON_COMMAND("time", CommonCommand_time(request, caller), "Print different formats/readouts of time") \
-       COMMON_COMMAND("timein", CommonCommand_timein(request, caller), "Resume the game from being paused with a timeout") \
-       COMMON_COMMAND("timeout", CommonCommand_timeout(request, caller), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
-       COMMON_COMMAND("vote", VoteCommand(request, caller, arguments, command), "Request an action to be voted upon by players") \
-       COMMON_COMMAND("who", CommonCommand_who(request, caller, arguments), "Display detailed client information about all players") \
-       /* nothing */
-
-void CommonCommand_macro_help(entity caller)
-{
-       #define COMMON_COMMAND(name,function,description) \
-               { print_to(caller, strcat("  ^2", name, "^7: ", description)); }
-
-       COMMON_COMMANDS(0, caller, 0, "")
-       #undef COMMON_COMMAND
-
-       return;
-}
-
-float CommonCommand_macro_command(float argc, entity caller, string command)
-{
-       #define COMMON_COMMAND(name,function,description) \
-               { if(name == strtolower(argv(0))) { function; return TRUE; } }
-
-       COMMON_COMMANDS(CMD_REQUEST_COMMAND, caller, argc, command)
-       #undef COMMON_COMMAND
-
-       return FALSE;
-}
-
-float CommonCommand_macro_usage(float argc, entity caller)
-{
-       #define COMMON_COMMAND(name,function,description) \
-               { if(name == strtolower(argv(1))) { function; return TRUE; } }
-
-       COMMON_COMMANDS(CMD_REQUEST_USAGE, caller, argc, "")
-       #undef COMMON_COMMAND
-
-       return FALSE;
-}
-
-void CommonCommand_macro_write_aliases(float fh)
-{
-       #define COMMON_COMMAND(name,function,description) \
-               { CMD_Write_Alias("qc_cmd_svcmd", name, description); }
-
-       COMMON_COMMANDS(0, world, 0, "")
-       #undef COMMON_COMMAND
-
-       return;
-}
index 589388bbad70d16faff12be3f5ae5dc418f0ce7b..ac99e32dc46d2583a677e3d687d6a067dde510ee 100644 (file)
@@ -1,21 +1,29 @@
+#ifndef COMMAND_COMMON_H
+#define COMMAND_COMMON_H
+
+#include "vote.qh"
+
+#include "../../common/command/generic.qh"
+#include "../../common/command/shared_defs.qh"
+
 // ============================================================
 //  Shared declarations for server commands, written by Samual
 //  Last updated: December 30th, 2011
 // ============================================================
 
 // client verification results
-#define CLIENT_ACCEPTABLE 1
-#define CLIENT_DOESNT_EXIST -1
-#define CLIENT_NOT_REAL -2
-#define CLIENT_NOT_BOT -3
+const float CLIENT_ACCEPTABLE = 1;
+const float CLIENT_DOESNT_EXIST = -1;
+const float CLIENT_NOT_REAL = -2;
+const float CLIENT_NOT_BOT = -3;
 
 // definitions for timeouts
-#define TIMEOUT_INACTIVE 0
-#define TIMEOUT_LEADTIME 1
-#define TIMEOUT_ACTIVE 2
+const float TIMEOUT_INACTIVE = 0;
+const float TIMEOUT_LEADTIME = 1;
+const float TIMEOUT_ACTIVE = 2;
 
 // timeout which pauses the game by setting the slowmo value extremely low.
-#define TIMEOUT_SLOWMO_VALUE 0.0001
+const float TIMEOUT_SLOWMO_VALUE = 0.0001;
 
 // global timeout information declarations
 entity timeout_caller; // contains the entity of the player who started the last timeout
@@ -35,4 +43,143 @@ void timeout_handler_think();
 void CommonCommand_macro_write_aliases(float fh);
 
 // keep track of the next token to use for argc
-float next_token;
\ No newline at end of file
+float next_token;
+
+// select the proper prefix for usage and other messages
+string GetCommandPrefix(entity caller);
+
+// if client return player nickname, or if server return admin nickname
+string GetCallerName(entity caller);
+
+// verify that the client provided is acceptable for kicking
+float VerifyKickableEntity(entity client);
+
+// verify that the client provided is acceptable for use
+float VerifyClientEntity(entity client, float must_be_real, float must_be_bots);
+
+// if the client is not acceptable, return a string to be used for error messages
+string GetClientErrorString_color(float clienterror, string original_input, string col);
+#define GetClientErrorString(clienterror,original_input) GetClientErrorString_color(clienterror,original_input,"^7")
+
+// is this entity number even in the possible range of entities?
+float VerifyClientNumber(float tmp_number);
+
+entity GetIndexedEntity(float argc, float start_index);
+
+// find a player which matches the input string, and return their entity
+entity GetFilteredEntity(string input);
+
+// same thing, but instead return their edict number
+float GetFilteredNumber(string input);
+
+// switch between sprint and print depending on whether the receiver is the server or a player
+void print_to(entity to, string input);
+
+// ==========================================
+//  Supporting functions for common commands
+// ==========================================
+
+// used by CommonCommand_timeout() and CommonCommand_timein() to handle game pausing and messaging and such.
+void timeout_handler_reset();
+
+void timeout_handler_think();
+
+// ===================================================
+//  Common commands used in both sv_cmd.qc and cmd.qc
+// ===================================================
+
+void CommonCommand_cvar_changes(float request, entity caller);
+
+void CommonCommand_cvar_purechanges(float request, entity caller);
+
+void CommonCommand_info(float request, entity caller, float argc);
+
+void CommonCommand_ladder(float request, entity caller);
+
+void CommonCommand_lsmaps(float request, entity caller);
+
+void CommonCommand_printmaplist(float request, entity caller);
+
+void CommonCommand_rankings(float request, entity caller);
+
+void CommonCommand_records(float request, entity caller);
+
+void CommonCommand_teamstatus(float request, entity caller);
+
+void CommonCommand_time(float request, entity caller);
+
+void CommonCommand_timein(float request, entity caller);
+
+void CommonCommand_timeout(float request, entity caller);
+
+void CommonCommand_who(float request, entity caller, float argc);
+
+
+// ==================================
+//  Macro system for common commands
+// ==================================
+
+// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
+#define COMMON_COMMANDS(request,caller,arguments,command) \
+       COMMON_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, caller), "Prints a list of all changed server cvars") \
+       COMMON_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, caller), "Prints a list of all changed gameplay cvars") \
+       COMMON_COMMAND("info", CommonCommand_info(request, caller, arguments), "Request for unique server information set up by admin") \
+       COMMON_COMMAND("ladder", CommonCommand_ladder(request, caller), "Get information about top players if supported") \
+       COMMON_COMMAND("lsmaps", CommonCommand_lsmaps(request, caller), "List maps which can be used with the current game mode") \
+       COMMON_COMMAND("printmaplist", CommonCommand_printmaplist(request, caller), "Display full server maplist reply") \
+       COMMON_COMMAND("rankings", CommonCommand_rankings(request, caller), "Print information about rankings") \
+       COMMON_COMMAND("records", CommonCommand_records(request, caller), "List top 10 records for the current map") \
+       COMMON_COMMAND("teamstatus", CommonCommand_teamstatus(request, caller), "Show information about player and team scores") \
+       COMMON_COMMAND("time", CommonCommand_time(request, caller), "Print different formats/readouts of time") \
+       COMMON_COMMAND("timein", CommonCommand_timein(request, caller), "Resume the game from being paused with a timeout") \
+       COMMON_COMMAND("timeout", CommonCommand_timeout(request, caller), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
+       COMMON_COMMAND("vote", VoteCommand(request, caller, arguments, command), "Request an action to be voted upon by players") \
+       COMMON_COMMAND("who", CommonCommand_who(request, caller, arguments), "Display detailed client information about all players") \
+       /* nothing */
+
+void CommonCommand_macro_help(entity caller)
+{
+       #define COMMON_COMMAND(name,function,description) \
+               { print_to(caller, strcat("  ^2", name, "^7: ", description)); }
+
+       COMMON_COMMANDS(0, caller, 0, "");
+       #undef COMMON_COMMAND
+
+       return;
+}
+
+float CommonCommand_macro_command(float argc, entity caller, string command)
+{
+       #define COMMON_COMMAND(name,function,description) \
+               { if(name == strtolower(argv(0))) { function; return true; } }
+
+       COMMON_COMMANDS(CMD_REQUEST_COMMAND, caller, argc, command);
+       #undef COMMON_COMMAND
+
+       return false;
+}
+
+float CommonCommand_macro_usage(float argc, entity caller)
+{
+       #define COMMON_COMMAND(name,function,description) \
+               { if(name == strtolower(argv(1))) { function; return true; } }
+
+       COMMON_COMMANDS(CMD_REQUEST_USAGE, caller, argc, "");
+       #undef COMMON_COMMAND
+
+       return false;
+}
+
+void CommonCommand_macro_write_aliases(float fh)
+{
+       #define COMMON_COMMAND(name,function,description) \
+               { CMD_Write_Alias("qc_cmd_svcmd", name, description); }
+
+       COMMON_COMMANDS(0, world, 0, "");
+       #undef COMMON_COMMAND
+
+       return;
+}
+
+
+#endif
index b777990338cca615706b0f1bd7b5390f55909d37..aa8efd6d69a15934416371d6066b76c419bfc212 100644 (file)
@@ -1,3 +1,18 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/util.qh"
+    #include "../../common/counting.qh"
+    #include "../../common/monsters/monsters.qh"
+    #include "../defs.qh"
+    #include "../../common/mapinfo.qh"
+    #include "getreplies.qh"
+    #include "../race.qh"
+#endif
+
 // =========================================================
 //  Reply messages for common commands, re-worked by Samual
 //  Last updated: December 30th, 2011
@@ -110,7 +125,7 @@ string getrankings()
 
 string getladder()
 {
-       float i, j, k, uidcnt = 0, thiscnt;
+       int i, j, k, uidcnt = 0, thiscnt;
        string s, temp_s, rr, myuid, thisuid;
 
        rr = (g_cts) ? CTS_RECORD : RACE_RECORD;
@@ -286,7 +301,7 @@ string getladder()
 string getmaplist()
 {
        string maplist = "", col;
-       float i, argc;
+       int i, argc;
 
        argc = tokenize_console(autocvar_g_maplist);
        for(i = 0; i < argc; ++i)
@@ -320,7 +335,7 @@ string getlsmaps()
                                (g_cts && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, CTS_RECORD, "time"))))
                        )
                        {
-                               newmaps = TRUE;
+                               newmaps = true;
                                if(i % 2) { col = "^4*"; }
                                else { col = "^5*"; }
                        }
@@ -341,9 +356,8 @@ string getlsmaps()
 string getmonsterlist()
 {
        string monsterlist = "", col;
-       float i;
 
-       for(i = MON_FIRST; i <= MON_LAST; ++i)
+       for(int i = MON_FIRST; i <= MON_LAST; ++i)
        {
                if(i % 2) { col = "^2"; }
                else { col = "^3"; }
index 583961d2246db10ce3907b411672100a92589b93..0e419fdea3ca94a327d90843bbfeb7cdfa8380e6 100644 (file)
@@ -1,12 +1,15 @@
+#ifndef GETREPLIES_H
+#define GETREPLIES_H
+
 // ======================================================
 //  Declarations for reply messages, re-worked by Samual
 //  Last updated: December 30th, 2011
 // ======================================================
 
 // ladder bullshit todo
-#define LADDER_FIRSTPOINT 100
+const int LADDER_FIRSTPOINT = 100;
 #define LADDER_CNT 10 // position X still gives LADDER_FIRSTPOINT/X points
-#define LADDER_SIZE 30         // ladder shows the top X players
+const int LADDER_SIZE = 30;    // ladder shows the top X players
 
 string top_uids[LADDER_SIZE];
 float top_scores[LADDER_SIZE];
@@ -18,3 +21,4 @@ string getladder(void);
 string getmaplist(void);
 string getlsmaps(void);
 string getmonsterlist(void);
+#endif
index f2205b68d5a5a8c8b26706c94364df72de9233b8..73e5108795525bd072c60cc5bd86bcd58cc25da5 100644 (file)
@@ -1,3 +1,14 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../common/util.qh"
+    #include "../defs.qh"
+    #include "radarmap.qh"
+    #include "../../csqcmodellib/sv_model.qh"
+#endif
+
 // ===============================================
 //     Generates radar map images for use in the HUD
 // ===============================================
@@ -28,7 +39,7 @@ float FullTraceFraction(vector a, vector mi, vector ma, vector b)
                        c = trace_endpos;
                }
 
-               n += tracebox_inverted(c, mi, ma, b, MOVE_WORLDONLY, world, FALSE, world);
+               n += tracebox_inverted(c, mi, ma, b, MOVE_WORLDONLY, world, false, world);
 
                white += vlen(trace_endpos - c);
                c = trace_endpos;
@@ -64,13 +75,13 @@ float RadarMapAtPoint_LineBlock(float x, float y, float w, float h, float zmin,
        ma = '1 0 0' * w + '0 1 0' * h + dz;
        o = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin;
 
-       if(x < world.absmin_x - w)
+       if(x < world.absmin.x - w)
                return 0;
-       if(y < world.absmin_y - h)
+       if(y < world.absmin.y - h)
                return 0;
-       if(x > world.absmax_x)
+       if(x > world.absmax.x)
                return 0;
-       if(y > world.absmax_y)
+       if(y > world.absmax.y)
                return 0;
 
        r = 0;
@@ -78,12 +89,12 @@ float RadarMapAtPoint_LineBlock(float x, float y, float w, float h, float zmin,
        {
                vector v1, v2;
                v1 = v2 = o + dz * i + mi;
-               v1_x += random() * (ma_x - mi_x);
-               v1_y += random() * (ma_y - mi_y);
-               v1_z += random() * (ma_z - mi_z);
-               v2_x += random() * (ma_x - mi_x);
-               v2_y += random() * (ma_y - mi_y);
-               v2_z += random() * (ma_z - mi_z);
+               v1_x += random() * (ma.x - mi.x);
+               v1_y += random() * (ma.y - mi.y);
+               v1_z += random() * (ma.z - mi.z);
+               v2_x += random() * (ma.x - mi.x);
+               v2_y += random() * (ma.y - mi.y);
+               v2_z += random() * (ma.z - mi.z);
                traceline(v1, v2, MOVE_WORLDONLY, world);
                if(trace_startsolid || trace_fraction < 1)
                        ++r;
@@ -104,13 +115,13 @@ float RadarMapAtPoint_Block(float x, float y, float w, float h, float zmin, floa
        ma = '1 0 0' * w + '0 1 0' * h + dz;
        o = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin;
 
-       if(x < world.absmin_x - w)
+       if(x < world.absmin.x - w)
                return 0;
-       if(y < world.absmin_y - h)
+       if(y < world.absmin.y - h)
                return 0;
-       if(x > world.absmax_x)
+       if(x > world.absmax.x)
                return 0;
-       if(y > world.absmax_y)
+       if(y > world.absmax.y)
                return 0;
 
        r = 0;
@@ -142,9 +153,9 @@ float RadarMapAtPoint_Sample(float x, float y, float w, float h, float zmin, flo
        for(i = 0; i < q; ++i)
        {
                vector v;
-               v_x = a_x + random() * b_x;
-               v_y = a_y + random() * b_y;
-               v_z = a_z + random() * b_z;
+               v.x = a.x + random() * b.x;
+               v.y = a.y + random() * b.y;
+               v.z = a.z + random() * b.z;
                traceline(v, v, MOVE_WORLDONLY, world);
                if(trace_startsolid)
                        ++c;
@@ -152,7 +163,7 @@ float RadarMapAtPoint_Sample(float x, float y, float w, float h, float zmin, flo
 
        return c / q;
 }
-void sharpen_set(float x, float v)
+void sharpen_set(int x, float v)
 {
        sharpen_buffer[x + 2 * RADAR_WIDTH_MAX] = v;
 }
@@ -170,8 +181,7 @@ float sharpen_getpixel(float x, float y)
 }
 float sharpen_get(float x, float a)
 {
-       float sum;
-       sum = sharpen_getpixel(x, 1);
+       float sum = sharpen_getpixel(x, 1);
        if(a == 0)
                return sum;
        sum *= (8 + 1/a);
@@ -185,20 +195,18 @@ float sharpen_get(float x, float a)
        sum -= sharpen_getpixel(x, 2);
        return bound(0, sum * a, 1);
 }
-void sharpen_shift(float w)
+void sharpen_shift(int w)
 {
-       float i;
-       for(i = 0; i < w; ++i)
+       for(int i = 0; i < w; ++i)
        {
                sharpen_buffer[i] = sharpen_buffer[i + RADAR_WIDTH_MAX];
                sharpen_buffer[i + RADAR_WIDTH_MAX] = sharpen_buffer[i + 2 * RADAR_WIDTH_MAX];
                sharpen_buffer[i + 2 * RADAR_WIDTH_MAX] = 0;
        }
 }
-void sharpen_init(float w)
+void sharpen_init(int w)
 {
-       float i;
-       for(i = 0; i < w; ++i)
+       for(int i = 0; i < w; ++i)
        {
                sharpen_buffer[i] = 0;
                sharpen_buffer[i + RADAR_WIDTH_MAX] = 0;
@@ -213,7 +221,7 @@ void RadarMap_Next()
        }
        else if(radarmapper.count & 2)
        {
-               localcmd(strcat("defer 1 \"sv_cmd radarmap --flags ", ftos(radarmapper.count), strcat(" --res ", ftos(radarmapper.size_x), " ", ftos(radarmapper.size_y), " --sharpen ", ftos(radarmapper.ltime), " --qual ", ftos(radarmapper.size_z)), "\"\n"));
+               localcmd(strcat("defer 1 \"sv_cmd radarmap --flags ", ftos(radarmapper.count), strcat(" --res ", ftos(radarmapper.size.x), " ", ftos(radarmapper.size.y), " --sharpen ", ftos(radarmapper.ltime), " --qual ", ftos(radarmapper.size.z)), "\"\n"));
                GotoNextMap(0);
        }
        remove(radarmapper);
@@ -235,10 +243,10 @@ void RadarMap_Think()
                // initialize
                get_mi_min_max_texcoords(1);
                self.mins = mi_picmin;
-               self.maxs_x = (mi_picmax_x - mi_picmin_x) / self.size_x;
-               self.maxs_y = (mi_picmax_y - mi_picmin_y) / self.size_y;
-               self.maxs_z = mi_max_z - mi_min_z;
-               print("Picture mins/maxs: ", ftos(self.maxs_x), " and ", ftos(self.maxs_y), " should match\n");
+               self.maxs_x = (mi_picmax.x - mi_picmin.x) / self.size.x;
+               self.maxs_y = (mi_picmax.y - mi_picmin.y) / self.size.y;
+               self.maxs_z = mi_max.z - mi_min.z;
+               print("Picture mins/maxs: ", ftos(self.maxs.x), " and ", ftos(self.maxs.y), " should match\n");
                self.netname = strzone(strcat("gfx/", mi_shortname, "_radar.xpm"));
                if(!(self.count & 1))
                {
@@ -276,7 +284,7 @@ void RadarMap_Think()
                fputs(self.cnt, "/* XPM */\n");
                fputs(self.cnt, "static char *RadarMap[] = {\n");
                fputs(self.cnt, "/* columns rows colors chars-per-pixel */\n");
-               fputs(self.cnt, strcat("\"", ftos(self.size_x), " ", ftos(self.size_y), " 256 2\",\n"));
+               fputs(self.cnt, strcat("\"", ftos(self.size.x), " ", ftos(self.size.y), " 256 2\",\n"));
                for(i = 0; i < 256; ++i)
                {
                        si = substring(doublehex, i*2, 2);
@@ -284,42 +292,42 @@ void RadarMap_Think()
                }
                self.frame += 1;
                self.nextthink = time;
-               sharpen_init(self.size_x);
+               sharpen_init(self.size.x);
        }
-       else if(self.frame <= self.size_y)
+       else if(self.frame <= self.size.y)
        {
                // fill the sharpen buffer with this line
-               sharpen_shift(self.size_x);
+               sharpen_shift(self.size.x);
                i = self.count & 24;
 
                switch(i)
                {
                        case 0:
                        default:
-                               for(x = 0; x < self.size_x; ++x)
+                               for(x = 0; x < self.size.x; ++x)
                                {
-                                       l = RadarMapAtPoint_Block(self.mins_x + x * self.maxs_x, self.mins_y + (self.size_y - self.frame) * self.maxs_y, self.maxs_x, self.maxs_y, self.mins_z, self.maxs_z, self.size_z);
+                                       l = RadarMapAtPoint_Block(self.mins.x + x * self.maxs.x, self.mins.y + (self.size.y - self.frame) * self.maxs.y, self.maxs.x, self.maxs.y, self.mins.z, self.maxs.z, self.size.z);
                                        sharpen_set(x, l);
                                }
                                break;
                        case 8:
-                               for(x = 0; x < self.size_x; ++x)
+                               for(x = 0; x < self.size.x; ++x)
                                {
-                                       l = RadarMapAtPoint_Trace(self.mins_x + x * self.maxs_x, self.mins_y + (self.size_y - self.frame) * self.maxs_y, self.maxs_x, self.maxs_y, self.mins_z, self.maxs_z, self.size_z);
+                                       l = RadarMapAtPoint_Trace(self.mins.x + x * self.maxs.x, self.mins.y + (self.size.y - self.frame) * self.maxs.y, self.maxs.x, self.maxs.y, self.mins.z, self.maxs.z, self.size.z);
                                        sharpen_set(x, l);
                                }
                                break;
                        case 16:
-                               for(x = 0; x < self.size_x; ++x)
+                               for(x = 0; x < self.size.x; ++x)
                                {
-                                       l = RadarMapAtPoint_Sample(self.mins_x + x * self.maxs_x, self.mins_y + (self.size_y - self.frame) * self.maxs_y, self.maxs_x, self.maxs_y, self.mins_z, self.maxs_z, self.size_z);
+                                       l = RadarMapAtPoint_Sample(self.mins.x + x * self.maxs.x, self.mins.y + (self.size.y - self.frame) * self.maxs.y, self.maxs.x, self.maxs.y, self.mins.z, self.maxs.z, self.size.z);
                                        sharpen_set(x, l);
                                }
                                break;
                        case 24:
-                               for(x = 0; x < self.size_x; ++x)
+                               for(x = 0; x < self.size.x; ++x)
                                {
-                                       l = RadarMapAtPoint_LineBlock(self.mins_x + x * self.maxs_x, self.mins_y + (self.size_y - self.frame) * self.maxs_y, self.maxs_x, self.maxs_y, self.mins_z, self.maxs_z, self.size_z);
+                                       l = RadarMapAtPoint_LineBlock(self.mins.x + x * self.maxs.x, self.mins.y + (self.size.y - self.frame) * self.maxs.y, self.maxs.x, self.maxs.y, self.mins.z, self.maxs.z, self.size.z);
                                        sharpen_set(x, l);
                                }
                                break;
@@ -330,37 +338,37 @@ void RadarMap_Think()
                {
                        // write a pixel line
                        fputs(self.cnt, "\"");
-                       for(x = 0; x < self.size_x; ++x)
+                       for(x = 0; x < self.size.x; ++x)
                        {
                                l = sharpen_get(x, self.ltime);
                                fputs(self.cnt, substring(doublehex, 2 * floor(l * 256.0), 2));
                        }
-                       if(self.frame == self.size_y)
+                       if(self.frame == self.size.y)
                                fputs(self.cnt, "\"\n");
                        else
                        {
                                fputs(self.cnt, "\",\n");
-                               print(ftos(self.size_y - self.frame), " lines left\n");
+                               print(ftos(self.size.y - self.frame), " lines left\n");
                        }
                }
 
                // is this the last line? then write back the missing line
-               if(self.frame == self.size_y)
+               if(self.frame == self.size.y)
                {
-                       sharpen_shift(self.size_x);
+                       sharpen_shift(self.size.x);
                        // write a pixel line
                        fputs(self.cnt, "\"");
-                       for(x = 0; x < self.size_x; ++x)
+                       for(x = 0; x < self.size.x; ++x)
                        {
                                l = sharpen_get(x, self.ltime);
                                fputs(self.cnt, substring(doublehex, 2 * floor(l * 256.0), 2));
                        }
-                       if(self.frame == self.size_y)
+                       if(self.frame == self.size.y)
                                fputs(self.cnt, "\"\n");
                        else
                        {
                                fputs(self.cnt, "\",\n");
-                               print(ftos(self.size_y - self.frame), " lines left\n");
+                               print(ftos(self.size.y - self.frame), " lines left\n");
                        }
                }
 
@@ -419,9 +427,9 @@ float RadarMap_Make(float argc)
                if(radarmapper) // after doing the arguments, see if we successfully went forward.
                {
                        print("Radarmap entity spawned.\n");
-                       return TRUE; // if so, don't print usage.
+                       return true; // if so, don't print usage.
                }
        }
 
-       return FALSE;
+       return false;
 }
index 706de70722d306c707ec6015c57e25fdf26fe581..c2b068c7d1a9f2a01e86f8dcf9b5531ab2fc702d 100644 (file)
@@ -1,13 +1,17 @@
+#ifndef RADARMAP_H
+#define RADARMAP_H
+
 // ===========================================
 //     Declarations for radarmap generation code
 // ===========================================
 
 entity radarmapper;
 
-const float RADAR_WIDTH_MAX = 512;
-const float RADAR_HEIGHT_MAX = 512;
+const int RADAR_WIDTH_MAX = 512;
+const int RADAR_HEIGHT_MAX = 512;
 float sharpen_buffer[RADAR_WIDTH_MAX * 3];
 
 string doublehex = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFFFF";
 // FF is contained twice, to map 256 to FF too
 // removes the need to bound()
+#endif
index 27ed6b8694e16ce8406b98b76cb7d95f020a19f7..7166ab7cfd1156b9377724ac6f2586e591f24872 100644 (file)
@@ -1,3 +1,26 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../warpzonelib/mathlib.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/teams.qh"
+    #include "../../common/util.qh"
+    #include "../../common/command/shared_defs.qh"
+    #include "../../common/monsters/sv_monsters.qh"
+    #include "../autocvars.qh"
+    #include "../defs.qh"
+    #include "../../common/notifications.qh"
+    #include "../mutators/mutators_include.qh"
+    #include "../../common/mapinfo.qh"
+    #include "common.qh"
+    #include "cmd.qh"
+    #include "sv_cmd.qh"
+    #include "../anticheat.qh"
+    #include "../playerdemo.qh"
+#endif
+
 // =====================================================
 //  Server side game commands code, reworked by Samual
 //  Last updated: December 29th, 2011
@@ -85,13 +108,13 @@ void GameCommand_adminmsg(float request, float argc)
 
                        if((targets) && (admin_message))
                        {
-                               for(;targets;)
+                               for (;targets;)
                                {
                                        t = car(targets); targets = cdr(targets);
 
                                        // Check to see if the player is a valid target
                                        client = GetFilteredEntity(t);
-                                       accepted = VerifyClientEntity(client, TRUE, FALSE);
+                                       accepted = VerifyClientEntity(client, true, false);
 
                                        if(accepted <= 0)
                                        {
@@ -241,7 +264,7 @@ void GameCommand_anticheat(float request, float argc)
                case CMD_REQUEST_COMMAND:
                {
                        entity client = GetIndexedEntity(argc, 1);
-                       float accepted = VerifyClientEntity(client, FALSE, FALSE);
+                       float accepted = VerifyClientEntity(client, false, false);
 
                        if(accepted > 0)
                        {
@@ -272,77 +295,77 @@ void GameCommand_bbox(float request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       print("Original size: ", ftos(world.absmin_x), " ", ftos(world.absmin_y), " ", ftos(world.absmin_z));
-                       print(" ", ftos(world.absmax_x), " ", ftos(world.absmax_y), " ", ftos(world.absmax_z), "\n");
-                       print("Currently set size: ", ftos(world.mins_x), " ", ftos(world.mins_y), " ", ftos(world.mins_z));
-                       print(" ", ftos(world.maxs_x), " ", ftos(world.maxs_y), " ", ftos(world.maxs_z), "\n");
+                       print("Original size: ", ftos(world.absmin.x), " ", ftos(world.absmin.y), " ", ftos(world.absmin.z));
+                       print(" ", ftos(world.absmax.x), " ", ftos(world.absmax.y), " ", ftos(world.absmax.z), "\n");
+                       print("Currently set size: ", ftos(world.mins.x), " ", ftos(world.mins.y), " ", ftos(world.mins.z));
+                       print(" ", ftos(world.maxs.x), " ", ftos(world.maxs.y), " ", ftos(world.maxs.z), "\n");
                        print("Solid bounding box size:");
 
-                       tracebox('1 0 0' * world.absmin_x,
-                                                       '0 1 0' * world.absmin_y + '0 0 1' * world.absmin_z,
-                                                       '0 1 0' * world.absmax_y + '0 0 1' * world.absmax_z,
-                                                       '1 0 0' * world.absmax_x,
+                       tracebox('1 0 0' * world.absmin.x,
+                                                       '0 1 0' * world.absmin.y + '0 0 1' * world.absmin.z,
+                                                       '0 1 0' * world.absmax.y + '0 0 1' * world.absmax.z,
+                                                       '1 0 0' * world.absmax.x,
                                        MOVE_WORLDONLY,
                                        world);
                        if(trace_startsolid)
-                               print(" ", ftos(world.absmin_x));
+                               print(" ", ftos(world.absmin.x));
                        else
-                               print(" ", ftos(trace_endpos_x));
+                               print(" ", ftos(trace_endpos.x));
 
-                       tracebox('0 1 0' * world.absmin_y,
-                                                       '1 0 0' * world.absmin_x + '0 0 1' * world.absmin_z,
-                                                       '1 0 0' * world.absmax_x + '0 0 1' * world.absmax_z,
-                                                       '0 1 0' * world.absmax_y,
+                       tracebox('0 1 0' * world.absmin.y,
+                                                       '1 0 0' * world.absmin.x + '0 0 1' * world.absmin.z,
+                                                       '1 0 0' * world.absmax.x + '0 0 1' * world.absmax.z,
+                                                       '0 1 0' * world.absmax.y,
                                        MOVE_WORLDONLY,
                                        world);
                        if(trace_startsolid)
-                               print(" ", ftos(world.absmin_y));
+                               print(" ", ftos(world.absmin.y));
                        else
-                               print(" ", ftos(trace_endpos_y));
+                               print(" ", ftos(trace_endpos.y));
 
-                       tracebox('0 0 1' * world.absmin_z,
-                                                       '1 0 0' * world.absmin_x + '0 1 0' * world.absmin_y,
-                                                       '1 0 0' * world.absmax_x + '0 1 0' * world.absmax_y,
-                                                       '0 0 1' * world.absmax_z,
+                       tracebox('0 0 1' * world.absmin.z,
+                                                       '1 0 0' * world.absmin.x + '0 1 0' * world.absmin.y,
+                                                       '1 0 0' * world.absmax.x + '0 1 0' * world.absmax.y,
+                                                       '0 0 1' * world.absmax.z,
                                        MOVE_WORLDONLY,
                                        world);
                        if(trace_startsolid)
-                               print(" ", ftos(world.absmin_z));
+                               print(" ", ftos(world.absmin.z));
                        else
-                               print(" ", ftos(trace_endpos_z));
+                               print(" ", ftos(trace_endpos.z));
 
-                       tracebox('1 0 0' * world.absmax_x,
-                                                       '0 1 0' * world.absmin_y + '0 0 1' * world.absmin_z,
-                                                       '0 1 0' * world.absmax_y + '0 0 1' * world.absmax_z,
-                                                       '1 0 0' * world.absmin_x,
+                       tracebox('1 0 0' * world.absmax.x,
+                                                       '0 1 0' * world.absmin.y + '0 0 1' * world.absmin.z,
+                                                       '0 1 0' * world.absmax.y + '0 0 1' * world.absmax.z,
+                                                       '1 0 0' * world.absmin.x,
                                        MOVE_WORLDONLY,
                                        world);
                        if(trace_startsolid)
-                               print(" ", ftos(world.absmax_x));
+                               print(" ", ftos(world.absmax.x));
                        else
-                               print(" ", ftos(trace_endpos_x));
+                               print(" ", ftos(trace_endpos.x));
 
-                       tracebox('0 1 0' * world.absmax_y,
-                                                       '1 0 0' * world.absmin_x + '0 0 1' * world.absmin_z,
-                                                       '1 0 0' * world.absmax_x + '0 0 1' * world.absmax_z,
-                                                       '0 1 0' * world.absmin_y,
+                       tracebox('0 1 0' * world.absmax.y,
+                                                       '1 0 0' * world.absmin.x + '0 0 1' * world.absmin.z,
+                                                       '1 0 0' * world.absmax.x + '0 0 1' * world.absmax.z,
+                                                       '0 1 0' * world.absmin.y,
                                        MOVE_WORLDONLY,
                                        world);
                        if(trace_startsolid)
-                               print(" ", ftos(world.absmax_y));
+                               print(" ", ftos(world.absmax.y));
                        else
-                               print(" ", ftos(trace_endpos_y));
+                               print(" ", ftos(trace_endpos.y));
 
-                       tracebox('0 0 1' * world.absmax_z,
-                                                       '1 0 0' * world.absmin_x + '0 1 0' * world.absmin_y,
-                                                       '1 0 0' * world.absmax_x + '0 1 0' * world.absmax_y,
-                                                       '0 0 1' * world.absmin_z,
+                       tracebox('0 0 1' * world.absmax.z,
+                                                       '1 0 0' * world.absmin.x + '0 1 0' * world.absmin.y,
+                                                       '1 0 0' * world.absmax.x + '0 1 0' * world.absmax.y,
+                                                       '0 0 1' * world.absmin.z,
                                        MOVE_WORLDONLY,
                                        world);
                        if(trace_startsolid)
-                               print(" ", ftos(world.absmax_z));
+                               print(" ", ftos(world.absmax.z));
                        else
-                               print(" ", ftos(trace_endpos_z));
+                               print(" ", ftos(trace_endpos.z));
 
                        print("\n");
                        return;
@@ -481,7 +504,7 @@ void GameCommand_cointoss(float request, float argc)
                        string result1 = (argv(2) ? strcat("^7", argv(1)) : "^1HEADS");
                        string result2 = (argv(2) ? strcat("^7", argv(2)) : "^4TAILS");
                        string choice = ((random() > 0.5) ? result1 : result2);
-                       
+
                        Send_Notification(NOTIF_ALL, world, MSG_MULTI, MULTI_COINTOSS, choice);
                        return;
                }
@@ -551,7 +574,7 @@ void GameCommand_defer_clear(float request, float argc)
                        if(argc >= 2)
                        {
                                client = GetIndexedEntity(argc, 1);
-                               accepted = VerifyClientEntity(client, TRUE, FALSE);
+                               accepted = VerifyClientEntity(client, true, false);
 
                                if(accepted > 0)
                                {
@@ -838,14 +861,14 @@ void GameCommand_gettaginfo(float request, float argc)
                                        v = gettaginfo(tmp_entity, i);
                                        print("model ", tmp_entity.model, " frame ", ftos(tmp_entity.frame), " tag ", gettaginfo_name);
                                        print(" index ", ftos(i), " parent ", ftos(gettaginfo_parent), "\n");
-                                       print(" vector = ", ftos(v_x), " ", ftos(v_y), " ", ftos(v_z), "\n");
-                                       print(" offset = ", ftos(gettaginfo_offset_x), " ", ftos(gettaginfo_offset_y), " ", ftos(gettaginfo_offset_z), "\n");
-                                       print(" forward = ", ftos(gettaginfo_forward_x), " ", ftos(gettaginfo_forward_y), " ", ftos(gettaginfo_forward_z), "\n");
-                                       print(" right = ", ftos(gettaginfo_right_x), " ", ftos(gettaginfo_right_y), " ", ftos(gettaginfo_right_z), "\n");
-                                       print(" up = ", ftos(gettaginfo_up_x), " ", ftos(gettaginfo_up_y), " ", ftos(gettaginfo_up_z), "\n");
+                                       print(" vector = ", ftos(v.x), " ", ftos(v.y), " ", ftos(v.z), "\n");
+                                       print(" offset = ", ftos(gettaginfo_offset.x), " ", ftos(gettaginfo_offset.y), " ", ftos(gettaginfo_offset.z), "\n");
+                                       print(" forward = ", ftos(gettaginfo_forward.x), " ", ftos(gettaginfo_forward.y), " ", ftos(gettaginfo_forward.z), "\n");
+                                       print(" right = ", ftos(gettaginfo_right.x), " ", ftos(gettaginfo_right.y), " ", ftos(gettaginfo_right.z), "\n");
+                                       print(" up = ", ftos(gettaginfo_up.x), " ", ftos(gettaginfo_up.y), " ", ftos(gettaginfo_up.z), "\n");
                                        if(argc >= 6)
                                        {
-                                               v_y = -v_y;
+                                               v.y = -v.y;
                                                localcmd(strcat(argv(4), vtos(v), argv(5), "\n"));
                                        }
                                }
@@ -1024,13 +1047,13 @@ void GameCommand_moveplayer(float request, float argc)
                        // lets see if the target(s) even actually exist.
                        if((targets) && (destination))
                        {
-                               for(;targets;)
+                               for (;targets;)
                                {
                                        t = car(targets); targets = cdr(targets);
 
                                        // Check to see if the player is a valid target
                                        client = GetFilteredEntity(t);
-                                       accepted = VerifyClientEntity(client, FALSE, FALSE);
+                                       accepted = VerifyClientEntity(client, false, false);
 
                                        if(accepted <= 0)
                                        {
@@ -1078,7 +1101,7 @@ void GameCommand_moveplayer(float request, float argc)
                                                                else if(team_id == 0)  // auto team
                                                                {
                                                                        CheckAllowedTeams(client);
-                                                                       team_id = Team_NumberToTeam(FindSmallestTeam(client, FALSE));
+                                                                       team_id = Team_NumberToTeam(FindSmallestTeam(client, false));
                                                                }
                                                                else
                                                                {
@@ -1190,7 +1213,7 @@ void GameCommand_playerdemo(float request, float argc)
                                        case "read":
                                        {
                                                client = GetIndexedEntity(argc, 2);
-                                               accepted = VerifyClientEntity(client, FALSE, TRUE);
+                                               accepted = VerifyClientEntity(client, false, true);
 
                                                if(accepted <= 0)
                                                {
@@ -1206,7 +1229,7 @@ void GameCommand_playerdemo(float request, float argc)
                                        case "write":
                                        {
                                                client = GetIndexedEntity(argc, 2);
-                                               accepted = VerifyClientEntity(client, FALSE, FALSE);
+                                               accepted = VerifyClientEntity(client, false, false);
 
                                                if(accepted <= 0)
                                                {
@@ -1261,7 +1284,7 @@ void GameCommand_printstats(float request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       DumpStats(FALSE);
+                       DumpStats(false);
                        print("stats dumped.\n");
                        return;
                }
@@ -1356,7 +1379,8 @@ void GameCommand_shuffleteams(float request)
                        if(teamplay)
                        {
                                entity tmp_player;
-                               float i, x, z, t_teams, t_players, team_color;
+                               int i;
+                               float x, z, t_teams, t_players, team_color;
 
                                // count the total amount of players and total amount of teams
                                t_players = 0;
@@ -1376,7 +1400,7 @@ void GameCommand_shuffleteams(float request)
                                // build a list of the players in a random order
                                FOR_EACH_PLAYER(tmp_player)
                                {
-                                       for(;;)
+                                       for (;;)
                                        {
                                                i = bound(1, floor(random() * maxclients) + 1, maxclients);
 
@@ -1468,7 +1492,7 @@ void GameCommand_stuffto(float request, float argc)
                        if(argv(2))
                        {
                                entity client = GetIndexedEntity(argc, 1);
-                               float accepted = VerifyClientEntity(client, TRUE, FALSE);
+                               float accepted = VerifyClientEntity(client, true, false);
 
                                if(accepted > 0)
                                {
@@ -1518,18 +1542,18 @@ void GameCommand_trace(float request, float argc)
                                        float hitcount = 0;
                                        print("TEST CASE. If this returns the runaway loop counter error, possibly everything is oaky.\n");
                                        float worst_endpos_bug = 0;
-                                       for(;;)
+                                       for (;;)
                                        {
                                                org = world.mins;
                                                delta = world.maxs - world.mins;
 
-                                               start_x = org_x + random() * delta_x;
-                                               start_y = org_y + random() * delta_y;
-                                               start_z = org_z + random() * delta_z;
+                                               start.x = org.x + random() * delta.x;
+                                               start.y = org.y + random() * delta.y;
+                                               start.z = org.z + random() * delta.z;
 
-                                               end_x = org_x + random() * delta_x;
-                                               end_y = org_y + random() * delta_y;
-                                               end_z = org_z + random() * delta_z;
+                                               end.x = org.x + random() * delta.x;
+                                               end.y = org.y + random() * delta.y;
+                                               end.z = org.z + random() * delta.z;
 
                                                start = stov(vtos(start));
                                                end = stov(vtos(end));
@@ -1547,7 +1571,7 @@ void GameCommand_trace(float request, float argc)
                                                                // how much do we need to back off?
                                                                safe = 1;
                                                                unsafe = 0;
-                                                               for(;;)
+                                                               for (;;)
                                                                {
                                                                        pos = p * (1 - (safe + unsafe) * 0.5) + start * ((safe + unsafe) * 0.5);
                                                                        tracebox(pos, PL_MIN, PL_MAX, pos, MOVE_NOMONSTERS, world);
@@ -1581,7 +1605,7 @@ void GameCommand_trace(float request, float argc)
                                                                q0 = p;
                                                                dq = 0;
                                                                dqf = 1;
-                                                               for(;;)
+                                                               for (;;)
                                                                {
                                                                        q = p + normalize(end - p) * (dq + dqf);
                                                                        if(q == q0)
@@ -1622,17 +1646,17 @@ void GameCommand_trace(float request, float argc)
                                        for(i = 0; i < 100000; ++i)
                                        {
                                                dv = randomvec();
-                                               if(dv_z > 0)
+                                               if(dv.z > 0)
                                                        dv = -1 * dv;
                                                tracebox(vv, e.mins, e.maxs, vv + dv, MOVE_NORMAL, e);
                                                if(trace_startsolid)
                                                        print("bug 1\n");
                                                if(trace_fraction == 1)
-                                               if(dv_z < f)
+                                               if(dv.z < f)
                                                {
-                                                       print("bug 2: ", ftos(dv_x), " ", ftos(dv_y), " ", ftos(dv_z));
-                                                       print(" (", ftos(asin(dv_z / vlen(dv)) * 180 / M_PI), " degrees)\n");
-                                                       f = dv_z;
+                                                       print("bug 2: ", ftos(dv.x), " ", ftos(dv.y), " ", ftos(dv.z));
+                                                       print(" (", ftos(asin(dv.z / vlen(dv)) * 180 / M_PI), " degrees)\n");
+                                                       f = dv.z;
                                                }
                                        }
                                        print("highest possible dist: ", ftos(f), "\n");
@@ -1815,7 +1839,7 @@ void GameCommand_macro_help()
        #define SERVER_COMMAND(name,function,description) \
                { print("  ^2", name, "^7: ", description, "\n"); }
 
-       SERVER_COMMANDS(0, 0, "")
+       SERVER_COMMANDS(0, 0, "");
        #undef SERVER_COMMAND
 
        return;
@@ -1824,23 +1848,23 @@ void GameCommand_macro_help()
 float GameCommand_macro_command(float argc, string command)
 {
        #define SERVER_COMMAND(name,function,description) \
-               { if(name == strtolower(argv(0))) { function; return TRUE; } }
+               { if(name == strtolower(argv(0))) { function; return true; } }
 
-       SERVER_COMMANDS(CMD_REQUEST_COMMAND, argc, command)
+       SERVER_COMMANDS(CMD_REQUEST_COMMAND, argc, command);
        #undef SERVER_COMMAND
 
-       return FALSE;
+       return false;
 }
 
 float GameCommand_macro_usage(float argc)
 {
        #define SERVER_COMMAND(name,function,description) \
-               { if(name == strtolower(argv(1))) { function; return TRUE; } }
+               { if(name == strtolower(argv(1))) { function; return true; } }
 
-       SERVER_COMMANDS(CMD_REQUEST_USAGE, argc, "")
+       SERVER_COMMANDS(CMD_REQUEST_USAGE, argc, "");
        #undef SERVER_COMMAND
 
-       return FALSE;
+       return false;
 }
 
 void GameCommand_macro_write_aliases(float fh)
@@ -1848,7 +1872,7 @@ void GameCommand_macro_write_aliases(float fh)
        #define SERVER_COMMAND(name,function,description) \
                { CMD_Write_Alias("qc_cmd_sv", name, description); }
 
-       SERVER_COMMANDS(0, 0, "")
+       SERVER_COMMANDS(0, 0, "");
        #undef SERVER_COMMAND
 
        return;
index 03bd80cefc2f71fea3ddcdb4d7cbaa60bef1b2be..0cc520c2e402e21d6bed78e35a94365b9a6033ab 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef SV_CMD_H
+#define SV_CMD_H
+
 // =================================================
 //  Declarations for server side game commands
 //  Last updated: December 25th, 2011
@@ -7,10 +10,11 @@ string GotoMap(string m);
 
 void race_deleteTime(string map, float pos);
 
-#define SHUFFLETEAMS_MAX_PLAYERS 255
-#define SHUFFLETEAMS_MAX_TEAMS 4
+const float SHUFFLETEAMS_MAX_PLAYERS = 255;
+const float SHUFFLETEAMS_MAX_TEAMS = 4;
 float shuffleteams_players[SHUFFLETEAMS_MAX_PLAYERS]; // maximum of 255 player slots
 float shuffleteams_teams[SHUFFLETEAMS_MAX_TEAMS]; // maximum of 4 teams
 
 // used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
-void GameCommand_macro_write_aliases(float fh);
\ No newline at end of file
+void GameCommand_macro_write_aliases(float fh);
+#endif
index 214083eaee9f32c080ad221512e3dfe39a28ba58..61fd2f3a2d44d423b8a2a1792aec5f635a7ae420 100644 (file)
@@ -1,3 +1,25 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/util.qh"
+    #include "../../common/command/shared_defs.qh"
+    #include "../autocvars.qh"
+    #include "../constants.qh"
+    #include "../defs.qh"
+    #include "../../common/notifications.qh"
+    #include "../mutators/mutators_include.qh"
+    #include "../../common/mapinfo.qh"
+    #include "common.qh"
+    #include "vote.qh"
+    #include "../../common/playerstats.qh"
+    #include "../scores.qh"
+    #include "../race.qh"
+    #include "../round_handler.qh"
+#endif
+
 // =============================================
 //  Server side voting code, reworked by Samual
 //  Last updated: December 27th, 2011
@@ -6,7 +28,7 @@
 //  Nagger for players to know status of voting
 float Nagger_SendEntity(entity to, float sendflags)
 {
-       float nags, i, f, b;
+       int nags, i, f, b;
        entity e;
        WriteByte(MSG_ENTITY, ENT_CLIENT_NAGGER);
 
@@ -69,12 +91,12 @@ float Nagger_SendEntity(entity to, float sendflags)
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 void Nagger_Init()
 {
-       Net_LinkEntity(nagger = spawn(), FALSE, 0, Nagger_SendEntity);
+       Net_LinkEntity(nagger = spawn(), false, 0, Nagger_SendEntity);
 }
 
 void Nagger_VoteChanged()
@@ -213,7 +235,7 @@ void VoteCount(float first_count)
                switch(tmp_player.vote_selection)
                {
                        case VOTE_SELECT_REJECT: { ++vote_reject_count; { if(IS_PLAYER(tmp_player)) ++vote_real_reject_count; } break; }
-                       case VOTE_SELECT_ACCEPT: { ++vote_accept_count; { if(IS_PLAYER(tmp_player)) ++vote_real_reject_count; } break; }
+                       case VOTE_SELECT_ACCEPT: { ++vote_accept_count; { if(IS_PLAYER(tmp_player)) ++vote_real_accept_count; } break; }
                        case VOTE_SELECT_ABSTAIN: { ++vote_abstain_count; { if(IS_PLAYER(tmp_player)) ++vote_real_abstain_count; } break; }
                        default: break;
                }
@@ -306,7 +328,7 @@ void VoteThink()
        if(vote_endtime > 0) // a vote was called
        if(time > vote_endtime) // time is up
        {
-               VoteCount(FALSE);
+               VoteCount(false);
        }
 
        return;
@@ -396,7 +418,7 @@ void reset_map(float dorespawn)
 void ReadyRestart_think()
 {
        restart_mapalreadyrestarted = 1;
-       reset_map(TRUE);
+       reset_map(true);
        Score_ClearAll();
        remove(self);
 
@@ -457,7 +479,7 @@ void ReadyRestart_force()
        if(autocvar_sv_timeout) { FOR_EACH_REALPLAYER(tmp_player) { tmp_player.allowed_timeouts = autocvar_sv_timeout_number; } }
 
        //reset map immediately if this cvar is not set
-       if (!autocvar_sv_ready_restart_after_countdown) { reset_map(TRUE); }
+       if (!autocvar_sv_ready_restart_after_countdown) { reset_map(true); }
 
        if(autocvar_sv_eventlog) { GameLogEcho(":restart"); }
 }
@@ -523,10 +545,10 @@ float Votecommand_check_assignment(entity caller, float assignment)
                || ((!from_server && assignment == VC_ASGNMNT_CLIENTONLY)
                || (from_server && assignment == VC_ASGNMNT_SERVERONLY)))
        {
-               return TRUE;
+               return true;
        }
 
-       return FALSE;
+       return false;
 }
 
 string VoteCommand_extractcommand(string input, float startpos, float argc)
@@ -547,9 +569,9 @@ float VoteCommand_checknasty(string vote_command)
                || (strstrofs(vote_command, "\n", 0) >= 0)
                || (strstrofs(vote_command, "\r", 0) >= 0)
                || (strstrofs(vote_command, "$", 0) >= 0))
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 float VoteCommand_checkinlist(string vote_command, string list)
@@ -557,9 +579,9 @@ float VoteCommand_checkinlist(string vote_command, string list)
        string l = strcat(" ", list, " ");
 
        if(strstrofs(l, strcat(" ", vote_command, " "), 0) >= 0)
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 string ValidateMap(string validated_map, entity caller)
@@ -599,7 +621,7 @@ float VoteCommand_checkargs(float startpos, float argc)
        float checkmate;
 
        if(cmdrestriction == "")
-               return TRUE;
+               return true;
 
        ++startpos; // skip command name
 
@@ -611,11 +633,11 @@ float VoteCommand_checkargs(float startpos, float argc)
 
        minargs = stof(cmdrestriction);
        if(argc - startpos < minargs)
-               return FALSE;
+               return false;
 
        p = strstrofs(cmdrestriction, ";", 0); // find first semicolon
 
-       for(;;)
+       for (;;)
        {
                // we know that at any time, startpos <= argc - minargs
                // so this means: argc-minargs >= startpos >= argc, thus
@@ -632,7 +654,7 @@ float VoteCommand_checkargs(float startpos, float argc)
                                break;
 
                        // otherwise fail
-                       return FALSE;
+                       return false;
                }
 
                // cut to next semicolon
@@ -652,7 +674,7 @@ float VoteCommand_checkargs(float startpos, float argc)
                        checkmate = strlen(arg);
                        for(check = 0; check < checkmate; ++check)
                                if(strstrofs(charlist, substring(arg, check, 1), 0) < 0)
-                                       return FALSE; // not allowed character
+                                       return false; // not allowed character
                        // all characters are allowed. FINE.
                }
 
@@ -661,7 +683,7 @@ float VoteCommand_checkargs(float startpos, float argc)
                p = q;
        }
 
-       return TRUE;
+       return true;
 }
 
 float VoteCommand_parse(entity caller, string vote_command, string vote_list, float startpos, float argc)
@@ -680,13 +702,13 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl
                &&
                (strlen(substring(vote_command, argv_start_index(startpos), strlen(vote_command) - argv_start_index(startpos))) > autocvar_sv_vote_limit)
        )
-               return FALSE;
+               return false;
 
        if (!VoteCommand_checkinlist(first_command, vote_list))
-               return FALSE;
+               return false;
 
        if (!VoteCommand_checkargs(startpos, argc))
-               return FALSE;
+               return false;
 
        switch(first_command) // now go through and parse the proper commands to adjust as needed.
        {
@@ -694,7 +716,7 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl
                case "kickban": // catch all kick/kickban commands
                {
                        entity victim = GetIndexedEntity(argc, (startpos + 1));
-                       float accepted = VerifyClientEntity(victim, TRUE, FALSE);
+                       float accepted = VerifyClientEntity(victim, true, false);
 
                        if(accepted > 0)
                        {
@@ -709,7 +731,7 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl
                                vote_parsed_command = strcat(first_command, " # ", ftos(num_for_edict(victim)), " ", command_arguments);
                                vote_parsed_display = strcat("^1", vote_command, " (^7", victim.netname, "^1): ", reason);
                        }
-                       else { print_to(caller, strcat("vcall: ", GetClientErrorString(accepted, argv(startpos + 1)), ".\n")); return FALSE; }
+                       else { print_to(caller, strcat("vcall: ", GetClientErrorString(accepted, argv(startpos + 1)), ".\n")); return false; }
 
                        break;
                }
@@ -719,7 +741,7 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl
                case "gotomap": // re-direct all map selection commands to gotomap
                {
                        vote_command = ValidateMap(argv(startpos + 1), caller);
-                       if (!vote_command) { return FALSE; }
+                       if (!vote_command) { return false; }
                        vote_parsed_command = strcat("gotomap ", vote_command);
                        vote_parsed_display = strzone(strcat("^1", vote_parsed_command));
 
@@ -735,7 +757,7 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 
@@ -757,7 +779,7 @@ void VoteCommand_abstain(float request, entity caller) // CLIENT ONLY
                                print_to(caller, "^1You abstained from your vote.");
                                caller.vote_selection = VOTE_SELECT_ABSTAIN;
                                msg_entity = caller;
-                               if(!autocvar_sv_vote_singlecount) { VoteCount(FALSE); }
+                               if(!autocvar_sv_vote_singlecount) { VoteCount(false); }
                        }
 
                        return;
@@ -792,6 +814,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm
                        else if(!autocvar_sv_vote_gamestart && time < game_starttime) { print_to(caller, "^1Vote calling is not allowed before the match has started."); }
                        else if(vote_called) { print_to(caller, "^1There is already a vote called."); }
                        else if(!spectators_allowed && (caller && !IS_PLAYER(caller))) { print_to(caller, "^1Only players can call a vote."); }
+                       else if(caller && !IS_CLIENT(caller)) { print_to(caller, "^1Only connected clients can vote."); }
                        else if(timeout_status) { print_to(caller, "^1You can not call a vote while a timeout is active."); }
                        else if(caller && (time < caller.vote_waittime)) { print_to(caller, strcat("^1You have to wait ^2", ftos(ceil(caller.vote_waittime - time)), "^1 seconds before you can again call a vote.")); }
                        else if (!VoteCommand_checknasty(vote_command)) { print_to(caller, "^1Syntax error in command, see 'vhelp' for more info."); }
@@ -818,7 +841,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm
                                bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2 calls a vote for ", vote_called_display, "\n");
                                if(autocvar_sv_eventlog) { GameLogEcho(strcat(":vote:vcall:", ftos(vote_caller.playerid), ":", vote_called_display)); }
                                Nagger_VoteChanged();
-                               VoteCount(TRUE); // needed if you are the only one
+                               VoteCount(true); // needed if you are the only one
                        }
 
                        return;
@@ -873,7 +896,7 @@ void VoteCommand_master(float request, entity caller, float argc, string vote_co
 
                                                else // everything went okay, proceed with giving this player master privilages
                                                {
-                                                       caller.vote_master = TRUE;
+                                                       caller.vote_master = true;
                                                        print_to(caller, strcat("Accepted vote master login from ", GetCallerName(caller)));
                                                        bprint("\{1}^2* ^3", GetCallerName(caller), "^2 logged in as ^3master^2\n");
                                                        if(autocvar_sv_eventlog) { GameLogEcho(strcat(":vote:vlogin:", ftos(caller.playerid))); }
@@ -907,7 +930,7 @@ void VoteCommand_master(float request, entity caller, float argc, string vote_co
                                                        bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2 calls a vote to become ^3master^2.\n");
                                                        if(autocvar_sv_eventlog) { GameLogEcho(strcat(":vote:vcall:", ftos(vote_caller.playerid), ":", vote_called_display)); }
                                                        Nagger_VoteChanged();
-                                                       VoteCount(TRUE); // needed if you are the only one
+                                                       VoteCount(true); // needed if you are the only one
                                                }
 
                                                return;
@@ -945,7 +968,7 @@ void VoteCommand_no(float request, entity caller) // CLIENT ONLY
                                print_to(caller, "^1You rejected the vote.");
                                caller.vote_selection = VOTE_SELECT_REJECT;
                                msg_entity = caller;
-                               if(!autocvar_sv_vote_singlecount) { VoteCount(FALSE); }
+                               if(!autocvar_sv_vote_singlecount) { VoteCount(false); }
                        }
 
                        return;
@@ -1022,7 +1045,7 @@ void VoteCommand_yes(float request, entity caller) // CLIENT ONLY
                                print_to(caller, "^1You accepted the vote.");
                                caller.vote_selection = VOTE_SELECT_ACCEPT;
                                msg_entity = caller;
-                               if(!autocvar_sv_vote_singlecount) { VoteCount(FALSE); }
+                               if(!autocvar_sv_vote_singlecount) { VoteCount(false); }
                        }
 
                        return;
@@ -1088,7 +1111,7 @@ void VoteCommand_macro_help(entity caller, float argc)
                #define VOTE_COMMAND(name,function,description,assignment) \
                        { if(Votecommand_check_assignment(caller, assignment)) { print_to(caller, strcat("  ^2", name, "^7: ", description)); } }
 
-               VOTE_COMMANDS(0, caller, 0, "")
+               VOTE_COMMANDS(0, caller, 0, "");
                #undef VOTE_COMMAND
 
                print_to(caller, strcat("\nUsage:^3 ", command_origin, " vote COMMAND...^7, where possible commands are listed above.\n"));
@@ -1100,7 +1123,7 @@ void VoteCommand_macro_help(entity caller, float argc)
                #define VOTE_COMMAND(name,function,description,assignment) \
                        { if(Votecommand_check_assignment(caller, assignment)) { if(name == strtolower(argv(2))) { function; return; } } }
 
-               VOTE_COMMANDS(CMD_REQUEST_USAGE, caller, argc, "")
+               VOTE_COMMANDS(CMD_REQUEST_USAGE, caller, argc, "");
                #undef VOTE_COMMAND
        }
 
@@ -1110,12 +1133,12 @@ void VoteCommand_macro_help(entity caller, float argc)
 float VoteCommand_macro_command(entity caller, float argc, string vote_command)
 {
        #define VOTE_COMMAND(name,function,description,assignment) \
-               { if(Votecommand_check_assignment(caller, assignment)) { if(name == strtolower(argv(1))) { function; return TRUE; } } }
+               { if(Votecommand_check_assignment(caller, assignment)) { if(name == strtolower(argv(1))) { function; return true; } } }
 
-       VOTE_COMMANDS(CMD_REQUEST_COMMAND, caller, argc, vote_command)
+       VOTE_COMMANDS(CMD_REQUEST_COMMAND, caller, argc, vote_command);
        #undef VOTE_COMMAND
 
-       return FALSE;
+       return false;
 }
 
 
index 0386e1d5a187f033da2ffc6ab7a6f99ebf98a6e7..ff33f5668cf635f2f00acf8929d338df7e6d05c7 100644 (file)
@@ -1,23 +1,26 @@
+#ifndef VOTE_H
+#define VOTE_H
+
 // ================================================
 //  Declarations for the vote system/vote commands
 //  Last updated: December 14th, 2011
 // ================================================
 
 // definitions for command selection between progs
-#define VC_ASGNMNT_BOTH 1
-#define VC_ASGNMNT_CLIENTONLY 2
-#define VC_ASGNMNT_SERVERONLY 3
+const float VC_ASGNMNT_BOTH = 1;
+const float VC_ASGNMNT_CLIENTONLY = 2;
+const float VC_ASGNMNT_SERVERONLY = 3;
 
 // vote selection definitions
-#define VOTE_SELECT_ABSTAIN -2
-#define VOTE_SELECT_REJECT -1
-#define VOTE_SELECT_NULL 0
-#define VOTE_SELECT_ACCEPT 1
+const float VOTE_SELECT_ABSTAIN = -2;
+const float VOTE_SELECT_REJECT = -1;
+const float VOTE_SELECT_NULL = 0;
+const float VOTE_SELECT_ACCEPT = 1;
 
 // different statuses of the current vote
-#define VOTE_NULL 0
-#define VOTE_NORMAL 1
-#define VOTE_MASTER 2
+const float VOTE_NULL = 0;
+const float VOTE_NORMAL = 1;
+const float VOTE_MASTER = 2;
 
 // global vote information declarations
 entity vote_caller; // original caller of the current vote
@@ -41,11 +44,12 @@ void VoteReset();
 void VoteCommand(float request, entity caller, float argc, string vote_command);
 
 // warmup and nagger stuff
-#define RESTART_COUNTDOWN 10
+const float RESTART_COUNTDOWN = 10;
 entity nagger;
 float readycount; // amount of players who are ready
 float readyrestart_happened; // keeps track of whether a restart has already happened
 float restart_mapalreadyrestarted; // bool, indicates whether reset_map() was already executed
 .float ready; // flag for if a player is ready
 void reset_map(float dorespawn);
-void ReadyCount();
\ No newline at end of file
+void ReadyCount();
+#endif
index ada2acd1adf3a183c76aed99298521e4711a8b83..1d4cc55232382a6fcd7f2491325b6364ec5a9736 100644 (file)
@@ -1,23 +1,27 @@
-const float FL_WEAPON = 8192;
-const float FL_POWERUP = 16384;
-const float FL_PROJECTILE = 32768;
-const float FL_TOSSED = 65536;
-const float FL_NO_WEAPON_STAY = 131072;
-const float FL_SPAWNING = 262144;
+#ifndef SERVER_CONSTANTS_H
+#define SERVER_CONSTANTS_H
 
-const float SVC_SOUND = 6;
-const float SVC_STOPSOUND = 16;
-const float SVC_SETVIEW = 5;
+const int FL_WEAPON = 8192;
+const int FL_POWERUP = 16384;
+const int FL_PROJECTILE = 32768;
+const int FL_TOSSED = 65536;
+const int FL_NO_WEAPON_STAY = 131072;
+const int FL_SPAWNING = 262144;
 
-const float RESPAWN_FORCE = 1;
-const float RESPAWN_SILENT = 2;
+const int SVC_SOUND = 6;
+const int SVC_STOPSOUND = 16;
+const int SVC_SETVIEW = 5;
+
+const int RESPAWN_FORCE = 1;
+const int RESPAWN_SILENT = 2;
 
 #define EFMASK_CHEAP (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NODRAW | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT)
 
-const float MSG_ENTITY = 5; // csqc
+const int MSG_ENTITY = 5; // csqc
 
-const float NUM_PLAYERSKINS_TEAMPLAY = 3;
+const int NUM_PLAYERSKINS_TEAMPLAY = 3;
 
-const float ASSAULT_VALUE_INACTIVE = 1000;
+const int ASSAULT_VALUE_INACTIVE = 1000;
 
-const float DOOR_NOSPLASH = 256; // generic anti-splashdamage spawnflag
+const int DOOR_NOSPLASH = 256; // generic anti-splashdamage spawnflag
+#endif
index ea13aedd5588e0c599ffc835935e61247de485b3..4ebe76b401fb0321724f6ed7b755d37d9da36e07 100644 (file)
@@ -1,13 +1,20 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../common/constants.qh"
+#endif
+
 void te_csqc_lightningarc(vector from,vector to)
 {
        WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
        WriteByte(MSG_BROADCAST, TE_CSQC_ARC);
 
-       WriteCoord(MSG_BROADCAST, from_x);
-       WriteCoord(MSG_BROADCAST, from_y);
-       WriteCoord(MSG_BROADCAST, from_z);
-       WriteCoord(MSG_BROADCAST, to_x);
-       WriteCoord(MSG_BROADCAST, to_y);
-       WriteCoord(MSG_BROADCAST, to_z);
+       WriteCoord(MSG_BROADCAST, from.x);
+       WriteCoord(MSG_BROADCAST, from.y);
+       WriteCoord(MSG_BROADCAST, from.z);
+       WriteCoord(MSG_BROADCAST, to.x);
+       WriteCoord(MSG_BROADCAST, to.y);
+       WriteCoord(MSG_BROADCAST, to.z);
 }
 
index 757ee65e2799449c1afd71e68aaf2339596faada..822c5163c384c1476656d825ab0a009f549ac406 100644 (file)
@@ -1,3 +1,8 @@
+#ifndef SERVER_DEFS_H
+#define SERVER_DEFS_H
+
+#include "../common/weapons/weapons.qh"
+
 #define INDEPENDENT_ATTACK_FINISHED
 
 noref float require_spawnfunc_prefix; // if this float exists, only functions with spawnfunc_ name prefix qualify as spawn functions
@@ -101,7 +106,7 @@ float server_is_dedicated;
 //.float cnt2;
 
 .float play_time;
-.float respawn_flags;
+.int respawn_flags;
 .float respawn_time;
 .float respawn_time_max;
 .float death_time;
@@ -138,8 +143,8 @@ void setanim(entity e, vector anim, float looping, float override, float restart
 //.float       chasecam;
 
 .float damageforcescale;
-#define MIN_DAMAGEEXTRARADIUS 2
-#define MAX_DAMAGEEXTRARADIUS 16
+const float MIN_DAMAGEEXTRARADIUS = 2;
+const float MAX_DAMAGEEXTRARADIUS = 16;
 .float damageextraradius;
 
 //.float          gravity;
@@ -177,9 +182,9 @@ void setanim(entity e, vector anim, float looping, float override, float restart
 .entity exteriorweaponentity;
 .vector weaponentity_glowmod;
 
-//.float weapon; // current weapon
-.float switchweapon; // weapon requested to switch to
-.float switchingweapon; // weapon currently being switched to (is copied from switchweapon once switch is possible)
+//.int weapon; // current weapon
+.int switchweapon; // weapon requested to switch to
+.int switchingweapon; // weapon currently being switched to (is copied from switchweapon once switch is possible)
 .string weaponname; // name of .weapon
 
 // WEAPONTODO
@@ -194,14 +199,14 @@ void w_ready();
 
 
 // weapon states (self.weaponentity.state)
-const float WS_CLEAR                   = 0; // no weapon selected
-const float WS_RAISE                   = 1; // raise frame
-const float WS_DROP                    = 2; // deselecting frame
-const float WS_INUSE                   = 3; // fire state
-const float WS_READY                   = 4; // idle frame
+const int WS_CLEAR                     = 0; // no weapon selected
+const int WS_RAISE                     = 1; // raise frame
+const int WS_DROP                              = 2; // deselecting frame
+const int WS_INUSE                     = 3; // fire state
+const int WS_READY                     = 4; // idle frame
 
 // there is 2 weapon tics that can run in one server frame
-#define W_TICSPERFRAME 2
+const int W_TICSPERFRAME = 2;
 
 void weapon_defaultspawnfunc(float wpn);
 
@@ -279,7 +284,7 @@ float default_weapon_alpha;
 
 .float version_nagtime;
 
-#define NUM_JUMPPADSUSED 3
+const int NUM_JUMPPADSUSED = 3;
 .float jumppadcount;
 .entity jumppadsused[NUM_JUMPPADSUSED];
 
@@ -341,7 +346,7 @@ float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end)
 float next_pingtime;
 
 .float Version;
-.float SendFlags;
+.int SendFlags;
 .float(entity to, float sendflags) SendEntity;
 
 // player sounds, voice messages
@@ -394,12 +399,12 @@ string globalsound_metalfall;
 string globalsound_step;
 string globalsound_metalstep;
 
-#define VOICETYPE_PLAYERSOUND 10
-#define VOICETYPE_TEAMRADIO 11
-#define VOICETYPE_LASTATTACKER 12
-#define VOICETYPE_LASTATTACKER_ONLY 13
-#define VOICETYPE_AUTOTAUNT 14
-#define VOICETYPE_TAUNT 15
+const float VOICETYPE_PLAYERSOUND = 10;
+const float VOICETYPE_TEAMRADIO = 11;
+const float VOICETYPE_LASTATTACKER = 12;
+const float VOICETYPE_LASTATTACKER_ONLY = 13;
+const float VOICETYPE_AUTOTAUNT = 14;
+const float VOICETYPE_TAUNT = 15;
 
 void PrecachePlayerSounds(string f);
 void PrecacheGlobalSound(string samplestring);
@@ -427,7 +432,7 @@ float independent_players;
 
 string clientstuff;
 .float phase;
-.float pressedkeys;
+.int pressedkeys;
 
 .float porto_forbidden;
 
@@ -449,7 +454,7 @@ float round_starttime; //point in time when the countdown to round start is over
 
 void W_Porto_Remove (entity p);
 
-.float projectiledeathtype;
+.int projectiledeathtype;
 
 .string message2;
 
@@ -510,7 +515,7 @@ string matchid;
 .float hit_time;
 .float typehit_time;
 
-.float damage_dealt_total; 
+.float damage_dealt_total;
 
 .float stat_leadlimit;
 
@@ -556,16 +561,16 @@ string deathmessage;
 
 .float ballistics_density; // wall piercing factor, larger = bullet can pass through more
 
-#define ACTIVE_NOT             0
-#define ACTIVE_ACTIVE  1
-#define ACTIVE_IDLE    2
-#define ACTIVE_BUSY    2
-#define ACTIVE_TOGGLE  3
+const float ACTIVE_NOT                 = 0;
+const float ACTIVE_ACTIVE      = 1;
+const float ACTIVE_IDLE        = 2;
+const float ACTIVE_BUSY        = 2;
+const float ACTIVE_TOGGLE      = 3;
 .float active;
 .void (float act_state) setactive;
 .entity realowner;
 
-float serverflags;
+//float serverflags;
 
 .float team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
 
@@ -594,21 +599,21 @@ typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t;
 string modname;
 
 .float missile_flags;
-#define MIF_SPLASH 2
-#define MIF_ARC 4
-#define MIF_PROXY 8
-#define MIF_GUIDED_MANUAL 16
-#define MIF_GUIDED_HEAT 32
-#define MIF_GUIDED_LASER 64
-#define MIF_GUIDED_AI 128
-#define MIF_GUIDED_TAG 128
+const int MIF_SPLASH = 2;
+const int MIF_ARC = 4;
+const int MIF_PROXY = 8;
+const int MIF_GUIDED_MANUAL = 16;
+const int MIF_GUIDED_HEAT = 32;
+const int MIF_GUIDED_LASER = 64;
+const int MIF_GUIDED_AI = 128;
+const int MIF_GUIDED_TAG = 128;
 #define MIF_GUIDED_ALL (MIF_GUIDED_MANUAL | MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG)
 #define MIF_GUIDED_TRACKING (MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG)
 #define MIF_GUIDED_CONFUSABLE (MIF_GUIDED_HEAT | MIF_GUIDED_AI)
 
-#define MISSILE_IS_CONFUSABLE(m) ((m.missile_flags & MIF_GUIDED_CONFUSABLE) ? TRUE : FALSE)
-#define MISSILE_IS_GUIDED(m) ((m.missile_flags & MIF_GUIDED_ALL) ? TRUE : FALSE)
-#define MISSILE_IS_TRACKING(m) ((m.missile_flags & MIF_GUIDED_TRACKING) ? TRUE : FALSE)
+#define MISSILE_IS_CONFUSABLE(m) ((m.missile_flags & MIF_GUIDED_CONFUSABLE) ? true : false)
+#define MISSILE_IS_GUIDED(m) ((m.missile_flags & MIF_GUIDED_ALL) ? true : false)
+#define MISSILE_IS_TRACKING(m) ((m.missile_flags & MIF_GUIDED_TRACKING) ? true : false)
 
 
 ////
@@ -618,3 +623,8 @@ string modname;
 .string playernick;
 .float elos;
 .float ranks;
+
+.float init_for_player_needed;
+.void(entity) init_for_player;
+
+#endif
index 7b3af04bfd9aa9f988f72f7e9a53b28d4ad2a96c..98ec277683c5477912cc1415f234c284a80754b5 100644 (file)
@@ -1,3 +1,14 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../common/constants.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "mutators/mutators_include.qh"
+#endif
+
 /**
  * The point of these entities is to avoid the problems
  * with clientprediction.
@@ -25,19 +36,19 @@ float entcs_customize()
        entity o;
        o = self.owner;
        if(o.deadflag != DEAD_NO)
-               return FALSE;
+               return false;
        if (!IS_PLAYER(o))
-               return FALSE;
+               return false;
        if(other == o)
-               return FALSE;
+               return false;
        if((IS_PLAYER(other)) || other.caplayer)
                if(!teamplay || o.team != other.team)
                        if (!radar_showennemies)
-                               return FALSE;
-       return TRUE;
+                               return false;
+       return true;
 }
 
-float entcs_send(entity to, float sf)
+float entcs_send(entity to, int sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS);
        WriteByte(MSG_ENTITY, sf);
@@ -45,17 +56,17 @@ float entcs_send(entity to, float sf)
                WriteByte(MSG_ENTITY, num_for_edict(self.owner)-1);
        if(sf & 2)
        {
-               WriteShort(MSG_ENTITY, self.origin_x);
-               WriteShort(MSG_ENTITY, self.origin_y);
-               WriteShort(MSG_ENTITY, self.origin_z);
+               WriteShort(MSG_ENTITY, self.origin.x);
+               WriteShort(MSG_ENTITY, self.origin.y);
+               WriteShort(MSG_ENTITY, self.origin.z);
        }
        if(sf & 4)
-               WriteByte(MSG_ENTITY, self.angles_y * 256.0 / 360);
+               WriteByte(MSG_ENTITY, self.angles.y * 256.0 / 360);
        if(sf & 8)
                WriteByte(MSG_ENTITY, self.health / 10); // FIXME use a better scale?
        if(sf & 16)
                WriteByte(MSG_ENTITY, self.armorvalue / 10); // FIXME use a better scale?
-       return TRUE;
+       return true;
 }
 
 void entcs_think()
@@ -70,7 +81,7 @@ void entcs_think()
                setorigin(self, o.origin);
                self.SendFlags |= 2;
        }
-       if(o.angles_y != self.angles_y)
+       if(o.angles.y != self.angles.y)
        {
                self.angles = o.angles;
                self.SendFlags |= 4;
@@ -97,7 +108,7 @@ entity attach_entcs()
        ent.think = entcs_think;
        ent.nextthink = time;
 
-       Net_LinkEntity(ent, FALSE, 0, entcs_send);
+       Net_LinkEntity(ent, false, 0, entcs_send);
        ent.customizeentityforclient = entcs_customize;
 
        self.entcs = ent;
diff --git a/qcsrc/server/ent_cs.qh b/qcsrc/server/ent_cs.qh
new file mode 100644 (file)
index 0000000..05821f9
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef ENT_CS_H
+#define ENT_CS_H
+
+/**
+ * The point of these entities is to avoid the problems
+ * with clientprediction.
+ * If you add SendEntity to players, the engine will not
+ * do any prediction anymore, and you'd have to write the whole
+ * prediction code in CSQC, you want that? :P
+ * Data can depend on gamemode. For now, it serves as GPS entities
+ * in onslaught... YAY ;)
+ */
+
+// Beware: do not redefine those in other files
+// and NO, you cannot use ".version", which already exists (at least
+// it did when I added this) But you have to use .Version
+// Capital V
+
+.entity entcs;
+
+void entcs_init();
+
+float entcs_customize();
+
+float entcs_send(entity to, int sf);
+
+void entcs_think();
+
+entity attach_entcs();
+
+void detach_entcs();
+#endif
index 0bf71059e6029ae10d9e94b1ed0ba861842cd609..be6104f1fa6d2c653cc6acb25bc3f818cab46840 100644 (file)
@@ -1,3 +1,5 @@
+#include "weapons/common.qh"
+
 .entity sprite;
 
 .float dmg;
@@ -31,7 +33,7 @@
 //   Otherwise mdl_dead will be displayed at the map origin, and nobody would
 //   want that!
 
-void func_breakable_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
+void func_breakable_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
 
 //
 // func_breakable
@@ -39,13 +41,11 @@ void func_breakable_damage(entity inflictor, entity attacker, float damage, floa
 //
 void LaunchDebris (string debrisname, vector force)
 {
-       local   entity dbr;
-
-       dbr = spawn();
+       entity dbr = spawn();
        setorigin(dbr, self.absmin
-                  + '1 0 0' * random() * (self.absmax_x - self.absmin_x)
-                  + '0 1 0' * random() * (self.absmax_y - self.absmin_y)
-                  + '0 0 1' * random() * (self.absmax_z - self.absmin_z));
+                  + '1 0 0' * random() * (self.absmax.x - self.absmin.x)
+                  + '0 1 0' * random() * (self.absmax.y - self.absmin.y)
+                  + '0 0 1' * random() * (self.absmax.z - self.absmin.z));
        setmodel (dbr, debrisname );
        dbr.skin = self.debrisskin;
        dbr.colormap = self.colormap; // inherit team colors
@@ -54,13 +54,13 @@ void LaunchDebris (string debrisname, vector force)
        dbr.solid = self.debrissolid;
        if(dbr.solid != SOLID_BSP) // SOLID_BSP has exact collision, MAYBE this works? TODO check this out
                setsize(dbr, '0 0 0', '0 0 0'); // needed for performance, until engine can deal better with it
-       dbr.velocity_x = self.debrisvelocity_x + self.debrisvelocityjitter_x * crandom();
-       dbr.velocity_y = self.debrisvelocity_y + self.debrisvelocityjitter_y * crandom();
-       dbr.velocity_z = self.debrisvelocity_z + self.debrisvelocityjitter_z * crandom();
+       dbr.velocity_x = self.debrisvelocity.x + self.debrisvelocityjitter.x * crandom();
+       dbr.velocity_y = self.debrisvelocity.y + self.debrisvelocityjitter.y * crandom();
+       dbr.velocity_z = self.debrisvelocity.z + self.debrisvelocityjitter.z * crandom();
        self.velocity = self.velocity + force * self.debrisdamageforcescale;
-       dbr.avelocity_x = random()*self.debrisavelocityjitter_x;
-       dbr.avelocity_y = random()*self.debrisavelocityjitter_y;
-       dbr.avelocity_z = random()*self.debrisavelocityjitter_z;
+       dbr.avelocity_x = random()*self.debrisavelocityjitter.x;
+       dbr.avelocity_y = random()*self.debrisavelocityjitter.y;
+       dbr.avelocity_z = random()*self.debrisavelocityjitter.z;
        dbr.damageforcescale = self.debrisdamageforcescale;
        if(dbr.damageforcescale)
                dbr.takedamage = DAMAGE_YES;
@@ -79,36 +79,44 @@ void func_breakable_colormod()
                self.colormod = '1 0 0' + '0 1 0' * (2 * h - 0.5);
        else
                self.colormod = '1 1 1';
-               
+
        CSQCMODEL_AUTOUPDATE();
 }
 
 void func_breakable_look_destroyed()
 {
-       float floor_z;
+       float floorZ;
 
        if(self.solid == SOLID_BSP) // in case a misc_follow moved me, save the current origin first
                self.dropped_origin = self.origin;
 
        if(self.mdl_dead == "")
-               self.model = "";
+               self.effects |= EF_NODRAW;
        else {
                if (self.origin == '0 0 0')     {       // probably no origin brush, so don't spawn in the middle of the map..
-                       floor_z = self.absmin_z;
+                       floorZ = self.absmin.z;
                        setorigin(self,((self.absmax+self.absmin)*.5));
-                       self.origin_z = floor_z;
+                       self.origin_z = floorZ;
                }
                setmodel(self, self.mdl_dead);
+               self.effects &= ~EF_NODRAW;
        }
 
+       CSQCMODEL_AUTOUPDATE();
+
        self.solid = SOLID_NOT;
 }
 
 void func_breakable_look_restore()
 {
        setmodel(self, self.mdl);
+       self.effects &= ~EF_NODRAW;
+
        if(self.mdl_dead != "") // only do this if we use mdl_dead, to behave better with misc_follow
                setorigin(self, self.dropped_origin);
+
+       CSQCMODEL_AUTOUPDATE();
+
        self.solid = SOLID_BSP;
 }
 
@@ -116,10 +124,12 @@ void func_breakable_behave_destroyed()
 {
        self.health = self.max_health;
        self.takedamage = DAMAGE_NO;
-       self.bot_attack = FALSE;
+       self.bot_attack = false;
        self.event_damage = func_null;
        self.state = 1;
        func_breakable_colormod();
+       if (self.noise1)
+               stopsound (self, CH_TRIGGER_SINGLE);
 }
 
 void func_breakable_behave_restore()
@@ -131,18 +141,29 @@ void func_breakable_behave_restore()
                WaypointSprite_UpdateHealth(self.sprite, self.health);
        }
        self.takedamage = DAMAGE_AIM;
-       self.bot_attack = TRUE;
+       self.bot_attack = true;
        self.event_damage = func_breakable_damage;
        self.state = 0;
        self.nextthink = 0; // cancel auto respawn
        func_breakable_colormod();
+       if (self.noise1)
+               sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
+}
+
+void func_breakable_init_for_player(entity player)
+{
+       if (self.noise1 && self.state == 0 && clienttype(player) == CLIENTTYPE_REAL)
+       {
+               msg_entity = player;
+               soundto (MSG_ONE, self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
+       }
 }
 
 void func_breakable_destroyed()
 {
        func_breakable_look_destroyed();
        func_breakable_behave_destroyed();
-       
+
        CSQCMODEL_AUTOUPDATE();
 }
 
@@ -150,7 +171,7 @@ void func_breakable_restore()
 {
        func_breakable_look_restore();
        func_breakable_behave_restore();
-       
+
        CSQCMODEL_AUTOUPDATE();
 }
 
@@ -190,7 +211,7 @@ void func_breakable_destroy() {
        self.message = oldmsg;
 }
 
-void func_breakable_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+void func_breakable_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        if(self.state == 1)
                return;
@@ -223,7 +244,7 @@ void func_breakable_reset()
                func_breakable_behave_destroyed();
        else
                func_breakable_behave_restore();
-               
+
        CSQCMODEL_AUTOUPDATE();
 }
 
@@ -270,13 +291,18 @@ void spawnfunc_func_breakable() {
                precache_model(argv(i));
        if(self.noise)
                precache_sound(self.noise);
+       if(self.noise1)
+               precache_sound(self.noise1);
 
        self.team_saved = self.team;
        self.dropped_origin = self.origin;
 
        self.reset = func_breakable_reset;
        func_breakable_reset();
-       
+
+       self.init_for_player_needed = 1;
+       self.init_for_player = func_breakable_init_for_player;
+
        CSQCMODEL_AUTOINIT();
 }
 
index e2c1c29385f57acc74b6ae2eca04dfeb287cd18d..2b78ebe0b2d309b5d33ef93768a3ba6cae4ce699 100644 (file)
@@ -1,23 +1,33 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+#endif
+
 float Casing_SendEntity(entity to, float sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_CASING);
        WriteByte(MSG_ENTITY, self.state); // actually type
-       WriteCoord(MSG_ENTITY, self.origin_x);
-       WriteCoord(MSG_ENTITY, self.origin_y);
-       WriteCoord(MSG_ENTITY, self.origin_z);
-       WriteShort(MSG_ENTITY, self.oldorigin_x); // acrually compressed velocity
-       WriteByte(MSG_ENTITY, self.angles_x * 256 / 360);
-       WriteByte(MSG_ENTITY, self.angles_y * 256 / 360);
-       WriteByte(MSG_ENTITY, self.angles_z * 256 / 360);
-       return TRUE;
+       WriteCoord(MSG_ENTITY, self.origin.x);
+       WriteCoord(MSG_ENTITY, self.origin.y);
+       WriteCoord(MSG_ENTITY, self.origin.z);
+       WriteShort(MSG_ENTITY, self.oldorigin.x); // acrually compressed velocity
+       WriteByte(MSG_ENTITY, self.angles.x * 256 / 360);
+       WriteByte(MSG_ENTITY, self.angles.y * 256 / 360);
+       WriteByte(MSG_ENTITY, self.angles.z * 256 / 360);
+       return true;
 }
 
-void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, float casingtype, entity casingowner)
+void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner)
 {
        entity e;
        vector org;
 
-       org = self.origin + self.view_ofs + self.weaponentity.spawnorigin_x * v_forward - self.weaponentity.spawnorigin_y * v_right + self.weaponentity.spawnorigin_z * v_up;
+       org = self.origin + self.view_ofs + self.weaponentity.spawnorigin.x * v_forward - self.weaponentity.spawnorigin.y * v_right + self.weaponentity.spawnorigin.z * v_up;
 
        if(!sound_allowed(MSG_BROADCAST, casingowner))
                casingtype |= 0x80;
@@ -29,6 +39,6 @@ void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float ran
        e.angles = ang;
        e.oldorigin_x = compressShortVector(e.velocity);
 
-       Net_LinkEntity(e, TRUE, 0.2, Casing_SendEntity);
+       Net_LinkEntity(e, true, 0.2, Casing_SendEntity);
                // 0.2s should be enough time for all clients to receive this ent once, do the gibbage and be done with it
 }
index 3f5ba0d6216fb2f5f48253cfdef98ab0f2ca85db..aab2f9ced5567164b401596cfe34a70d4972491f 100644 (file)
@@ -1,21 +1,46 @@
-.float dmg;
-.float dmg_edge;
-.float dmg_force;
-.float dmg_radius;
+#include "g_damage.qh"
+
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+    #include "../warpzonelib/common.qh"
+    #include "../common/constants.qh"
+    #include "../common/teams.qh"
+    #include "../common/util.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "weapons/accuracy.qh"
+    #include "weapons/csqcprojectile.qh"
+    #include "weapons/selection.qh"
+    #include "t_items.qh"
+    #include "autocvars.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "../common/notifications.qh"
+    #include "../common/deathtypes.qh"
+    #include "mutators/mutators_include.qh"
+    #include "../common/turrets/turrets.qh"
+    #include "../common/turrets/sv_turrets.qh"
+    #include "vehicles/vehicles_def.qh"
+    #include "../csqcmodellib/sv_model.qh"
+    #include "../common/playerstats.qh"
+    #include "g_hook.qh"
+    #include "scores.qh"
+    #include "spawnpoints.qh"
+#endif
 
 float Damage_DamageInfo_SendEntity(entity to, float sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_DAMAGEINFO);
        WriteShort(MSG_ENTITY, self.projectiledeathtype);
-       WriteCoord(MSG_ENTITY, floor(self.origin_x));
-       WriteCoord(MSG_ENTITY, floor(self.origin_y));
-       WriteCoord(MSG_ENTITY, floor(self.origin_z));
+       WriteCoord(MSG_ENTITY, floor(self.origin.x));
+       WriteCoord(MSG_ENTITY, floor(self.origin.y));
+       WriteCoord(MSG_ENTITY, floor(self.origin.z));
        WriteByte(MSG_ENTITY, bound(1, self.dmg, 255));
        WriteByte(MSG_ENTITY, bound(0, self.dmg_radius, 255));
        WriteByte(MSG_ENTITY, bound(1, self.dmg_edge, 255));
-       WriteShort(MSG_ENTITY, self.oldorigin_x);
+       WriteShort(MSG_ENTITY, self.oldorigin.x);
        WriteByte(MSG_ENTITY, self.species);
-       return TRUE;
+       return true;
 }
 
 void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad, vector force, float deathtype, float bloodtype, entity dmgowner)
@@ -39,23 +64,9 @@ void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad
        e.oldorigin_x = compressShortVector(e.velocity);
        e.species = bloodtype;
 
-       Net_LinkEntity(e, FALSE, 0.2, Damage_DamageInfo_SendEntity);
+       Net_LinkEntity(e, false, 0.2, Damage_DamageInfo_SendEntity);
 }
 
-float checkrules_firstblood;
-
-float yoda;
-float damage_goodhits;
-float damage_gooddamage;
-
-.float dmg_team;
-.float teamkill_complain;
-.float teamkill_soundtime;
-.entity teamkill_soundsource;
-.entity pusher;
-.float istypefrag;
-.float taunt_soundtime;
-
 float IsFlying(entity a)
 {
        if(a.flags & FL_ONGROUND)
@@ -73,9 +84,6 @@ void UpdateFrags(entity player, float f)
        PlayerTeamScore_AddScore(player, f);
 }
 
-// NOTE: f=0 means still count as a (positive) kill, but count no frags for it
-void W_SwitchWeapon_Force(entity e, float w);
-entity GiveFrags_randomweapons;
 void GiveFrags (entity attacker, entity targ, float f, float deathtype)
 {
        // TODO route through PlayerScores instead
@@ -275,7 +283,6 @@ void Obituary_SpecialDeath(
        else { backtrace("Obituary_SpecialDeath called without a special deathtype?\n"); return; }
 }
 
-float w_deathtype;
 float Obituary_WeaponDeath(
        entity notif_target,
        float murder,
@@ -288,7 +295,7 @@ float Obituary_WeaponDeath(
        {
                w_deathtype = deathtype;
                float death_message = WEP_ACTION(death_weapon, ((murder) ? WR_KILLMESSAGE : WR_SUICIDEMESSAGE));
-               w_deathtype = FALSE;
+               w_deathtype = false;
 
                if(death_message)
                {
@@ -318,9 +325,9 @@ float Obituary_WeaponDeath(
                        );
                }
 
-               return TRUE;
+               return true;
        }
-       return FALSE;
+       return false;
 }
 
 void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
@@ -329,7 +336,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
        if (!IS_PLAYER(targ)) { backtrace("Obituary called on non-player?!\n"); return; }
 
        // Declarations
-       float notif_firstblood = FALSE;
+       float notif_firstblood = false;
        float kill_count_to_attacker, kill_count_to_target;
 
        // Set final information for the death
@@ -359,7 +366,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
                {
                        if(deathtype == DEATH_TEAMCHANGE || deathtype == DEATH_AUTOTEAMCHANGE)
                        {
-                               Obituary_SpecialDeath(targ, FALSE, deathtype, targ.netname, deathlocation, "", targ.team, 0, 0);
+                               Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", targ.team, 0, 0);
                        }
                        else
                        {
@@ -367,19 +374,19 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
                                {
                                        case DEATH_MIRRORDAMAGE:
                                        {
-                                               Obituary_SpecialDeath(targ, FALSE, deathtype, targ.netname, deathlocation, "", targ.killcount, 0, 0);
+                                               Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", targ.killcount, 0, 0);
                                                break;
                                        }
 
                                        default:
                                        {
-                                               Obituary_SpecialDeath(targ, FALSE, deathtype, targ.netname, deathlocation, "", targ.killcount, 0, 0);
+                                               Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", targ.killcount, 0, 0);
                                                break;
                                        }
                                }
                        }
                }
-               else if (!Obituary_WeaponDeath(targ, FALSE, deathtype, targ.netname, deathlocation, "", targ.killcount, 0))
+               else if (!Obituary_WeaponDeath(targ, false, deathtype, targ.netname, deathlocation, "", targ.killcount, 0))
                {
                        backtrace("SUICIDE: what the hell happened here?\n");
                        return;
@@ -431,8 +438,8 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
 
                        if(!checkrules_firstblood)
                        {
-                               checkrules_firstblood = TRUE;
-                               notif_firstblood = TRUE; // modify the current messages so that they too show firstblood information
+                               checkrules_firstblood = true;
+                               notif_firstblood = true; // modify the current messages so that they too show firstblood information
                                PS_GR_P_ADDVAL(attacker, PLAYERSTATS_ACHIEVEMENT_FIRSTBLOOD, 1);
                                PS_GR_P_ADDVAL(targ, PLAYERSTATS_ACHIEVEMENT_FIRSTVICTIM, 1);
 
@@ -493,8 +500,8 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
                                );
                        }
 
-                       if (!Obituary_WeaponDeath(targ, TRUE, deathtype, targ.netname, attacker.netname, deathlocation, targ.killcount, kill_count_to_attacker))
-                               Obituary_SpecialDeath(targ, TRUE, deathtype, targ.netname, attacker.netname, deathlocation, targ.killcount, kill_count_to_attacker, 0);
+                       if (!Obituary_WeaponDeath(targ, true, deathtype, targ.netname, attacker.netname, deathlocation, targ.killcount, kill_count_to_attacker))
+                               Obituary_SpecialDeath(targ, true, deathtype, targ.netname, attacker.netname, deathlocation, targ.killcount, kill_count_to_attacker, 0);
                }
        }
 
@@ -518,7 +525,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
 
                        case DEATH_CUSTOM:
                        {
-                               Obituary_SpecialDeath(targ, FALSE, deathtype,
+                               Obituary_SpecialDeath(targ, false, deathtype,
                                        targ.netname,
                                        ((strstrofs(deathmessage, "%", 0) < 0) ? strcat("%s ", deathmessage) : deathmessage),
                                        deathlocation,
@@ -530,7 +537,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
 
                        default:
                        {
-                               Obituary_SpecialDeath(targ, FALSE, deathtype, targ.netname, deathlocation, "", targ.killcount, 0, 0);
+                               Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", targ.killcount, 0, 0);
                                break;
                        }
                }
@@ -603,8 +610,8 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo
                RemoveGrapplingHook(head);
 
        // add waypoint
-       if(show_waypoint)       
-               WaypointSprite_Spawn("frozen", 0, 0, targ, '0 0 64', world, targ.team, targ, waypointsprite_attached, TRUE, RADARICON_WAYPOINT, '0.25 0.90 1');
+       if(show_waypoint)
+               WaypointSprite_Spawn("frozen", 0, 0, targ, '0 0 64', world, targ.team, targ, waypointsprite_attached, true, RADARICON_WAYPOINT, '0.25 0.90 1');
 }
 
 void Unfreeze (entity targ)
@@ -616,9 +623,9 @@ void Unfreeze (entity targ)
        targ.frozen = 0;
        targ.revive_progress = 0;
        targ.revival_time = time;
-       
+
        WaypointSprite_Kill(targ.waypointsprite_attached);
-       
+
        FOR_EACH_PLAYER(head)
        if(head.hook.aiment == targ)
                RemoveGrapplingHook(head);
@@ -629,11 +636,6 @@ void Unfreeze (entity targ)
        targ.iceblock = world;
 }
 
-// these are updated by each Damage call for use in button triggering and such
-entity damage_targ;
-entity damage_inflictor;
-entity damage_attacker;
-
 void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
 {
        float mirrordamage;
@@ -724,18 +726,18 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                                        if(autocvar_g_mirrordamage_virtual)
                                                        {
                                                                vector v  = healtharmor_applydamage(attacker.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, mirrordamage);
-                                                               attacker.dmg_take += v_x;
-                                                               attacker.dmg_save += v_y;
+                                                               attacker.dmg_take += v.x;
+                                                               attacker.dmg_save += v.y;
                                                                attacker.dmg_inflictor = inflictor;
-                                                               mirrordamage = v_z;
+                                                               mirrordamage = v.z;
                                                                mirrorforce = 0;
                                                        }
 
                                                        if(autocvar_g_friendlyfire_virtual)
                                                        {
                                                                vector v = healtharmor_applydamage(targ.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
-                                                               targ.dmg_take += v_x;
-                                                               targ.dmg_save += v_y;
+                                                               targ.dmg_take += v.x;
+                                                               targ.dmg_save += v.y;
                                                                targ.dmg_inflictor = inflictor;
                                                                damage = 0;
                                                                if(!autocvar_g_friendlyfire_virtual_force)
@@ -787,42 +789,42 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        damage = 0;
                        force *= autocvar_g_freezetag_frozen_force;
                }
-               
+
                if(targ.frozen && deathtype == DEATH_HURTTRIGGER && !autocvar_g_freezetag_frozen_damage_trigger)
                {
                        pointparticles(particleeffectnum("teleport"), targ.origin, '0 0 0', 1);
-               
+
                        entity oldself = self;
                        self = targ;
-                       entity spot = SelectSpawnPoint (FALSE);
-                       
+                       entity spot = SelectSpawnPoint (false);
+
                        if(spot)
                        {
                                damage = 0;
                                self.deadflag = DEAD_NO;
 
                                self.angles = spot.angles;
-                               
+
                                self.effects = 0;
                                self.effects |= EF_TELEPORT_BIT;
 
                                self.angles_z = 0; // never spawn tilted even if the spot says to
-                               self.fixangle = TRUE; // turn this way immediately
+                               self.fixangle = true; // turn this way immediately
                                self.velocity = '0 0 0';
                                self.avelocity = '0 0 0';
                                self.punchangle = '0 0 0';
                                self.punchvector = '0 0 0';
                                self.oldvelocity = self.velocity;
-                               
+
                                self.spawnorigin = spot.origin;
-                               setorigin (self, spot.origin + '0 0 1' * (1 - self.mins_z - 24));
+                               setorigin (self, spot.origin + '0 0 1' * (1 - self.mins.z - 24));
                                // don't reset back to last position, even if new position is stuck in solid
                                self.oldorigin = self.origin;
                                self.prevorigin = self.origin;
-                               
+
                                pointparticles(particleeffectnum("teleport"), self.origin, '0 0 0', 1);
                        }
-                       
+
                        self = oldself;
                }
 
@@ -948,7 +950,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        }
 }
 
-float RadiusDamage_running;
 float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float inflictorselfdamage, float forceintensity, float deathtype, entity directhitentity)
        // Returns total damage applies to creatures
 {
@@ -990,7 +991,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
 
        stat_damagedone = 0;
 
-       targ = WarpZone_FindRadius (inflictororigin, rad + MAX_DAMAGEEXTRARADIUS, FALSE);
+       targ = WarpZone_FindRadius (inflictororigin, rad + MAX_DAMAGEEXTRARADIUS, false);
        while (targ)
        {
                next = targ.chain;
@@ -1087,9 +1088,9 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
                                                                else
                                                                        hitloc = nearest;
                                                        }
-                                                       nearest_x = targ.origin_x + targ.mins_x + random() * targ.size_x;
-                                                       nearest_y = targ.origin_y + targ.mins_y + random() * targ.size_y;
-                                                       nearest_z = targ.origin_z + targ.mins_z + random() * targ.size_z;
+                                                       nearest.x = targ.origin.x + targ.mins.x + random() * targ.size.x;
+                                                       nearest.y = targ.origin.y + targ.mins.y + random() * targ.size.y;
+                                                       nearest.z = targ.origin.z + targ.mins.z + random() * targ.size.z;
                                                }
 
                                                nearest = hitloc * (1 / max(1, hits));
@@ -1140,18 +1141,9 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
 
 float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, float deathtype, entity directhitentity)
 {
-       return RadiusDamageForSource (inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, FALSE, forceintensity, deathtype, directhitentity);
+       return RadiusDamageForSource (inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, false, forceintensity, deathtype, directhitentity);
 }
 
-.float fire_damagepersec;
-.float fire_endtime;
-.float fire_deathtype;
-.entity fire_owner;
-.float fire_hitsound;
-.entity fire_burner;
-
-void fireburner_think();
-
 float Fire_IsBurning(entity e)
 {
        return (time < e.fire_endtime);
@@ -1254,7 +1246,7 @@ float Fire_AddDamage(entity e, entity o, float d, float t, float dt)
                                if(e.fire_owner != o)
                                {
                                        e.fire_owner = o;
-                                       e.fire_hitsound = FALSE;
+                                       e.fire_hitsound = false;
                                }
                        }
                        if(accuracy_isgooddamage(o, e))
@@ -1270,7 +1262,7 @@ float Fire_AddDamage(entity e, entity o, float d, float t, float dt)
                e.fire_endtime = time + t;
                e.fire_deathtype = dt;
                e.fire_owner = o;
-               e.fire_hitsound = FALSE;
+               e.fire_hitsound = false;
                if(accuracy_isgooddamage(o, e))
                        accuracy_add(o, DEATH_WEAPONOFWEAPONDEATH(dt), 0, d);
                return d;
@@ -1309,7 +1301,7 @@ void Fire_ApplyDamage(entity e)
                e.fire_owner.damage_dealt = hi;
                e.fire_owner.typehitsound = ty;
        }
-       e.fire_hitsound = TRUE;
+       e.fire_hitsound = true;
 
        if (!IS_INDEPENDENT_PLAYER(e))
        if(!e.frozen)
diff --git a/qcsrc/server/g_damage.qh b/qcsrc/server/g_damage.qh
new file mode 100644 (file)
index 0000000..68f9a0a
--- /dev/null
@@ -0,0 +1,122 @@
+#ifndef G_DAMAGE_H
+#define G_DAMAGE_H
+
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../warpzonelib/common.qh"
+    #include "../common/constants.qh"
+    #include "../common/teams.qh"
+    #include "../common/util.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "weapons/accuracy.qh"
+    #include "weapons/csqcprojectile.qh"
+    #include "weapons/selection.qh"
+    #include "t_items.qh"
+    #include "autocvars.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "../common/notifications.qh"
+    #include "../common/deathtypes.qh"
+    #include "mutators/mutators_include.qh"
+    #include "vehicles/vehicles_def.qh"
+    #include "../csqcmodellib/sv_model.qh"
+    #include "../common/playerstats.qh"
+    #include "g_hook.qh"
+    #include "scores.qh"
+    #include "spawnpoints.qh"
+#endif
+
+.float dmg;
+.float dmg_edge;
+.float dmg_force;
+.float dmg_radius;
+
+float Damage_DamageInfo_SendEntity(entity to, float sf);
+
+void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad, vector force, float deathtype, float bloodtype, entity dmgowner);
+
+float checkrules_firstblood;
+
+float yoda;
+float damage_goodhits;
+float damage_gooddamage;
+
+.float dmg_team;
+.float teamkill_complain;
+.float teamkill_soundtime;
+.entity teamkill_soundsource;
+.entity pusher;
+.float istypefrag;
+.float taunt_soundtime;
+
+float IsFlying(entity a);
+
+void UpdateFrags(entity player, float f);
+
+// NOTE: f=0 means still count as a (positive) kill, but count no frags for it
+void W_SwitchWeapon_Force(entity e, float w);
+entity GiveFrags_randomweapons;
+void GiveFrags (entity attacker, entity targ, float f, float deathtype);
+
+string AppendItemcodes(string s, entity player);
+
+void LogDeath(string mode, float deathtype, entity killer, entity killed);
+
+void Obituary_SpecialDeath(
+       entity notif_target,
+       float murder,
+       float deathtype,
+       string s1, string s2, string s3,
+       float f1, float f2, float f3);
+
+float w_deathtype;
+float Obituary_WeaponDeath(
+       entity notif_target,
+       float murder,
+       float deathtype,
+       string s1, string s2, string s3,
+       float f1, float f2);
+
+void Obituary(entity attacker, entity inflictor, entity targ, float deathtype);
+
+void Ice_Think();
+
+void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypoint);
+
+void Unfreeze (entity targ);
+
+// these are updated by each Damage call for use in button triggering and such
+entity damage_targ;
+entity damage_inflictor;
+entity damage_attacker;
+
+void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
+
+float RadiusDamage_running;
+float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float inflictorselfdamage, float forceintensity, float deathtype, entity directhitentity);
+       // Returns total damage applies to creatures
+
+float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, float deathtype, entity directhitentity);
+
+.float fire_damagepersec;
+.float fire_endtime;
+.float fire_deathtype;
+.entity fire_owner;
+.float fire_hitsound;
+.entity fire_burner;
+
+void fireburner_think();
+
+float Fire_IsBurning(entity e);
+
+float Fire_AddDamage(entity e, entity o, float d, float t, float dt);
+
+void Fire_ApplyDamage(entity e);
+
+void Fire_ApplyEffect(entity e);
+
+void fireburner_think();
+#endif
index eab482618bc3833d47cd74250cd706fbf827063b..310833e4367ce2f036ad10c4570be683bfb4f275 100644 (file)
@@ -1,3 +1,22 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../warpzonelib/common.qh"
+    #include "../warpzonelib/server.qh"
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "autocvars.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "vehicles/vehicles_def.qh"
+    #include "command/common.qh"
+    #include "g_hook.qh"
+    #include "round_handler.qh"
+#endif
+
 /*============================================
 
       Wazat's Xonotic Grappling Hook
@@ -59,7 +78,7 @@ void RemoveGrapplingHook(entity pl)
        if(pl.movetype == MOVETYPE_FLY)
                pl.movetype = MOVETYPE_WALK;
 
-       //pl.disableclientprediction = FALSE;
+       //pl.disableclientprediction = false;
 }
 
 void GrapplingHookReset(void)
@@ -99,17 +118,17 @@ float GrapplingHookSend(entity to, float sf)
        }
        if(sf & 2)
        {
-               WriteCoord(MSG_ENTITY, self.hook_start_x);
-               WriteCoord(MSG_ENTITY, self.hook_start_y);
-               WriteCoord(MSG_ENTITY, self.hook_start_z);
+               WriteCoord(MSG_ENTITY, self.hook_start.x);
+               WriteCoord(MSG_ENTITY, self.hook_start.y);
+               WriteCoord(MSG_ENTITY, self.hook_start.z);
        }
        if(sf & 4)
        {
-               WriteCoord(MSG_ENTITY, self.hook_end_x);
-               WriteCoord(MSG_ENTITY, self.hook_end_y);
-               WriteCoord(MSG_ENTITY, self.hook_end_z);
+               WriteCoord(MSG_ENTITY, self.hook_end.x);
+               WriteCoord(MSG_ENTITY, self.hook_end.y);
+               WriteCoord(MSG_ENTITY, self.hook_end.z);
        }
-       return TRUE;
+       return true;
 }
 
 void GrapplingHookThink()
@@ -138,7 +157,7 @@ void GrapplingHookThink()
        vs = hook_shotorigin[s];
 
        makevectors(self.realowner.v_angle);
-       org = self.realowner.origin + self.realowner.view_ofs + v_forward * vs_x + v_right * -vs_y + v_up * vs_z;
+       org = self.realowner.origin + self.realowner.view_ofs + v_forward * vs.x + v_right * -vs.y + v_up * vs.z;
        myorg = WarpZone_RefSys_TransformOrigin(self.realowner, self, org);
 
        if(self.hook_length < 0)
@@ -239,7 +258,7 @@ void GrapplingHookThink()
                }
        }
 
-       makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0');
+       makevectors(self.angles.x * '-1 0 0' + self.angles.y * '0 1 0');
        myorg = WarpZone_RefSys_TransformOrigin(self, self.realowner, self.origin); // + v_forward * (-9);
 
        if(myorg != self.hook_start)
@@ -267,7 +286,7 @@ void GrapplingHookTouch (void)
                        WarpZone_RefSys_BeginAddingIncrementally(self, self.aiment);
                }
 
-       //self.realowner.disableclientprediction = TRUE;
+       //self.realowner.disableclientprediction = true;
 }
 
 void GrapplingHook_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
@@ -312,7 +331,7 @@ void FireGrapplingHook (void)
 
        // UGLY WORKAROUND: play this on CH_WEAPON_B so it can't cut off fire sounds
        sound (self, CH_WEAPON_B, "weapons/hook_fire.wav", VOL_BASE, ATTEN_NORM);
-       org = self.origin + self.view_ofs + v_forward * vs_x + v_right * -vs_y + v_up * vs_z;
+       org = self.origin + self.view_ofs + v_forward * vs.x + v_right * -vs.y + v_up * vs.z;
 
        tracebox(self.origin + self.view_ofs, '-3 -3 -3', '3 3 3', org, MOVE_NORMAL, self);
        org = trace_endpos;
@@ -335,7 +354,7 @@ void FireGrapplingHook (void)
 
        missile.state = 0; // not latched onto anything
 
-       W_SetupProjVelocity_Explicit(missile, v_forward, v_up, autocvar_g_balance_grapplehook_speed_fly, 0, 0, 0, FALSE);
+       W_SetupProjVelocity_Explicit(missile, v_forward, v_up, autocvar_g_balance_grapplehook_speed_fly, 0, 0, 0, false);
 
        missile.angles = vectoangles (missile.velocity);
        //missile.glow_color = 250; // 244, 250
@@ -354,7 +373,7 @@ void FireGrapplingHook (void)
 
        missile.hook_start = missile.hook_end = missile.origin;
 
-       Net_LinkEntity(missile, FALSE, 0, GrapplingHookSend);
+       Net_LinkEntity(missile, false, 0, GrapplingHookSend);
 }
 
 //  void GrapplingHookFrame()
@@ -477,10 +496,10 @@ void GrappleHookInit()
        else
        {
                WEP_ACTION(WEP_HOOK, WR_INIT);
-               hook_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), FALSE, FALSE, 1);
-               hook_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), FALSE, FALSE, 2);
-               hook_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), FALSE, FALSE, 3);
-               hook_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), FALSE, FALSE, 4);
+               hook_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), false, false, 1);
+               hook_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), false, false, 2);
+               hook_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), false, false, 3);
+               hook_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), false, false, 4);
        }
 }
 
index 2904c3230010db8ec0cde840d63cc9595e2b66e5..aa641a56bc84bc927299e4715f2c456fbd05e205 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef HOOK_H
+#define HOOK_H
+
 // Wazat's grappling hook
 .entity                hook;
 void GrapplingHookFrame();
@@ -15,3 +18,4 @@ const float HOOK_WAITING_FOR_RELEASE = 16;
 
 void GrappleHookInit();
 vector hook_shotorigin[4];
+#endif
index 98429f7d7a510fe07a09657825d58809335ec1de..da53fbe64b2837689491d9b522780ac5999b9a27 100644 (file)
@@ -84,8 +84,6 @@ void dynlight_use()
 }
 void spawnfunc_dynlight()
 {
-       local   entity  targ;
-
        if (!self.light_lev)
                self.light_lev = 200;
        if (!self.color)
index 8a2fe9ef3334faf5d067d2ca101ee235428f62df..6e1c06d056f2eb5bf3306240042ad3b933af56bc 100644 (file)
@@ -1,3 +1,15 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../common/constants.qh"
+    #include "autocvars.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "../csqcmodellib/sv_model.qh"
+#endif
+
 .float modelscale;
 
 void g_model_setcolormaptoactivator (void)
@@ -35,7 +47,7 @@ void g_model_dropbyspawnflags()
        else if((self.spawnflags & 3) == 3) // ALIGN_ORIGIN | ALIGN_BOTTOM
        {
                traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self);
-               setorigin(self, trace_endpos - '0 0 1' * self.mins_z);
+               setorigin(self, trace_endpos - '0 0 1' * self.mins.z);
        }
 }
 
@@ -71,18 +83,18 @@ float g_clientmodel_genericsendentity (entity to, float sf)
 
        if(sf & 2)
        {
-               WriteCoord(MSG_ENTITY, self.origin_x);
-               WriteCoord(MSG_ENTITY, self.origin_y);
-               WriteCoord(MSG_ENTITY, self.origin_z);
+               WriteCoord(MSG_ENTITY, self.origin.x);
+               WriteCoord(MSG_ENTITY, self.origin.y);
+               WriteCoord(MSG_ENTITY, self.origin.z);
        }
 
        if(sf & 4)
        {
                if(sf & 0x10)
                {
-                       WriteAngle(MSG_ENTITY, self.angles_x);
-                       WriteAngle(MSG_ENTITY, self.angles_y);
-                       WriteAngle(MSG_ENTITY, self.angles_z);
+                       WriteAngle(MSG_ENTITY, self.angles.x);
+                       WriteAngle(MSG_ENTITY, self.angles.y);
+                       WriteAngle(MSG_ENTITY, self.angles.z);
                }
        }
 
@@ -102,12 +114,12 @@ float g_clientmodel_genericsendentity (entity to, float sf)
                WriteShort(MSG_ENTITY, floor(self.scale * 256));
                if(sf & 0x20)
                {
-                       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);
+                       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);
                }
                WriteString(MSG_ENTITY, self.bgmscript);
                if(self.bgmscript != "")
@@ -116,14 +128,14 @@ float g_clientmodel_genericsendentity (entity to, float sf)
                        WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 64));
                        WriteByte(MSG_ENTITY, floor(self.bgmscriptsustain * 255));
                        WriteByte(MSG_ENTITY, floor(self.bgmscriptrelease * 64));
-                       WriteCoord(MSG_ENTITY, self.movedir_x);
-                       WriteCoord(MSG_ENTITY, self.movedir_y);
-                       WriteCoord(MSG_ENTITY, self.movedir_z);
+                       WriteCoord(MSG_ENTITY, self.movedir.x);
+                       WriteCoord(MSG_ENTITY, self.movedir.y);
+                       WriteCoord(MSG_ENTITY, self.movedir.z);
                        WriteByte(MSG_ENTITY, floor(self.lip * 255));
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 
@@ -143,12 +155,12 @@ float g_clientmodel_genericsendentity (entity to, float sf)
        InitializeEntity(self, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
        if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT; \
        if(!self.bgmscriptsustain) self.bgmscriptsustain = 1; else if(self.bgmscriptsustain < 0) self.bgmscriptsustain = 0; \
-       Net_LinkEntity(self, TRUE, 0, g_clientmodel_genericsendentity);
+       Net_LinkEntity(self, true, 0, g_clientmodel_genericsendentity);
 
 // non-solid model entities:
-void spawnfunc_misc_gamemodel()         { self.angles_x = -self.angles_x; G_MODEL_INIT      (SOLID_NOT) } // model entity
-void spawnfunc_misc_clientmodel()       { self.angles_x = -self.angles_x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity
-void spawnfunc_misc_models()            { self.angles_x = -self.angles_x; G_MODEL_INIT      (SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use
+void spawnfunc_misc_gamemodel()         { self.angles_x = -self.angles.x; G_MODEL_INIT      (SOLID_NOT) } // model entity
+void spawnfunc_misc_clientmodel()       { self.angles_x = -self.angles.x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity
+void spawnfunc_misc_models()            { self.angles_x = -self.angles.x; G_MODEL_INIT      (SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use
 
 // non-solid brush entities:
 void spawnfunc_func_illusionary()       { G_MODEL_INIT      (SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED)
index fd0dc7861e20b1cee25cdfaa0545231952d78d57..74a8cf7f96126135f1ec45074a86d9d0036e3201 100644 (file)
@@ -1,9 +1,6 @@
-void SUB_NullThink(void) { }
+#include "g_subs.qh"
 
-void()  SUB_CalcMoveDone;
-void() SUB_CalcAngleMoveDone;
-//void() SUB_UseTargets;
-void() SUB_Remove;
+void SUB_NullThink(void) { }
 
 void spawnfunc_info_null (void)
 {
@@ -16,22 +13,22 @@ void setanim(entity e, vector anim, float looping, float override, float restart
        if (!anim)
                return; // no animation was given to us! We can't use this.
 
-       if (anim_x == e.animstate_startframe)
-       if (anim_y == e.animstate_numframes)
-       if (anim_z == e.animstate_framerate)
+       if (anim.x == e.animstate_startframe)
+       if (anim.y == e.animstate_numframes)
+       if (anim.z == e.animstate_framerate)
        {
                if(restart)
                {
                        if(restart > 0)
-                       if(anim_y == 1) // ZYM animation
+                       if(anim.y == 1) // ZYM animation
                                BITXOR_ASSIGN(e.effects, EF_RESTARTANIM_BIT);
                }
                else
                        return;
        }
-       e.animstate_startframe = anim_x;
-       e.animstate_numframes = anim_y;
-       e.animstate_framerate = anim_z;
+       e.animstate_startframe = anim.x;
+       e.animstate_numframes = anim.y;
+       e.animstate_framerate = anim.z;
        e.animstate_starttime = servertime - 0.1 * serverframetime; // shift it a little bit into the past to prevent float inaccuracy hiccups
        e.animstate_endtime = e.animstate_starttime + e.animstate_numframes / e.animstate_framerate;
        e.animstate_looping = looping;
@@ -49,7 +46,7 @@ void updateanim(entity e)
                        e.animstate_starttime = e.animstate_endtime;
                        e.animstate_endtime = e.animstate_starttime + e.animstate_numframes / e.animstate_framerate;
                }
-               e.animstate_override = FALSE;
+               e.animstate_override = false;
        }
        e.frame = e.animstate_startframe + bound(0, (time - e.animstate_starttime) * e.animstate_framerate, e.animstate_numframes - 1);
        //print(ftos(time), " -> ", ftos(e.frame), "\n");
@@ -74,7 +71,6 @@ SUB_Friction
 Applies some friction to self
 ==================
 */
-.float friction;
 void SUB_Friction (void)
 {
        self.nextthink = time;
@@ -152,7 +148,6 @@ void SUB_CalcMoveDone (void)
                self.think1 ();
 }
 
-.float platmovetype_turn;
 void SUB_CalcMove_controller_think (void)
 {
        entity oldself;
@@ -180,12 +175,12 @@ void SUB_CalcMove_controller_think (void)
                        vector destangle;
                        destangle = delta + 2 * delta2 * phasepos;
                        destangle = vectoangles(destangle);
-                       destangle_x = -destangle_x; // flip up / down orientation
+                       destangle.x = -destangle.x; // flip up / down orientation
 
                        // take the shortest distance for the angles
-                       self.owner.angles_x -= 360 * floor((self.owner.angles_x - destangle_x) / 360 + 0.5);
-                       self.owner.angles_y -= 360 * floor((self.owner.angles_y - destangle_y) / 360 + 0.5);
-                       self.owner.angles_z -= 360 * floor((self.owner.angles_z - destangle_z) / 360 + 0.5);
+                       self.owner.angles_x -= 360 * floor((self.owner.angles.x - destangle.x) / 360 + 0.5);
+                       self.owner.angles_y -= 360 * floor((self.owner.angles.y - destangle.y) / 360 + 0.5);
+                       self.owner.angles_z -= 360 * floor((self.owner.angles.z - destangle.z) / 360 + 0.5);
                        angloc = destangle - self.owner.angles;
                        angloc = angloc * (1 / sys_frametime); // so it arrives for the next frame
                        self.owner.avelocity = angloc;
@@ -236,12 +231,6 @@ void SUB_CalcMove_controller_setlinear (entity controller, vector org, vector de
        controller.destvec2 = '0 0 0';
 }
 
-float TSPEED_TIME = -1;
-float TSPEED_LINEAR = 0;
-float TSPEED_START = 1;
-float TSPEED_END = 2;
-// TODO average too?
-
 void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void() func)
 {
        float   traveltime;
@@ -392,9 +381,9 @@ void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void()
                objerror ("No speed is defined!");
 
        // take the shortest distance for the angles
-       self.angles_x -= 360 * floor((self.angles_x - destangle_x) / 360 + 0.5);
-       self.angles_y -= 360 * floor((self.angles_y - destangle_y) / 360 + 0.5);
-       self.angles_z -= 360 * floor((self.angles_z - destangle_z) / 360 + 0.5);
+       self.angles_x -= 360 * floor((self.angles.x - destangle.x) / 360 + 0.5);
+       self.angles_y -= 360 * floor((self.angles.y - destangle.y) / 360 + 0.5);
+       self.angles_z -= 360 * floor((self.angles.z - destangle.z) / 360 + 0.5);
        delta = destangle - self.angles;
 
        switch(tspeedtype)
@@ -507,7 +496,7 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma,
 }
 void traceline_antilag_force (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
 {
-       tracebox_antilag_force_wz(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag, FALSE);
+       tracebox_antilag_force_wz(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag, false);
 }
 void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
 {
@@ -519,11 +508,11 @@ void tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2
 {
        if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
                lag = 0;
-       tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, FALSE);
+       tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, false);
 }
 void WarpZone_traceline_antilag_force (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
 {
-       tracebox_antilag_force_wz(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag, TRUE);
+       tracebox_antilag_force_wz(source, v1, '0 0 0', '0 0 0', v2, nomonst, forent, lag, true);
 }
 void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag)
 {
@@ -535,7 +524,7 @@ void WarpZone_tracebox_antilag (entity source, vector v1, vector mi, vector ma,
 {
        if (autocvar_g_antilag != 2 || source.cvar_cl_noantilag)
                lag = 0;
-       tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, TRUE);
+       tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, true);
 }
 
 float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity) // returns the number of traces done, for benchmarking
@@ -554,7 +543,7 @@ float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomon
        float c;
        c = 0;
 
-       for(;;)
+       for (;;)
        {
                if(pos * dir >= v2 * dir)
                {
@@ -640,21 +629,21 @@ vector findbetterlocation (vector org, float mindist)
        c = 0;
        while (c < 6)
        {
-               traceline (org, org + vec, TRUE, world);
+               traceline (org, org + vec, true, world);
                vec = vec * -1;
                if (trace_fraction < 1)
                {
                        loc = trace_endpos;
-                       traceline (loc, loc + vec, TRUE, world);
+                       traceline (loc, loc + vec, true, world);
                        if (trace_fraction >= 1)
                                org = loc + vec;
                }
                if (c & 1)
                {
-                       h = vec_y;
-                       vec_y = vec_x;
-                       vec_x = vec_z;
-                       vec_z = h;
+                       h = vec.y;
+                       vec.y = vec.x;
+                       vec.x = vec.z;
+                       vec.z = h;
                }
                c = c + 1;
        }
@@ -704,16 +693,6 @@ float angc (float a1, float a2)
        return a;
 }
 
-.string lodtarget1;
-.string lodtarget2;
-.string lodmodel1;
-.string lodmodel2;
-.float lodmodelindex0;
-.float lodmodelindex1;
-.float lodmodelindex2;
-.float loddistance1;
-.float loddistance2;
-
 float LOD_customize()
 {
        float d;
@@ -727,7 +706,7 @@ float LOD_customize()
                        self.modelindex = self.lodmodelindex1;
                else // if(d == 3)
                        self.modelindex = self.lodmodelindex2;
-               return TRUE;
+               return true;
        }
 
        // TODO csqc network this so it only gets sent once
@@ -739,7 +718,7 @@ float LOD_customize()
        else
                self.modelindex = self.lodmodelindex2;
 
-       return TRUE;
+       return true;
 }
 
 void LOD_uncustomize()
@@ -809,24 +788,24 @@ void LODmodel_attach()
 
 void ApplyMinMaxScaleAngles(entity e)
 {
-       if(e.angles_x != 0 || e.angles_z != 0 || self.avelocity_x != 0 || self.avelocity_z != 0) // "weird" rotation
+       if(e.angles.x != 0 || e.angles.z != 0 || self.avelocity.x != 0 || self.avelocity.z != 0) // "weird" rotation
        {
                e.maxs = '1 1 1' * vlen(
-                       '1 0 0' * max(-e.mins_x, e.maxs_x) +
-                       '0 1 0' * max(-e.mins_y, e.maxs_y) +
-                       '0 0 1' * max(-e.mins_z, e.maxs_z)
+                       '1 0 0' * max(-e.mins.x, e.maxs.x) +
+                       '0 1 0' * max(-e.mins.y, e.maxs.y) +
+                       '0 0 1' * max(-e.mins.z, e.maxs.z)
                );
                e.mins = -e.maxs;
        }
-       else if(e.angles_y != 0 || self.avelocity_y != 0) // yaw only is a bit better
+       else if(e.angles.y != 0 || self.avelocity.y != 0) // yaw only is a bit better
        {
                e.maxs_x = vlen(
-                       '1 0 0' * max(-e.mins_x, e.maxs_x) +
-                       '0 1 0' * max(-e.mins_y, e.maxs_y)
+                       '1 0 0' * max(-e.mins.x, e.maxs.x) +
+                       '0 1 0' * max(-e.mins.y, e.maxs.y)
                );
-               e.maxs_y = e.maxs_x;
-               e.mins_x = -e.maxs_x;
-               e.mins_y = -e.maxs_x;
+               e.maxs_y = e.maxs.x;
+               e.mins_x = -e.maxs.x;
+               e.mins_y = -e.maxs.x;
        }
        if(e.scale)
                setsize(e, e.mins * e.scale, e.maxs * e.scale);
diff --git a/qcsrc/server/g_subs.qh b/qcsrc/server/g_subs.qh
new file mode 100644 (file)
index 0000000..04477e6
--- /dev/null
@@ -0,0 +1,197 @@
+#ifndef G_SUBS_H
+#define G_SUBS_H
+
+void SUB_NullThink(void);
+
+void()  SUB_CalcMoveDone;
+void() SUB_CalcAngleMoveDone;
+//void() SUB_UseTargets;
+void() SUB_Remove;
+
+void spawnfunc_info_null (void);
+
+void setanim(entity e, vector anim, float looping, float override, float restart);
+
+void updateanim(entity e);
+
+/*
+==================
+SUB_Remove
+
+Remove self
+==================
+*/
+void SUB_Remove (void);
+
+/*
+==================
+SUB_Friction
+
+Applies some friction to self
+==================
+*/
+.float friction;
+void SUB_Friction (void);
+
+/*
+==================
+SUB_VanishOrRemove
+
+Makes client invisible or removes non-client
+==================
+*/
+void SUB_VanishOrRemove (entity ent);
+
+void SUB_SetFade_Think (void);
+
+/*
+==================
+SUB_SetFade
+
+Fade 'ent' out when time >= 'when'
+==================
+*/
+void SUB_SetFade (entity ent, float when, float fadetime);
+
+/*
+=============
+SUB_CalcMove
+
+calculate self.velocity and self.nextthink to reach dest from
+self.origin traveling at speed
+===============
+*/
+void SUB_CalcMoveDone (void);
+
+.float platmovetype_turn;
+void SUB_CalcMove_controller_think (void);
+
+void SUB_CalcMove_controller_setbezier (entity controller, vector org, vector control, vector dest);
+
+void SUB_CalcMove_controller_setlinear (entity controller, vector org, vector dest);
+
+float TSPEED_TIME = -1;
+float TSPEED_LINEAR = 0;
+float TSPEED_START = 1;
+float TSPEED_END = 2;
+// TODO average too?
+
+void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void() func);
+
+void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func);
+
+void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func);
+
+/*
+=============
+SUB_CalcAngleMove
+
+calculate self.avelocity and self.nextthink to reach destangle from
+self.angles rotating
+
+The calling function should make sure self.think is valid
+===============
+*/
+void SUB_CalcAngleMoveDone (void);
+
+// FIXME: I fixed this function only for rotation around the main axes
+void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void() func);
+
+void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func);
+
+/*
+==================
+main
+
+unused but required by the engine
+==================
+*/
+void main (void);
+
+// Misc
+
+/*
+==================
+traceline_antilag
+
+A version of traceline that must be used by SOLID_SLIDEBOX things that want to hit SOLID_CORPSE things with a trace attack
+Additionally it moves players back into the past before the trace and restores them afterward.
+==================
+*/
+void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag, float wz);
+void traceline_antilag_force (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
+void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
+void tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag);
+void WarpZone_traceline_antilag_force (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
+void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
+void WarpZone_tracebox_antilag (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag);
+
+float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity); // returns the number of traces done, for benchmarking
+
+void traceline_inverted (vector v1, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity);
+
+/*
+==================
+findbetterlocation
+
+Returns a point at least 12 units away from walls
+(useful for explosion animations, although the blast is performed where it really happened)
+Ripped from DPMod
+==================
+*/
+vector findbetterlocation (vector org, float mindist);
+
+/*
+==================
+crandom
+
+Returns a random number between -1.0 and 1.0
+==================
+*/
+float crandom (void);
+
+/*
+==================
+Angc used for animations
+==================
+*/
+
+
+float angc (float a1, float a2);
+
+.string lodtarget1;
+.string lodtarget2;
+.string lodmodel1;
+.string lodmodel2;
+.float lodmodelindex0;
+.float lodmodelindex1;
+.float lodmodelindex2;
+.float loddistance1;
+.float loddistance2;
+
+float LOD_customize();
+
+void LOD_uncustomize();
+
+void LODmodel_attach();
+
+void ApplyMinMaxScaleAngles(entity e);
+
+void SetBrushEntityModel();
+
+void SetBrushEntityModelNoLOD();
+
+/*
+================
+InitTrigger
+================
+*/
+
+void SetMovedir();
+
+void InitTrigger();
+
+void InitSolidBSPTrigger();
+
+float InitMovingBrushTrigger();
+#endif
index f0ea33b61ee5bcad2117cd34089b7f9cfe85f35d..63e498bfc36075512a8d0f0581e44d8d0f9dd3c4 100644 (file)
@@ -1,3 +1,10 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/dpextensions.qh"
+    #include "autocvars.qh"
+#endif
+
 /*
 
 Installation:
@@ -24,7 +31,7 @@ float tet_vs_current_timeout;
 //   2 = game over
 //   3 = waiting for VS players
 
-var float tet_high_score = 0;
+float tet_high_score = 0;
 
 const vector TET_START_PIECE_POS = '5 1 0';
 const float TET_LINES = 22;
@@ -208,13 +215,13 @@ float PieceMetric(float x, float y, float rot, float pc)
                //   x = X-cx
                //   y = Y-cy
                t = y;
-               y = x - ce_x + ce_y;
-               x = -t + ce_x + ce_y;
+               y = x - ce.x + ce.y;
+               x = -t + ce.x + ce.y;
        }
        else if (rot == 2)//180
        {
-               x = 2 * ce_x - x;
-               y = 2 * ce_y - y;
+               x = 2 * ce.x - x;
+               y = 2 * ce.y - y;
        }
        else if (rot == 3) // 270
        {
@@ -223,16 +230,16 @@ float PieceMetric(float x, float y, float rot, float pc)
                //   x = X-cx
                //   y = Y-cy
                t = y;
-               y = -x + ce_y + ce_x;
-               x =  t - ce_y + ce_x;
+               y = -x + ce.y + ce.x;
+               x =  t - ce.y + ce.x;
        }
        if (x < 1 || y < 1 || x > 4 || y > 2)
                return 0;
        ce = PieceShape(pc);
        if (y == 1)
-               return !!(ce_x & pow(4, x-1)); // first row
+               return !!(ce.x & pow(4, x-1)); // first row
        else if (y == 2)
-               return !!(ce_y & pow(4, x-1)); // second row
+               return !!(ce.y & pow(4, x-1)); // second row
        else
                return 0; // illegal parms
 }
@@ -250,31 +257,31 @@ void PieceMinsMaxs(float rot, float pc)
        // 2 = 2..3
        // 3 = 1..3
        // 4 = 1..4
-       tet_piecemins_x = floor(3.0 - sz_x * 0.5);
-       tet_piecemaxs_x = floor(2.0 + sz_x * 0.5);
-       if(sz_y == 1)
+       tet_piecemins.x = floor(3.0 - sz.x * 0.5);
+       tet_piecemaxs.x = floor(2.0 + sz.x * 0.5);
+       if(sz.y == 1)
        {
                // special case for "I"
-               tet_piecemins_y = tet_piecemaxs_y = 2;
+               tet_piecemins.y = tet_piecemaxs.y = 2;
        }
        else
        {
-               tet_piecemins_y = 1;
-               tet_piecemaxs_y = sz_y;
+               tet_piecemins.y = 1;
+               tet_piecemaxs.y = sz.y;
        }
        //printf("ce%v sz%v mi%v ma%v\n", ce, sz, tet_piecemins, tet_piecemaxs);
        if (rot == 1) // 90 degrees
        {
-               t = tet_piecemins_y;
-               tet_piecemins_y = -tet_piecemins_x + ce_y + ce_x;
-               tet_piecemins_x = t - ce_y + ce_x;
-               t = tet_piecemaxs_y;
-               tet_piecemaxs_y = -tet_piecemaxs_x + ce_y + ce_x;
-               tet_piecemaxs_x = t - ce_y + ce_x;
+               t = tet_piecemins.y;
+               tet_piecemins.y = -tet_piecemins.x + ce.y + ce.x;
+               tet_piecemins.x = t - ce.y + ce.x;
+               t = tet_piecemaxs.y;
+               tet_piecemaxs.y = -tet_piecemaxs.x + ce.y + ce.x;
+               tet_piecemaxs.x = t - ce.y + ce.x;
                // swap mins_y, maxs_y
-               t = tet_piecemins_y;
-               tet_piecemins_y = tet_piecemaxs_y;
-               tet_piecemaxs_y = t;
+               t = tet_piecemins.y;
+               tet_piecemins.y = tet_piecemaxs.y;
+               tet_piecemaxs.y = t;
                // TODO OPTIMIZE
        }
        else if (rot == 2)//180
@@ -285,24 +292,24 @@ void PieceMinsMaxs(float rot, float pc)
        }
        else if (rot == 3) // 270
        {
-               t = tet_piecemins_y;
-               tet_piecemins_y = tet_piecemins_x - ce_x + ce_y;
-               tet_piecemins_x = -t + ce_x + ce_y;
-               t = tet_piecemaxs_y;
-               tet_piecemaxs_y = tet_piecemaxs_x - ce_x + ce_y;
-               tet_piecemaxs_x = -t + ce_x + ce_y;
+               t = tet_piecemins.y;
+               tet_piecemins.y = tet_piecemins.x - ce.x + ce.y;
+               tet_piecemins.x = -t + ce.x + ce.y;
+               t = tet_piecemaxs.y;
+               tet_piecemaxs.y = tet_piecemaxs.x - ce.x + ce.y;
+               tet_piecemaxs.x = -t + ce.x + ce.y;
                // swap mins_x, maxs_x
-               t = tet_piecemins_x;
-               tet_piecemins_x = tet_piecemaxs_x;
-               tet_piecemaxs_x = t;
+               t = tet_piecemins.x;
+               tet_piecemins.x = tet_piecemaxs.x;
+               tet_piecemaxs.x = t;
                // TODO OPTIMIZE
        }
 #ifdef VERIFY
        print(vtos(tet_piecemins), "-");
        print(vtos(tet_piecemaxs), "\n");
-       if(tet_piecemins_x > tet_piecemaxs_x)
+       if(tet_piecemins.x > tet_piecemaxs.x)
                error("inconsistent mins/maxs");
-       if(tet_piecemins_y > tet_piecemaxs_y)
+       if(tet_piecemins.y > tet_piecemaxs.y)
                error("inconsistent mins/maxs");
        float i, j;
        vector realmins, realmaxs;
@@ -312,10 +319,10 @@ void PieceMinsMaxs(float rot, float pc)
                for(j = 1; j <= 4; ++j)
                        if(PieceMetric(i, j, rot, pc))
                        {
-                               realmins_x = min(realmins_x, i);
-                               realmins_y = min(realmins_y, j);
-                               realmaxs_x = max(realmaxs_x, i);
-                               realmaxs_y = max(realmaxs_y, j);
+                               realmins.x = min(realmins.x, i);
+                               realmins.y = min(realmins.y, j);
+                               realmaxs.x = max(realmaxs.x, i);
+                               realmaxs.y = max(realmaxs.y, j);
                        }
        if(realmins != tet_piecemins || realmaxs != tet_piecemaxs)
                error(sprintf("incorrect mins/maxs: %v %v in %d rot %d mins %v maxs %v\n", realmins, realmaxs, rot, pc, tet_piecemins, tet_piecemaxs));
@@ -394,9 +401,9 @@ void DrawPiece(float pc, float ln)
 
        piece_dat = PieceShape(pc);
        if (ln == 1)
-               piece_ln = piece_dat_x;
+               piece_ln = piece_dat.x;
        else
-               piece_ln = piece_dat_y;
+               piece_ln = piece_dat.y;
        for (x = 1; x <= 4; x = x + 1)
        {
                if (piece_ln & pow(4, x-1))
@@ -688,7 +695,7 @@ float BastetPiece()
 
        bastet_profile_evaluate_time = 0;
        bastet_profile_checkmetrics_time = 0;
-       var float t1 = gettime(GETTIME_HIRES);
+       float t1 = gettime(GETTIME_HIRES);
 
        b = buf_create(); bastet_piece[0] = 1; bastet_score[0] = BastetSearch(b, 1, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[0]; buf_del(b);
        b = buf_create(); bastet_piece[1] = 2; bastet_score[1] = BastetSearch(b, 2, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[1]; buf_del(b);
@@ -698,7 +705,7 @@ float BastetPiece()
        b = buf_create(); bastet_piece[5] = 6; bastet_score[5] = BastetSearch(b, 6, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[5]; buf_del(b);
        b = buf_create(); bastet_piece[6] = 7; bastet_score[6] = BastetSearch(b, 7, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[6]; buf_del(b);
 
-       var float t2 = gettime(GETTIME_HIRES);
+       float t2 = gettime(GETTIME_HIRES);
        dprintf("Time taken: %.6f seconds (of this, ev = %.2f%%, cm = %.2f%%)\n", t2 - t1, 100 * bastet_profile_evaluate_time / (t2 - t1), 100 * bastet_profile_checkmetrics_time / (t2 - t1));
 
        // sort
@@ -819,18 +826,18 @@ float CheckMetrics(float piece, float orgx, float orgy, float rot) /*FIXDECL*/
        orgy = orgy - 1;
 
        PieceMinsMaxs(rot, piece);
-       if (tet_piecemins_x+orgx<1 || tet_piecemaxs_x+orgx > TET_WIDTH || tet_piecemins_y+orgy<1 || tet_piecemaxs_y+orgy> TET_LINES)
-               return FALSE; // ouside the level
-       for (y = tet_piecemins_y; y <= tet_piecemaxs_y; y = y + 1)
+       if (tet_piecemins.x+orgx<1 || tet_piecemaxs.x+orgx > TET_WIDTH || tet_piecemins.y+orgy<1 || tet_piecemaxs.y+orgy> TET_LINES)
+               return false; // ouside the level
+       for (y = tet_piecemins.y; y <= tet_piecemaxs.y; y = y + 1)
        {
                l = GetLine(y + orgy);
                if(l != TET_EMPTY_LINE)
-               for (x = tet_piecemins_x; x <= tet_piecemaxs_x; x = x + 1)
+               for (x = tet_piecemins.x; x <= tet_piecemaxs.x; x = x + 1)
                        if (PieceMetric(x, y, rot, piece))
                                if (GetXBlock(x + orgx, l))
-                                       return FALSE; // uhoh, gonna hit something.
+                                       return false; // uhoh, gonna hit something.
        }
-       return TRUE;
+       return true;
 }
 
 void ClearPiece(float piece, float orgx, float orgy, float rot) /*FIXDECL*/
@@ -841,9 +848,9 @@ void ClearPiece(float piece, float orgx, float orgy, float rot) /*FIXDECL*/
        orgy = orgy - 1;
 
        PieceMinsMaxs(rot, piece);
-       for (y = tet_piecemins_y; y <= tet_piecemaxs_y; y = y + 1)
+       for (y = tet_piecemins.y; y <= tet_piecemaxs.y; y = y + 1)
        {
-               for (x = tet_piecemins_x; x <= tet_piecemaxs_x; x = x + 1)
+               for (x = tet_piecemins.x; x <= tet_piecemaxs.x; x = x + 1)
                {
                        if (PieceMetric(x, y, rot, piece))
                        {
@@ -863,9 +870,9 @@ void CementPiece(float piece, float orgx, float orgy, float rot) /*FIXDECL*/
        pcolor = PieceColor(piece);
 
        PieceMinsMaxs(rot, piece);
-       for (y = tet_piecemins_y; y <= tet_piecemaxs_y; y = y + 1)
+       for (y = tet_piecemins.y; y <= tet_piecemaxs.y; y = y + 1)
        {
-               for (x = tet_piecemins_x; x <= tet_piecemaxs_x; x = x + 1)
+               for (x = tet_piecemins.x; x <= tet_piecemaxs.x; x = x + 1)
                {
                        if (PieceMetric(x, y, rot, piece))
                        {
@@ -894,7 +901,7 @@ void CompletedLines()
 
        cleared = 0;
        y = TET_LINES;
-       for(;;)
+       for (;;)
        {
                ln = GetLine(y);
                if(strstrofs(ln, "0", 0) < 0)
@@ -990,7 +997,7 @@ void HandleGame(float keyss)
                brand_new = 1;
        }
        else
-               ClearPiece(self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z);
+               ClearPiece(self.piece_type, self.piece_pos.x, self.piece_pos.y, self.piece_pos.z);
 
        // next we need to check the piece metrics against what's on the level
        // based on the key order
@@ -1001,36 +1008,36 @@ void HandleGame(float keyss)
        nudge = 0;
        if (keyss & TETKEY_RIGHT)
        {
-               check_pos_x = check_pos_x + 1;
+               check_pos.x = check_pos.x + 1;
                tetsnd("tetmove");
        }
        else if (keyss & TETKEY_LEFT)
        {
-               check_pos_x = check_pos_x - 1;
+               check_pos.x = check_pos.x - 1;
                tetsnd("tetmove");
        }
        else if (keyss & TETKEY_ROTRIGHT)
        {
-               check_pos_z = check_pos_z + 1;
+               check_pos.z = check_pos.z + 1;
                piece_data = PieceShape(self.piece_type);
                nudge = 1;
                tetsnd("tetrot");
        }
        else if (keyss & TETKEY_ROTLEFT)
        {
-               check_pos_z = check_pos_z - 1;
+               check_pos.z = check_pos.z - 1;
                piece_data = PieceShape(self.piece_type);
                nudge = 1;
                tetsnd("tetrot");
        }
        // bounds check
-       if (check_pos_z > 3)
-               check_pos_z = 0;
-       else if (check_pos_z < 0)
-               check_pos_z = 3;
+       if (check_pos.z > 3)
+               check_pos.z = 0;
+       else if (check_pos.z < 0)
+               check_pos.z = 3;
 
        // reality check
-       if (CheckMetrics(self.piece_type, check_pos_x, check_pos_y, check_pos_z))
+       if (CheckMetrics(self.piece_type, check_pos.x, check_pos.y, check_pos.z))
                self.piece_pos = check_pos;
        else if (brand_new)
        {
@@ -1042,9 +1049,9 @@ void HandleGame(float keyss)
        {
                for(i = 1; i <= nudge; ++i)
                {
-                       if(CheckMetrics(self.piece_type, check_pos_x + i, check_pos_y, check_pos_z))
+                       if(CheckMetrics(self.piece_type, check_pos.x + i, check_pos.y, check_pos.z))
                                self.piece_pos = check_pos + '1 0 0' * i;
-                       else if(CheckMetrics(self.piece_type, check_pos_x - i, check_pos_y, check_pos_z))
+                       else if(CheckMetrics(self.piece_type, check_pos.x - i, check_pos.y, check_pos.z))
                                self.piece_pos = check_pos - '1 0 0' * i;
                        else
                                continue;
@@ -1056,22 +1063,22 @@ void HandleGame(float keyss)
        {
                // drop to bottom, but do NOT cement it yet
                // this allows sliding it
-               ++check_pos_y;
-               while(CheckMetrics(self.piece_type, check_pos_x, check_pos_y + 1, check_pos_z))
-                       ++check_pos_y;
+               ++check_pos.y;
+               while(CheckMetrics(self.piece_type, check_pos.x, check_pos.y + 1, check_pos.z))
+                       ++check_pos.y;
                self.tet_autodown = time + 2 / (1 + Tetris_Level());
        }
        else if (keyss & TETKEY_DOWN)
        {
-               check_pos_y = check_pos_y + 1;
+               check_pos.y = check_pos.y + 1;
                self.tet_autodown = time + 2 / (1 + Tetris_Level());
        }
        else if (self.tet_autodown < time)
        {
-               check_pos_y = check_pos_y + 1;
+               check_pos.y = check_pos.y + 1;
                self.tet_autodown = time + 2 / (1 + Tetris_Level());
        }
-       if (CheckMetrics(self.piece_type, check_pos_x, check_pos_y, check_pos_z))
+       if (CheckMetrics(self.piece_type, check_pos.x, check_pos.y, check_pos.z))
        {
                if(old_pos != check_pos)
                        self.tet_drawtime = 0;
@@ -1079,14 +1086,14 @@ void HandleGame(float keyss)
        }
        else
        {
-               CementPiece(self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z);
+               CementPiece(self.piece_type, self.piece_pos.x, self.piece_pos.y, self.piece_pos.z);
                TetAddScore(1);
                CompletedLines();
                self.piece_type = 0;
                self.tet_drawtime = 0;
                return;
        }
-       CementPiece(self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z);
+       CementPiece(self.piece_type, self.piece_pos.x, self.piece_pos.y, self.piece_pos.z);
 }
 
 /*
@@ -1218,16 +1225,16 @@ float TetrisPostFrame()
 
        if(self.tetris_on == 1)
        {
-               if(TetrisKeyRepeat(tetkey_down, self.movement_x < 0))
+               if(TetrisKeyRepeat(tetkey_down, self.movement.x < 0))
                        keysa |= TETKEY_DOWN;
 
-               if(TetrisKeyRepeat(tetkey_rotright, self.movement_x > 0))
+               if(TetrisKeyRepeat(tetkey_rotright, self.movement.x > 0))
                        keysa |= TETKEY_ROTRIGHT;
 
-               if(TetrisKeyRepeat(tetkey_left, self.movement_y < 0))
+               if(TetrisKeyRepeat(tetkey_left, self.movement.y < 0))
                        keysa |= TETKEY_LEFT;
 
-               if(TetrisKeyRepeat(tetkey_right, self.movement_y > 0))
+               if(TetrisKeyRepeat(tetkey_right, self.movement.y > 0))
                        keysa |= TETKEY_RIGHT;
 
                if(TetrisKeyRepeat(tetkey_rotleft, self.BUTTON_CROUCH))
index c5fb08c965c2afa88d6f6f3aecf1d58974c333bd..9bb1e06e7affc73015e5a8b34bbf0340a6bc004a 100644 (file)
@@ -1,10 +1,11 @@
+#include "g_triggers.qh"
+#include "t_jumppads.qh"
+
 void SUB_DontUseTargets()
 {
 }
 
 
-void() SUB_UseTargets;
-
 void DelayThink()
 {
        activator = self.enemy;
@@ -136,9 +137,6 @@ void SUB_UseTargets()
 
 //=============================================================================
 
-const float    SPAWNFLAG_NOMESSAGE = 1;
-const float    SPAWNFLAG_NOTOUCH = 1;
-
 // the wait time has passed, so set back up for another activation
 void multi_wait()
 {
@@ -431,7 +429,6 @@ void trigger_hurt_use()
                self.enemy = world; // let's just destroy it, if taking over is too much work
 }
 
-.float triggerhurttime;
 void trigger_hurt_touch()
 {
        if (self.active != ACTIVE_ACTIVE)
@@ -478,9 +475,6 @@ Any object touching this will be hurt
 set dmg to damage amount
 defalt dmg = 5
 */
-.entity trigger_hurt_next;
-entity trigger_hurt_last;
-entity trigger_hurt_first;
 void spawnfunc_trigger_hurt()
 {
        EXACTTRIGGER_INIT;
@@ -509,9 +503,9 @@ float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end)
 
        for(th = trigger_hurt_first; th; th = th.trigger_hurt_next)
                if(tracebox_hits_box(start, mi, ma, end, th.absmin, th.absmax))
-                       return TRUE;
+                       return true;
 
-       return FALSE;
+       return false;
 }
 
 //////////////////////////////////////////////////////////////
@@ -522,7 +516,6 @@ float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end)
 //
 //////////////////////////////////////////////////////////////
 
-.float triggerhealtime;
 void trigger_heal_touch()
 {
        if (self.active != ACTIVE_ACTIVE)
@@ -572,7 +565,6 @@ void spawnfunc_trigger_heal()
 //
 //////////////////////////////////////////////////////////////
 
-.entity trigger_gravity_check;
 void trigger_gravity_remove(entity own)
 {
        if(own.trigger_gravity_check.owner == own)
@@ -614,7 +606,7 @@ void trigger_gravity_touch()
 {
        float g;
 
-       if(self.state != TRUE)
+       if(self.state != true)
                return;
 
        EXACTTRIGGER_TOUCH;
@@ -668,20 +660,18 @@ void spawnfunc_trigger_gravity()
        if(self.noise != "")
                precache_sound(self.noise);
 
-       self.state = TRUE;
+       self.state = true;
        IFTARGETED
        {
                self.use = trigger_gravity_use;
                if(self.spawnflags & 2)
-                       self.state = FALSE;
+                       self.state = false;
        }
 }
 
 //=============================================================================
 
 // TODO add a way to do looped sounds with sound(); then complete this entity
-.float volume, atten;
-void target_speaker_use_off();
 void target_speaker_use_activator()
 {
        if (!IS_REAL_CLIENT(activator))
@@ -817,11 +807,6 @@ void spawnfunc_func_stardust() {
        self.effects = EF_STARDUST;
 }
 
-.string bgmscript;
-.float bgmscriptattack;
-.float bgmscriptdecay;
-.float bgmscriptsustain;
-.float bgmscriptrelease;
 float pointparticles_SendEntity(entity to, float fl)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_POINTPARTICLES);
@@ -847,9 +832,9 @@ float pointparticles_SendEntity(entity to, float fl)
        }
        if(fl & 4)
        {
-               WriteCoord(MSG_ENTITY, self.origin_x);
-               WriteCoord(MSG_ENTITY, self.origin_y);
-               WriteCoord(MSG_ENTITY, self.origin_z);
+               WriteCoord(MSG_ENTITY, self.origin.x);
+               WriteCoord(MSG_ENTITY, self.origin.y);
+               WriteCoord(MSG_ENTITY, self.origin.z);
        }
        if(fl & 1)
        {
@@ -858,12 +843,12 @@ float pointparticles_SendEntity(entity to, float fl)
                        WriteShort(MSG_ENTITY, self.modelindex);
                        if(fl & 0x80)
                        {
-                               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);
+                               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);
                        }
                }
                else
@@ -871,9 +856,9 @@ float pointparticles_SendEntity(entity to, float fl)
                        WriteShort(MSG_ENTITY, 0);
                        if(fl & 0x80)
                        {
-                               WriteCoord(MSG_ENTITY, self.maxs_x);
-                               WriteCoord(MSG_ENTITY, self.maxs_y);
-                               WriteCoord(MSG_ENTITY, self.maxs_z);
+                               WriteCoord(MSG_ENTITY, self.maxs.x);
+                               WriteCoord(MSG_ENTITY, self.maxs.y);
+                               WriteCoord(MSG_ENTITY, self.maxs.z);
                        }
                }
                WriteShort(MSG_ENTITY, self.cnt);
@@ -1003,12 +988,12 @@ float rainsnow_SendEntity(entity to, float sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_RAINSNOW);
        WriteByte(MSG_ENTITY, self.state);
-       WriteCoord(MSG_ENTITY, self.origin_x + self.mins_x);
-       WriteCoord(MSG_ENTITY, self.origin_y + self.mins_y);
-       WriteCoord(MSG_ENTITY, self.origin_z + self.mins_z);
-       WriteCoord(MSG_ENTITY, self.maxs_x - self.mins_x);
-       WriteCoord(MSG_ENTITY, self.maxs_y - self.mins_y);
-       WriteCoord(MSG_ENTITY, self.maxs_z - self.mins_z);
+       WriteCoord(MSG_ENTITY, self.origin.x + self.mins.x);
+       WriteCoord(MSG_ENTITY, self.origin.y + self.mins.y);
+       WriteCoord(MSG_ENTITY, self.origin.z + self.mins.z);
+       WriteCoord(MSG_ENTITY, self.maxs.x - self.mins.x);
+       WriteCoord(MSG_ENTITY, self.maxs.y - self.mins.y);
+       WriteCoord(MSG_ENTITY, self.maxs.z - self.mins.z);
        WriteShort(MSG_ENTITY, compressShortVector(self.dest));
        WriteShort(MSG_ENTITY, self.count);
        WriteByte(MSG_ENTITY, self.cnt);
@@ -1040,7 +1025,7 @@ void spawnfunc_func_rain()
                self.cnt = 12;
        if (!self.count)
                self.count = 2000;
-       self.count = 0.01 * self.count * (self.size_x / 1024) * (self.size_y / 1024);
+       self.count = 0.01 * self.count * (self.size.x / 1024) * (self.size.y / 1024);
        if (self.count < 1)
                self.count = 1;
        if(self.count > 65535)
@@ -1049,7 +1034,7 @@ void spawnfunc_func_rain()
        self.state = 1; // 1 is rain, 0 is snow
        self.Version = 1;
 
-       Net_LinkEntity(self, FALSE, 0, rainsnow_SendEntity);
+       Net_LinkEntity(self, false, 0, rainsnow_SendEntity);
 }
 
 
@@ -1078,7 +1063,7 @@ void spawnfunc_func_snow()
                self.cnt = 12;
        if (!self.count)
                self.count = 2000;
-       self.count = 0.01 * self.count * (self.size_x / 1024) * (self.size_y / 1024);
+       self.count = 0.01 * self.count * (self.size.x / 1024) * (self.size.y / 1024);
        if (self.count < 1)
                self.count = 1;
        if(self.count > 65535)
@@ -1087,10 +1072,9 @@ void spawnfunc_func_snow()
        self.state = 0; // 1 is rain, 0 is snow
        self.Version = 1;
 
-       Net_LinkEntity(self, FALSE, 0, rainsnow_SendEntity);
+       Net_LinkEntity(self, false, 0, rainsnow_SendEntity);
 }
 
-.float modelscale;
 void misc_laser_aim()
 {
        vector a;
@@ -1107,7 +1091,7 @@ void misc_laser_aim()
                else
                {
                        a = vectoangles(self.enemy.origin - self.origin);
-                       a_x = -a_x;
+                       a.x = -a.x;
                        if(a != self.mangle)
                        {
                                self.mangle = a;
@@ -1136,7 +1120,6 @@ void misc_laser_init()
                self.enemy = find(world, targetname, self.target);
 }
 
-.entity pusher;
 void misc_laser_think()
 {
        vector o;
@@ -1226,15 +1209,15 @@ float laser_SendEntity(entity to, float fl)
        WriteByte(MSG_ENTITY, fl);
        if(fl & 1)
        {
-               WriteCoord(MSG_ENTITY, self.origin_x);
-               WriteCoord(MSG_ENTITY, self.origin_y);
-               WriteCoord(MSG_ENTITY, self.origin_z);
+               WriteCoord(MSG_ENTITY, self.origin.x);
+               WriteCoord(MSG_ENTITY, self.origin.y);
+               WriteCoord(MSG_ENTITY, self.origin.z);
        }
        if(fl & 8)
        {
-               WriteByte(MSG_ENTITY, self.colormod_x * 255.0);
-               WriteByte(MSG_ENTITY, self.colormod_y * 255.0);
-               WriteByte(MSG_ENTITY, self.colormod_z * 255.0);
+               WriteByte(MSG_ENTITY, self.colormod.x * 255.0);
+               WriteByte(MSG_ENTITY, self.colormod.y * 255.0);
+               WriteByte(MSG_ENTITY, self.colormod.z * 255.0);
                if(fl & 0x40)
                        WriteByte(MSG_ENTITY, self.alpha * 255.0);
                if(fl & 0x20)
@@ -1249,14 +1232,14 @@ float laser_SendEntity(entity to, float fl)
        {
                if(fl & 0x80)
                {
-                       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.origin.x);
+                       WriteCoord(MSG_ENTITY, self.enemy.origin.y);
+                       WriteCoord(MSG_ENTITY, self.enemy.origin.z);
                }
                else
                {
-                       WriteAngle(MSG_ENTITY, self.mangle_x);
-                       WriteAngle(MSG_ENTITY, self.mangle_y);
+                       WriteAngle(MSG_ENTITY, self.mangle.x);
+                       WriteAngle(MSG_ENTITY, self.mangle.y);
                }
        }
        if(fl & 4)
@@ -1334,7 +1317,7 @@ void spawnfunc_misc_laser()
 
        self.mangle = self.angles;
 
-       Net_LinkEntity(self, FALSE, 0, laser_SendEntity);
+       Net_LinkEntity(self, false, 0, laser_SendEntity);
 
        IFTARGETED
        {
@@ -1347,10 +1330,6 @@ void spawnfunc_misc_laser()
 }
 
 // tZorks trigger impulse / gravity
-.float radius;
-.float falloff;
-.float strength;
-.float lastpushtime;
 
 // targeted (directional) mode
 void trigger_impulse_touch1()
@@ -1726,11 +1705,6 @@ void spawnfunc_trigger_gamestart() {
 
 
 
-.entity voicescript; // attached voice script
-.float voicescript_index; // index of next voice, or -1 to use the randomized ones
-.float voicescript_nextthink; // time to play next voice
-.float voicescript_voiceend; // time when this voice ends
-
 void target_voicescript_clear(entity pl)
 {
        pl.voicescript = world;
@@ -1894,8 +1868,6 @@ void spawnfunc_trigger_disablerelay()
        self.use = trigger_disablerelay_use;
 }
 
-float magicear_matched;
-float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorepitch, float mintempo, float maxtempo);
 string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin)
 {
        float domatch, dotrigger, matchstart, l;
@@ -1903,7 +1875,7 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay,
        entity oldself;
        string savemessage;
 
-       magicear_matched = FALSE;
+       magicear_matched = false;
 
        dotrigger = ((IS_PLAYER(source)) && (source.deadflag == DEAD_NO) && ((ear.radius == 0) || (vlen(source.origin - ear.origin) <= ear.radius)));
        domatch = ((ear.spawnflags & 32) || dotrigger);
@@ -1917,10 +1889,10 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay,
                if (!(ear.spawnflags & 256))
                        return msgin;
 
-               if(!W_Tuba_HasPlayed(source, ear.message, ear.movedir_x, !(ear.spawnflags & 512), ear.movedir_y, ear.movedir_z))
+               if(!W_Tuba_HasPlayed(source, ear.message, ear.movedir.x, !(ear.spawnflags & 512), ear.movedir.y, ear.movedir.z))
                        return msgin;
 
-               magicear_matched = TRUE;
+               magicear_matched = true;
 
                if(dotrigger)
                {
@@ -2011,7 +1983,7 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay,
        if(matchstart == -1) // no match
                return msgin;
 
-       magicear_matched = TRUE;
+       magicear_matched = true;
 
        if(dotrigger)
        {
@@ -2044,7 +2016,6 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay,
                return msgin;
 }
 
-entity magicears;
 string trigger_magicear_processmessage_forallears(entity source, float teamsay, entity privatesay, string msgin)
 {
        entity ear;
@@ -2141,7 +2112,6 @@ void spawnfunc_relay_activatetoggle()
        self.use = relay_activators_use;
 }
 
-.string chmap, gametype;
 void spawnfunc_target_changelevel_use()
 {
        if(self.gametype != "")
diff --git a/qcsrc/server/g_triggers.qh b/qcsrc/server/g_triggers.qh
new file mode 100644 (file)
index 0000000..35c39f2
--- /dev/null
@@ -0,0 +1,388 @@
+#ifndef G_TRIGGERS_H
+#define G_TRIGGERS_H
+
+void SUB_DontUseTargets();
+
+
+void() SUB_UseTargets;
+
+void DelayThink();
+
+/*
+==============================
+SUB_UseTargets
+
+the global "activator" should be set to the entity that initiated the firing.
+
+If self.delay is set, a DelayedUse entity will be created that will actually
+do the SUB_UseTargets after that many seconds have passed.
+
+Centerprints any self.message to the activator.
+
+Removes all entities with a targetname that match self.killtarget,
+and removes them, so some events can remove other triggers.
+
+Search for (string)targetname in all entities that
+match (string)self.target and call their .use function
+
+==============================
+*/
+void SUB_UseTargets();
+
+
+//=============================================================================
+
+const float    SPAWNFLAG_NOMESSAGE = 1;
+const float    SPAWNFLAG_NOTOUCH = 1;
+
+// the wait time has passed, so set back up for another activation
+void multi_wait();
+
+
+// the trigger was just touched/killed/used
+// self.enemy should be set to the activator so it can be held through a delay
+// so wait for the delay time before firing
+void multi_trigger();
+
+void multi_use();
+
+void multi_touch();
+
+void multi_eventdamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
+
+void multi_reset();
+
+/*QUAKED spawnfunc_trigger_multiple (.5 .5 .5) ? notouch
+Variable sized repeatable trigger.  Must be targeted at one or more entities.  If "health" is set, the trigger must be killed to activate each time.
+If "delay" is set, the trigger waits some time after activating before firing.
+"wait" : Seconds between triggerings. (.2 default)
+If notouch is set, the trigger is only fired by other entities, not by touching.
+NOTOUCH has been obsoleted by spawnfunc_trigger_relay!
+sounds
+1)     secret
+2)     beep beep
+3)     large switch
+4)
+set "message" to text string
+*/
+void spawnfunc_trigger_multiple();
+
+
+/*QUAKED spawnfunc_trigger_once (.5 .5 .5) ? notouch
+Variable sized trigger. Triggers once, then removes itself.  You must set the key "target" to the name of another object in the level that has a matching
+"targetname".  If "health" is set, the trigger must be killed to activate.
+If notouch is set, the trigger is only fired by other entities, not by touching.
+if "killtarget" is set, any objects that have a matching "target" will be removed when the trigger is fired.
+if "angle" is set, the trigger will only fire when someone is facing the direction of the angle.  Use "360" for an angle of 0.
+sounds
+1)     secret
+2)     beep beep
+3)     large switch
+4)
+set "message" to text string
+*/
+void spawnfunc_trigger_once();
+
+//=============================================================================
+
+/*QUAKED spawnfunc_trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8)
+This fixed size trigger cannot be touched, it can only be fired by other events.  It can contain killtargets, targets, delays, and messages.
+*/
+void spawnfunc_trigger_relay();
+
+void delay_use();
+
+void delay_reset();
+
+void spawnfunc_trigger_delay();
+
+//=============================================================================
+
+
+void counter_use();
+
+void counter_reset();
+
+/*QUAKED spawnfunc_trigger_counter (.5 .5 .5) ? nomessage
+Acts as an intermediary for an action that takes multiple inputs.
+
+If nomessage is not set, t will print "1 more.. " etc when triggered and "sequence complete" when finished.
+
+After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself.
+*/
+void spawnfunc_trigger_counter();
+
+void trigger_hurt_use();
+
+.float triggerhurttime;
+void trigger_hurt_touch();
+
+/*QUAKED spawnfunc_trigger_hurt (.5 .5 .5) ?
+Any object touching this will be hurt
+set dmg to damage amount
+defalt dmg = 5
+*/
+.entity trigger_hurt_next;
+entity trigger_hurt_last;
+entity trigger_hurt_first;
+void spawnfunc_trigger_hurt();
+
+float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end);
+
+//////////////////////////////////////////////////////////////
+//
+//
+//
+//Trigger heal --a04191b92fbd93aa67214ef7e72d6d2e
+//
+//////////////////////////////////////////////////////////////
+
+.float triggerhealtime;
+void trigger_heal_touch();
+
+void spawnfunc_trigger_heal();
+
+
+//////////////////////////////////////////////////////////////
+//
+//
+//
+//End trigger_heal
+//
+//////////////////////////////////////////////////////////////
+
+.entity trigger_gravity_check;
+void trigger_gravity_remove(entity own);
+void trigger_gravity_check_think();
+
+void trigger_gravity_use();
+
+void trigger_gravity_touch();
+
+void spawnfunc_trigger_gravity();
+
+//=============================================================================
+
+// TODO add a way to do looped sounds with sound(); then complete this entity
+.float volume, atten;
+void target_speaker_use_off();
+void target_speaker_use_activator();
+void target_speaker_use_on();
+void target_speaker_use_off();
+void target_speaker_reset();
+
+void spawnfunc_target_speaker();
+
+
+void spawnfunc_func_stardust();
+
+.string bgmscript;
+.float bgmscriptattack;
+.float bgmscriptdecay;
+.float bgmscriptsustain;
+.float bgmscriptrelease;
+float pointparticles_SendEntity(entity to, float fl);
+
+void pointparticles_use();
+
+void pointparticles_think();
+
+void pointparticles_reset();
+
+void spawnfunc_func_pointparticles();
+
+void spawnfunc_func_sparks();
+
+float rainsnow_SendEntity(entity to, float sf);
+
+/*QUAKED spawnfunc_func_rain (0 .5 .8) ?
+This is an invisible area like a trigger, which rain falls inside of.
+
+Keys:
+"velocity"
+ falling direction (should be something like '0 0 -700', use the X and Y velocity for wind)
+"cnt"
+ sets color of rain (default 12 - white)
+"count"
+ adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
+*/
+void spawnfunc_func_rain();
+
+
+/*QUAKED spawnfunc_func_snow (0 .5 .8) ?
+This is an invisible area like a trigger, which snow falls inside of.
+
+Keys:
+"velocity"
+ falling direction (should be something like '0 0 -300', use the X and Y velocity for wind)
+"cnt"
+ sets color of rain (default 12 - white)
+"count"
+ adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
+*/
+void spawnfunc_func_snow();
+
+.float modelscale;
+void misc_laser_aim();
+
+void misc_laser_init();
+
+.entity pusher;
+void misc_laser_think();
+
+float laser_SendEntity(entity to, float fl);
+
+/*QUAKED spawnfunc_misc_laser (.5 .5 .5) ? START_ON DEST_IS_FIXED
+Any object touching the beam will be hurt
+Keys:
+"target"
+ spawnfunc_target_position where the laser ends
+"mdl"
+ name of beam end effect to use
+"colormod"
+ color of the beam (default: red)
+"dmg"
+ damage per second (-1 for a laser that kills immediately)
+*/
+void laser_use();
+
+void laser_reset();
+
+void spawnfunc_misc_laser();
+
+// tZorks trigger impulse / gravity
+.float radius;
+.float falloff;
+.float strength;
+.float lastpushtime;
+
+// targeted (directional) mode
+void trigger_impulse_touch1();
+
+// Directionless (accelerator/decelerator) mode
+void trigger_impulse_touch2();
+
+// Spherical (gravity/repulsor) mode
+void trigger_impulse_touch3();
+
+/*QUAKED spawnfunc_trigger_impulse (.5 .5 .5) ?
+-------- KEYS --------
+target : If this is set, this points to the spawnfunc_target_position to which the player will get pushed.
+         If not, this trigger acts like a damper/accelerator field.
+
+strength : This is how mutch force to add in the direction of .target each second
+           when .target is set. If not, this is hoe mutch to slow down/accelerate
+           someting cought inside this trigger. (1=no change, 0,5 half speed rougthly each tic, 2 = doubble)
+
+radius   : If set, act as a spherical device rather then a liniar one.
+
+falloff : 0 = none, 1 = liniar, 2 = inverted liniar
+
+-------- NOTES --------
+Use a brush textured with common/origin in the trigger entity to determine the origin of the force
+in directional and sperical mode. For damper/accelerator mode this is not nessesary (and has no effect).
+*/
+
+void spawnfunc_trigger_impulse();
+
+/*QUAKED spawnfunc_trigger_flipflop (.5 .5 .5) (-8 -8 -8) (8 8 8) START_ENABLED
+"Flip-flop" trigger gate... lets only every second trigger event through
+*/
+void flipflop_use();
+
+void spawnfunc_trigger_flipflop();
+
+/*QUAKED spawnfunc_trigger_monoflop (.5 .5 .5) (-8 -8 -8) (8 8 8)
+"Mono-flop" trigger gate... turns one trigger event into one "on" and one "off" event, separated by a delay of "wait"
+*/
+void monoflop_use();
+void monoflop_fixed_use();
+
+void monoflop_think();
+
+void monoflop_reset();
+
+void spawnfunc_trigger_monoflop();
+
+void multivibrator_send();
+
+void multivibrator_toggle();
+
+void multivibrator_reset();
+
+/*QUAKED trigger_multivibrator (.5 .5 .5) (-8 -8 -8) (8 8 8) START_ON
+"Multivibrator" trigger gate... repeatedly sends trigger events. When triggered, turns on or off.
+-------- KEYS --------
+target: trigger all entities with this targetname when it goes off
+targetname: name that identifies this entity so it can be triggered; when off, it always uses the OFF state
+phase: offset of the timing
+wait: "on" cycle time (default: 1)
+respawntime: "off" cycle time (default: same as wait)
+-------- SPAWNFLAGS --------
+START_ON: assume it is already turned on (when targeted)
+*/
+void spawnfunc_trigger_multivibrator();
+
+
+void follow_init();
+
+void spawnfunc_misc_follow();
+
+
+
+void gamestart_use();
+
+void spawnfunc_trigger_gamestart();
+
+
+
+
+.entity voicescript; // attached voice script
+.float voicescript_index; // index of next voice, or -1 to use the randomized ones
+.float voicescript_nextthink; // time to play next voice
+.float voicescript_voiceend; // time when this voice ends
+
+void target_voicescript_clear(entity pl);
+
+void target_voicescript_use();
+
+void target_voicescript_next(entity pl);
+
+void spawnfunc_target_voicescript();
+
+
+
+void trigger_relay_teamcheck_use();
+
+void trigger_relay_teamcheck_reset();
+
+void spawnfunc_trigger_relay_teamcheck();
+
+
+
+void trigger_disablerelay_use();
+
+void spawnfunc_trigger_disablerelay();
+
+float magicear_matched;
+float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorepitch, float mintempo, float maxtempo);
+string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin);
+
+entity magicears;
+string trigger_magicear_processmessage_forallears(entity source, float teamsay, entity privatesay, string msgin);
+
+void spawnfunc_trigger_magicear();
+
+void relay_activators_use();
+
+void spawnfunc_relay_activate();
+
+void spawnfunc_relay_deactivate();
+
+void spawnfunc_relay_activatetoggle();
+
+.string chmap, gametype;
+void spawnfunc_target_changelevel_use();
+
+void spawnfunc_target_changelevel();
+#endif
index 34d384c2833ad502a2c164992e2d68ac57481e35..fdff4a66f369bf8c9e8cf45709e146395ad0f2d7 100644 (file)
@@ -1,13 +1,15 @@
+#include "g_violence.qh"
+
 float Violence_GibSplash_SendEntity(entity to, float sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_GIBSPLASH);
        WriteByte(MSG_ENTITY, self.state); // actually type
        WriteByte(MSG_ENTITY, bound(1, self.cnt * 16, 255)); // gibbage amount multiplier
-       WriteShort(MSG_ENTITY, floor(self.origin_x / 4)); // not using a coord here, as gibs don't need this accuracy
-       WriteShort(MSG_ENTITY, floor(self.origin_y / 4)); // not using a coord here, as gibs don't need this accuracy
-       WriteShort(MSG_ENTITY, floor(self.origin_z / 4)); // not using a coord here, as gibs don't need this accuracy
-       WriteShort(MSG_ENTITY, self.oldorigin_x); // acrually compressed velocity
-       return TRUE;
+       WriteShort(MSG_ENTITY, floor(self.origin.x / 4)); // not using a coord here, as gibs don't need this accuracy
+       WriteShort(MSG_ENTITY, floor(self.origin.y / 4)); // not using a coord here, as gibs don't need this accuracy
+       WriteShort(MSG_ENTITY, floor(self.origin.z / 4)); // not using a coord here, as gibs don't need this accuracy
+       WriteShort(MSG_ENTITY, self.oldorigin.x); // acrually compressed velocity
+       return true;
 }
 
 // TODO maybe convert this to a TE?
@@ -38,7 +40,7 @@ void Violence_GibSplash_At(vector org, vector dir, float type, float amount, ent
 
        e.oldorigin_x = compressShortVector(e.velocity);
 
-       Net_LinkEntity(e, FALSE, 0.2, Violence_GibSplash_SendEntity);
+       Net_LinkEntity(e, false, 0.2, Violence_GibSplash_SendEntity);
 }
 
 void Violence_GibSplash(entity source, float type, float amount, entity attacker)
diff --git a/qcsrc/server/g_violence.qh b/qcsrc/server/g_violence.qh
new file mode 100644 (file)
index 0000000..1f1df06
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef G_VIOLENCE_H
+#define G_VIOLENCE_H
+
+float Violence_GibSplash_SendEntity(entity to, float sf);
+
+// TODO maybe convert this to a TE?
+void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker);
+
+void Violence_GibSplash(entity source, float type, float amount, entity attacker);
+#endif
index dc5d9d6e30eff6baff355026d80cc7b8af631183..24a3d211cce9e908378baba167d9a0adbc2a854b 100644 (file)
@@ -1,4 +1,42 @@
-#define LATENCY_THINKRATE 10
+#include "g_world.qh"
+
+#include "../common/buffs.qh"
+
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+    #include "../common/constants.qh"
+    #include "../common/stats.qh"
+    #include "../common/teams.qh"
+    #include "../common/util.qh"
+    #include "../common/monsters/sv_monsters.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "weapons/weaponstats.qh"
+    #include "autocvars.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "../common/notifications.qh"
+    #include "mutators/mutators_include.qh"
+    #include "campaign.qh"
+    #include "../common/mapinfo.qh"
+    #include "command/common.qh"
+    #include "command/vote.qh"
+    #include "command/getreplies.qh"
+    #include "command/sv_cmd.qh"
+    #include "anticheat.qh"
+    #include "cheats.qh"
+       #include "../common/turrets/turrets.qh"
+    #include "../common/playerstats.qh"
+    #include "g_hook.qh"
+    #include "scores.qh"
+    #include "mapvoting.qh"
+    #include "ipban.qh"
+    #include "race.qh"
+    #include "antilag.qh"
+    #include "secret.qh"
+#endif
+
+const float LATENCY_THINKRATE = 10;
 .float latency_sum;
 .float latency_cnt;
 .float latency_time;
@@ -133,8 +171,8 @@ void cvar_changes_init()
        buf_cvarlist(h, "", "_"); // exclude all _ cvars as they are temporary
        n = buf_getsize(h);
 
-       adding = TRUE;
-       pureadding = TRUE;
+       adding = true;
+       pureadding = true;
 
        for(i = 0; i < n; ++i)
        {
@@ -277,15 +315,21 @@ void cvar_changes_init()
                // does nothing visible
                BADCVAR("captureleadlimit_override");
                BADCVAR("g_balance_kill_delay");
+               BADCVAR("g_ca_point_limit");
                BADCVAR("g_ca_point_leadlimit");
                BADCVAR("g_ctf_captimerecord_always");
                BADCVAR("g_ctf_flag_glowtrails");
                BADCVAR("g_ctf_flag_pickup_verbosename");
                BADCVAR("g_domination_point_leadlimit");
                BADCVAR("g_forced_respawn");
+               BADCVAR("g_freezetag_point_limit");
+               BADCVAR("g_freezetag_point_leadlimit");
                BADCVAR("g_keyhunt_point_leadlimit");
                BADPREFIX("g_mod_");
+               BADCVAR("g_invasion_point_limit");
                BADCVAR("g_nexball_goalleadlimit");
+               BADCVAR("g_tdm_point_limit");
+               BADCVAR("g_tdm_point_leadlimit");
                BADCVAR("leadlimit_and_fraglimit");
                BADCVAR("leadlimit_override");
                BADCVAR("pausable");
@@ -439,12 +483,12 @@ void detect_maptype()
        vector o, v;
        float i;
 
-       for(;;)
+       for (;;)
        {
                o = world.mins;
-               o_x += random() * (world.maxs_x - world.mins_x);
-               o_y += random() * (world.maxs_y - world.mins_y);
-               o_z += random() * (world.maxs_z - world.mins_z);
+               o.x += random() * (world.maxs.x - world.mins.x);
+               o.y += random() * (world.maxs.y - world.mins.y);
+               o.z += random() * (world.maxs.z - world.mins.z);
 
                tracebox(o, PL_MIN, PL_MAX, o - '0 0 32768', MOVE_WORLDONLY, world);
                if(trace_fraction == 1)
@@ -470,7 +514,7 @@ float RandomSeed_Send(entity to, float sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_RANDOMSEED);
        WriteShort(MSG_ENTITY, self.cnt);
-       return TRUE;
+       return true;
 }
 void RandomSeed_Think()
 {
@@ -483,7 +527,7 @@ void RandomSeed_Spawn()
 {
        randomseed = spawn();
        randomseed.think = RandomSeed_Think;
-       Net_LinkEntity(randomseed, FALSE, 0, RandomSeed_Send);
+       Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
 
        entity oldself;
        oldself = self;
@@ -543,7 +587,7 @@ void spawnfunc_worldspawn (void)
 
        if(world_already_spawned)
                error("world already spawned - you may have EXACTLY ONE worldspawn!");
-       world_already_spawned = TRUE;
+       world_already_spawned = true;
 
        remove = remove_safely; // during spawning, watch what you remove!
 
@@ -560,7 +604,7 @@ void spawnfunc_worldspawn (void)
                head = nextent(head);
        }
 
-       server_is_dedicated = (stof(cvar_defstring("is_dedicated")) ? TRUE : FALSE);
+       server_is_dedicated = (stof(cvar_defstring("is_dedicated")) ? true : false);
 
        // needs to be done so early because of the constants they create
        CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
@@ -645,7 +689,7 @@ void spawnfunc_worldspawn (void)
        // character set: ASCII 33-126 without the following characters: : ; ' " \ $
        if(autocvar_sv_eventlog)
        {
-               s = sprintf("%d.%s.%06d", ftos(autocvar_sv_eventlog_files_counter), strftime(FALSE, "%s"), floor(random() * 1000000));
+               s = sprintf("%d.%s.%06d", ftos(autocvar_sv_eventlog_files_counter), strftime(false, "%s"), floor(random() * 1000000));
                matchid = strzone(s);
 
                GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", s));
@@ -766,7 +810,7 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_VORTEX_CHARGEPOOL, AS_FLOAT, vortex_chargepool_ammo);
 
        addstat(STAT_HAGAR_LOAD, AS_INT, hagar_load);
-       
+
        addstat(STAT_ARC_HEAT, AS_FLOAT, arc_heat_percent);
 
        // freeze attacks
@@ -825,7 +869,7 @@ void spawnfunc_worldspawn (void)
                        if(substring(argv(i), -18, -1) != "-serverpackage.txt")
                        if(substring(argv(i), -14, -1) != ".serverpackage") // OLD legacy
                                s = strcat(s, " ", argv(i));
-               fd = search_begin("*-serverpackage.txt", TRUE, FALSE);
+               fd = search_begin("*-serverpackage.txt", true, false);
                if(fd >= 0)
                {
                        j = search_getsize(fd);
@@ -833,7 +877,7 @@ void spawnfunc_worldspawn (void)
                                s = strcat(s, " ", search_getfilename(fd, i));
                        search_end(fd);
                }
-               fd = search_begin("*.serverpackage", TRUE, FALSE);
+               fd = search_begin("*.serverpackage", true, false);
                if(fd >= 0)
                {
                        j = search_getsize(fd);
@@ -915,7 +959,7 @@ float MapHasRightSize(string map)
                if(!fexists(strcat("maps/", map, ".waypoints")))
                {
                        dprint(": no waypoints\n");
-                       return FALSE;
+                       return false;
                }
                dprint(": has waypoints\n");
        }
@@ -933,18 +977,18 @@ float MapHasRightSize(string map)
                if(player_count < mapmin)
                {
                        dprint("not enough\n");
-                       return FALSE;
+                       return false;
                }
                if(player_count > mapmax)
                {
                        dprint("too many\n");
-                       return FALSE;
+                       return false;
                }
                dprint("right size\n");
-               return TRUE;
+               return true;
        }
        dprint(": not found\n");
-       return TRUE;
+       return true;
 }
 
 string Map_Filename(float position)
@@ -1174,60 +1218,60 @@ float DoNextMapOverride(float reinit)
        if(autocvar_g_campaign)
        {
                CampaignPostIntermission();
-               alreadychangedlevel = TRUE;
-               return TRUE;
+               alreadychangedlevel = true;
+               return true;
        }
        if(autocvar_quit_when_empty)
        {
                if(player_count <= currentbots)
                {
                        localcmd("quit\n");
-                       alreadychangedlevel = TRUE;
-                       return TRUE;
+                       alreadychangedlevel = true;
+                       return true;
                }
        }
        if(autocvar_quit_and_redirect != "")
        {
                redirection_target = strzone(autocvar_quit_and_redirect);
-               alreadychangedlevel = TRUE;
-               return TRUE;
+               alreadychangedlevel = true;
+               return true;
        }
        if (!reinit && autocvar_samelevel) // if samelevel is set, stay on same level
        {
                localcmd("restart\n");
-               alreadychangedlevel = TRUE;
-               return TRUE;
+               alreadychangedlevel = true;
+               return true;
        }
        if(autocvar_nextmap != "")
        {
                string m;
                m = GameTypeVote_MapInfo_FixName(autocvar_nextmap);
                cvar_set("nextmap",m);
-       
+
                if(!m || gametypevote)
-                       return FALSE;
+                       return false;
                if(autocvar_sv_vote_gametype)
                {
                        Map_Goto_SetStr(m);
-                       return FALSE;
+                       return false;
                }
-               
+
                if(MapInfo_CheckMap(m))
                {
                        Map_Goto_SetStr(m);
                        Map_Goto(reinit);
-                       alreadychangedlevel = TRUE;
-                       return TRUE;
+                       alreadychangedlevel = true;
+                       return true;
                }
        }
        if(!reinit && autocvar_lastlevel)
        {
                cvar_settemp_restore();
                localcmd("set lastlevel 0\ntogglemenu 1\n");
-               alreadychangedlevel = TRUE;
-               return TRUE;
+               alreadychangedlevel = true;
+               return true;
        }
-       return FALSE;
+       return false;
 }
 
 void GotoNextMap(float reinit)
@@ -1237,7 +1281,7 @@ void GotoNextMap(float reinit)
        //string s;
        if (alreadychangedlevel)
                return;
-       alreadychangedlevel = TRUE;
+       alreadychangedlevel = true;
 
        string nextMap;
 
@@ -1267,7 +1311,7 @@ void IntermissionThink()
                && ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) )
        {
                self.autoscreenshot = -1;
-               if(IS_REAL_CLIENT(self)) { stuffcmd(self, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"\n", GetMapname(), strftime(FALSE, "%s"))); }
+               if(IS_REAL_CLIENT(self)) { stuffcmd(self, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"\n", GetMapname(), strftime(false, "%s"))); }
                return;
        }
 
@@ -1352,13 +1396,13 @@ void DumpStats(float final)
 
        if(!final)
        {
-               to_console = TRUE; // always print printstats replies
-               to_eventlog = FALSE; // but never print them to the event log
+               to_console = true; // always print printstats replies
+               to_eventlog = false; // but never print them to the event log
        }
 
        if(to_eventlog)
                if(autocvar_sv_eventlog_console)
-                       to_console = FALSE; // otherwise we get the output twice
+                       to_console = false; // otherwise we get the output twice
 
        if(final)
                s = ":scores:";
@@ -1376,7 +1420,7 @@ void DumpStats(float final)
        {
                file = fopen(autocvar_sv_logscores_filename, FILE_APPEND);
                if(file == -1)
-                       to_file = FALSE;
+                       to_file = false;
                else
                        fputs(file, strcat(s, "\n"));
        }
@@ -1478,7 +1522,7 @@ only called if a time or frag limit has expired
 */
 void NextLevel()
 {
-       gameover = TRUE;
+       gameover = true;
 
        intermission_running = 1;
 
@@ -1499,10 +1543,10 @@ void NextLevel()
 
        VoteReset();
 
-       DumpStats(TRUE);
+       DumpStats(true);
 
        // send statistics
-       PlayerStats_GameReport(TRUE);
+       PlayerStats_GameReport(true);
        WeaponStats_Shutdown();
 
        Kill_Notification(NOTIF_ALL, world, MSG_CENTER, 0); // kill all centerprints now
@@ -1545,15 +1589,6 @@ void CheckRules_Player()
        //   (div0: and that in CheckRules_World please)
 }
 
-float checkrules_equality;
-float checkrules_suddendeathwarning;
-float checkrules_suddendeathend;
-float checkrules_overtimesadded; //how many overtimes have been already added
-
-const float WINNING_NO = 0; // no winner, but time limits may terminate the game
-const float WINNING_YES = 1; // winner found
-const float WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached
-const float WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW
 
 float InitiateSuddenDeath()
 {
@@ -1739,16 +1774,16 @@ float WinningCondition_LMS()
        float have_players;
        float l;
 
-       have_player = FALSE;
-       have_players = FALSE;
+       have_player = false;
+       have_players = false;
        l = LMS_NewPlayerLives();
 
        head = find(world, classname, "player");
        if(head)
-               have_player = TRUE;
+               have_player = true;
        head2 = find(head, classname, "player");
        if(head2)
-               have_players = TRUE;
+               have_players = true;
 
        if(have_player)
        {
@@ -1800,7 +1835,7 @@ float WinningCondition_LMS()
 
        ClearWinners();
        if(WinningConditionHelper_winner)
-               WinningConditionHelper_winner.winning = TRUE;
+               WinningConditionHelper_winner.winning = true;
        if(WinningConditionHelper_topscore == WinningConditionHelper_secondscore)
                return WINNING_NEVER;
 
@@ -1862,10 +1897,10 @@ float WinningCondition_Scores(float limit, float leadlimit)
                }
        }
 
-       limitreached = FALSE;
+       limitreached = false;
        if(limit)
                if(WinningConditionHelper_topscore >= limit)
-                       limitreached = TRUE;
+                       limitreached = true;
        if(leadlimit)
        {
                float leadlimitreached;
@@ -1967,7 +2002,7 @@ float WinningCondition_RanOutOfSpawns()
        ClearWinners();
        if(team1_score + team2_score + team3_score + team4_score == 0)
        {
-               checkrules_equality = TRUE;
+               checkrules_equality = true;
                return WINNING_YES;
        }
        else if(team1_score + team2_score + team3_score + team4_score == 1)
@@ -2064,7 +2099,7 @@ void CheckRules_World()
        {
                if(!checkrules_suddendeathwarning)
                {
-                       checkrules_suddendeathwarning = TRUE;
+                       checkrules_suddendeathwarning = true;
                        if(g_race && !g_race_qualifying)
                                Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_RACE_FINISHLAP);
                        else
@@ -2223,7 +2258,7 @@ void EndFrame()
        // needed!
        FOR_EACH_CLIENT(self)
        {
-               self.typehitsound = FALSE;
+               self.typehitsound = false;
                self.damage_dealt = 0;
                antilag_record(self, altime);
        }
@@ -2234,7 +2269,7 @@ void EndFrame()
 
 /*
  * RedirectionThink:
- * returns TRUE if redirecting
+ * returns true if redirecting
  */
 float redirection_timeout;
 float redirection_nextthink;
@@ -2243,7 +2278,7 @@ float RedirectionThink()
        float clients_found;
 
        if(redirection_target == "")
-               return FALSE;
+               return false;
 
        if(!redirection_timeout)
        {
@@ -2256,7 +2291,7 @@ float RedirectionThink()
        }
 
        if(time < redirection_nextthink)
-               return TRUE;
+               return true;
 
        redirection_nextthink = time + 1;
 
@@ -2277,7 +2312,7 @@ float RedirectionThink()
        if(time > redirection_timeout || clients_found == 0)
                localcmd("\nwait; wait; wait; quit\n");
 
-       return TRUE;
+       return true;
 }
 
 void TargetMusic_RestoreGame();
@@ -2309,7 +2344,7 @@ void Shutdown()
                Ban_SaveBans();
 
                // playerstats with unfinished match
-               PlayerStats_GameReport(FALSE);
+               PlayerStats_GameReport(false);
 
                if(!cheatcount_total)
                {
diff --git a/qcsrc/server/g_world.qh b/qcsrc/server/g_world.qh
new file mode 100644 (file)
index 0000000..3a5e5d5
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef G_WORLD_H
+#define G_WORLD_H
+
+float checkrules_equality;
+float checkrules_suddendeathwarning;
+float checkrules_suddendeathend;
+float checkrules_overtimesadded; //how many overtimes have been already added
+
+const float WINNING_NO = 0; // no winner, but time limits may terminate the game
+const float WINNING_YES = 1; // winner found
+const float WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached
+const float WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW
+
+void CheckRules_Player();
+void IntermissionThink();
+
+#endif
index d3d7fdca6e93aa87ad5db6b41f5261891672ff0a..9591ee8baa9d9b7620d5b5fbe32f430a8e0a22cb 100644 (file)
@@ -1,3 +1,16 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "autocvars.qh"
+    #include "defs.qh"
+    #include "command/banning.qh"
+    #include "ipban.qh"
+#endif
+
 /*
  * Protocol of online ban list:
  *
@@ -238,7 +251,7 @@ void OnlineBanList_Think()
        remove(self);
 }
 
-#define BAN_MAX 256
+const float BAN_MAX = 256;
 float ban_loaded;
 string ban_ip[BAN_MAX];
 float ban_expire[BAN_MAX];
@@ -276,11 +289,11 @@ void Ban_SaveBans()
 float Ban_Delete(float i)
 {
        if(i < 0)
-               return FALSE;
+               return false;
        if(i >= ban_count)
-               return FALSE;
+               return false;
        if(ban_expire[i] == 0)
-               return FALSE;
+               return false;
        if(ban_expire[i] > 0)
        {
                OnlineBanList_SendUnban(ban_ip[i]);
@@ -289,7 +302,7 @@ float Ban_Delete(float i)
        ban_expire[i] = 0;
        ban_ip[i] = "";
        Ban_SaveBans();
-       return TRUE;
+       return true;
 }
 
 void Ban_LoadBans()
@@ -298,7 +311,7 @@ void Ban_LoadBans()
        for(i = 0; i < ban_count; ++i)
                Ban_Delete(i);
        ban_count = 0;
-       ban_loaded = TRUE;
+       ban_loaded = true;
        n = tokenize_console(autocvar_g_banned_list);
        if(stof(argv(0)) == 1)
        {
@@ -348,7 +361,7 @@ float Ban_GetClientIP(entity client)
        float i1, i2, i3, i4;
        string s;
 
-       if(client.crypto_keyfp)
+       if(client.crypto_idfp_signed)
                ban_idfp = client.crypto_idfp;
        else
                ban_idfp = string_null;
@@ -360,10 +373,10 @@ float Ban_GetClientIP(entity client)
                goto ipv6;
        i2 = strstrofs(s, ".", i1 + 1);
        if(i2 < 0)
-               return FALSE;
+               return false;
        i3 = strstrofs(s, ".", i2 + 1);
        if(i3 < 0)
-               return FALSE;
+               return false;
        i4 = strstrofs(s, ".", i3 + 1);
        if(i4 >= 0)
                s = substring(s, 0, i4);
@@ -372,21 +385,21 @@ float Ban_GetClientIP(entity client)
        ban_ip2 = substring(s, 0, i2); // 16
        ban_ip3 = substring(s, 0, i3); // 24
        ban_ip4 = strcat1(s); // 32
-       return TRUE;
+       return true;
 
 :ipv6
        i1 = strstrofs(s, ":", 0);
        if(i1 < 0)
-               return FALSE;
+               return false;
        i1 = strstrofs(s, ":", i1 + 1);
        if(i1 < 0)
-               return FALSE;
+               return false;
        i2 = strstrofs(s, ":", i1 + 1);
        if(i2 < 0)
-               return FALSE;
+               return false;
        i3 = strstrofs(s, ":", i2 + 1);
        if(i3 < 0)
-               return FALSE;
+               return false;
 
        ban_ip1 = strcat(substring(s, 0, i1), "::/32"); // 32
        ban_ip2 = strcat(substring(s, 0, i2), "::/48"); // 48
@@ -397,7 +410,7 @@ float Ban_GetClientIP(entity client)
        else
                ban_ip3 = strcat(substring(s, 0, i2), ":0::/56");
 
-       return TRUE;
+       return true;
 }
 
 float Ban_IsClientBanned(entity client, float idx)
@@ -406,7 +419,7 @@ float Ban_IsClientBanned(entity client, float idx)
        if(!ban_loaded)
                Ban_LoadBans();
        if(!Ban_GetClientIP(client))
-               return FALSE;
+               return false;
        if(idx < 0)
        {
                b = 0;
@@ -417,27 +430,27 @@ float Ban_IsClientBanned(entity client, float idx)
                b = idx;
                e = idx + 1;
        }
-       ipbanned = FALSE;
+       ipbanned = false;
        for(i = b; i < e; ++i)
        {
                string s;
                if(time > ban_expire[i])
                        continue;
                s = ban_ip[i];
-               if(ban_ip1 == s) ipbanned = TRUE;
-               if(ban_ip2 == s) ipbanned = TRUE;
-               if(ban_ip3 == s) ipbanned = TRUE;
-               if(ban_ip4 == s) ipbanned = TRUE;
-               if(ban_idfp == s) return TRUE;
+               if(ban_ip1 == s) ipbanned = true;
+               if(ban_ip2 == s) ipbanned = true;
+               if(ban_ip3 == s) ipbanned = true;
+               if(ban_ip4 == s) ipbanned = true;
+               if(ban_idfp == s) return true;
        }
        if(ipbanned)
        {
                if(!autocvar_g_banned_list_idmode)
-                       return TRUE;
+                       return true;
                if (!ban_idfp)
-                       return TRUE;
+                       return true;
        }
-       return FALSE;
+       return false;
 }
 
 float Ban_MaybeEnforceBan(entity client)
@@ -448,18 +461,18 @@ float Ban_MaybeEnforceBan(entity client)
                s = strcat("^1NOTE:^7 banned client ", client.netaddress, " just tried to enter\n");
                dropclient(client);
                bprint(s);
-               return TRUE;
+               return true;
        }
-       return FALSE;
+       return false;
 }
 
 .float ban_checked;
 float Ban_MaybeEnforceBanOnce(entity client)
 {
        if(client.ban_checked)
-               return FALSE;
-       client.ban_checked = TRUE;
-       return Ban_MaybeEnforceBan(self);
+               return false;
+       client.ban_checked = true;
+       return Ban_MaybeEnforceBan(client);
 }
 
 string Ban_Enforce(float i, string reason)
@@ -469,7 +482,8 @@ string Ban_Enforce(float i, string reason)
 
        // Enforce our new ban
        s = "";
-       FOR_EACH_REALCLIENT(e)
+       FOR_EACH_CLIENTSLOT(e)
+               if (IS_REAL_CLIENT(e))
                if(Ban_IsClientBanned(e, i))
                {
                        if(reason != "")
@@ -516,7 +530,7 @@ float Ban_Insert(string ip, float bantime, string reason, float dosync)
                                        if(substring(reason, 0, 1) != "~") // like IRC: unauthenticated banner
                                                OnlineBanList_SendBan(ip, bantime, reason);
 
-                       return FALSE;
+                       return false;
                }
 
        // do we have a free slot?
@@ -543,7 +557,7 @@ float Ban_Insert(string ip, float bantime, string reason, float dosync)
        if(ban_expire[i] > time + bantime)
        {
                print(ip, " could not get banned due to no free ban slot\n");
-               return FALSE;
+               return false;
        }
        // okay, insert our new victim as i
        Ban_Delete(i);
@@ -562,7 +576,7 @@ float Ban_Insert(string ip, float bantime, string reason, float dosync)
                        if(substring(reason, 0, 1) != "~") // like IRC: unauthenticated banner
                                OnlineBanList_SendBan(ip, bantime, reason);
 
-       return TRUE;
+       return true;
 }
 
 void Ban_KickBanClient(entity client, float bantime, float masksize, string reason)
index d466942e31ed318bd052e5407616ba9a0c90c326..e758cbca4e94fdaef60a33f7f0cef18141fe3c4e 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef IPBAN_H
+#define IPBAN_H
+
 void Ban_SaveBans();
 void Ban_LoadBans();
 float Ban_MaybeEnforceBan(entity client);
@@ -5,3 +8,4 @@ float Ban_MaybeEnforceBanOnce(entity client);
 float BanCommand(string command);
 
 void OnlineBanList_URI_Get_Callback(float id, float status, string data);
+#endif
index 79003853a6deef93d6ce20e93f5beecfb183518e..f4893094efb533c429902e0defbd2ad2ad82b1df 100644 (file)
@@ -1,3 +1,16 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../warpzonelib/util_server.qh"
+    #include "../common/util.qh"
+    #include "../common/monsters/monsters.qh"
+    #include "defs.qh"
+    #include "../common/notifications.qh"
+    #include "item_key.qh"
+#endif
+
 /*
 TODO:
 - add an unlock sound (here to trigger_keylock and to func_door)
@@ -7,20 +20,20 @@ TODO:
 - should keys have a trigger?
 */
 
-float item_keys_usekey(entity l, entity p) {
+bool item_keys_usekey(entity l, entity p) {
        float valid = l.itemkeys & p.itemkeys;
 
        if (!valid) {
                // other has none of the needed keys
-               return FALSE;
+               return false;
        } else if (l.itemkeys == valid) {
                // ALL needed keys were given
                l.itemkeys = 0;
-               return TRUE;
+               return true;
        } else {
                // only some of the needed keys were given
                l.itemkeys &= ~valid;
-               return TRUE;
+               return true;
        }
 }
 
@@ -105,7 +118,7 @@ void spawn_item_key() {
        {
                // first nudge it off the floor a little bit to avoid math errors
                setorigin(self, self.origin + '0 0 1');
-               // note droptofloor returns FALSE if stuck/or would fall too far
+               // note droptofloor returns false if stuck/or would fall too far
                droptofloor();
        }
 
@@ -140,8 +153,8 @@ This is the only correct way to put keys on the map!
 itemkeys MUST always have exactly one bit set.
 */
 void spawnfunc_item_key() {
-       local string _model, _netname;
-       local vector _colormod;
+       string _netname;
+       vector _colormod;
 
        // reject this entity if more than one key was set!
        if (self.itemkeys>0 && (self.itemkeys & (self.itemkeys-1)) != 0) {
@@ -196,9 +209,7 @@ void spawnfunc_item_key() {
        }
 
        // find default model
-#ifdef GMQCC
-       _model = string_null;
-#endif
+       string _model = string_null;
        if (self.itemkeys <= ITEM_KEY_BIT(2)) {
                _model = "models/keys/key.md3";
        } else if (self.itemkeys >= ITEM_KEY_BIT(3) && self.itemkeys <= ITEM_KEY_BIT(5)) {
@@ -282,13 +293,11 @@ trigger_keylock
  * trigger givent targets
  */
 void trigger_keylock_trigger(string s) {
-       local entity t, stemp, otemp, atemp;
-
-       stemp = self;
-       otemp = other;
-       atemp = activator;
-
+       entity stemp = self;
+       entity otemp = other;
+       entity atemp = activator;
 
+       entity t;
        for(t = world; (t = find(t, targetname, s)); )
                if (t.use) {
                        self = t;
@@ -306,16 +315,14 @@ void trigger_keylock_trigger(string s) {
  * kill killtarget of trigger keylock.
  */
 void trigger_keylock_kill(string s) {
-       local entity t;
+       entity t;
        for(t = world; (t = find(t, targetname, s)); )
                remove(t);
 };
 
 void trigger_keylock_touch(void) {
-       local float key_used, started_delay;
-
-       key_used = FALSE;
-       started_delay = FALSE;
+       bool key_used = false;
+       bool started_delay = false;
 
        // only player may trigger the lock
        if (!IS_PLAYER(other))
@@ -343,10 +350,10 @@ void trigger_keylock_touch(void) {
                }
 
                // trigger target2
-               if (self.delay <= time || started_delay == TRUE)
+               if (self.delay <= time || started_delay == true)
                if (self.target2) {
                        trigger_keylock_trigger(self.target2);
-                       started_delay = TRUE;
+                       started_delay = true;
                        self.delay = time + self.wait;
                }
        } else {
index 24ef1e935c8f51e09f40079b01fb687d4c3f8c9c..6ab56050368601b25496c20717744e5ff1ff9b29 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef ITEM_KEY
+#define ITEM_KEY
+
 /**
  * Returns the bit ID of a key
  */
@@ -12,7 +15,7 @@ string item_keys_names[ITEM_KEY_MAX];
 
 /**
  * Use keys from p on l.
- * Returns TRUE if any new keys were given, FALSE otherwise.
+ * Returns true if any new keys were given, false otherwise.
  */
 float item_keys_usekey(entity l, entity p);
 
@@ -20,4 +23,4 @@ float item_keys_usekey(entity l, entity p);
  * Returns a string with a comma separated list of key names, as specified in keylist.
  */
 string item_keys_keylist(float keylist);
-
+#endif
index 9a2cb1871706d7cb40978ac6a805ef05b093ee7f..fd42c99ab9c6e5f30ffdfdb573a887149f2ad14f 100644 (file)
@@ -1,17 +1,34 @@
-float GameTypeVote_AvailabilityStatus(string gtname) 
-{ 
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "autocvars.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "../common/mapinfo.qh"
+    #include "command/getreplies.qh"
+    #include "command/cmd.qh"
+    #include "../common/playerstats.qh"
+    #include "mapvoting.qh"
+#endif
+
+float GameTypeVote_AvailabilityStatus(string gtname)
+{
        float type = MapInfo_Type_FromString(gtname);
        if( type == 0 )
                return GTV_FORBIDDEN;
-       
+
        if ( autocvar_nextmap != "" )
        {
-               if ( !MapInfo_Get_ByName(autocvar_nextmap, FALSE, 0) )
+               if ( !MapInfo_Get_ByName(autocvar_nextmap, false, 0) )
                        return GTV_FORBIDDEN;
                if (!(MapInfo_Map_supportedGametypes & type))
                        return GTV_FORBIDDEN;
        }
-       
+
        return GTV_AVAILABLE;
 }
 
@@ -169,10 +186,10 @@ void MapVote_Init()
 
        if(mapvote_suggestion_ptr)
                for(i = 0; i < 100 && mapvote_count < smax; ++i)
-                       MapVote_AddVotable(mapvote_suggestions[floor(random() * mapvote_suggestion_ptr)], TRUE);
+                       MapVote_AddVotable(mapvote_suggestions[floor(random() * mapvote_suggestion_ptr)], true);
 
        for(i = 0; i < 100 && mapvote_count < nmax; ++i)
-               MapVote_AddVotable(GetNextMap(), FALSE);
+               MapVote_AddVotable(GetNextMap(), false);
 
        if(mapvote_count == 0)
        {
@@ -182,7 +199,7 @@ void MapVote_Init()
                        ShuffleMaplist();
                localcmd("\nmenu_cmd sync\n");
                for(i = 0; i < 100 && mapvote_count < nmax; ++i)
-                       MapVote_AddVotable(GetNextMap(), FALSE);
+                       MapVote_AddVotable(GetNextMap(), false);
        }
 
        mapvote_count_real = mapvote_count;
@@ -220,7 +237,7 @@ void MapVote_WriteMask()
                for(i = 0, power = 1; i < mapvote_count; ++i, power *= 2)
                        if(mapvote_maps_availability[i] == GTV_AVAILABLE )
                                mask |= power;
-                       
+
                if(mapvote_count < 8)
                        WriteByte(MSG_ENTITY, mask);
                else if (mapvote_count < 16)
@@ -255,7 +272,7 @@ float MapVote_SendEntity(entity to, float sf)
                WriteByte(MSG_ENTITY, mapvote_abstain);
                WriteByte(MSG_ENTITY, mapvote_detail);
                WriteCoord(MSG_ENTITY, mapvote_timeout);
-               
+
                if ( gametypevote )
                {
                        // gametype vote
@@ -308,12 +325,12 @@ float MapVote_SendEntity(entity to, float sf)
                WriteByte(MSG_ENTITY, to.mapvote);
        }
 
-       return TRUE;
+       return true;
 }
 
 void MapVote_Spawn()
 {
-       Net_LinkEntity(mapvote_ent = spawn(), FALSE, 0, MapVote_SendEntity);
+       Net_LinkEntity(mapvote_ent = spawn(), false, 0, MapVote_SendEntity);
 }
 
 void MapVote_TouchMask()
@@ -329,7 +346,7 @@ void MapVote_TouchVotes(entity voter)
 float MapVote_Finished(float mappos)
 {
        if(alreadychangedlevel)
-               return FALSE;
+               return false;
 
        string result;
        float i;
@@ -364,32 +381,32 @@ float MapVote_Finished(float mappos)
        {
                if ( GameTypeVote_Finished(mappos) )
                {
-                       gametypevote = FALSE;
+                       gametypevote = false;
                        if(autocvar_nextmap != "")
                        {
                                Map_Goto_SetStr(autocvar_nextmap);
                                Map_Goto(0);
-                               alreadychangedlevel = TRUE;
-                               return TRUE;
+                               alreadychangedlevel = true;
+                               return true;
                        }
                        else
                                MapVote_Init();
                }
-               return FALSE;
+               return false;
        }
-       
+
        Map_Goto_SetStr(mapvote_maps[mappos]);
        Map_Goto(0);
-       alreadychangedlevel = TRUE;
-       
-       return TRUE;
+       alreadychangedlevel = true;
+
+       return true;
 }
 
 void MapVote_CheckRules_1()
 {
        float i;
 
-       for(i = 0; i < mapvote_count; ++i) 
+       for(i = 0; i < mapvote_count; ++i)
                if( mapvote_maps_availability[i] == GTV_AVAILABLE )
                {
                        //dprint("Map ", ftos(i), ": "); dprint(mapvote_maps[i], "\n");
@@ -427,7 +444,7 @@ float MapVote_CheckRules_2()
        RandomSelection_Init();
        currentPlace = 0;
        currentVotes = -1;
-       for(i = 0; i < mapvote_count_real; ++i) 
+       for(i = 0; i < mapvote_count_real; ++i)
                if ( mapvote_maps_availability[i] == GTV_AVAILABLE )
                {
                        RandomSelection_Add(world, i, string_null, 1, mapvote_selections[i]);
@@ -442,7 +459,7 @@ float MapVote_CheckRules_2()
                firstPlace = currentPlace;
        else
                firstPlace = RandomSelection_chosen_float;
-       
+
        //dprint("First place: ", ftos(firstPlace), "\n");
        //dprint("First place votes: ", ftos(firstPlaceVotes), "\n");
 
@@ -493,7 +510,7 @@ float MapVote_CheckRules_2()
                                GameLogEcho(result);
                }
 
-       return FALSE;
+       return false;
 }
 
 void MapVote_Tick()
@@ -551,7 +568,7 @@ void MapVote_Start()
 
        MapInfo_Enumerate();
        if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 1))
-               mapvote_run = TRUE;
+               mapvote_run = true;
 }
 
 void MapVote_Think()
@@ -590,7 +607,7 @@ void MapVote_Think()
                        cvar_set("rescan_pending", "0");
                }
 
-               mapvote_initialized = TRUE;
+               mapvote_initialized = true;
                if(DoNextMapOverride(0))
                        return;
                if(!autocvar_g_maplist_votable || player_count <= 0)
@@ -598,7 +615,7 @@ void MapVote_Think()
                        GotoNextMap(0);
                        return;
                }
-               
+
                if(autocvar_sv_vote_gametype) { GameTypeVote_Start(); }
                else if(autocvar_nextmap == "") { MapVote_Init(); }
        }
@@ -609,8 +626,8 @@ void MapVote_Think()
 float GameTypeVote_SetGametype(float type)
 {
        if (MapInfo_CurrentGametype() == type)
-               return TRUE;
-               
+               return true;
+
        float tsave = MapInfo_CurrentGametype();
 
        MapInfo_SwitchGameType(type);
@@ -629,7 +646,7 @@ float GameTypeVote_SetGametype(float type)
                bprint("Cannot use this game type: no map for it found\n");
                MapInfo_SwitchGameType(tsave);
                MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
-               return FALSE;
+               return false;
        }
 
        //localcmd("gametype ", MapInfo_Type_ToString(type), "\n");
@@ -638,48 +655,48 @@ float GameTypeVote_SetGametype(float type)
        if(autocvar_g_maplist_shuffle)
                ShuffleMaplist();
 
-       return TRUE;
+       return true;
 }
 
 float gametypevote_finished;
 float GameTypeVote_Finished(float pos)
 {
        if(!gametypevote || gametypevote_finished)
-               return FALSE;
-       
+               return false;
+
        if ( !GameTypeVote_SetGametype(MapInfo_Type_FromString(mapvote_maps[pos])) )
        {
                dprint("Selected gametype is not supported by any map");
        }
-       
+
        localcmd("sv_vote_gametype_hook_all\n");
        localcmd("sv_vote_gametype_hook_", mapvote_maps[pos], "\n");
-       
-       gametypevote_finished = TRUE;
-       
-       return TRUE;
+
+       gametypevote_finished = true;
+
+       return true;
 }
 
 float GameTypeVote_AddVotable(string nextMode)
 {
        float j;
        if ( nextMode == "" || MapInfo_Type_FromString(nextMode) == 0 )
-               return FALSE;
+               return false;
        for(j = 0; j < mapvote_count; ++j)
                if(mapvote_maps[j] == nextMode)
-                       return FALSE;
-       
+                       return false;
+
        mapvote_maps[mapvote_count] = strzone(nextMode);
-       mapvote_maps_suggested[mapvote_count] = FALSE;
+       mapvote_maps_suggested[mapvote_count] = false;
 
        mapvote_maps_screenshot_dir[mapvote_count] = 0;
        mapvote_maps_pakfile[mapvote_count] = strzone("");
        mapvote_maps_availability[mapvote_count] = GameTypeVote_AvailabilityStatus(nextMode);
 
        mapvote_count += 1;
-       
-       return TRUE;
-       
+
+       return true;
+
 }
 
 float GameTypeVote_Start()
@@ -687,15 +704,15 @@ float GameTypeVote_Start()
        float j;
        MapVote_ClearAllVotes();
        MapVote_UnzoneStrings();
-       
+
        mapvote_count = 0;
        mapvote_timeout = time + autocvar_sv_vote_gametype_timeout;
        mapvote_abstain = 0;
        mapvote_detail = !autocvar_g_maplist_votable_nodetail;
-       
+
        float n = tokenizebyseparator(autocvar_sv_vote_gametype_options, " ");
        n = min(MAPVOTE_COUNT, n);
-       
+
        float really_available, which_available;
        really_available = 0;
        which_available = -1;
@@ -710,9 +727,9 @@ float GameTypeVote_Start()
        }
 
        mapvote_count_real = mapvote_count;
-       
+
        gametypevote = 1;
-       
+
        if ( really_available == 0 )
        {
                if ( mapvote_count > 0 )
@@ -720,22 +737,22 @@ float GameTypeVote_Start()
                mapvote_maps[0] = strzone(MapInfo_Type_ToString(MapInfo_CurrentGametype()));
                //GameTypeVote_Finished(0);
                MapVote_Finished(0);
-               return FALSE;
+               return false;
        }
        if ( really_available == 1 )
        {
                //GameTypeVote_Finished(which_available);
                MapVote_Finished(which_available);
-               return FALSE;
+               return false;
        }
-       
+
        mapvote_count_real = mapvote_count;
 
        mapvote_keeptwotime = time + autocvar_sv_vote_gametype_keeptwotime;
        if(mapvote_count_real < 3 || mapvote_keeptwotime <= time)
                mapvote_keeptwotime = 0;
-       
+
        MapVote_Spawn();
-       
-       return TRUE;
+
+       return true;
 }
index 6875958bfe464aa54ce11fd6f6d3a9d12189fbd1..d2eff1cf08ec0422fef2292e25326ee96244ac65 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef MAPVOTING_H
+#define MAPVOTING_H
+
 // definitions for functions used outside mapvoting.qc
 void MapVote_Start();
 void MapVote_Spawn();
@@ -12,11 +15,10 @@ string getmapname_stored;
 float mapvote_initialized;
 
 float mapvote_nextthink;
-float mapvote_initialized;
 float mapvote_keeptwotime;
 float mapvote_timeout;
 string mapvote_message;
-#define MAPVOTE_SCREENSHOT_DIRS_COUNT 4
+const float MAPVOTE_SCREENSHOT_DIRS_COUNT = 4;
 string mapvote_screenshot_dirs[MAPVOTE_SCREENSHOT_DIRS_COUNT];
 float mapvote_screenshot_dirs_count;
 
@@ -37,3 +39,4 @@ float mapvote_abstain;
 .float mapvote;
 
 entity mapvote_ent;
+#endif
index db706003be07673ea998e31750af5d38551da21c..eb457449ec61aca0073cd66fd5fd2d80d52757b6 100644 (file)
@@ -1,9 +1,34 @@
-var void remove(entity e);
-void objerror(string s);
-void droptofloor();
-.vector dropped_origin;
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "miscfunctions.qh"
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../common/playerstats.qh"
+    #include "../warpzonelib/anglestransform.qh"
+    #include "../warpzonelib/server.qh"
+    #include "../common/constants.qh"
+    #include "../common/teams.qh"
+    #include "../common/util.qh"
+    #include "../common/urllib.qh"
+    #include "../common/command/generic.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "weapons/accuracy.qh"
+    #include "weapons/csqcprojectile.qh"
+    #include "weapons/selection.qh"
+    #include "t_items.qh"
+    #include "autocvars.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "../common/notifications.qh"
+    #include "../common/deathtypes.qh"
+    #include "mutators/mutators_include.qh"
+    #include "../common/mapinfo.qh"
+    #include "command/common.qh"
+    #include "../csqcmodellib/sv_model.qh"
+    #include "ipban.qh"
+#endif
 
-void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
 void crosshair_trace(entity pl)
 {
        traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * MAX_SHOT_DISTANCE, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
@@ -23,15 +48,11 @@ void crosshair_trace_plusvisibletriggers(entity pl)
        for (e = first; e; e = e.chain)
                e.solid = SOLID_TRIGGER;
 }
-void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
 void WarpZone_crosshair_trace(entity pl)
 {
        WarpZone_traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * MAX_SHOT_DISTANCE, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
 }
 
-void() spawnfunc_info_player_deathmatch; // needed for the other spawnpoints
-void() spawnpoint_use;
-string GetMapname();
 
 string admin_name(void)
 {
@@ -41,8 +62,6 @@ string admin_name(void)
                return "SERVER ADMIN";
 }
 
-float DistributeEvenly_amount;
-float DistributeEvenly_totalweight;
 void DistributeEvenly_Init(float amount, float totalweight)
 {
     if (DistributeEvenly_amount)
@@ -77,37 +96,6 @@ float DistributeEvenly_GetRandomized(float weight)
     return f;
 }
 
-#define move_out_of_solid(e) WarpZoneLib_MoveOutOfSolid(e)
-
-const string STR_PLAYER = "player";
-const string STR_SPECTATOR = "spectator";
-const string STR_OBSERVER = "observer";
-
-#define IS_PLAYER(v)                   (v.classname == STR_PLAYER)
-#define IS_SPEC(v)                             (v.classname == STR_SPECTATOR)
-#define IS_OBSERVER(v)                         (v.classname == STR_OBSERVER)
-#define IS_CLIENT(v)                   (v.flags & FL_CLIENT)
-#define IS_BOT_CLIENT(v)               (clienttype(v) == CLIENTTYPE_BOT)
-#define IS_REAL_CLIENT(v)              (clienttype(v) == CLIENTTYPE_REAL)
-#define IS_NOT_A_CLIENT(v)             (clienttype(v) == CLIENTTYPE_NOTACLIENT)
-
-#define FOR_EACH_CLIENTSLOT(v) for(v = world; (v = nextent(v)) && (num_for_edict(v) <= maxclients); )
-#define FOR_EACH_CLIENT(v) FOR_EACH_CLIENTSLOT(v) if(IS_CLIENT(v))
-#define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if(IS_REAL_CLIENT(v))
-
-#define FOR_EACH_PLAYER(v) FOR_EACH_CLIENT(v) if(IS_PLAYER(v))
-#define FOR_EACH_SPEC(v) FOR_EACH_CLIENT(v) if (!IS_PLAYER(v)) // Samual: shouldn't this be IS_SPEC(v)? and rather create a separate macro to include observers too
-#define FOR_EACH_REALPLAYER(v) FOR_EACH_REALCLIENT(v) if(IS_PLAYER(v))
-
-#define FOR_EACH_MONSTER(v) for(v = world; (v = findflags(v, flags, FL_MONSTER)) != world; )
-
-#define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))
-
-// copies a string to a tempstring (so one can strunzone it)
-string strcat1(string s) = #115; // FRIK_FILE
-
-float logfile_open;
-float logfile;
 
 void GameLogEcho(string s)
 {
@@ -118,7 +106,7 @@ void GameLogEcho(string s)
     {
         if (!logfile_open)
         {
-            logfile_open = TRUE;
+            logfile_open = true;
             matches = autocvar_sv_eventlog_files_counter + 1;
             cvar_set("sv_eventlog_files_counter", ftos(matches));
             fn = ftos(matches);
@@ -131,7 +119,7 @@ void GameLogEcho(string s)
         if (logfile >= 0)
         {
             if (autocvar_sv_eventlog_files_timestamps)
-                fputs(logfile, strcat(":time:", strftime(TRUE, "%Y-%m-%d %H:%M:%S", "\n", s, "\n")));
+                fputs(logfile, strcat(":time:", strftime(true, "%Y-%m-%d %H:%M:%S", "\n", s, "\n")));
             else
                 fputs(logfile, strcat(s, "\n"));
         }
@@ -157,32 +145,6 @@ void GameLogClose()
     }
 }
 
-#define strstr strstrofs
-/*
-// NOTE: DO NOT USE THIS FUNCTION TOO OFTEN.
-// IT WILL MOST PROBABLY DESTROY _ALL_ OTHER TEMP
-// STRINGS AND TAKE QUITE LONG. haystack and needle MUST
-// BE CONSTANT OR strzoneD!
-float strstr(string haystack, string needle, float offset)
-{
-       float len, endpos;
-       string found;
-       len = strlen(needle);
-       endpos = strlen(haystack) - len;
-       while(offset <= endpos)
-       {
-               found = substring(haystack, offset, len);
-               if(found == needle)
-                       return offset;
-               offset = offset + 1;
-       }
-       return -1;
-}
-*/
-
-const float NUM_NEAREST_ENTITIES = 4;
-entity nearest_entity[NUM_NEAREST_ENTITIES];
-float nearest_length[NUM_NEAREST_ENTITIES];
 entity findnearest(vector point, .string field, string value, vector axismod)
 {
     entity localhead;
@@ -202,7 +164,7 @@ entity findnearest(vector point, .string field, string value, vector axismod)
         else
             dist = localhead.origin;
         dist = dist - point;
-        dist = dist_x * axismod_x * '1 0 0' + dist_y * axismod_y * '0 1 0' + dist_z * axismod_z * '0 0 1';
+        dist = dist.x * axismod.x * '1 0 0' + dist.y * axismod.y * '0 1 0' + dist.z * axismod.z * '0 0 1';
         len = vlen(dist);
 
         for (i = 0; i < num_nearest; ++i)
@@ -232,7 +194,7 @@ entity findnearest(vector point, .string field, string value, vector axismod)
     // now use the first one from our list that we can see
     for (i = 0; i < num_nearest; ++i)
     {
-        traceline(point, nearest_entity[i].origin, TRUE, world);
+        traceline(point, nearest_entity[i].origin, true, world);
         if (trace_fraction == 1)
         {
             if (i != 0)
@@ -368,7 +330,7 @@ string formatmessage(string msg)
                        if (replacement == "" || !cursor_ent)
                                replacement = "nothing";
                } else if (escape == "s")
-                       replacement = ftos(vlen(self.velocity - self.velocity_z * '0 0 1'));
+                       replacement = ftos(vlen(self.velocity - self.velocity.z * '0 0 1'));
                else if (escape == "S")
                        replacement = ftos(vlen(self.velocity));
 
@@ -378,8 +340,8 @@ string formatmessage(string msg)
        return msg;
 }
 
-float boolean(float value) { // if value is 0 return FALSE (0), otherwise return TRUE (1)
-       return (value == 0) ? FALSE : TRUE;
+float boolean(float value) { // if value is 0 return false (0), otherwise return true (1)
+       return (value == 0) ? false : true;
 }
 
 /*
@@ -548,94 +510,16 @@ vector randompos(vector m1, vector m2)
 {
     vector v;
     m2 = m2 - m1;
-    v_x = m2_x * random() + m1_x;
-    v_y = m2_y * random() + m1_y;
-    v_z = m2_z * random() + m1_z;
+    v.x = m2_x * random() + m1_x;
+    v.y = m2_y * random() + m1_y;
+    v.z = m2_z * random() + m1_z;
     return  v;
 }
 
-//#NO AUTOCVARS START
-
-float g_pickup_shells;
-float g_pickup_shells_max;
-float g_pickup_nails;
-float g_pickup_nails_max;
-float g_pickup_rockets;
-float g_pickup_rockets_max;
-float g_pickup_cells;
-float g_pickup_cells_max;
-float g_pickup_plasma;
-float g_pickup_plasma_max;
-float g_pickup_fuel;
-float g_pickup_fuel_jetpack;
-float g_pickup_fuel_max;
-float g_pickup_armorsmall;
-float g_pickup_armorsmall_max;
-float g_pickup_armorsmall_anyway;
-float g_pickup_armormedium;
-float g_pickup_armormedium_max;
-float g_pickup_armormedium_anyway;
-float g_pickup_armorbig;
-float g_pickup_armorbig_max;
-float g_pickup_armorbig_anyway;
-float g_pickup_armorlarge;
-float g_pickup_armorlarge_max;
-float g_pickup_armorlarge_anyway;
-float g_pickup_healthsmall;
-float g_pickup_healthsmall_max;
-float g_pickup_healthsmall_anyway;
-float g_pickup_healthmedium;
-float g_pickup_healthmedium_max;
-float g_pickup_healthmedium_anyway;
-float g_pickup_healthlarge;
-float g_pickup_healthlarge_max;
-float g_pickup_healthlarge_anyway;
-float g_pickup_healthmega;
-float g_pickup_healthmega_max;
-float g_pickup_healthmega_anyway;
-float g_pickup_ammo_anyway;
-float g_pickup_weapons_anyway;
-float g_weaponarena;
-WepSet g_weaponarena_weapons;
-float g_weaponarena_random;
-float g_weaponarena_random_with_blaster;
-string g_weaponarena_list;
-float g_weaponspeedfactor;
-float g_weaponratefactor;
-float g_weapondamagefactor;
-float g_weaponforcefactor;
-float g_weaponspreadfactor;
-
-WepSet start_weapons;
-WepSet start_weapons_default;
-WepSet start_weapons_defaultmask;
-float start_items;
-float start_ammo_shells;
-float start_ammo_nails;
-float start_ammo_rockets;
-float start_ammo_cells;
-float start_ammo_plasma;
-float start_ammo_fuel;
-float start_health;
-float start_armorvalue;
-WepSet warmup_start_weapons;
-WepSet warmup_start_weapons_default;
-WepSet warmup_start_weapons_defaultmask;
-#define WARMUP_START_WEAPONS ((g_warmup_allguns == 1) ? (warmup_start_weapons & (weaponsInMap | start_weapons)) : warmup_start_weapons)
-float warmup_start_ammo_shells;
-float warmup_start_ammo_nails;
-float warmup_start_ammo_rockets;
-float warmup_start_ammo_cells;
-float warmup_start_ammo_plasma;
-float warmup_start_ammo_fuel;
-float warmup_start_health;
-float warmup_start_armorvalue;
-float g_weapon_stay;
-
-float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still needs done? 
-{
-       var float i = weaponinfo.weapon;
-       var float d = 0;
+float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still needs done?
+{
+       int i = weaponinfo.weapon;
+       int d = 0;
 
        if (!i)
                return 0;
@@ -643,9 +527,9 @@ float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still ne
        if (g_lms || g_ca || allguns)
        {
                if(weaponinfo.spawnflags & WEP_FLAG_NORMAL)
-                       d = TRUE;
+                       d = true;
                else
-                       d = FALSE;
+                       d = false;
        }
        else if (g_cts)
                d = (i == WEP_SHOTGUN);
@@ -659,7 +543,7 @@ float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still ne
        if(!g_cts && (weaponinfo.spawnflags & WEP_FLAG_MUTATORBLOCKED)) // never default mutator blocked guns
                d = 0;
 
-       var float t = weaponinfo.weaponstartoverride;
+       float t = weaponinfo.weaponstartoverride;
 
        //print(strcat("want_weapon: ", weaponinfo.netname, " - d: ", ftos(d), ", t: ", ftos(t), ". \n"));
 
@@ -783,7 +667,7 @@ void readplayerstartcvars()
                for (i = WEP_FIRST; i <= WEP_LAST; ++i)
                {
                        e = get_weaponinfo(i);
-                       float w = want_weapon(e, FALSE);
+                       int w = want_weapon(e, false);
                        if(w & 1)
                                start_weapons |= WepSet_FromWeapon(i);
                        if(w & 2)
@@ -845,7 +729,7 @@ void readplayerstartcvars()
                        for (i = WEP_FIRST; i <= WEP_LAST; ++i)
                        {
                                e = get_weaponinfo(i);
-                               float w = want_weapon(e, g_warmup_allguns);
+                               int w = want_weapon(e, g_warmup_allguns);
                                if(w & 1)
                                        warmup_start_weapons |= WepSet_FromWeapon(i);
                                if(w & 2)
@@ -893,156 +777,7 @@ void readplayerstartcvars()
        warmup_start_ammo_fuel = max(0, warmup_start_ammo_fuel);
 }
 
-float g_bugrigs;
-float g_bugrigs_planar_movement;
-float g_bugrigs_planar_movement_car_jumping;
-float g_bugrigs_reverse_spinning;
-float g_bugrigs_reverse_speeding;
-float g_bugrigs_reverse_stopping;
-float g_bugrigs_air_steering;
-float g_bugrigs_angle_smoothing;
-float g_bugrigs_friction_floor;
-float g_bugrigs_friction_brake;
-float g_bugrigs_friction_air;
-float g_bugrigs_accel;
-float g_bugrigs_speed_ref;
-float g_bugrigs_speed_pow;
-float g_bugrigs_steer;
-
-float sv_autotaunt;
-float sv_taunt;
-
-string GetGametype(); // g_world.qc
-void mutators_add(); // mutators.qc
-void readlevelcvars(void)
-{
-       // load mutators
-       mutators_add();
-
-       if(cvar("sv_allow_fullbright"))
-               serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT;
-
-    g_bugrigs = cvar("g_bugrigs");
-    g_bugrigs_planar_movement = cvar("g_bugrigs_planar_movement");
-    g_bugrigs_planar_movement_car_jumping = cvar("g_bugrigs_planar_movement_car_jumping");
-    g_bugrigs_reverse_spinning = cvar("g_bugrigs_reverse_spinning");
-    g_bugrigs_reverse_speeding = cvar("g_bugrigs_reverse_speeding");
-    g_bugrigs_reverse_stopping = cvar("g_bugrigs_reverse_stopping");
-    g_bugrigs_air_steering = cvar("g_bugrigs_air_steering");
-    g_bugrigs_angle_smoothing = cvar("g_bugrigs_angle_smoothing");
-    g_bugrigs_friction_floor = cvar("g_bugrigs_friction_floor");
-    g_bugrigs_friction_brake = cvar("g_bugrigs_friction_brake");
-    g_bugrigs_friction_air = cvar("g_bugrigs_friction_air");
-    g_bugrigs_accel = cvar("g_bugrigs_accel");
-    g_bugrigs_speed_ref = cvar("g_bugrigs_speed_ref");
-    g_bugrigs_speed_pow = cvar("g_bugrigs_speed_pow");
-    g_bugrigs_steer = cvar("g_bugrigs_steer");
-
-       g_instagib = cvar("g_instagib");
-
-       sv_clones = cvar("sv_clones");
-       sv_foginterval = cvar("sv_foginterval");
-       g_cloaked = cvar("g_cloaked");
-       g_footsteps = cvar("g_footsteps");
-       g_grappling_hook = cvar("g_grappling_hook");
-       g_jetpack = cvar("g_jetpack");
-       sv_maxidle = cvar("sv_maxidle");
-       sv_maxidle_spectatorsareidle = cvar("sv_maxidle_spectatorsareidle");
-       sv_autotaunt = cvar("sv_autotaunt");
-       sv_taunt = cvar("sv_taunt");
-
-       warmup_stage = cvar("g_warmup");
-       g_warmup_limit = cvar("g_warmup_limit");
-       g_warmup_allguns = cvar("g_warmup_allguns");
-       g_warmup_allow_timeout = cvar("g_warmup_allow_timeout");
-
-       if ((g_race && g_race_qualifying == 2) || g_assault || cvar("g_campaign"))
-               warmup_stage = 0; // these modes cannot work together, sorry
-
-       g_pickup_respawntime_weapon = cvar("g_pickup_respawntime_weapon");
-       g_pickup_respawntime_superweapon = cvar("g_pickup_respawntime_superweapon");
-       g_pickup_respawntime_ammo = cvar("g_pickup_respawntime_ammo");
-       g_pickup_respawntime_short = cvar("g_pickup_respawntime_short");
-       g_pickup_respawntime_medium = cvar("g_pickup_respawntime_medium");
-       g_pickup_respawntime_long = cvar("g_pickup_respawntime_long");
-       g_pickup_respawntime_powerup = cvar("g_pickup_respawntime_powerup");
-       g_pickup_respawntimejitter_weapon = cvar("g_pickup_respawntimejitter_weapon");
-       g_pickup_respawntimejitter_superweapon = cvar("g_pickup_respawntimejitter_superweapon");
-       g_pickup_respawntimejitter_ammo = cvar("g_pickup_respawntimejitter_ammo");
-       g_pickup_respawntimejitter_short = cvar("g_pickup_respawntimejitter_short");
-       g_pickup_respawntimejitter_medium = cvar("g_pickup_respawntimejitter_medium");
-       g_pickup_respawntimejitter_long = cvar("g_pickup_respawntimejitter_long");
-       g_pickup_respawntimejitter_powerup = cvar("g_pickup_respawntimejitter_powerup");
-
-       g_weaponspeedfactor = cvar("g_weaponspeedfactor");
-       g_weaponratefactor = cvar("g_weaponratefactor");
-       g_weapondamagefactor = cvar("g_weapondamagefactor");
-       g_weaponforcefactor = cvar("g_weaponforcefactor");
-       g_weaponspreadfactor = cvar("g_weaponspreadfactor");
-
-       g_pickup_shells = cvar("g_pickup_shells");
-       g_pickup_shells_max = cvar("g_pickup_shells_max");
-       g_pickup_nails = cvar("g_pickup_nails");
-       g_pickup_nails_max = cvar("g_pickup_nails_max");
-       g_pickup_rockets = cvar("g_pickup_rockets");
-       g_pickup_rockets_max = cvar("g_pickup_rockets_max");
-       g_pickup_cells = cvar("g_pickup_cells");
-       g_pickup_cells_max = cvar("g_pickup_cells_max");
-       g_pickup_plasma = cvar("g_pickup_plasma");
-       g_pickup_plasma_max = cvar("g_pickup_plasma_max");
-       g_pickup_fuel = cvar("g_pickup_fuel");
-       g_pickup_fuel_jetpack = cvar("g_pickup_fuel_jetpack");
-       g_pickup_fuel_max = cvar("g_pickup_fuel_max");
-       g_pickup_armorsmall = cvar("g_pickup_armorsmall");
-       g_pickup_armorsmall_max = cvar("g_pickup_armorsmall_max");
-       g_pickup_armorsmall_anyway = cvar("g_pickup_armorsmall_anyway");
-       g_pickup_armormedium = cvar("g_pickup_armormedium");
-       g_pickup_armormedium_max = cvar("g_pickup_armormedium_max");
-       g_pickup_armormedium_anyway = cvar("g_pickup_armormedium_anyway");
-       g_pickup_armorbig = cvar("g_pickup_armorbig");
-       g_pickup_armorbig_max = cvar("g_pickup_armorbig_max");
-       g_pickup_armorbig_anyway = cvar("g_pickup_armorbig_anyway");
-       g_pickup_armorlarge = cvar("g_pickup_armorlarge");
-       g_pickup_armorlarge_max = cvar("g_pickup_armorlarge_max");
-       g_pickup_armorlarge_anyway = cvar("g_pickup_armorlarge_anyway");
-       g_pickup_healthsmall = cvar("g_pickup_healthsmall");
-       g_pickup_healthsmall_max = cvar("g_pickup_healthsmall_max");
-       g_pickup_healthsmall_anyway = cvar("g_pickup_healthsmall_anyway");
-       g_pickup_healthmedium = cvar("g_pickup_healthmedium");
-       g_pickup_healthmedium_max = cvar("g_pickup_healthmedium_max");
-       g_pickup_healthmedium_anyway = cvar("g_pickup_healthmedium_anyway");
-       g_pickup_healthlarge = cvar("g_pickup_healthlarge");
-       g_pickup_healthlarge_max = cvar("g_pickup_healthlarge_max");
-       g_pickup_healthlarge_anyway = cvar("g_pickup_healthlarge_anyway");
-       g_pickup_healthmega = cvar("g_pickup_healthmega");
-       g_pickup_healthmega_max = cvar("g_pickup_healthmega_max");
-       g_pickup_healthmega_anyway = cvar("g_pickup_healthmega_anyway");
-
-       g_pickup_ammo_anyway = cvar("g_pickup_ammo_anyway");
-       g_pickup_weapons_anyway = cvar("g_pickup_weapons_anyway");
-
-    g_weapon_stay = cvar(strcat("g_", GetGametype(), "_weapon_stay"));
-    if(!g_weapon_stay)
-        g_weapon_stay = cvar("g_weapon_stay");
-
-       if (!warmup_stage)
-               game_starttime = time + cvar("g_start_delay");
-
-       readplayerstartcvars();
-}
-
-//#NO AUTOCVARS END
-
-// Sound functions
-string precache_sound (string s) = #19;
-float precache_sound_index (string s) = #19;
-
-#define SND_VOLUME      1
-#define SND_ATTENUATION 2
-#define SND_LARGEENTITY 8
-#define SND_LARGESOUND  16
-
-float sound_allowed(float dest, entity e)
+float sound_allowed(float _dest, entity e)
 {
     // sounds from world may always pass
     for (;;)
@@ -1057,30 +792,30 @@ float sound_allowed(float dest, entity e)
             break;
     }
     // sounds to self may always pass
-    if (dest == MSG_ONE)
+    if (_dest == MSG_ONE)
         if (e == msg_entity)
-            return TRUE;
+            return true;
     // sounds by players can be removed
     if (autocvar_bot_sound_monopoly)
         if (IS_REAL_CLIENT(e))
-            return FALSE;
+            return false;
     // anything else may pass
-    return TRUE;
+    return true;
 }
 
 #undef sound
-void sound(entity e, float chan, string samp, float vol, float atten)
+void sound(entity e, float chan, string samp, float vol, float _atten)
 {
     if (!sound_allowed(MSG_BROADCAST, e))
         return;
-    sound7(e, chan, samp, vol, atten, 0, 0);
+    sound7(e, chan, samp, vol, _atten, 0, 0);
 }
 
-void soundtoat(float dest, entity e, vector o, float chan, string samp, float vol, float atten)
+void soundtoat(float _dest, entity e, vector o, float chan, string samp, float vol, float _atten)
 {
     float entno, idx;
 
-    if (!sound_allowed(dest, e))
+    if (!sound_allowed(_dest, e))
         return;
 
     entno = num_for_edict(e);
@@ -1089,61 +824,61 @@ void soundtoat(float dest, entity e, vector o, float chan, string samp, float vo
     float sflags;
     sflags = 0;
 
-    atten = floor(atten * 64);
+    _atten = floor(_atten * 64);
     vol = floor(vol * 255);
 
     if (vol != 255)
         sflags |= SND_VOLUME;
-    if (atten != 64)
+    if (_atten != 64)
         sflags |= SND_ATTENUATION;
     if (entno >= 8192 || chan < 0 || chan > 7)
         sflags |= SND_LARGEENTITY;
     if (idx >= 256)
         sflags |= SND_LARGESOUND;
 
-    WriteByte(dest, SVC_SOUND);
-    WriteByte(dest, sflags);
+    WriteByte(_dest, SVC_SOUND);
+    WriteByte(_dest, sflags);
     if (sflags & SND_VOLUME)
-        WriteByte(dest, vol);
+        WriteByte(_dest, vol);
     if (sflags & SND_ATTENUATION)
-        WriteByte(dest, atten);
+        WriteByte(_dest, _atten);
     if (sflags & SND_LARGEENTITY)
     {
-        WriteShort(dest, entno);
-        WriteByte(dest, chan);
+        WriteShort(_dest, entno);
+        WriteByte(_dest, chan);
     }
     else
     {
-        WriteShort(dest, entno * 8 + chan);
+        WriteShort(_dest, entno * 8 + chan);
     }
     if (sflags & SND_LARGESOUND)
-        WriteShort(dest, idx);
+        WriteShort(_dest, idx);
     else
-        WriteByte(dest, idx);
+        WriteByte(_dest, idx);
 
-    WriteCoord(dest, o_x);
-    WriteCoord(dest, o_y);
-    WriteCoord(dest, o_z);
+    WriteCoord(_dest, o.x);
+    WriteCoord(_dest, o.y);
+    WriteCoord(_dest, o.z);
 }
-void soundto(float dest, entity e, float chan, string samp, float vol, float atten)
+void soundto(float _dest, entity e, float chan, string samp, float vol, float _atten)
 {
     vector o;
 
-    if (!sound_allowed(dest, e))
+    if (!sound_allowed(_dest, e))
         return;
 
     o = e.origin + 0.5 * (e.mins + e.maxs);
-    soundtoat(dest, e, o, chan, samp, vol, atten);
+    soundtoat(_dest, e, o, chan, samp, vol, _atten);
 }
-void soundat(entity e, vector o, float chan, string samp, float vol, float atten)
+void soundat(entity e, vector o, float chan, string samp, float vol, float _atten)
 {
-    soundtoat(((chan & 8) ? MSG_ALL : MSG_BROADCAST), e, o, chan, samp, vol, atten);
+    soundtoat(((chan & 8) ? MSG_ALL : MSG_BROADCAST), e, o, chan, samp, vol, _atten);
 }
-void stopsoundto(float dest, entity e, float chan)
+void stopsoundto(float _dest, entity e, float chan)
 {
     float entno;
 
-    if (!sound_allowed(dest, e))
+    if (!sound_allowed(_dest, e))
         return;
 
     entno = num_for_edict(e);
@@ -1155,22 +890,22 @@ void stopsoundto(float dest, entity e, float chan)
         sflags = SND_LARGEENTITY;
         if (idx >= 256)
             sflags |= SND_LARGESOUND;
-        WriteByte(dest, SVC_SOUND);
-        WriteByte(dest, sflags);
-        WriteShort(dest, entno);
-        WriteByte(dest, chan);
+        WriteByte(_dest, SVC_SOUND);
+        WriteByte(_dest, sflags);
+        WriteShort(_dest, entno);
+        WriteByte(_dest, chan);
         if (sflags & SND_LARGESOUND)
-            WriteShort(dest, idx);
+            WriteShort(_dest, idx);
         else
-            WriteByte(dest, idx);
-        WriteCoord(dest, e.origin_x);
-        WriteCoord(dest, e.origin_y);
-        WriteCoord(dest, e.origin_z);
+            WriteByte(_dest, idx);
+        WriteCoord(_dest, e.origin.x);
+        WriteCoord(_dest, e.origin.y);
+        WriteCoord(_dest, e.origin.z);
     }
     else
     {
-        WriteByte(dest, SVC_STOPSOUND);
-        WriteShort(dest, entno * 8 + chan);
+        WriteByte(_dest, SVC_STOPSOUND);
+        WriteShort(_dest, entno * 8 + chan);
     }
 }
 void stopsound(entity e, float chan)
@@ -1191,18 +926,18 @@ void play2(entity e, string filename)
 
 // use this one if you might be causing spam (e.g. from touch functions that might get called more than once per frame)
 .float spamtime;
-float spamsound(entity e, float chan, string samp, float vol, float atten)
+float spamsound(entity e, float chan, string samp, float vol, float _atten)
 {
     if (!sound_allowed(MSG_BROADCAST, e))
-        return FALSE;
+        return false;
 
     if (time > e.spamtime)
     {
         e.spamtime = time;
-        sound(e, chan, samp, vol, atten);
-        return TRUE;
+        sound(e, chan, samp, vol, _atten);
+        return true;
     }
-    return FALSE;
+    return false;
 }
 
 void play2team(float t, string filename)
@@ -1245,7 +980,7 @@ void precache_playermodel(string m)
        if(fexists(f))
                precache_model(f);
 
-       globhandle = search_begin(strcat(m, "_*.sounds"), TRUE, FALSE);
+       globhandle = search_begin(strcat(m, "_*.sounds"), true, false);
        if (globhandle < 0)
                return;
        n = search_getsize(globhandle);
@@ -1262,7 +997,7 @@ void precache_all_playermodels(string pattern)
        float globhandle, i, n;
        string f;
 
-       globhandle = search_begin(pattern, TRUE, FALSE);
+       globhandle = search_begin(pattern, true, false);
        if (globhandle < 0)
                return;
        n = search_getsize(globhandle);
@@ -1384,23 +1119,6 @@ void precache()
 #include "precache-for-csqc.inc"
 }
 
-// WARNING: this kills the trace globals
-#define EXACTTRIGGER_TOUCH if(WarpZoneLib_ExactTrigger_Touch()) return
-#define EXACTTRIGGER_INIT  WarpZoneLib_ExactTrigger_Init()
-
-#define INITPRIO_FIRST              0
-#define INITPRIO_GAMETYPE           0
-#define INITPRIO_GAMETYPE_FALLBACK  1
-#define INITPRIO_FINDTARGET        10
-#define INITPRIO_DROPTOFLOOR       20
-#define INITPRIO_SETLOCATION       90
-#define INITPRIO_LINKDOORS         91
-#define INITPRIO_LAST              99
-
-.void(void) initialize_entity;
-.float initialize_entity_order;
-.entity initialize_entity_next;
-entity initialize_entity_first;
 
 void make_safe_for_remove(entity e)
 {
@@ -1535,8 +1253,6 @@ void InitializeEntitiesRun()
     remove = remove_unsafely;
 }
 
-.float uncustomizeentityforclient_set;
-.void(void) uncustomizeentityforclient;
 void UncustomizeEntitiesRun()
 {
     entity oldself;
@@ -1552,10 +1268,7 @@ void SetCustomizer(entity e, float(void) customizer, void(void) uncustomizer)
     e.uncustomizeentityforclient_set = !!uncustomizer;
 }
 
-.float nottargeted;
-#define IFTARGETED if(!self.nottargeted && self.targetname != "")
 
-void() SUB_Remove;
 void Net_LinkEntity(entity e, float docull, float dt, float(entity, float) sendfunc)
 {
     vector mi, ma;
@@ -1607,7 +1320,7 @@ float EliminatedPlayers_SendEntity(entity to, float sendflags)
                }
        }
 
-       return TRUE;
+       return true;
 }
 
 void EliminatedPlayers_Init(float(entity) isEliminated_func)
@@ -1617,7 +1330,7 @@ void EliminatedPlayers_Init(float(entity) isEliminated_func)
                backtrace("Can't spawn eliminatedPlayers again!");
                return;
        }
-       Net_LinkEntity(eliminatedPlayers = spawn(), FALSE, 0, EliminatedPlayers_SendEntity);
+       Net_LinkEntity(eliminatedPlayers = spawn(), false, 0, EliminatedPlayers_SendEntity);
        eliminatedPlayers.isEliminated = isEliminated_func;
 }
 
@@ -1672,9 +1385,9 @@ float trace_hits_box_1d(float end, float thmi, float thma)
     {
         // just check if x is in range
         if (0 < thmi)
-            return FALSE;
+            return false;
         if (0 > thma)
-            return FALSE;
+            return false;
     }
     else
     {
@@ -1683,9 +1396,9 @@ float trace_hits_box_1d(float end, float thmi, float thma)
         trace_hits_box_a0 = max(trace_hits_box_a0, min(thmi / end, thma / end));
         trace_hits_box_a1 = min(trace_hits_box_a1, max(thmi / end, thma / end));
         if (trace_hits_box_a0 > trace_hits_box_a1)
-            return FALSE;
+            return false;
     }
-    return TRUE;
+    return true;
 }
 
 float trace_hits_box(vector start, vector end, vector thmi, vector thma)
@@ -1698,14 +1411,14 @@ float trace_hits_box(vector start, vector end, vector thmi, vector thma)
     trace_hits_box_a0 = 0;
     trace_hits_box_a1 = 1;
 
-    if (!trace_hits_box_1d(end_x, thmi_x, thma_x))
-        return FALSE;
-    if (!trace_hits_box_1d(end_y, thmi_y, thma_y))
-        return FALSE;
-    if (!trace_hits_box_1d(end_z, thmi_z, thma_z))
-        return FALSE;
+    if (!trace_hits_box_1d(end.x, thmi.x, thma.x))
+        return false;
+    if (!trace_hits_box_1d(end.y, thmi.y, thma.y))
+        return false;
+    if (!trace_hits_box_1d(end.z, thmi.z, thma.z))
+        return false;
 
-    return TRUE;
+    return true;
 }
 
 float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma)
@@ -1754,11 +1467,11 @@ void W_Crylink_Dequeue(entity e);
 float WarpZone_Projectile_Touch_ImpactFilter_Callback()
 {
        if(SUB_OwnerCheck())
-               return TRUE;
+               return true;
        if(SUB_NoImpactCheck())
        {
                if(self.classname == "nade")
-                       return FALSE; // no checks here
+                       return false; // no checks here
                else if(self.classname == "grapplinghook")
                        RemoveGrapplingHook(self.realowner);
                else if(self.classname == "spike")
@@ -1768,16 +1481,13 @@ float WarpZone_Projectile_Touch_ImpactFilter_Callback()
                }
                else
                        remove(self);
-               return TRUE;
+               return true;
        }
        if(trace_ent && trace_ent.solid > SOLID_TRIGGER)
                UpdateCSQCProjectile(self);
-       return FALSE;
+       return false;
 }
-#define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return
 
-#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
-#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER) || ((dt) == DEATH_SLIME) || ((dt) == DEATH_LAVA) || ((dt) == DEATH_SWAMP))
 
 void URI_Get_Callback(float id, float status, string data)
 {
@@ -1842,14 +1552,14 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
 
     for (i = 0; i < attempts; ++i)
     {
-        start_x = org_x + random() * delta_x;
-        start_y = org_y + random() * delta_y;
-        start_z = org_z + random() * delta_z;
+        start.x = org.x + random() * delta.x;
+        start.y = org.y + random() * delta.y;
+        start.z = org.z + random() * delta.z;
 
         // rule 1: start inside world bounds, and outside
         // solid, and don't start from somewhere where you can
         // fall down to evil
-        tracebox(start, e.mins, e.maxs, start - '0 0 1' * delta_z, MOVE_NORMAL, e);
+        tracebox(start, e.mins, e.maxs, start - '0 0 1' * delta.z, MOVE_NORMAL, e);
         if (trace_fraction >= 1)
             continue;
         if (trace_startsolid)
@@ -1860,7 +1570,7 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
             continue;
 
         // rule 2: if we are too high, lower the point
-        if (trace_fraction * delta_z > maxaboveground)
+        if (trace_fraction * delta.z > maxaboveground)
             start = trace_endpos + '0 0 1' * maxaboveground;
         enddown = trace_endpos;
 
@@ -1869,19 +1579,19 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
         // the map should have a convex outside hull.
         // these can be traceLINES as we already verified the starting box
         mstart = start + 0.5 * (e.mins + e.maxs);
-        traceline(mstart, mstart + '1 0 0' * delta_x, MOVE_NORMAL, e);
+        traceline(mstart, mstart + '1 0 0' * delta.x, MOVE_NORMAL, e);
         if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
             continue;
-        traceline(mstart, mstart - '1 0 0' * delta_x, MOVE_NORMAL, e);
+        traceline(mstart, mstart - '1 0 0' * delta.x, MOVE_NORMAL, e);
         if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
             continue;
-        traceline(mstart, mstart + '0 1 0' * delta_y, MOVE_NORMAL, e);
+        traceline(mstart, mstart + '0 1 0' * delta.y, MOVE_NORMAL, e);
         if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
             continue;
-        traceline(mstart, mstart - '0 1 0' * delta_y, MOVE_NORMAL, e);
+        traceline(mstart, mstart - '0 1 0' * delta.y, MOVE_NORMAL, e);
         if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
             continue;
-        traceline(mstart, mstart + '0 0 1' * delta_z, MOVE_NORMAL, e);
+        traceline(mstart, mstart + '0 0 1' * delta.z, MOVE_NORMAL, e);
         if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
             continue;
 
@@ -1901,9 +1611,9 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
        }
 
         // find a random vector to "look at"
-        end_x = org_x + random() * delta_x;
-        end_y = org_y + random() * delta_y;
-        end_z = org_z + random() * delta_z;
+        end.x = org.x + random() * delta.x;
+        end.y = org.y + random() * delta.y;
+        end.z = org.z + random() * delta.z;
         end = start + normalize(end - start) * vlen(delta);
 
         // rule 4: start TO end must not be too short
@@ -1931,10 +1641,10 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
         setorigin(e, start);
         e.angles = vectoangles(end - start);
         dprint("Needed ", ftos(i + 1), " attempts\n");
-        return TRUE;
+        return true;
     }
     else
-        return FALSE;
+        return false;
 }
 
 void write_recordmarker(entity pl, float tstart, float dt)
@@ -1957,15 +1667,15 @@ vector shotorg_adjustfromclient(vector vecs, float y_is_right, float allowcenter
                        break;
 
                case 4: // left
-                       vecs_y = -vecs_y;
+                       vecs.y = -vecs.y;
                        break;
 
                case 1:
                        if(allowcenter) // 2: allow center handedness
                        {
                                // center
-                               vecs_y = 0;
-                               vecs_z -= 2;
+                               vecs.y = 0;
+                               vecs.z -= 2;
                        }
                        else
                        {
@@ -1977,13 +1687,13 @@ vector shotorg_adjustfromclient(vector vecs, float y_is_right, float allowcenter
                        if(allowcenter) // 2: allow center handedness
                        {
                                // center
-                               vecs_y = 0;
-                               vecs_z -= 2;
+                               vecs.y = 0;
+                               vecs.z -= 2;
                        }
                        else
                        {
                                // left
-                               vecs_y = -vecs_y;
+                               vecs.y = -vecs.y;
                        }
                        break;
        }
@@ -2000,28 +1710,28 @@ vector shotorg_adjust_values(vector vecs, float y_is_right, float visual, float
                if (visual)
                {
                        if (autocvar_g_shootfromclient) { vecs = shotorg_adjustfromclient(vecs, y_is_right, (autocvar_g_shootfromclient >= 2), algn); }
-                       else { vecs_y = 0; vecs_z -= 2; }
+                       else { vecs.y = 0; vecs.z -= 2; }
                }
                else
                {
-                       vecs_y = 0;
-                       vecs_z = 0;
+                       vecs.y = 0;
+                       vecs.z = 0;
                }
        }
        else if (autocvar_g_shootfromcenter)
        {
-               vecs_y = 0;
-               vecs_z -= 2;
+               vecs.y = 0;
+               vecs.z -= 2;
        }
        else if ((s = autocvar_g_shootfromfixedorigin) != "")
        {
                v = stov(s);
                if (y_is_right)
-                       v_y = -v_y;
-               if (v_x != 0)
-                       vecs_x = v_x;
-               vecs_y = v_y;
-               vecs_z = v_z;
+                       v.y = -v.y;
+               if (v.x != 0)
+                       vecs.x = v.x;
+               vecs.y = v.y;
+               vecs.z = v.z;
        }
        else if (autocvar_g_shootfromclient)
        {
@@ -2059,12 +1769,12 @@ void attach_sameorigin(entity e, entity to, string tag)
     fixedmakevectors(e.angles);
 
     // untransform forward, up!
-    e_forward_x = v_forward * t_forward;
-    e_forward_y = v_forward * t_left;
-    e_forward_z = v_forward * t_up;
-    e_up_x = v_up * t_forward;
-    e_up_y = v_up * t_left;
-    e_up_z = v_up * t_up;
+    e_forward.x = v_forward * t_forward;
+    e_forward.y = v_forward * t_left;
+    e_forward.z = v_forward * t_up;
+    e_up.x = v_up * t_forward;
+    e_up.y = v_up * t_left;
+    e_up.z = v_up * t_up;
 
     e.angles = fixedvectoangles2(e_forward, e_up);
     if (substring(e.model, 0, 1) == "*") // bmodels have their own rules
@@ -2137,26 +1847,26 @@ float modeleffect_SendEntity(entity to, float sf)
        WriteShort(MSG_ENTITY, self.modelindex);
        WriteByte(MSG_ENTITY, self.skin);
        WriteByte(MSG_ENTITY, self.frame);
-       WriteCoord(MSG_ENTITY, self.origin_x);
-       WriteCoord(MSG_ENTITY, self.origin_y);
-       WriteCoord(MSG_ENTITY, self.origin_z);
+       WriteCoord(MSG_ENTITY, self.origin.x);
+       WriteCoord(MSG_ENTITY, self.origin.y);
+       WriteCoord(MSG_ENTITY, self.origin.z);
        if(f & 1)
        {
-               WriteCoord(MSG_ENTITY, self.velocity_x);
-               WriteCoord(MSG_ENTITY, self.velocity_y);
-               WriteCoord(MSG_ENTITY, self.velocity_z);
+               WriteCoord(MSG_ENTITY, self.velocity.x);
+               WriteCoord(MSG_ENTITY, self.velocity.y);
+               WriteCoord(MSG_ENTITY, self.velocity.z);
        }
        if(f & 2)
        {
-               WriteCoord(MSG_ENTITY, self.angles_x);
-               WriteCoord(MSG_ENTITY, self.angles_y);
-               WriteCoord(MSG_ENTITY, self.angles_z);
+               WriteCoord(MSG_ENTITY, self.angles.x);
+               WriteCoord(MSG_ENTITY, self.angles.y);
+               WriteCoord(MSG_ENTITY, self.angles.z);
        }
        if(f & 4)
        {
-               WriteCoord(MSG_ENTITY, self.avelocity_x);
-               WriteCoord(MSG_ENTITY, self.avelocity_y);
-               WriteCoord(MSG_ENTITY, self.avelocity_z);
+               WriteCoord(MSG_ENTITY, self.avelocity.x);
+               WriteCoord(MSG_ENTITY, self.avelocity.y);
+               WriteCoord(MSG_ENTITY, self.avelocity.z);
        }
        WriteShort(MSG_ENTITY, self.scale * 256.0);
        WriteShort(MSG_ENTITY, self.scale2 * 256.0);
@@ -2164,7 +1874,7 @@ float modeleffect_SendEntity(entity to, float sf)
        WriteByte(MSG_ENTITY, self.fade_time * 100.0);
        WriteByte(MSG_ENTITY, self.alpha * 255.0);
 
-       return TRUE;
+       return true;
 }
 
 void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector ang, vector angv, float s0, float s2, float a, float t1, float t2)
@@ -2184,16 +1894,16 @@ void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector an
        e.fade_time = t2;
        e.skin = s;
        if(s0 >= 0)
-               e.scale = s0 / max6(-e.mins_x, -e.mins_y, -e.mins_z, e.maxs_x, e.maxs_y, e.maxs_z);
+               e.scale = s0 / max6(-e.mins.x, -e.mins.y, -e.mins.z, e.maxs.x, e.maxs.y, e.maxs.z);
        else
                e.scale = -s0;
        if(s2 >= 0)
-               e.scale2 = s2 / max6(-e.mins_x, -e.mins_y, -e.mins_z, e.maxs_x, e.maxs_y, e.maxs_z);
+               e.scale2 = s2 / max6(-e.mins.x, -e.mins.y, -e.mins.z, e.maxs.x, e.maxs.y, e.maxs.z);
        else
                e.scale2 = -s2;
        sz = max(e.scale, e.scale2);
        setsize(e, e.mins * sz, e.maxs * sz);
-       Net_LinkEntity(e, FALSE, 0.1, modeleffect_SendEntity);
+       Net_LinkEntity(e, false, 0.1, modeleffect_SendEntity);
 }
 
 void shockwave_spawn(string m, vector org, float sz, float t1, float t2)
@@ -2263,26 +1973,6 @@ float ExponentialFalloff(float mindist, float maxdist, float halflifedist, float
 }
 
 
-
-
-#ifdef RELEASE
-#define cvar_string_normal builtin_cvar_string
-#define cvar_normal builtin_cvar
-#else
-string cvar_string_normal(string n)
-{
-       if (!(cvar_type(n) & 1))
-               backtrace(strcat("Attempt to access undefined cvar: ", n));
-       return builtin_cvar_string(n);
-}
-
-float cvar_normal(string n)
-{
-       return stof(cvar_string_normal(n));
-}
-#endif
-#define cvar_set_normal builtin_cvar_set
-
 void defer_think()
 {
     entity oself;
@@ -2350,9 +2040,9 @@ float LostMovetypeFollow(entity ent)
 float isPushable(entity e)
 {
        if(e.iscreature)
-               return TRUE;
+               return true;
        if(e.pushable)
-               return TRUE;
+               return true;
        switch(e.classname)
        {
                case "body":
@@ -2360,11 +2050,11 @@ float isPushable(entity e)
                case "keepawayball":
                case "nexball_basketball":
                case "nexball_football":
-                       return TRUE;
+                       return true;
                case "bullet": // antilagged bullets can't hit this either
-                       return FALSE;
+                       return false;
        }
        if (e.projectiledeathtype)
-               return TRUE;
-       return FALSE;
+               return true;
+       return false;
 }
diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh
new file mode 100644 (file)
index 0000000..f19f53f
--- /dev/null
@@ -0,0 +1,431 @@
+#ifndef MISCFUNCTIONS_H
+#define MISCFUNCTIONS_H
+
+#include "t_items.qh"
+
+#include "mutators/base.qh"
+#include "mutators/gamemode_race.qh"
+
+#include "../common/constants.qh"
+#include "../common/mapinfo.qh"
+
+#ifdef RELEASE
+#define cvar_string_normal builtin_cvar_string
+#define cvar_normal builtin_cvar
+#else
+string cvar_string_normal(string n)
+{
+       if (!(cvar_type(n) & 1))
+               backtrace(strcat("Attempt to access undefined cvar: ", n));
+       return builtin_cvar_string(n);
+}
+
+float cvar_normal(string n)
+{
+       return stof(cvar_string_normal(n));
+}
+#endif
+#define cvar_set_normal builtin_cvar_set
+
+.vector dropped_origin;
+.void(void) uncustomizeentityforclient;
+.float uncustomizeentityforclient_set;
+.float nottargeted;
+
+
+float DistributeEvenly_amount;
+float DistributeEvenly_totalweight;
+var void remove(entity e);
+void objerror(string s);
+void droptofloor();
+void() spawnfunc_info_player_deathmatch; // needed for the other spawnpoints
+void() spawnpoint_use;
+void() SUB_Remove;
+
+void attach_sameorigin(entity e, entity to, string tag);
+
+void crosshair_trace(entity pl);
+
+void crosshair_trace_plusvisibletriggers(entity pl);
+
+void detach_sameorigin(entity e);
+
+void follow_sameorigin(entity e, entity to);
+
+string formatmessage(string msg);
+
+void GameLogEcho(string s);
+
+void GameLogInit();
+
+void GameLogClose();
+
+void GetCvars(float f);
+
+string GetMapname();
+
+float isPushable(entity e);
+
+float LostMovetypeFollow(entity ent);
+
+float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance);
+
+string NearestLocation(vector p);
+
+void play2(entity e, string filename);
+
+string playername(entity p);
+
+void precache();
+
+void remove_safely(entity e);
+
+void remove_unsafely(entity e);
+
+void SetMovetypeFollow(entity ent, entity e);
+
+vector shotorg_adjust_values(vector vecs, float y_is_right, float visual, float algn);
+
+void soundto(float dest, entity e, float chan, string samp, float vol, float atten);
+
+void stopsound(entity e, float chan);
+
+float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma);
+
+void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
+
+void WarpZone_crosshair_trace(entity pl);
+
+void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
+
+
+#define IFTARGETED if(!self.nottargeted && self.targetname != "")
+
+#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
+#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER) || ((dt) == DEATH_SLIME) || ((dt) == DEATH_LAVA) || ((dt) == DEATH_SWAMP))
+
+#define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return
+
+#define move_out_of_solid(e) WarpZoneLib_MoveOutOfSolid(e)
+
+const string STR_PLAYER = "player";
+const string STR_SPECTATOR = "spectator";
+const string STR_OBSERVER = "observer";
+
+#define IS_PLAYER(v)                   (v.classname == STR_PLAYER)
+#define IS_SPEC(v)                             (v.classname == STR_SPECTATOR)
+#define IS_OBSERVER(v)                         (v.classname == STR_OBSERVER)
+#define IS_CLIENT(v)                   (v.flags & FL_CLIENT)
+#define IS_BOT_CLIENT(v)               (clienttype(v) == CLIENTTYPE_BOT)
+#define IS_REAL_CLIENT(v)              (clienttype(v) == CLIENTTYPE_REAL)
+#define IS_NOT_A_CLIENT(v)             (clienttype(v) == CLIENTTYPE_NOTACLIENT)
+
+#define FOR_EACH_CLIENTSLOT(v) for(v = world; (v = nextent(v)) && (num_for_edict(v) <= maxclients); )
+#define FOR_EACH_CLIENT(v) FOR_EACH_CLIENTSLOT(v) if(IS_CLIENT(v))
+#define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if(IS_REAL_CLIENT(v))
+
+#define FOR_EACH_PLAYER(v) FOR_EACH_CLIENT(v) if(IS_PLAYER(v))
+#define FOR_EACH_SPEC(v) FOR_EACH_CLIENT(v) if (!IS_PLAYER(v)) // Samual: shouldn't this be IS_SPEC(v)? and rather create a separate macro to include observers too
+#define FOR_EACH_REALPLAYER(v) FOR_EACH_REALCLIENT(v) if(IS_PLAYER(v))
+
+#define FOR_EACH_MONSTER(v) for(v = world; (v = findflags(v, flags, FL_MONSTER)) != world; )
+
+#define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))
+
+// copies a string to a tempstring (so one can strunzone it)
+string strcat1(string s) = #115; // FRIK_FILE
+
+float logfile_open;
+float logfile;
+
+#define strstr strstrofs
+/*
+// NOTE: DO NOT USE THIS FUNCTION TOO OFTEN.
+// IT WILL MOST PROBABLY DESTROY _ALL_ OTHER TEMP
+// STRINGS AND TAKE QUITE LONG. haystack and needle MUST
+// BE CONSTANT OR strzoneD!
+float strstr(string haystack, string needle, float offset)
+{
+       float len, endpos;
+       string found;
+       len = strlen(needle);
+       endpos = strlen(haystack) - len;
+       while(offset <= endpos)
+       {
+               found = substring(haystack, offset, len);
+               if(found == needle)
+                       return offset;
+               offset = offset + 1;
+       }
+       return -1;
+}
+*/
+
+const float NUM_NEAREST_ENTITIES = 4;
+entity nearest_entity[NUM_NEAREST_ENTITIES];
+float nearest_length[NUM_NEAREST_ENTITIES];
+
+
+//#NO AUTOCVARS START
+
+float g_pickup_shells;
+float g_pickup_shells_max;
+float g_pickup_nails;
+float g_pickup_nails_max;
+float g_pickup_rockets;
+float g_pickup_rockets_max;
+float g_pickup_cells;
+float g_pickup_cells_max;
+float g_pickup_plasma;
+float g_pickup_plasma_max;
+float g_pickup_fuel;
+float g_pickup_fuel_jetpack;
+float g_pickup_fuel_max;
+float g_pickup_armorsmall;
+float g_pickup_armorsmall_max;
+float g_pickup_armorsmall_anyway;
+float g_pickup_armormedium;
+float g_pickup_armormedium_max;
+float g_pickup_armormedium_anyway;
+float g_pickup_armorbig;
+float g_pickup_armorbig_max;
+float g_pickup_armorbig_anyway;
+float g_pickup_armorlarge;
+float g_pickup_armorlarge_max;
+float g_pickup_armorlarge_anyway;
+float g_pickup_healthsmall;
+float g_pickup_healthsmall_max;
+float g_pickup_healthsmall_anyway;
+float g_pickup_healthmedium;
+float g_pickup_healthmedium_max;
+float g_pickup_healthmedium_anyway;
+float g_pickup_healthlarge;
+float g_pickup_healthlarge_max;
+float g_pickup_healthlarge_anyway;
+float g_pickup_healthmega;
+float g_pickup_healthmega_max;
+float g_pickup_healthmega_anyway;
+float g_pickup_ammo_anyway;
+float g_pickup_weapons_anyway;
+float g_weaponarena;
+WepSet g_weaponarena_weapons;
+float g_weaponarena_random;
+float g_weaponarena_random_with_blaster;
+string g_weaponarena_list;
+float g_weaponspeedfactor;
+float g_weaponratefactor;
+float g_weapondamagefactor;
+float g_weaponforcefactor;
+float g_weaponspreadfactor;
+
+WepSet start_weapons;
+WepSet start_weapons_default;
+WepSet start_weapons_defaultmask;
+int start_items;
+float start_ammo_shells;
+float start_ammo_nails;
+float start_ammo_rockets;
+float start_ammo_cells;
+float start_ammo_plasma;
+float start_ammo_fuel;
+float start_health;
+float start_armorvalue;
+WepSet warmup_start_weapons;
+WepSet warmup_start_weapons_default;
+WepSet warmup_start_weapons_defaultmask;
+#define WARMUP_START_WEAPONS ((g_warmup_allguns == 1) ? (warmup_start_weapons & (weaponsInMap | start_weapons)) : warmup_start_weapons)
+float warmup_start_ammo_shells;
+float warmup_start_ammo_nails;
+float warmup_start_ammo_rockets;
+float warmup_start_ammo_cells;
+float warmup_start_ammo_plasma;
+float warmup_start_ammo_fuel;
+float warmup_start_health;
+float warmup_start_armorvalue;
+float g_weapon_stay;
+
+float want_weapon(entity weaponinfo, float allguns); // WEAPONTODO: what still needs done?
+void readplayerstartcvars();
+
+float g_bugrigs;
+float g_bugrigs_planar_movement;
+float g_bugrigs_planar_movement_car_jumping;
+float g_bugrigs_reverse_spinning;
+float g_bugrigs_reverse_speeding;
+float g_bugrigs_reverse_stopping;
+float g_bugrigs_air_steering;
+float g_bugrigs_angle_smoothing;
+float g_bugrigs_friction_floor;
+float g_bugrigs_friction_brake;
+float g_bugrigs_friction_air;
+float g_bugrigs_accel;
+float g_bugrigs_speed_ref;
+float g_bugrigs_speed_pow;
+float g_bugrigs_steer;
+
+float sv_autotaunt;
+float sv_taunt;
+
+string GetGametype(); // g_world.qc
+void mutators_add(); // mutators.qc
+void readlevelcvars(void)
+{
+       // load mutators
+       mutators_add();
+
+       if(cvar("sv_allow_fullbright"))
+               serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT;
+
+    g_bugrigs = cvar("g_bugrigs");
+    g_bugrigs_planar_movement = cvar("g_bugrigs_planar_movement");
+    g_bugrigs_planar_movement_car_jumping = cvar("g_bugrigs_planar_movement_car_jumping");
+    g_bugrigs_reverse_spinning = cvar("g_bugrigs_reverse_spinning");
+    g_bugrigs_reverse_speeding = cvar("g_bugrigs_reverse_speeding");
+    g_bugrigs_reverse_stopping = cvar("g_bugrigs_reverse_stopping");
+    g_bugrigs_air_steering = cvar("g_bugrigs_air_steering");
+    g_bugrigs_angle_smoothing = cvar("g_bugrigs_angle_smoothing");
+    g_bugrigs_friction_floor = cvar("g_bugrigs_friction_floor");
+    g_bugrigs_friction_brake = cvar("g_bugrigs_friction_brake");
+    g_bugrigs_friction_air = cvar("g_bugrigs_friction_air");
+    g_bugrigs_accel = cvar("g_bugrigs_accel");
+    g_bugrigs_speed_ref = cvar("g_bugrigs_speed_ref");
+    g_bugrigs_speed_pow = cvar("g_bugrigs_speed_pow");
+    g_bugrigs_steer = cvar("g_bugrigs_steer");
+
+       g_instagib = cvar("g_instagib");
+
+       sv_clones = cvar("sv_clones");
+       sv_foginterval = cvar("sv_foginterval");
+       g_cloaked = cvar("g_cloaked");
+       g_footsteps = cvar("g_footsteps");
+       g_grappling_hook = cvar("g_grappling_hook");
+       g_jetpack = cvar("g_jetpack");
+       sv_maxidle = cvar("sv_maxidle");
+       sv_maxidle_spectatorsareidle = cvar("sv_maxidle_spectatorsareidle");
+       sv_autotaunt = cvar("sv_autotaunt");
+       sv_taunt = cvar("sv_taunt");
+
+       warmup_stage = cvar("g_warmup");
+       g_warmup_limit = cvar("g_warmup_limit");
+       g_warmup_allguns = cvar("g_warmup_allguns");
+       g_warmup_allow_timeout = cvar("g_warmup_allow_timeout");
+
+       if ((g_race && g_race_qualifying == 2) || g_assault || cvar("g_campaign"))
+               warmup_stage = 0; // these modes cannot work together, sorry
+
+       g_pickup_respawntime_weapon = cvar("g_pickup_respawntime_weapon");
+       g_pickup_respawntime_superweapon = cvar("g_pickup_respawntime_superweapon");
+       g_pickup_respawntime_ammo = cvar("g_pickup_respawntime_ammo");
+       g_pickup_respawntime_short = cvar("g_pickup_respawntime_short");
+       g_pickup_respawntime_medium = cvar("g_pickup_respawntime_medium");
+       g_pickup_respawntime_long = cvar("g_pickup_respawntime_long");
+       g_pickup_respawntime_powerup = cvar("g_pickup_respawntime_powerup");
+       g_pickup_respawntimejitter_weapon = cvar("g_pickup_respawntimejitter_weapon");
+       g_pickup_respawntimejitter_superweapon = cvar("g_pickup_respawntimejitter_superweapon");
+       g_pickup_respawntimejitter_ammo = cvar("g_pickup_respawntimejitter_ammo");
+       g_pickup_respawntimejitter_short = cvar("g_pickup_respawntimejitter_short");
+       g_pickup_respawntimejitter_medium = cvar("g_pickup_respawntimejitter_medium");
+       g_pickup_respawntimejitter_long = cvar("g_pickup_respawntimejitter_long");
+       g_pickup_respawntimejitter_powerup = cvar("g_pickup_respawntimejitter_powerup");
+
+       g_weaponspeedfactor = cvar("g_weaponspeedfactor");
+       g_weaponratefactor = cvar("g_weaponratefactor");
+       g_weapondamagefactor = cvar("g_weapondamagefactor");
+       g_weaponforcefactor = cvar("g_weaponforcefactor");
+       g_weaponspreadfactor = cvar("g_weaponspreadfactor");
+
+       g_pickup_shells = cvar("g_pickup_shells");
+       g_pickup_shells_max = cvar("g_pickup_shells_max");
+       g_pickup_nails = cvar("g_pickup_nails");
+       g_pickup_nails_max = cvar("g_pickup_nails_max");
+       g_pickup_rockets = cvar("g_pickup_rockets");
+       g_pickup_rockets_max = cvar("g_pickup_rockets_max");
+       g_pickup_cells = cvar("g_pickup_cells");
+       g_pickup_cells_max = cvar("g_pickup_cells_max");
+       g_pickup_plasma = cvar("g_pickup_plasma");
+       g_pickup_plasma_max = cvar("g_pickup_plasma_max");
+       g_pickup_fuel = cvar("g_pickup_fuel");
+       g_pickup_fuel_jetpack = cvar("g_pickup_fuel_jetpack");
+       g_pickup_fuel_max = cvar("g_pickup_fuel_max");
+       g_pickup_armorsmall = cvar("g_pickup_armorsmall");
+       g_pickup_armorsmall_max = cvar("g_pickup_armorsmall_max");
+       g_pickup_armorsmall_anyway = cvar("g_pickup_armorsmall_anyway");
+       g_pickup_armormedium = cvar("g_pickup_armormedium");
+       g_pickup_armormedium_max = cvar("g_pickup_armormedium_max");
+       g_pickup_armormedium_anyway = cvar("g_pickup_armormedium_anyway");
+       g_pickup_armorbig = cvar("g_pickup_armorbig");
+       g_pickup_armorbig_max = cvar("g_pickup_armorbig_max");
+       g_pickup_armorbig_anyway = cvar("g_pickup_armorbig_anyway");
+       g_pickup_armorlarge = cvar("g_pickup_armorlarge");
+       g_pickup_armorlarge_max = cvar("g_pickup_armorlarge_max");
+       g_pickup_armorlarge_anyway = cvar("g_pickup_armorlarge_anyway");
+       g_pickup_healthsmall = cvar("g_pickup_healthsmall");
+       g_pickup_healthsmall_max = cvar("g_pickup_healthsmall_max");
+       g_pickup_healthsmall_anyway = cvar("g_pickup_healthsmall_anyway");
+       g_pickup_healthmedium = cvar("g_pickup_healthmedium");
+       g_pickup_healthmedium_max = cvar("g_pickup_healthmedium_max");
+       g_pickup_healthmedium_anyway = cvar("g_pickup_healthmedium_anyway");
+       g_pickup_healthlarge = cvar("g_pickup_healthlarge");
+       g_pickup_healthlarge_max = cvar("g_pickup_healthlarge_max");
+       g_pickup_healthlarge_anyway = cvar("g_pickup_healthlarge_anyway");
+       g_pickup_healthmega = cvar("g_pickup_healthmega");
+       g_pickup_healthmega_max = cvar("g_pickup_healthmega_max");
+       g_pickup_healthmega_anyway = cvar("g_pickup_healthmega_anyway");
+
+       g_pickup_ammo_anyway = cvar("g_pickup_ammo_anyway");
+       g_pickup_weapons_anyway = cvar("g_pickup_weapons_anyway");
+
+    g_weapon_stay = cvar(strcat("g_", GetGametype(), "_weapon_stay"));
+    if(!g_weapon_stay)
+        g_weapon_stay = cvar("g_weapon_stay");
+
+       if (!warmup_stage)
+               game_starttime = time + cvar("g_start_delay");
+
+       for(int i = WEP_FIRST; i <= WEP_LAST; ++i)
+               WEP_ACTION(i, WR_INIT);
+
+       readplayerstartcvars();
+}
+
+//#NO AUTOCVARS END
+
+
+// Sound functions
+//string precache_sound (string s) = #19;
+// hack
+float precache_sound_index (string s) = #19;
+
+const float SND_VOLUME = 1;
+const float SND_ATTENUATION = 2;
+const float SND_LARGEENTITY = 8;
+const float SND_LARGESOUND = 16;
+
+// WARNING: this kills the trace globals
+#define EXACTTRIGGER_TOUCH if(WarpZoneLib_ExactTrigger_Touch()) return
+#define EXACTTRIGGER_INIT  WarpZoneLib_ExactTrigger_Init()
+
+const float INITPRIO_FIRST                             = 0;
+const float INITPRIO_GAMETYPE                  = 0;
+const float INITPRIO_GAMETYPE_FALLBACK         = 1;
+const float INITPRIO_FINDTARGET                = 10;
+const float INITPRIO_DROPTOFLOOR               = 20;
+const float INITPRIO_SETLOCATION               = 90;
+const float INITPRIO_LINKDOORS                         = 91;
+const float INITPRIO_LAST                              = 99;
+
+.void(void) 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(void) func, float order);
+void SetCustomizer(entity e, float(void) customizer, void(void) uncustomizer);
+void Net_LinkEntity(entity e, float docull, float dt, float(entity, float) sendfunc);
+
+#endif
index 0774dd1dc7037de88324db2bd2698aa0df088863..994849f5572cfa712148705297c363cf48cbf079 100644 (file)
@@ -1,3 +1,5 @@
+#include "movelib.qh"
+
 #ifdef SVQC
 .vector moveto;
 
@@ -53,7 +55,6 @@ vector movelib_inertmove(vector new_vel,float new_bias)
     return new_vel * new_bias + self.velocity * (1-new_bias);
 }
 
-.float  movelib_lastupdate;
 void movelib_move(vector force,float max_velocity,float drag,float theMass,float breakforce)
 {
     float deltatime;
@@ -162,18 +163,6 @@ void movelib_update(vector dir,float force)
 }
 */
 
-/*
-void movelib_move_simple(vector newdir,float velo,float blendrate)
-{
-    self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo;
-}
-*/
-#define movelib_move_simple(newdir,velo,blendrate) \
-    self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo
-
-#define movelib_move_simple_gravity(newdir,velo,blendrate) \
-    if(self.flags & FL_ONGROUND) movelib_move_simple(newdir,velo,blendrate)
-
 void movelib_beak_simple(float force)
 {
     float mspeed;
@@ -182,7 +171,7 @@ void movelib_beak_simple(float force)
 
     mspeed = max(0,vlen(self.velocity) - force);
     mdir   = normalize(self.velocity);
-    vz = self.velocity_z;
+    vz = self.velocity.z;
     self.velocity = mdir * mspeed;
     self.velocity_z = vz;
 }
@@ -197,13 +186,13 @@ void movelib_groundalign4point(float spring_length, float spring_up, float blend
 {
     vector a, b, c, d, e, r, push_angle, ahead, side;
 
-    push_angle_y = 0;
+    push_angle.y = 0;
     r = (self.absmax + self.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 * (self.maxs.x * 0.8);
+    side  = v_right   * (self.maxs.y * 0.8);
 
     a = r + ahead + side;
     b = r + ahead - side;
@@ -211,36 +200,36 @@ void movelib_groundalign4point(float spring_length, float spring_up, float blend
     d = r - ahead - side;
 
     traceline(a, a - e,MOVE_NORMAL,self);
-    a_z =  (1 - trace_fraction);
+    a.z =  (1 - trace_fraction);
     r = trace_endpos;
 
     traceline(b, b - e,MOVE_NORMAL,self);
-    b_z =  (1 - trace_fraction);
+    b.z =  (1 - trace_fraction);
     r += trace_endpos;
 
     traceline(c, c - e,MOVE_NORMAL,self);
-    c_z =  (1 - trace_fraction);
+    c.z =  (1 - trace_fraction);
     r += trace_endpos;
 
     traceline(d, d - e,MOVE_NORMAL,self);
-    d_z =  (1 - trace_fraction);
+    d.z =  (1 - trace_fraction);
     r += trace_endpos;
 
-    a_x = r_z;
+    a.x = r.z;
     r = self.origin;
-    r_z = r_z;
+    r.z = r.z;
 
-    push_angle_x = (a_z - c_z) * _max;
-    push_angle_x += (b_z - d_z) * _max;
+    push_angle.x = (a.z - c.z) * _max;
+    push_angle.x += (b.z - d.z) * _max;
 
-    push_angle_z = (b_z - a_z) * _max;
-    push_angle_z += (d_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;
 
-    self.angles_x = ((1-blendrate) *  self.angles_x)  + (push_angle_x * blendrate);
-    self.angles_z = ((1-blendrate) *  self.angles_z)  + (push_angle_z * blendrate);
+    self.angles_x = ((1-blendrate) *  self.angles.x)  + (push_angle.x * blendrate);
+    self.angles_z = ((1-blendrate) *  self.angles.z)  + (push_angle.z * blendrate);
 
     //a = self.origin;
     setorigin(self,r);
diff --git a/qcsrc/server/movelib.qh b/qcsrc/server/movelib.qh
new file mode 100644 (file)
index 0000000..8a4bfd4
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef MOVELIB_H
+#define MOVELIB_H
+
+#ifdef SVQC
+.vector moveto;
+
+/**
+    Simulate drag
+    self.velocity = movelib_dragvec(self.velocity,0.02,0.5);
+**/
+vector movelib_dragvec(float drag, float exp_);
+
+/**
+    Simulate drag
+    self.velocity *= movelib_dragflt(somespeed,0.01,0.7);
+**/
+float movelib_dragflt(float fspeed,float drag,float exp_);
+
+/**
+    Do a inertia simulation based on velocity.
+    Basicaly, this allows you to simulate loss of steering with higher speed.
+    self.velocity = movelib_inertmove_byspeed(self.velocity,newvel,1000,0.1,0.9);
+**/
+vector movelib_inertmove_byspeed(vector vel_new, float vel_max,float newmin,float oldmax);
+
+vector movelib_inertmove(vector new_vel,float new_bias);
+
+.float  movelib_lastupdate;
+void movelib_move(vector force,float max_velocity,float drag,float theMass,float breakforce);
+
+/*
+void movelib_move_simple(vector newdir,float velo,float blendrate)
+{
+    self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo;
+}
+*/
+#define movelib_move_simple(newdir,velo,blendrate) \
+    self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo
+
+#define movelib_move_simple_gravity(newdir,velo,blendrate) \
+    if(self.flags & FL_ONGROUND) movelib_move_simple(newdir,velo,blendrate)
+
+void movelib_beak_simple(float force);
+
+/**
+Pitches and rolls the entity to match the gound.
+Yed need to set v_up and v_forward (generally by calling makevectors) before calling this.
+**/
+#endif
+
+void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max);
+
+#endif
index 1ba8f2663e730b8796da2e6fb8cd3b1592d61eb0..e13919a23b174b5372f301b06070bfe31c0182df 100644 (file)
@@ -91,7 +91,7 @@ float CallbackChain_Call(entity cb)
        return r; // callbacks return an error status, so 0 is default return value
 }
 
-#define MAX_MUTATORS 15
+const float MAX_MUTATORS = 15;
 string loaded_mutators[MAX_MUTATORS];
 float Mutator_Add(mutatorfunc_t func, string name)
 {
index 95d85d793963181309ad6e63f182106c055717cb..7d36af08e30fb61f35b14a4953c66e3bc8fb0385 100644 (file)
@@ -1,7 +1,9 @@
-#define CBC_ORDER_EXCLUSIVE 3
-#define CBC_ORDER_FIRST 1
-#define CBC_ORDER_LAST 2
-#define CBC_ORDER_ANY 4
+#ifndef MUTATORS_BASE_H
+#define MUTATORS_BASE_H
+const float CBC_ORDER_EXCLUSIVE = 3;
+const float CBC_ORDER_FIRST = 1;
+const float CBC_ORDER_LAST = 2;
+const float CBC_ORDER_ANY = 4;
 
 float CallbackChain_ReturnValue; // read-only field of the current return value
 
@@ -16,9 +18,9 @@ float CallbackChain_Remove(entity cb, float() func);
 // }
 float CallbackChain_Call(entity cb);
 
-#define MUTATOR_REMOVING 0
-#define MUTATOR_ADDING 1
-#define MUTATOR_ROLLING_BACK 2
+const float MUTATOR_REMOVING = 0;
+const float MUTATOR_ADDING = 1;
+const float MUTATOR_ROLLING_BACK = 2;
 typedef float(float) mutatorfunc_t;
 float Mutator_Add(mutatorfunc_t func, string name);
 void Mutator_Remove(mutatorfunc_t func, string name); // calls error() on fail
@@ -42,12 +44,13 @@ void Mutator_Remove(mutatorfunc_t func, string name); // calls error() on fail
 
 
 // register all possible hooks here
+// some parameters are commented to avoid duplicate declarations
 
 MUTATOR_HOOKABLE(MakePlayerObserver);
        // called when a player becomes observer, after shared setup
 
 MUTATOR_HOOKABLE(PutClientInServer);
-       entity self; // client wanting to spawn
+//     entity self; // client wanting to spawn
 
 MUTATOR_HOOKABLE(PlayerSpawn);
        entity spawn_spot; // spot that was used, or world
@@ -82,8 +85,8 @@ MUTATOR_HOOKABLE(PlayerJump);
 MUTATOR_HOOKABLE(GiveFragsForKill);
        // called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill
        // INPUT:
-               entity frag_attacker; // same as self
-               entity frag_target;
+//             entity frag_attacker; // same as self
+//             entity frag_target;
        // INPUT, OUTPUT:
                float frag_score;
 
@@ -98,7 +101,7 @@ MUTATOR_HOOKABLE(GetTeamCount);
 MUTATOR_HOOKABLE(SpectateCopy);
        // copies variables for spectating "other" to "self"
        // INPUT:
-               entity other;
+//             entity other;
 
 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon);
        // returns 1 if throwing the current weapon shall not be allowed
@@ -119,7 +122,7 @@ MUTATOR_HOOKABLE(BuildMutatorsString);
 MUTATOR_HOOKABLE(BuildMutatorsPrettyString);
        // appends ", Mutator name" to ret_string for display
        // INPUT, OUTPUT:
-               string ret_string;
+//             string ret_string;
 
 MUTATOR_HOOKABLE(CustomizeWaypoint);
        // called every frame
@@ -156,39 +159,39 @@ MUTATOR_HOOKABLE(GetCvars);
 MUTATOR_HOOKABLE(EditProjectile);
        // can edit any "just fired" projectile
        // INPUT:
-               entity self;
-               entity other;
-        
+//             entity self;
+//             entity other;
+
 MUTATOR_HOOKABLE(MonsterSpawn);
        // called when a monster spawns
-    
+
 MUTATOR_HOOKABLE(MonsterDies);
        // called when a monster dies
        // INPUT:
-               entity frag_attacker;
-               
+//             entity frag_attacker;
+
 MUTATOR_HOOKABLE(MonsterRespawn);
        // called when a monster wants to respawn
        // INPUT:
-               entity other;
-               
+//             entity other;
+
 MUTATOR_HOOKABLE(MonsterDropItem);
        // called when a monster is dropping loot
        // INPUT, OUTPUT:
                .void() monster_loot;
-               entity other;
-       
+//             entity other;
+
 MUTATOR_HOOKABLE(MonsterMove);
        // called when a monster moves
-       // returning TRUE makes the monster stop
+       // returning true makes the monster stop
        // INPUT:
                float monster_speed_run;
                float monster_speed_walk;
                entity monster_target;
-    
+
 MUTATOR_HOOKABLE(MonsterFindTarget);
        // called when a monster looks for another target
-    
+
 MUTATOR_HOOKABLE(MonsterCheckBossFlag);
     // called to change a random monster to a miniboss
 
@@ -199,9 +202,9 @@ MUTATOR_HOOKABLE(AllowMobSpawning);
 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor);
        // called when a player gets damaged to e.g. remove stuff he was carrying.
        // INPUT:
-               entity frag_inflictor;
-               entity frag_attacker;
-               entity frag_target; // same as self
+//             entity frag_inflictor;
+//             entity frag_attacker;
+//             entity frag_target; // same as self
                vector damage_force; // NOTE: this force already HAS been applied
        // INPUT, OUTPUT:
                float damage_take;
@@ -211,9 +214,9 @@ MUTATOR_HOOKABLE(PlayerDamage_Calculate);
        // called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
        // i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
        // INPUT:
-               entity frag_attacker;
-               entity frag_target;
-               float frag_deathtype;
+//             entity frag_attacker;
+//             entity frag_target;
+//             float frag_deathtype;
        // INPUT, OUTPUT:
                float frag_damage;
                float frag_mirrordamage;
@@ -222,7 +225,7 @@ MUTATOR_HOOKABLE(PlayerDamage_Calculate);
 MUTATOR_HOOKABLE(PlayerPowerups);
        // called at the end of player_powerups() in cl_client.qc, used for manipulating the values which are set by powerup items.
        // INPUT
-       entity self;
+//     entity self;
        float olditems; // also technically output, but since it is at the end of the function it's useless for that :P
 
 MUTATOR_HOOKABLE(PlayerRegen);
@@ -272,8 +275,8 @@ MUTATOR_HOOKABLE(Spawn_Score);
        // called when a spawnpoint is being evaluated
        // return 1 to make the spawnpoint unusable
        // INPUT
-       entity self; // player wanting to spawn
-       entity spawn_spot; // spot to be evaluated
+//     entity self; // player wanting to spawn
+//     entity spawn_spot; // spot to be evaluated
        // IN+OUT
        vector spawn_score; // _x is priority, _y is "distance"
 
@@ -282,20 +285,20 @@ MUTATOR_HOOKABLE(SV_StartFrame);
 
 MUTATOR_HOOKABLE(SetModname);
        // OUT
-       string modname; // name of the mutator/mod if it warrants showing as such in the server browser
+//     string modname; // name of the mutator/mod if it warrants showing as such in the server browser
 
 MUTATOR_HOOKABLE(Item_Spawn);
        // called for each item being spawned on a map, including dropped weapons
        // return 1 to remove an item
        // INPUT
-       entity self; // the item
+//     entity self; // the item
 
 MUTATOR_HOOKABLE(SetWeaponreplace);
        // IN
-               entity self; // map entity
-               entity other; // weapon info
+//             entity self; // map entity
+//             entity other; // weapon info
        // IN+OUT
-               string ret_string;
+//             string ret_string;
 
 MUTATOR_HOOKABLE(Item_RespawnCountdown);
        // called when an item is about to respawn
@@ -312,7 +315,7 @@ MUTATOR_HOOKABLE(PortalTeleport);
        // called whenever a player goes through a portal gun teleport
        // allows you to strip a player of an item if they go through the teleporter to help prevent cheating
        // INPUT
-       entity self;
+//     entity self;
 
 MUTATOR_HOOKABLE(HelpMePing);
        // called whenever a player uses impulse 33 (help me) in cl_impulse.qc
@@ -320,11 +323,11 @@ MUTATOR_HOOKABLE(HelpMePing);
        // but if your mutator uses something different then you can handle it
        // in a special manner using this hook
        // INPUT
-       entity self; // the player who pressed impulse 33
+//     entity self; // the player who pressed impulse 33
 
 MUTATOR_HOOKABLE(VehicleSpawn);
        // called when a vehicle initializes
-       // return TRUE to remove the vehicle
+       // return true to remove the vehicle
 
 MUTATOR_HOOKABLE(VehicleEnter);
        // called when a player enters a vehicle
@@ -335,42 +338,43 @@ MUTATOR_HOOKABLE(VehicleEnter);
 
 MUTATOR_HOOKABLE(VehicleTouch);
        // called when a player touches a vehicle
-       // return TRUE to stop player from entering the vehicle
+       // return true to stop player from entering the vehicle
        // INPUT
-       entity self; // vehicle
-       entity other; // player
+//     entity self; // vehicle
+//     entity other; // player
 
 MUTATOR_HOOKABLE(VehicleExit);
        // called when a player exits a vehicle
        // allows mutators to set special settings in this event
        // INPUT
-       entity vh_player; // player
-       entity vh_vehicle; // vehicle
+//     entity vh_player; // player
+//     entity vh_vehicle; // vehicle
 
 MUTATOR_HOOKABLE(AbortSpeedrun);
        // called when a speedrun is aborted and the player is teleported back to start position
        // INPUT
-       entity self; // player
+//     entity self; // player
 
 MUTATOR_HOOKABLE(ItemTouch);
        // called at when a item is touched. Called early, can edit item properties.
-       entity self;    // item
-       entity other;   // player
-       #define MUT_ITEMTOUCH_CONTINUE 0 // return this flag to make the function continue as normal
-       #define MUT_ITEMTOUCH_RETURN 1 // return this flag to make the function return (handled entirely by mutator)
-       #define MUT_ITEMTOUCH_PICKUP 2 // return this flag to have the item "picked up" and taken even after mutator handled it
+//     entity self;    // item
+//     entity other;   // player
+       const float MUT_ITEMTOUCH_CONTINUE = 0; // return this flag to make the function continue as normal
+       const float MUT_ITEMTOUCH_RETURN = 1; // return this flag to make the function return (handled entirely by mutator)
+       const float MUT_ITEMTOUCH_PICKUP = 2; // return this flag to have the item "picked up" and taken even after mutator handled it
 
 MUTATOR_HOOKABLE(ClientConnect);
        // called at when a player connect
-       entity self;    // player
+//     entity self;    // player
 
 MUTATOR_HOOKABLE(HavocBot_ChooseRole);
-       entity self;
+//     entity self;
 
 MUTATOR_HOOKABLE(AccuracyTargetValid);
        // called when a target is checked for accuracy
-       entity frag_attacker; // attacker
-       entity frag_target; // target
-       #define MUT_ACCADD_VALID 0 // return this flag to make the function continue if target is a client
-       #define MUT_ACCADD_INVALID 1 // return this flag to make the function always continue
-       #define MUT_ACCADD_INDIFFERENT 2 // return this flag to make the function always return
+//     entity frag_attacker; // attacker
+//     entity frag_target; // target
+       const float MUT_ACCADD_VALID = 0; // return this flag to make the function continue if target is a client
+       const float MUT_ACCADD_INVALID = 1; // return this flag to make the function always continue
+       const float MUT_ACCADD_INDIFFERENT = 2; // return this flag to make the function always return
+#endif
index 8d1a7c1fd256956fb194751d9059af9b2d64132d..841b5a910b5dd7ad2148b1400fd929a477b800f3 100644 (file)
@@ -106,9 +106,9 @@ float assault_decreaser_sprite_visible(entity e)
        decreaser = self.assault_decreaser;
 
        if(decreaser.enemy.health >= ASSAULT_VALUE_INACTIVE)
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 void target_objective_decrease_activate()
@@ -344,7 +344,7 @@ void havocbot_goalrating_ast_targets(float ratingscale)
                if (!ad.bot_attack)
                        continue;
 
-               found = FALSE;
+               found = false;
                for(tod = world; (tod = find(tod, targetname, ad.target)); )
                {
                        if(tod.classname == "target_objective_decrease")
@@ -352,7 +352,7 @@ void havocbot_goalrating_ast_targets(float ratingscale)
                                if(tod.enemy.health > 0 && tod.enemy.health < ASSAULT_VALUE_INACTIVE)
                                {
                                //      dprint(etos(ad),"\n");
-                                       found = TRUE;
+                                       found = true;
                                        break;
                                }
                        }
@@ -372,7 +372,7 @@ void havocbot_goalrating_ast_targets(float ratingscale)
        //      te_lightning2(world, '0 0 0', p);
 
                // Find and rate waypoints around it
-               found = FALSE;
+               found = false;
                best = world;
                bestvalue = 99999999999;
                for(radius=0; radius<1500 && !found; radius+=500)
@@ -383,7 +383,7 @@ void havocbot_goalrating_ast_targets(float ratingscale)
                                if(wp.classname=="waypoint")
                                if(checkpvs(wp.origin, ad))
                                {
-                                       found = TRUE;
+                                       found = true;
                                        if(wp.cnt<bestvalue)
                                        {
                                                best = wp;
@@ -518,7 +518,7 @@ MUTATOR_HOOKFUNCTION(assault_PlayerSpawn)
        else
                Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_DEFENDING);
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(assault_TurretSpawn)
@@ -526,26 +526,26 @@ MUTATOR_HOOKFUNCTION(assault_TurretSpawn)
        if (!self.team)
                self.team = 14;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(assault_VehicleSpawn)
 {
        self.nextthink = time + 0.5;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(assault_BotRoles)
 {
        havocbot_ast_reset_role(self);
-       return TRUE;
+       return true;
 }
 
 // scoreboard setup
 void assault_ScoreRules()
 {
-       ScoreRules_basics(2, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, TRUE);
+       ScoreRules_basics(2, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, true);
        ScoreInfo_SetLabel_TeamScore(  ST_ASSAULT_OBJECTIVES,    "objectives",      SFL_SORT_PRIO_PRIMARY);
        ScoreInfo_SetLabel_PlayerScore(SP_ASSAULT_OBJECTIVES,    "objectives",      SFL_SORT_PRIO_PRIMARY);
        ScoreRules_basics_end();
index 9aecf87f29824919cefe61c6f6cb79ca6d4f4a68..330707e67c949bf097192658d2c0d57c8a2048bb 100644 (file)
@@ -1,13 +1,15 @@
+#ifndef GAMEMODE_ASSAULT_H
+#define GAMEMODE_ASSAULT_H
 // sprites
 .entity assault_decreaser;
 .entity assault_sprite;
 
 // legacy bot defs
-#define HAVOCBOT_AST_ROLE_NONE                 0
-#define HAVOCBOT_AST_ROLE_DEFENSE      2
-#define HAVOCBOT_AST_ROLE_OFFENSE      4
+const int HAVOCBOT_AST_ROLE_NONE = 0;
+const int HAVOCBOT_AST_ROLE_DEFENSE = 2;
+const int HAVOCBOT_AST_ROLE_OFFENSE = 4;
 
-.float havocbot_role_flags;
+.int havocbot_role_flags;
 .float havocbot_attack_time;
 
 .void() havocbot_role;
@@ -23,9 +25,10 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_items;
 void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
 
 // scoreboard stuff
-#define ST_ASSAULT_OBJECTIVES 1
-#define SP_ASSAULT_OBJECTIVES 4
+const float ST_ASSAULT_OBJECTIVES = 1;
+const float SP_ASSAULT_OBJECTIVES = 4;
 
 // predefined spawnfuncs
 void spawnfunc_func_breakable();
-void target_objective_decrease_activate();
\ No newline at end of file
+void target_objective_decrease_activate();
+#endif
index 4ba1830048ec4f7733aa62454842e816b4c8c082..a0f238358455a271a80a45d996ecf9c07fe16f36 100644 (file)
@@ -4,10 +4,10 @@ float redalive, bluealive, yellowalive, pinkalive;
 float ca_teams;
 float allowed_to_spawn;
 
-#define ST_CA_ROUNDS 1
+const float ST_CA_ROUNDS = 1;
 void ca_ScoreRules(float teams)
 {
-       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
+       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
        ScoreInfo_SetLabel_TeamScore(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
        ScoreRules_basics_end();
 }
@@ -80,7 +80,7 @@ float CA_CheckWinner()
        {
                Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER);
                Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_OVER);
-               allowed_to_spawn = FALSE;
+               allowed_to_spawn = false;
                round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
                FOR_EACH_PLAYER(e)
                        nades_Clear(e);
@@ -104,7 +104,7 @@ float CA_CheckWinner()
                Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_TIED);
        }
 
-       allowed_to_spawn = FALSE;
+       allowed_to_spawn = false;
        round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
 
        FOR_EACH_PLAYER(e)
@@ -116,15 +116,15 @@ float CA_CheckWinner()
 void CA_RoundStart()
 {
        if(warmup_stage)
-               allowed_to_spawn = TRUE;
+               allowed_to_spawn = true;
        else
-               allowed_to_spawn = FALSE;
+               allowed_to_spawn = false;
 }
 
-float prev_missing_teams_mask;
 float CA_CheckTeams()
 {
-       allowed_to_spawn = TRUE;
+       static float prev_missing_teams_mask;
+       allowed_to_spawn = true;
        CA_count_alive_players();
        if(CA_ALIVE_TEAMS_OK())
        {
@@ -154,10 +154,10 @@ float CA_CheckTeams()
 float ca_isEliminated(entity e)
 {
        if(e.caplayer == 1 && (e.deadflag != DEAD_NO || e.frags == FRAGS_LMS_LOSER))
-               return TRUE;
+               return true;
        if(e.caplayer == 0.5)
-               return TRUE;
-       return FALSE;
+               return true;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ca_PlayerSpawn)
@@ -213,7 +213,7 @@ MUTATOR_HOOKFUNCTION(ca_ClientConnect)
 
 MUTATOR_HOOKFUNCTION(ca_reset_map_global)
 {
-       allowed_to_spawn = TRUE;
+       allowed_to_spawn = true;
        return 1;
 }
 
@@ -320,19 +320,19 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDamage)
 
        frag_mirrordamage = 0;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ca_FilterItem)
 {
        if(autocvar_g_powerups <= 0)
        if(self.flags & FL_POWERUP)
-               return TRUE;
+               return true;
 
        if(autocvar_g_pickup_items <= 0)
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ca_PlayerDamage_SplitHealthArmor)
@@ -342,18 +342,18 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDamage_SplitHealthArmor)
        if(frag_target != frag_attacker && IS_PLAYER(frag_attacker))
                PlayerTeamScore_Add(frag_attacker, SP_SCORE, ST_SCORE, (frag_damage - excess) * autocvar_g_ca_damage2score_multiplier);
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ca_PlayerRegen)
 {
        // no regeneration in CA
-       return TRUE;
+       return true;
 }
 
 void ca_Initialize()
 {
-       allowed_to_spawn = TRUE;
+       allowed_to_spawn = true;
 
        ca_teams = autocvar_g_ca_teams_override;
        if(ca_teams < 2)
index a7c1edfc53870a43666b596eac2f533dc2ebab7b..bf6686d73a70433f7bcc5be9d139c6aa9046f9da 100644 (file)
@@ -1,2 +1,5 @@
+#ifndef GAMEMODE_CA_H
+#define GAMEMODE_CA_H
 // should be removed in the future, as other code should not have to care
 .float caplayer; // 0.5 if scheduled to join the next round
+#endif
index 4e051d197298ba1ac9cdb0b6da519a515fd42d3c..5ea2924cc4a40184fc80f9197ac49cebdb0dfab0 100644 (file)
@@ -43,7 +43,7 @@ void ctf_CaptureRecord(entity flag, entity player)
 
 void ctf_FlagcarrierWaypoints(entity player)
 {
-       WaypointSprite_Spawn("flagcarrier", 0, 0, player, FLAG_WAYPOINT_OFFSET, world, player.team, player, wps_flagcarrier, TRUE, RADARICON_FLAG, WPCOLOR_FLAGCARRIER(player.team));
+       WaypointSprite_Spawn("flagcarrier", 0, 0, player, FLAG_WAYPOINT_OFFSET, world, player.team, player, wps_flagcarrier, true, RADARICON_FLAG, WPCOLOR_FLAGCARRIER(player.team));
        WaypointSprite_UpdateMaxHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON) * 2);
        WaypointSprite_UpdateHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(player.health, player.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON));
        WaypointSprite_UpdateTeamRadar(player.wps_flagcarrier, RADARICON_FLAGCARRIER, WPCOLOR_FLAGCARRIER(player.team));
@@ -51,7 +51,7 @@ void ctf_FlagcarrierWaypoints(entity player)
 
 void ctf_CalculatePassVelocity(entity flag, vector to, vector from, float turnrate)
 {
-       float current_distance = vlen((('1 0 0' * to_x) + ('0 1 0' * to_y)) - (('1 0 0' * from_x) + ('0 1 0' * from_y))); // for the sake of this check, exclude Z axis
+       float current_distance = vlen((('1 0 0' * to.x) + ('0 1 0' * to.y)) - (('1 0 0' * from.x) + ('0 1 0' * from.y))); // for the sake of this check, exclude Z axis
        float initial_height = min(autocvar_g_ctf_pass_arc_max, (flag.pass_distance * tanh(autocvar_g_ctf_pass_arc)));
        float current_height = (initial_height * min(1, (current_distance / flag.pass_distance)));
        //print("current_height = ", ftos(current_height), ", initial_height = ", ftos(initial_height), ".\n");
@@ -89,13 +89,11 @@ float ctf_CheckPassDirection(vector head_center, vector passer_center, vector pa
                makevectors(passer_angle);
 
                // find the closest point on the enemy to the center of the attack
-               float ang; // angle between shotdir and h
                float h; // hypotenuse, which is the distance between attacker to head
                float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
 
                h = vlen(head_center - passer_center);
-               ang = acos(dotproduct(normalize(head_center - passer_center), v_forward));
-               a = h * cos(ang);
+               a = h * (normalize(head_center - passer_center) * v_forward);
 
                vector nearest_on_line = (passer_center + a * v_forward);
                float distance_from_line = vlen(nearest_to_passer - nearest_on_line);
@@ -104,11 +102,11 @@ float ctf_CheckPassDirection(vector head_center, vector passer_center, vector pa
                spreadlimit = (autocvar_g_ctf_pass_directional_min * (1 - spreadlimit) + autocvar_g_ctf_pass_directional_max * spreadlimit);
 
                if(spreadlimit && (distance_from_line <= spreadlimit) && ((vlen(normalize(head_center - passer_center) - v_forward) * RAD2DEG) <= 90))
-                       { return TRUE; }
+                       { return true; }
                else
-                       { return FALSE; }
+                       { return false; }
        }
-       else { return TRUE; }
+       else { return true; }
 }
 
 
@@ -123,11 +121,11 @@ float ctf_CaptureShield_CheckStatus(entity p)
        float players_worseeq, players_total;
 
        if(ctf_captureshield_max_ratio <= 0)
-               return FALSE;
+               return false;
 
        s = PlayerScore_Add(p, SP_SCORE, 0);
        if(s >= -ctf_captureshield_min_negscore)
-               return FALSE;
+               return false;
 
        players_total = players_worseeq = 0;
        FOR_EACH_PLAYER(e)
@@ -144,9 +142,9 @@ float ctf_CaptureShield_CheckStatus(entity p)
        // use this rule here
 
        if(players_worseeq >= players_total * ctf_captureshield_max_ratio)
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 void ctf_CaptureShield_Update(entity player, float wanted_status)
@@ -161,10 +159,10 @@ void ctf_CaptureShield_Update(entity player, float wanted_status)
 
 float ctf_CaptureShield_Customize()
 {
-       if(!other.ctf_captureshielded) { return FALSE; }
-       if(SAME_TEAM(self, other)) { return FALSE; }
+       if(!other.ctf_captureshielded) { return false; }
+       if(SAME_TEAM(self, other)) { return false; }
 
-       return TRUE;
+       return true;
 }
 
 void ctf_CaptureShield_Touch()
@@ -229,7 +227,7 @@ void ctf_Handle_Drop(entity flag, entity player, float droptype)
 
        // waypoints
        if(autocvar_g_ctf_flag_dropped_waypoint)
-               WaypointSprite_Spawn("flagdropped", 0, 0, flag, FLAG_WAYPOINT_OFFSET, world, ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : player.team), flag, wps_flagdropped, TRUE, RADARICON_FLAG, WPCOLOR_DROPPEDFLAG(flag.team));
+               WaypointSprite_Spawn("flagdropped", 0, 0, flag, FLAG_WAYPOINT_OFFSET, world, ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : player.team), flag, wps_flagdropped, true, RADARICON_FLAG, WPCOLOR_DROPPEDFLAG(flag.team));
 
        if(autocvar_g_ctf_flag_return_time || (autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health))
        {
@@ -331,8 +329,8 @@ void ctf_Handle_Throw(entity player, entity receiver, float droptype)
                        WarpZone_RefSys_AddInverse(flag, receiver); // wz1^-1 ... wzn^-1 receiver
                        targ_origin = WarpZone_RefSys_TransformOrigin(receiver, flag, (0.5 * (receiver.absmin + receiver.absmax))); // this is target origin as seen by the flag
 
-                       flag.pass_distance = vlen((('1 0 0' * targ_origin_x) + ('0 1 0' * targ_origin_y)) - (('1 0 0' *  player.origin_x) + ('0 1 0' *  player.origin_y))); // for the sake of this check, exclude Z axis
-                       ctf_CalculatePassVelocity(flag, targ_origin, player.origin, FALSE);
+                       flag.pass_distance = vlen((('1 0 0' * targ_origin.x) + ('0 1 0' * targ_origin.y)) - (('1 0 0' *  player.origin.x) + ('0 1 0' *  player.origin.y))); // for the sake of this check, exclude Z axis
+                       ctf_CalculatePassVelocity(flag, targ_origin, player.origin, false);
 
                        // main
                        flag.movetype = MOVETYPE_FLY;
@@ -350,10 +348,10 @@ void ctf_Handle_Throw(entity player, entity receiver, float droptype)
 
                case DROP_THROW:
                {
-                       makevectors((player.v_angle_y * '0 1 0') + (bound(autocvar_g_ctf_throw_angle_min, player.v_angle_x, autocvar_g_ctf_throw_angle_max) * '1 0 0'));
+                       makevectors((player.v_angle.y * '0 1 0') + (bound(autocvar_g_ctf_throw_angle_min, player.v_angle.x, autocvar_g_ctf_throw_angle_max) * '1 0 0'));
 
                        flag_velocity = (('0 0 1' * autocvar_g_ctf_throw_velocity_up) + ((v_forward * autocvar_g_ctf_throw_velocity_forward) * ((player.items & IT_STRENGTH) ? autocvar_g_ctf_throw_strengthmultiplier : 1)));
-                       flag.velocity = W_CalculateProjectileVelocity(player.velocity, flag_velocity, FALSE);
+                       flag.velocity = W_CalculateProjectileVelocity(player.velocity, flag_velocity, false);
                        ctf_Handle_Drop(flag, player, droptype);
                        break;
                }
@@ -367,7 +365,7 @@ void ctf_Handle_Throw(entity player, entity receiver, float droptype)
                default:
                case DROP_NORMAL:
                {
-                       flag.velocity = W_CalculateProjectileVelocity(player.velocity, (('0 0 1' * autocvar_g_ctf_drop_velocity_up) + ((('0 1 0' * crandom()) + ('1 0 0' * crandom())) * autocvar_g_ctf_drop_velocity_side)), FALSE);
+                       flag.velocity = W_CalculateProjectileVelocity(player.velocity, (('0 0 1' * autocvar_g_ctf_drop_velocity_up) + ((('0 1 0' * crandom()) + ('1 0 0' * crandom())) * autocvar_g_ctf_drop_velocity_side)), false);
                        ctf_Handle_Drop(flag, player, droptype);
                        break;
                }
@@ -620,11 +618,11 @@ void ctf_CheckStalemate(void)
        }
 
        if(stale_red_flags && stale_blue_flags)
-               ctf_stalemate = TRUE;
+               ctf_stalemate = true;
        else if((!stale_red_flags && !stale_blue_flags) && autocvar_g_ctf_stalemate_endcondition == 2)
-               { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; }
+               { ctf_stalemate = false; wpforenemy_announced = false; }
        else if((!stale_red_flags || !stale_blue_flags) && autocvar_g_ctf_stalemate_endcondition == 1)
-               { ctf_stalemate = FALSE; wpforenemy_announced = FALSE; }
+               { ctf_stalemate = false; wpforenemy_announced = false; }
 
        // if sufficient stalemate, then set up the waypointsprite and announce the stalemate if necessary
        if(ctf_stalemate)
@@ -632,7 +630,7 @@ void ctf_CheckStalemate(void)
                for(tmp_entity = ctf_staleflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_staleflagnext)
                {
                        if((tmp_entity.owner) && (!tmp_entity.owner.wps_enemyflagcarrier))
-                               WaypointSprite_Spawn("enemyflagcarrier", 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, tmp_entity.team, tmp_entity.owner, wps_enemyflagcarrier, TRUE, RADARICON_FLAG, WPCOLOR_ENEMYFC(tmp_entity.owner.team));
+                               WaypointSprite_Spawn("enemyflagcarrier", 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, tmp_entity.team, tmp_entity.owner, wps_enemyflagcarrier, true, RADARICON_FLAG, WPCOLOR_ENEMYFC(tmp_entity.owner.team));
                }
 
                if (!wpforenemy_announced)
@@ -640,7 +638,7 @@ void ctf_CheckStalemate(void)
                        FOR_EACH_REALPLAYER(tmp_entity)
                                Send_Notification(NOTIF_ONE, tmp_entity, MSG_CENTER, ((tmp_entity.flagcarried) ? CENTER_CTF_STALEMATE_CARRIER : CENTER_CTF_STALEMATE_OTHER));
 
-                       wpforenemy_announced = TRUE;
+                       wpforenemy_announced = true;
                }
        }
 }
@@ -786,7 +784,7 @@ void ctf_FlagThink()
                        else
                        {
                                // still a viable target, go for it
-                               ctf_CalculatePassVelocity(self, targ_origin, self.origin, TRUE);
+                               ctf_CalculatePassVelocity(self, targ_origin, self.origin, true);
                        }
                        return;
                }
@@ -951,8 +949,8 @@ void ctf_DelayedFlagSetup(void) // called after a flag is placed on a map by ctf
        self.bot_basewaypoint = self.nearestwaypoint;
 
        // waypointsprites
-       WaypointSprite_SpawnFixed(((self.team == NUM_TEAM_1) ? "redbase" : "bluebase"), self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG, colormapPaletteColor(self.team - 1, FALSE));
-       WaypointSprite_UpdateTeamRadar(self.wps_flagbase, RADARICON_FLAG, colormapPaletteColor(self.team - 1, FALSE));
+       WaypointSprite_SpawnFixed(((self.team == NUM_TEAM_1) ? "redbase" : "bluebase"), self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG, colormapPaletteColor(self.team - 1, false));
+       WaypointSprite_UpdateTeamRadar(self.wps_flagbase, RADARICON_FLAG, colormapPaletteColor(self.team - 1, false));
 
        // captureshield setup
        ctf_CaptureShield_Spawn(self);
@@ -982,7 +980,7 @@ void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag
        flag.max_flag_health = ((autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health) ? autocvar_g_ctf_flag_health : 100);
        flag.health = flag.max_flag_health;
        flag.event_damage = ctf_FlagDamage;
-       flag.pushable = TRUE;
+       flag.pushable = true;
        flag.teleportable = TELEPORT_NORMAL;
        flag.damagedbytriggers = autocvar_g_ctf_flag_return_when_unreachable;
        flag.damagedbycontents = autocvar_g_ctf_flag_return_when_unreachable;
@@ -1043,12 +1041,12 @@ void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag
        if((flag.spawnflags & 1) || flag.noalign) // don't drop to floor, just stay at fixed location
        {
                flag.dropped_origin = flag.origin;
-               flag.noalign = TRUE;
+               flag.noalign = true;
                flag.movetype = MOVETYPE_NONE;
        }
        else // drop to floor, automatically find a platform and set that as spawn origin
        {
-               flag.noalign = FALSE;
+               flag.noalign = false;
                self = flag;
                droptofloor();
                flag.movetype = MOVETYPE_TOSS;
@@ -1233,7 +1231,7 @@ void havocbot_goalrating_ctf_carrieritems(float ratingscale, vector org, float s
 {
        entity head;
        float t;
-       head = findchainfloat(bot_pickup, TRUE);
+       head = findchainfloat(bot_pickup, true);
        while (head)
        {
                // gather health and armor only
@@ -1581,7 +1579,7 @@ void havocbot_role_ctf_middle()
                vector org;
 
                org = havocbot_ctf_middlepoint;
-               org_z = self.origin_z;
+               org.z = self.origin.z;
 
                self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
                navigation_goalrating_start();
@@ -1757,7 +1755,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerPreThink)
        if(self.wps_flagcarrier)
                WaypointSprite_UpdateHealth(self.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON));
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ctf_PlayerDamage) // for changing damage and force values that are applied to players in g_damage.qc
@@ -1785,7 +1783,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerDamage) // for changing damage and force values t
                }
                // todo: add notification for when flag carrier needs help?
        }
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ctf_PlayerDies)
@@ -1799,7 +1797,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerDies)
        if(frag_target.flagcarried)
                { ctf_Handle_Throw(frag_target, world, DROP_NORMAL); }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ctf_GiveFragsForKill)
@@ -1822,7 +1820,7 @@ MUTATOR_HOOKFUNCTION(ctf_RemovePlayer)
                if(flag.ctf_dropper == self) { flag.ctf_dropper = world; }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ctf_PortalTeleport)
@@ -1831,12 +1829,12 @@ MUTATOR_HOOKFUNCTION(ctf_PortalTeleport)
        if(!autocvar_g_ctf_portalteleport)
                { ctf_Handle_Throw(self, world, DROP_NORMAL); }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
 {
-       if(MUTATOR_RETURNVALUE || gameover) { return FALSE; }
+       if(MUTATOR_RETURNVALUE || gameover) { return false; }
 
        entity player = self;
 
@@ -1846,7 +1844,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
                if(autocvar_g_ctf_pass)
                {
                        entity head, closest_target = world;
-                       head = WarpZone_FindRadius(player.origin, autocvar_g_ctf_pass_radius, TRUE);
+                       head = WarpZone_FindRadius(player.origin, autocvar_g_ctf_pass_radius, true);
 
                        while(head) // find the closest acceptable target to pass to
                        {
@@ -1873,7 +1871,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
                                                                Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PASS_REQUESTING, head.netname);
                                                        }
                                                        player.throw_antispam = time + autocvar_g_ctf_pass_wait;
-                                                       return TRUE;
+                                                       return true;
                                                }
                                                else if(player.flagcarried)
                                                {
@@ -1890,7 +1888,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
                                head = head.chain;
                        }
 
-                       if(closest_target) { ctf_Handle_Throw(player, closest_target, DROP_PASS); return TRUE; }
+                       if(closest_target) { ctf_Handle_Throw(player, closest_target, DROP_PASS); return true; }
                }
 
                // throw the flag in front of you
@@ -1903,12 +1901,12 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
                                        player.throw_prevtime = time;
                                        player.throw_count = 1;
                                        ctf_Handle_Throw(player, world, DROP_THROW);
-                                       return TRUE;
+                                       return true;
                                }
                                else
                                {
                                        Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_FLAG_THROW_PUNISH, rint((player.throw_prevtime + autocvar_g_ctf_throw_punish_delay) - time));
-                                       return FALSE;
+                                       return false;
                                }
                        }
                        else
@@ -1919,12 +1917,12 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
 
                                player.throw_prevtime = time;
                                ctf_Handle_Throw(player, world, DROP_THROW);
-                               return TRUE;
+                               return true;
                        }
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ctf_HelpMePing)
@@ -1936,11 +1934,11 @@ MUTATOR_HOOKFUNCTION(ctf_HelpMePing)
        }
        else // create a normal help me waypointsprite
        {
-               WaypointSprite_Spawn("helpme", waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, self.team, self, wps_helpme, FALSE, RADARICON_HELPME, '1 0.5 0');
+               WaypointSprite_Spawn("helpme", waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, self.team, self, wps_helpme, false, RADARICON_HELPME, '1 0.5 0');
                WaypointSprite_Ping(self.wps_helpme);
        }
 
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(ctf_VehicleEnter)
@@ -1958,10 +1956,10 @@ MUTATOR_HOOKFUNCTION(ctf_VehicleEnter)
                        vh_player.flagcarried.scale = VEHICLE_FLAG_SCALE;
                        //vh_player.flagcarried.angles = '0 0 0';
                }
-               return TRUE;
+               return true;
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ctf_VehicleExit)
@@ -1972,10 +1970,10 @@ MUTATOR_HOOKFUNCTION(ctf_VehicleExit)
                setorigin(vh_player.flagcarried, FLAG_CARRY_OFFSET);
                vh_player.flagcarried.scale = FLAG_SCALE;
                vh_player.flagcarried.angles = '0 0 0';
-               return TRUE;
+               return true;
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ctf_AbortSpeedrun)
@@ -1984,10 +1982,10 @@ MUTATOR_HOOKFUNCTION(ctf_AbortSpeedrun)
        {
                Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(self.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN_));
                ctf_RespawnFlag(self.flagcarried);
-               return TRUE;
+               return true;
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ctf_MatchEnd)
@@ -2005,7 +2003,7 @@ MUTATOR_HOOKFUNCTION(ctf_MatchEnd)
                                flag.movetype = MOVETYPE_NONE;
                                flag.takedamage = DAMAGE_NO;
                                flag.solid = SOLID_NOT;
-                               flag.nextthink = FALSE; // stop thinking
+                               flag.nextthink = false; // stop thinking
 
                                //dprint("stopping the ", flag.netname, " from moving.\n");
                                break;
@@ -2021,13 +2019,13 @@ MUTATOR_HOOKFUNCTION(ctf_MatchEnd)
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ctf_BotRoles)
 {
        havocbot_ctf_reset_role(self);
-       return TRUE;
+       return true;
 }
 
 
@@ -2147,7 +2145,7 @@ void spawnfunc_team_CTF_bluespawn()  { spawnfunc_info_player_team2();  }
 // scoreboard setup
 void ctf_ScoreRules()
 {
-       ScoreRules_basics(2, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
+       ScoreRules_basics(2, SFL_SORT_PRIO_PRIMARY, 0, true);
        ScoreInfo_SetLabel_TeamScore  (ST_CTF_CAPS,     "caps",      SFL_SORT_PRIO_PRIMARY);
        ScoreInfo_SetLabel_PlayerScore(SP_CTF_CAPS,     "caps",      SFL_SORT_PRIO_SECONDARY);
        ScoreInfo_SetLabel_PlayerScore(SP_CTF_CAPTIME,  "captime",   SFL_LOWER_IS_BETTER | SFL_TIME);
index ca4961eddc24231a6056943a0b2bffcdb5dcec06..0e5930db2cbe83c95b439e8f75461cdce64eda7f 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef GAMEMODE_CTF_H
+#define GAMEMODE_CTF_H
 // these are needed since mutators are compiled last
 
 #ifdef SVQC
@@ -5,23 +7,23 @@
 void ctf_RespawnFlag(entity flag);
 
 // score rule declarations
-#define ST_CTF_CAPS 1
-#define SP_CTF_CAPS 4
-#define SP_CTF_CAPTIME 5
-#define SP_CTF_PICKUPS 6
-#define SP_CTF_DROPS 7
-#define SP_CTF_FCKILLS 8
-#define SP_CTF_RETURNS 9
+const float ST_CTF_CAPS = 1;
+const float SP_CTF_CAPS = 4;
+const float SP_CTF_CAPTIME = 5;
+const float SP_CTF_PICKUPS = 6;
+const float SP_CTF_DROPS = 7;
+const float SP_CTF_FCKILLS = 8;
+const float SP_CTF_RETURNS = 9;
 
 // flag constants // for most of these, there is just one question to be asked: WHYYYYY?
 #define FLAG_MIN (PL_MIN + '0 0 -13')
 #define FLAG_MAX (PL_MAX + '0 0 -13')
 
-#define FLAG_SCALE 0.6
+const float FLAG_SCALE = 0.6;
 
-#define FLAG_THINKRATE 0.2
-#define FLAG_TOUCHRATE 0.5
-#define WPFE_THINKRATE 0.5
+const float FLAG_THINKRATE = 0.2;
+const float FLAG_TOUCHRATE = 0.5;
+const float WPFE_THINKRATE = 0.5;
 
 #define FLAG_DROP_OFFSET ('0 0 32')
 #define FLAG_CARRY_OFFSET ('-16 0 8')
@@ -31,12 +33,12 @@ void ctf_RespawnFlag(entity flag);
 #define FLAG_PASS_ARC_OFFSET ('0 0 -10')
 
 #define VEHICLE_FLAG_OFFSET ('0 0 96')
-#define VEHICLE_FLAG_SCALE 1.0
+const float VEHICLE_FLAG_SCALE = 1.0;
 
 // waypoint colors
-#define WPCOLOR_ENEMYFC(t) (colormapPaletteColor(t - 1, FALSE) * 0.75)
+#define WPCOLOR_ENEMYFC(t) (colormapPaletteColor(t - 1, false) * 0.75)
 #define WPCOLOR_FLAGCARRIER(t) ('0.8 0.8 0')
-#define WPCOLOR_DROPPEDFLAG(t) (('0.25 0.25 0.25' + colormapPaletteColor(t - 1, FALSE)) * 0.5)
+#define WPCOLOR_DROPPEDFLAG(t) (('0.25 0.25 0.25' + colormapPaletteColor(t - 1, false)) * 0.5)
 
 // sounds
 #define snd_flag_taken noise
@@ -69,27 +71,27 @@ float wpforenemy_announced;
 float wpforenemy_nextthink;
 
 // statuses
-#define FLAG_BASE 1
-#define FLAG_DROPPED 2
-#define FLAG_CARRY 3
-#define FLAG_PASSING 4
+const float FLAG_BASE = 1;
+const float FLAG_DROPPED = 2;
+const float FLAG_CARRY = 3;
+const float FLAG_PASSING = 4;
 
-#define DROP_NORMAL 1
-#define DROP_THROW 2
-#define DROP_PASS 3
-#define DROP_RESET 4
+const float DROP_NORMAL = 1;
+const float DROP_THROW = 2;
+const float DROP_PASS = 3;
+const float DROP_RESET = 4;
 
-#define PICKUP_BASE 1
-#define PICKUP_DROPPED 2
+const float PICKUP_BASE = 1;
+const float PICKUP_DROPPED = 2;
 
-#define CAPTURE_NORMAL 1
-#define CAPTURE_DROPPED 2
+const float CAPTURE_NORMAL = 1;
+const float CAPTURE_DROPPED = 2;
 
-#define RETURN_TIMEOUT 1
-#define RETURN_DROPPED 2
-#define RETURN_DAMAGE 3
-#define RETURN_SPEEDRUN 4
-#define RETURN_NEEDKILL 5
+const float RETURN_TIMEOUT = 1;
+const float RETURN_DROPPED = 2;
+const float RETURN_DAMAGE = 3;
+const float RETURN_SPEEDRUN = 4;
+const float RETURN_NEEDKILL = 5;
 
 // flag properties
 #define ctf_spawnorigin dropped_origin
@@ -117,13 +119,13 @@ float ctf_captureshield_max_ratio; // punish at most 30% of each team
 float ctf_captureshield_force; // push force of the shield
 
 // bot player logic
-#define HAVOCBOT_CTF_ROLE_NONE 0
-#define HAVOCBOT_CTF_ROLE_DEFENSE 2
-#define HAVOCBOT_CTF_ROLE_MIDDLE 4
-#define HAVOCBOT_CTF_ROLE_OFFENSE 8
-#define HAVOCBOT_CTF_ROLE_CARRIER 16
-#define HAVOCBOT_CTF_ROLE_RETRIEVER 32
-#define HAVOCBOT_CTF_ROLE_ESCORT 64
+const float HAVOCBOT_CTF_ROLE_NONE = 0;
+const float HAVOCBOT_CTF_ROLE_DEFENSE = 2;
+const float HAVOCBOT_CTF_ROLE_MIDDLE = 4;
+const float HAVOCBOT_CTF_ROLE_OFFENSE = 8;
+const float HAVOCBOT_CTF_ROLE_CARRIER = 16;
+const float HAVOCBOT_CTF_ROLE_RETRIEVER = 32;
+const float HAVOCBOT_CTF_ROLE_ESCORT = 64;
 
 .float havocbot_cantfindflag;
 
@@ -132,3 +134,4 @@ float havocbot_ctf_middlepoint_radius;
 
 void havocbot_role_ctf_setrole(entity bot, float role);
 #endif
+#endif
index 9c674d45d89933fa9f24e8bc13e31e7f2a7995d4..0886a9ce59921cf205bc71dba4a89bc9897b3846 100644 (file)
@@ -29,7 +29,7 @@ void havocbot_role_cts()
 
 void cts_ScoreRules()
 {
-       ScoreRules_basics(0, 0, 0, FALSE);
+       ScoreRules_basics(0, 0, 0, false);
        if(g_race_qualifying)
        {
                ScoreInfo_SetLabel_PlayerScore(SP_CTS_FASTEST, "fastest",   SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME);
@@ -59,26 +59,26 @@ MUTATOR_HOOKFUNCTION(cts_PlayerPhysics)
        // ensure nothing EVIL is being done (i.e. div0_evade)
        // this hinders joystick users though
        // but it still gives SOME analog control
-       wishvel_x = fabs(self.movement_x);
-       wishvel_y = fabs(self.movement_y);
-       if(wishvel_x != 0 && wishvel_y != 0 && wishvel_x != wishvel_y)
+       wishvel.x = fabs(self.movement.x);
+       wishvel.y = fabs(self.movement.y);
+       if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y)
        {
-               wishvel_z = 0;
+               wishvel.z = 0;
                wishspeed = vlen(wishvel);
-               if(wishvel_x >= 2 * wishvel_y)
+               if(wishvel.x >= 2 * wishvel.y)
                {
                        // pure X motion
-                       if(self.movement_x > 0)
+                       if(self.movement.x > 0)
                                self.movement_x = wishspeed;
                        else
                                self.movement_x = -wishspeed;
                        self.movement_y = 0;
                }
-               else if(wishvel_y >= 2 * wishvel_x)
+               else if(wishvel.y >= 2 * wishvel.x)
                {
                        // pure Y motion
                        self.movement_x = 0;
-                       if(self.movement_y > 0)
+                       if(self.movement.y > 0)
                                self.movement_y = wishspeed;
                        else
                                self.movement_y = -wishspeed;
@@ -86,18 +86,18 @@ MUTATOR_HOOKFUNCTION(cts_PlayerPhysics)
                else
                {
                        // diagonal
-                       if(self.movement_x > 0)
+                       if(self.movement.x > 0)
                                self.movement_x = M_SQRT1_2 * wishspeed;
                        else
                                self.movement_x = -M_SQRT1_2 * wishspeed;
-                       if(self.movement_y > 0)
+                       if(self.movement.y > 0)
                                self.movement_y = M_SQRT1_2 * wishspeed;
                        else
                                self.movement_y = -M_SQRT1_2 * wishspeed;
                }
        }
-       
-       return FALSE;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts_ResetMap)
@@ -130,8 +130,8 @@ MUTATOR_HOOKFUNCTION(cts_ResetMap)
                cvar_set("timelimit", ftos(race_timelimit));
                cts_ScoreRules();
        }
-       
-       return FALSE;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts_PlayerPreThink)
@@ -141,14 +141,14 @@ MUTATOR_HOOKFUNCTION(cts_PlayerPreThink)
        if(msg_entity.enemy.race_laptime)
                race_SendNextCheckpoint(msg_entity.enemy, 1);
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts_ClientConnect)
 {
        race_PreparePlayer();
        self.race_checkpoint = -1;
-       
+
        if(IS_REAL_CLIENT(self))
        {
                string rr = CTS_RECORD;
@@ -168,7 +168,7 @@ MUTATOR_HOOKFUNCTION(cts_ClientConnect)
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts_MakePlayerObserver)
@@ -181,7 +181,7 @@ MUTATOR_HOOKFUNCTION(cts_MakePlayerObserver)
        race_PreparePlayer();
        self.race_checkpoint = -1;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts_PlayerSpawn)
@@ -195,8 +195,8 @@ MUTATOR_HOOKFUNCTION(cts_PlayerSpawn)
        self.race_respawn_spotref = spawn_spot;
 
        self.race_place = 0;
-       
-       return FALSE;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts_PutClientInServer)
@@ -211,20 +211,20 @@ MUTATOR_HOOKFUNCTION(cts_PutClientInServer)
 
                race_AbandonRaceCheck(self);
        }
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts_PlayerDies)
 {
        self.respawn_flags |= RESPAWN_FORCE;
        race_AbandonRaceCheck(self);
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts_BotRoles)
 {
        self.havocbot_role = havocbot_role_cts;
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(cts_PlayerPostThink)
@@ -241,21 +241,21 @@ MUTATOR_HOOKFUNCTION(cts_PlayerPostThink)
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts_ForbidThrowing)
 {
        // no weapon dropping in CTS
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(cts_FilterItem)
 {
        if(self.classname == "droppedweapon")
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts_PlayerDamage)
@@ -264,19 +264,19 @@ MUTATOR_HOOKFUNCTION(cts_PlayerDamage)
        if(!autocvar_g_cts_selfdamage)
                frag_damage = 0;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(cts_ForbidClearPlayerScore)
 {
-       return TRUE; // in CTS, you don't lose score by observing
+       return true; // in CTS, you don't lose score by observing
 }
 
 MUTATOR_HOOKFUNCTION(cts_SetMods)
 {
        g_cloaked = 1; // always enable cloak in CTS
 
-       return FALSE;
+       return false;
 }
 
 void cts_Initialize()
index f02caf01fae1bf99341f93a8fd101362048d5abf..fa27fe4fcd140e1601940b211f96a272860eee8c 100644 (file)
@@ -1,7 +1,10 @@
-float g_race_qualifying;
+#ifndef GAMEMODE_CTS_H
+#define GAMEMODE_CTS_H
+//float g_race_qualifying;
 
 // scores
-#define ST_CTS_LAPS 1
-#define SP_CTS_LAPS 4
-#define SP_CTS_TIME 5
-#define SP_CTS_FASTEST 6
+const float ST_CTS_LAPS = 1;
+const float SP_CTS_LAPS = 4;
+const float SP_CTS_TIME = 5;
+const float SP_CTS_FASTEST = 6;
+#endif
index 8e4d929beefed58d4163d6c5b5c119c6e4f9fc78..dd6e8b2109be3b97ceab791a5874a8ec94edf880 100644 (file)
@@ -422,19 +422,19 @@ MUTATOR_HOOKFUNCTION(dom_PlayerSpawn)
                self.player_blocked = 1;
        else
                self.player_blocked = 0;
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(dom_ClientConnect)
 {
        set_dom_state(self);
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(dom_BotRoles)
 {
        self.havocbot_role = havocbot_role_dom;
-       return TRUE;
+       return true;
 }
 
 /*QUAKED spawnfunc_dom_controlpoint (0 .5 .8) (-16 -16 -24) (16 16 32)
@@ -513,7 +513,7 @@ void ScoreRules_dom(float teams)
 {
        if(domination_roundbased)
        {
-               ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
+               ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
                ScoreInfo_SetLabel_TeamScore  (ST_DOM_CAPS, "caps", SFL_SORT_PRIO_PRIMARY);
                ScoreInfo_SetLabel_PlayerScore(SP_DOM_TAKES, "takes", 0);
                ScoreRules_basics_end();
@@ -526,7 +526,7 @@ void ScoreRules_dom(float teams)
                        sp_domticks = SFL_SORT_PRIO_PRIMARY;
                else
                        sp_score = SFL_SORT_PRIO_PRIMARY;
-               ScoreRules_basics(teams, sp_score, sp_score, TRUE);
+               ScoreRules_basics(teams, sp_score, sp_score, true);
                ScoreInfo_SetLabel_TeamScore  (ST_DOM_TICKS,    "ticks",     sp_domticks);
                ScoreInfo_SetLabel_PlayerScore(SP_DOM_TICKS,    "ticks",     sp_domticks);
                ScoreInfo_SetLabel_PlayerScore(SP_DOM_TAKES,    "takes",     0);
@@ -596,7 +596,7 @@ void dom_DelayedInit() // Do this check with a delay so we can wait for teams to
                domination_teams = bound(2, ((autocvar_g_domination_teams_override < 2) ? autocvar_g_domination_default_teams : autocvar_g_domination_teams_override), 4);
                dom_spawnteams(domination_teams);
        }
-       
+
        CheckAllowedTeams(world);
        domination_teams = ((c4>=0) ? 4 : (c3>=0) ? 3 : 2);
 
index 6b5b334e4906ef969597e3600070d172e8ecb49e..d017b62a4968ddbeb46af747f174a4d392200889 100644 (file)
@@ -1,11 +1,13 @@
+#ifndef GAMEMODE_DOMINATION_H
+#define GAMEMODE_DOMINATION_H
 // these are needed since mutators are compiled last
 
 // score rule declarations
-#define ST_DOM_TICKS 1
-#define SP_DOM_TICKS 4
-#define SP_DOM_TAKES 5
-#define ST_DOM_CAPS 1
-#define SP_DOM_CAPS 4
+const float ST_DOM_TICKS = 1;
+const float SP_DOM_TICKS = 4;
+const float SP_DOM_TAKES = 5;
+const float ST_DOM_CAPS = 1;
+const float SP_DOM_CAPS = 4;
 
 // pps: points per second
 .float dom_total_pps;
@@ -27,3 +29,4 @@ float pps_pink;
 // misc globals
 float domination_roundbased;
 float domination_teams;
+#endif
index 5ab96277b9e4a286a04999ab8c0832fb09d0fdc2..d6285cdafd112509b99e8c9ffcacd6b0430e3abe 100644 (file)
@@ -1,13 +1,13 @@
 .float freezetag_frozen_time;
 .float freezetag_frozen_timeout;
-#define ICE_MAX_ALPHA 1
-#define ICE_MIN_ALPHA 0.1
+const float ICE_MAX_ALPHA = 1;
+const float ICE_MIN_ALPHA = 0.1;
 float freezetag_teams;
 
-#define SP_FREEZETAG_REVIVALS 4
+const float SP_FREEZETAG_REVIVALS = 4;
 void freezetag_ScoreRules(float teams)
 {
-       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE); // SFL_SORT_PRIO_PRIMARY
+       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true); // SFL_SORT_PRIO_PRIMARY
        ScoreInfo_SetLabel_PlayerScore(SP_FREEZETAG_REVIVALS, "revivals", 0);
        ScoreRules_basics_end();
 }
@@ -39,9 +39,9 @@ void freezetag_count_alive_players()
 #define FREEZETAG_ALIVE_TEAMS() ((redalive > 0) + (bluealive > 0) + (yellowalive > 0) + (pinkalive > 0))
 #define FREEZETAG_ALIVE_TEAMS_OK() (FREEZETAG_ALIVE_TEAMS() == freezetag_teams)
 
-float prev_missing_teams_mask;
 float freezetag_CheckTeams()
 {
+       static float prev_missing_teams_mask;
        if(FREEZETAG_ALIVE_TEAMS_OK())
        {
                if(prev_missing_teams_mask > 0)
@@ -188,7 +188,7 @@ void freezetag_Freeze(entity attacker)
        if(autocvar_g_freezetag_frozen_maxtime > 0)
                self.freezetag_frozen_timeout = time + autocvar_g_freezetag_frozen_maxtime;
 
-       Freeze(self, 0, 1, TRUE);
+       Freeze(self, 0, 1, true);
 
        freezetag_count_alive_players();
 
@@ -206,8 +206,8 @@ void freezetag_Unfreeze(entity attacker)
 float freezetag_isEliminated(entity e)
 {
        if(IS_PLAYER(e) && (e.frozen == 1 || e.deadflag != DEAD_NO))
-               return TRUE;
-       return FALSE;
+               return true;
+       return false;
 }
 
 
@@ -465,7 +465,7 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerPreThink)
                        if(!o)
                                o = other;
                        if(self.frozen == 1)
-                               other.reviving = TRUE;
+                               other.reviving = true;
                        ++n;
                }
        }
@@ -509,7 +509,7 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerPreThink)
                        if(other.reviving)
                        {
                                other.revive_progress = self.revive_progress;
-                               other.reviving = FALSE;
+                               other.reviving = false;
                        }
                }
        }
@@ -536,7 +536,7 @@ MUTATOR_HOOKFUNCTION(freezetag_BotRoles)
                        self.havocbot_role = havocbot_role_ft_offense;
        }
 
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(freezetag_GetTeamCount)
index dcdd3365af9d9ca468d805071809d26acd3c2dc6..fe0d0a7ecc4094048a9a7b878e2428a0ad258523 100644 (file)
@@ -59,19 +59,19 @@ void invasion_SpawnChosenMonster(float mon)
                setsize(e, (get_monsterinfo(mon)).mins, (get_monsterinfo(mon)).maxs);
 
                if(MoveToRandomMapLocation(e, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
-                       monster = spawnmonster("", mon, world, world, e.origin, FALSE, FALSE, 2);
+                       monster = spawnmonster("", mon, world, world, e.origin, false, false, 2);
                else return;
 
                e.think = SUB_Remove;
                e.nextthink = time + 0.1;
        }
        else
-               monster = spawnmonster("", ((spawn_point.monsterid) ? spawn_point.monsterid : mon), spawn_point, spawn_point, spawn_point.origin, FALSE, FALSE, 2);
-       
+               monster = spawnmonster("", ((spawn_point.monsterid) ? spawn_point.monsterid : mon), spawn_point, spawn_point, spawn_point.origin, false, false, 2);
+
        if(spawn_point) monster.target2 = spawn_point.target2;
        monster.spawnshieldtime = time;
        if(spawn_point && spawn_point.target_range) monster.target_range = spawn_point.target_range;
-       
+
        if(teamplay)
        if(spawn_point && spawn_point.team && inv_monsters_perteam[spawn_point.team] > 0)
                monster.team = spawn_point.team;
@@ -82,14 +82,14 @@ void invasion_SpawnChosenMonster(float mon)
                if(inv_monsters_perteam[NUM_TEAM_2] > 0) RandomSelection_Add(world, NUM_TEAM_2, string_null, 1, 1);
                if(invasion_teams >= 3) if(inv_monsters_perteam[NUM_TEAM_3] > 0) { RandomSelection_Add(world, NUM_TEAM_3, string_null, 1, 1); }
                if(invasion_teams >= 4) if(inv_monsters_perteam[NUM_TEAM_4] > 0) { RandomSelection_Add(world, NUM_TEAM_4, string_null, 1, 1); }
-               
+
                monster.team = RandomSelection_chosen_float;
        }
-       
+
        if(teamplay)
        {
                monster_setupcolors(monster);
-       
+
                if(monster.sprite)
                {
                        WaypointSprite_UpdateTeamRadar(monster.sprite, RADARICON_DANGER, ((monster.team) ? Team_ColorRGB(monster.team) : '1 0 0'));
@@ -98,8 +98,8 @@ void invasion_SpawnChosenMonster(float mon)
                        monster.sprite.SendFlags |= 1;
                }
        }
-       
-       monster.monster_attack = FALSE; // it's the player's job to kill all the monsters
+
+       monster.monster_attack = false; // it's the player's job to kill all the monsters
 
        if(inv_roundcnt >= inv_maxrounds)
                monster.spawnflags |= MONSTERFLAG_MINIBOSS; // last round spawns minibosses
@@ -157,7 +157,7 @@ float Invasion_CheckWinner()
 
        if(inv_numspawned < 1)
                return 0; // nothing has spawned yet
-               
+
        if(teamplay)
        {
                if(((red_alive > 0) + (blue_alive > 0) + (yellow_alive > 0) + (pink_alive > 0)) > 1)
@@ -182,7 +182,7 @@ float Invasion_CheckWinner()
                if(pink_alive > 0)
                if(winner_team) { winner_team = 0; }
                else { winner_team = NUM_TEAM_4; }
-       }       
+       }
        else
        FOR_EACH_PLAYER(head)
        {
@@ -218,7 +218,7 @@ float Invasion_CheckWinner()
 
 float Invasion_CheckPlayers()
 {
-       return TRUE;
+       return true;
 }
 
 void Invasion_RoundStart()
@@ -271,13 +271,13 @@ MUTATOR_HOOKFUNCTION(invasion_MonsterDies)
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(invasion_MonsterSpawn)
 {
        if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
-               return TRUE;
+               return true;
 
        if(!(self.spawnflags & MONSTERFLAG_RESPAWNED))
        {
@@ -292,16 +292,16 @@ MUTATOR_HOOKFUNCTION(invasion_MonsterSpawn)
 
        self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(invasion_OnEntityPreSpawn)
 {
        if(startsWith(self.classname, "monster_"))
        if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
-               return TRUE;
-       
-       return FALSE;
+               return true;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(invasion_StartFrame)
@@ -309,19 +309,19 @@ MUTATOR_HOOKFUNCTION(invasion_StartFrame)
        monsters_total = inv_maxspawned; // TODO: make sure numspawned never exceeds maxspawned
        monsters_killed = inv_numkilled;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(invasion_PlayerRegen)
 {
        // no regeneration in invasion
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(invasion_PlayerSpawn)
 {
-       self.bot_attack = FALSE;
-       return FALSE;
+       self.bot_attack = false;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(invasion_PlayerDamage)
@@ -332,13 +332,13 @@ MUTATOR_HOOKFUNCTION(invasion_PlayerDamage)
                frag_force = '0 0 0';
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(invasion_PlayerCommand)
 {
        if(MUTATOR_RETURNVALUE) // command was already handled?
-               return FALSE;
+               return false;
 
        if(cmd_name == "debuginvasion")
        {
@@ -350,18 +350,18 @@ MUTATOR_HOOKFUNCTION(invasion_PlayerCommand)
                sprint(self, strcat("monsters_killed = ", ftos(monsters_killed), "\n"));
                sprint(self, strcat("inv_monsterskill = ", ftos(inv_monsterskill), "\n"));
 
-               return TRUE;
+               return true;
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(invasion_BotShouldAttack)
 {
        if(!(checkentity.flags & FL_MONSTER))
-               return TRUE;
-       
-       return FALSE;
+               return true;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(invasion_SetStartItems)
@@ -369,7 +369,7 @@ MUTATOR_HOOKFUNCTION(invasion_SetStartItems)
        start_health = 200;
        start_armorvalue = 200;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(invasion_AccuracyTargetValid)
@@ -382,19 +382,19 @@ MUTATOR_HOOKFUNCTION(invasion_AccuracyTargetValid)
 MUTATOR_HOOKFUNCTION(invasion_AllowMobSpawning)
 {
        // monster spawning disabled during an invasion
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(invasion_GetTeamCount)
 {
        ret_float = invasion_teams;
-       return FALSE;
+       return false;
 }
 
 void invasion_ScoreRules(float inv_teams)
 {
        if(inv_teams) { CheckAllowedTeams(world); }
-       ScoreRules_basics(inv_teams, 0, 0, FALSE);
+       ScoreRules_basics(inv_teams, 0, 0, false);
        if(inv_teams) ScoreInfo_SetLabel_TeamScore(ST_INV_KILLS, "frags", SFL_SORT_PRIO_PRIMARY);
        ScoreInfo_SetLabel_PlayerScore(SP_KILLS, "frags", ((inv_teams) ? SFL_SORT_PRIO_SECONDARY : SFL_SORT_PRIO_PRIMARY));
        ScoreRules_basics_end();
@@ -406,7 +406,7 @@ void invasion_DelayedInit() // Do this check with a delay so we can wait for tea
                invasion_teams = bound(2, autocvar_g_invasion_teams, 4);
        else
                invasion_teams = 0;
-       
+
        independent_players = 1; // to disable extra useless scores
 
        invasion_ScoreRules(invasion_teams);
@@ -437,7 +437,7 @@ void invasion_Initialize()
                        MON_ACTION(i, MR_PRECACHE);
                }
        }
-       
+
        InitializeEntity(world, invasion_DelayedInit, INITPRIO_GAMETYPE);
 }
 
index 04492d4a345824652998afe8d413af6ea9e42082..191aef9ad2e734a2fd8dc9cf219361c767df96c4 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef GAMEMODE_INVASION_H
+#define GAMEMODE_INVASION_H
+
 float inv_numspawned;
 float inv_maxspawned;
 float inv_roundcnt;
@@ -11,4 +14,5 @@ float inv_monsters_perteam[17];
 
 float inv_monsterskill;
 
-#define ST_INV_KILLS 1
+const float ST_INV_KILLS = 1;
+#endif
index 7e1006ec1d92252e624fda40366e08dee47feb99..095857e14325ebf83550b5feee918024d9bb07e4 100644 (file)
@@ -7,11 +7,11 @@ float ka_ballcarrier_waypointsprite_visible_for_player(entity e) // runs on wayp
 {
        if(e.ballcarried)
                if(IS_SPEC(other))
-                       return FALSE; // we don't want spectators of the ballcarrier to see the attached waypoint on the top of their screen
+                       return false; // we don't want spectators of the ballcarrier to see the attached waypoint on the top of their screen
 
        // TODO: Make the ballcarrier lack a waypointsprite whenever they have the invisibility powerup
 
-       return TRUE;
+       return true;
 }
 
 void ka_EventLog(string mode, entity actor) // use an alias for easy changing and quick editing later
@@ -27,7 +27,7 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated
 
        if(!MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
        {
-               entity spot = SelectSpawnPoint(TRUE);
+               entity spot = SelectSpawnPoint(true);
                setorigin(self, spot.origin);
                self.angles = spot.angles;
        }
@@ -43,7 +43,7 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated
        pointparticles(particleeffectnum("electro_combo"), oldballorigin, '0 0 0', 1);
        pointparticles(particleeffectnum("electro_combo"), self.origin, '0 0 0', 1);
 
-       WaypointSprite_Spawn("ka-ball", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, '0 1 1');
+       WaypointSprite_Spawn("ka-ball", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER, '0 1 1');
        WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
 
        sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
@@ -97,7 +97,7 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth
 
        // apply effects to player
        other.glow_color = autocvar_g_keepawayball_trail_color;
-       other.glow_trail = TRUE;
+       other.glow_trail = true;
        other.effects |= autocvar_g_keepaway_ballcarrier_effects;
 
        // messages and sounds
@@ -140,7 +140,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los
        ball.owner = world;
 
        // reset the player effects
-       plyr.glow_trail = FALSE;
+       plyr.glow_trail = false;
        plyr.effects &= ~autocvar_g_keepaway_ballcarrier_effects;
 
        // messages and sounds
@@ -153,7 +153,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los
        // PlayerScore_Add(plyr, SP_KEEPAWAY_DROPS, 1); Not anymore, this is 100% the same as pickups and is useless.
 
        // waypoints
-       WaypointSprite_Spawn("ka-ball", 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, '0 1 1');
+       WaypointSprite_Spawn("ka-ball", 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER, '0 1 1');
        WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
        WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
        WaypointSprite_Kill(plyr.waypointsprite_attachedforcarrier);
@@ -349,7 +349,7 @@ MUTATOR_HOOKFUNCTION(ka_BotRoles)
                self.havocbot_role = havocbot_role_ka_carrier;
        else
                self.havocbot_role = havocbot_role_ka_collector;
-       return TRUE;
+       return true;
 }
 
 
@@ -373,7 +373,7 @@ void ka_SpawnBall() // loads various values for the ball, runs only once at star
        e.solid = SOLID_TRIGGER;
        e.movetype = MOVETYPE_BOUNCE;
        e.glow_color = autocvar_g_keepawayball_trail_color;
-       e.glow_trail = TRUE;
+       e.glow_trail = true;
        e.flags = FL_ITEM;
        e.reset = ka_Reset;
        e.touch = ka_TouchEvent;
@@ -385,7 +385,7 @@ void ka_SpawnBall() // loads various values for the ball, runs only once at star
 
 void ka_ScoreRules()
 {
-       ScoreRules_basics(0, SFL_SORT_PRIO_PRIMARY, 0, TRUE); // SFL_SORT_PRIO_PRIMARY
+       ScoreRules_basics(0, SFL_SORT_PRIO_PRIMARY, 0, true); // SFL_SORT_PRIO_PRIMARY
        ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_PICKUPS,                     "pickups",              0);
        ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_CARRIERKILLS,        "bckills",              0);
        ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_BCTIME,                      "bctime",               SFL_SORT_PRIO_SECONDARY);
index 062fc9e0cb2325b46663c480263efd72fd04d62d..fd9ed4f2f0e98b9b2c5a29ce9b0736dd99df4187 100644 (file)
@@ -1,10 +1,14 @@
+#ifndef GAMEMODE_KEEPAWAY_H
+#define GAMEMODE_KEEPAWAY_H
+
 // these are needed since mutators are compiled last
 
 entity ka_ball;
 
-#define SP_KEEPAWAY_PICKUPS 4
-#define SP_KEEPAWAY_CARRIERKILLS 5
-#define SP_KEEPAWAY_BCTIME 6
+const float SP_KEEPAWAY_PICKUPS = 4;
+const float SP_KEEPAWAY_CARRIERKILLS = 5;
+const float SP_KEEPAWAY_BCTIME = 6;
 
 void() havocbot_role_ka_carrier;
 void() havocbot_role_ka_collector;
+#endif
index 7b3ea98af6dc0dc558224870e604164259e969d3..2a67316101f846261dc819f6476bf7ef23f539e7 100644 (file)
@@ -46,10 +46,10 @@ float kh_Team_ByID(float t)
        return 0;
 }
 
-entity kh_worldkeylist;
+//entity kh_worldkeylist;
 .entity kh_worldkeynext;
 entity kh_controller;
-float kh_tracking_enabled;
+//float kh_tracking_enabled;
 float kh_teams;
 float kh_interferemsg_time, kh_interferemsg_team;
 .entity kh_next, kh_prev; // linked list
@@ -67,16 +67,16 @@ string kh_sound_alarm = "kh/alarm.wav";  // the new siren/alarm
 
 float kh_key_dropped, kh_key_carried;
 
-#define ST_KH_CAPS 1
-#define SP_KH_CAPS 4
-#define SP_KH_PUSHES 5
-#define SP_KH_DESTROYS 6
-#define SP_KH_PICKUPS 7
-#define SP_KH_KCKILLS 8
-#define SP_KH_LOSSES 9
+const float ST_KH_CAPS = 1;
+const float SP_KH_CAPS = 4;
+const float SP_KH_PUSHES = 5;
+const float SP_KH_DESTROYS = 6;
+const float SP_KH_PICKUPS = 7;
+const float SP_KH_KCKILLS = 8;
+const float SP_KH_LOSSES = 9;
 void kh_ScoreRules(float teams)
 {
-       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE);
+       ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
        ScoreInfo_SetLabel_TeamScore(  ST_KH_CAPS,      "caps",      SFL_SORT_PRIO_SECONDARY);
        ScoreInfo_SetLabel_PlayerScore(SP_KH_CAPS,      "caps",      SFL_SORT_PRIO_SECONDARY);
        ScoreInfo_SetLabel_PlayerScore(SP_KH_PUSHES,    "pushes",    0);
@@ -91,20 +91,20 @@ float kh_KeyCarrier_waypointsprite_visible_for_player(entity e)  // runs all the
 {
        if(!IS_PLAYER(e) || self.team != e.team)
                if(!kh_tracking_enabled)
-                       return FALSE;
+                       return false;
 
-       return TRUE;
+       return true;
 }
 
 float kh_Key_waypointsprite_visible_for_player(entity e) // ??
 {
        if(!kh_tracking_enabled)
-               return FALSE;
+               return false;
        if(!self.owner)
-               return TRUE;
+               return true;
        if(!self.owner.owner)
-               return TRUE;
-       return FALSE;  // draw only when key is not owned
+               return true;
+       return false;  // draw only when key is not owned
 }
 
 void kh_update_state()
@@ -200,7 +200,7 @@ vector kh_AttachedOrigin(entity e)  // runs when a team captures the flag, it ca
        if(e.tag_entity)
        {
                makevectors(e.tag_entity.angles);
-               return e.tag_entity.origin + e.origin_x * v_forward - e.origin_y * v_right + e.origin_z * v_up;
+               return e.tag_entity.origin + e.origin.x * v_forward - e.origin.y * v_right + e.origin.z * v_up;
        }
        else
                return e.origin;
@@ -237,7 +237,7 @@ void kh_Key_Attach(entity key)  // runs when a player picks up a key and several
 #else
        setattachment(key, key.owner, "");
        setorigin(key, '0 0 1' * KH_KEY_ZSHIFT);  // fixing x, y in think
-       key.angles_y -= key.owner.angles_y;
+       key.angles_y -= key.owner.angles.y;
 #endif
        key.flags = 0;
        key.solid = SOLID_NOT;
@@ -274,9 +274,9 @@ void kh_Key_Detach(entity key) // runs every time a key is dropped or lost. Runs
        setorigin(key, key.owner.origin + '0 0 1' * (PL_MIN_z - KH_KEY_MIN_z));
        key.angles = key.owner.angles;
 #else
-       setorigin(key, key.owner.origin + key.origin_z * '0 0 1');
+       setorigin(key, key.owner.origin + key.origin.z * '0 0 1');
        setattachment(key, world, "");
-       key.angles_y += key.owner.angles_y;
+       key.angles_y += key.owner.angles.y;
 #endif
        key.flags = FL_ITEM;
        key.solid = SOLID_TRIGGER;
@@ -494,10 +494,10 @@ void kh_FinishRound()  // runs when a team captures the keys
        kh_interferemsg_time = 0;
        entity key;
 
-       kh_no_radar_circles = TRUE;
+       kh_no_radar_circles = true;
        FOR_EACH_KH_KEY(key)
                kh_Key_Remove(key);
-       kh_no_radar_circles = FALSE;
+       kh_no_radar_circles = false;
 
        Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_KEYHUNT_ROUNDSTART, autocvar_g_balance_keyhunt_delay_round);
        kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, kh_StartRound);
@@ -523,7 +523,7 @@ void kh_WinnerTeam(float teem)  // runs when a team wins // Samual: Teem?.... TE
                nades_GiveBonus(key.owner, autocvar_g_nades_bonus_score_high);
        }
 
-       first = TRUE;
+       first = true;
        string keyowner = "";
        FOR_EACH_KH_KEY(key)
                if(key.owner.kh_next == key)
@@ -531,12 +531,12 @@ void kh_WinnerTeam(float teem)  // runs when a team wins // Samual: Teem?.... TE
                        if(!first)
                                keyowner = strcat(keyowner, ", ");
                        keyowner = key.owner.netname;
-                       first = FALSE;
+                       first = false;
                }
 
        Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(teem, INFO_KEYHUNT_CAPTURE_), keyowner);
 
-       first = TRUE;
+       first = true;
        midpoint = '0 0 0';
        firstorigin = '0 0 0';
        lastorigin = '0 0 0';
@@ -553,7 +553,7 @@ void kh_WinnerTeam(float teem)  // runs when a team wins // Samual: Teem?.... TE
                lastorigin = thisorigin;
                if(first)
                        firstorigin = thisorigin;
-               first = FALSE;
+               first = false;
        }
        if(kh_teams > 2)
        {
@@ -669,7 +669,7 @@ void kh_Key_Think()  // runs all the time
        {
 #ifndef KH_PLAYER_USE_ATTACHMENT
                makevectors('0 1 0' * (self.cnt + (time % 360) * KH_KEY_XYSPEED));
-               setorigin(self, v_forward * KH_KEY_XYDIST + '0 0 1' * self.origin_z);
+               setorigin(self, v_forward * KH_KEY_XYDIST + '0 0 1' * self.origin.z);
 #endif
        }
 
@@ -769,7 +769,7 @@ void kh_Key_Spawn(entity initial_owner, float angle, float i)  // runs every tim
 
        Send_Notification(NOTIF_ONE, initial_owner, MSG_CENTER, APP_TEAM_NUM_4(initial_owner.team, CENTER_KEYHUNT_START_));
 
-       WaypointSprite_Spawn("key-dropped", 0, 0, key, '0 0 1' * KH_KEY_WP_ZSHIFT, world, key.team, key, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAG, '0 1 1');
+       WaypointSprite_Spawn("key-dropped", 0, 0, key, '0 0 1' * KH_KEY_WP_ZSHIFT, world, key.team, key, waypointsprite_attachedforcarrier, false, RADARICON_FLAG, '0 1 1');
        key.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_Key_waypointsprite_visible_for_player;
 
        kh_Key_AssignTo(key, initial_owner);
@@ -814,7 +814,7 @@ void kh_Key_DropOne(entity key)
 
        kh_Key_AssignTo(key, world);
        makevectors(player.v_angle);
-       key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_throwvelocity * v_forward, FALSE);
+       key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_throwvelocity * v_forward, false);
        key.pusher = world;
        key.pushltime = time + autocvar_g_balance_keyhunt_protecttime;
        key.kh_dropperteam = key.team;
@@ -839,7 +839,7 @@ void kh_Key_DropAll(entity player, float suicide) // runs whenever a player dies
                        Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(key, INFO_KEYHUNT_LOST_), player.netname);
                        kh_Key_AssignTo(key, world);
                        makevectors('-1 0 0' * (45 + 45 * random()) + '0 360 0' * random());
-                       key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_dropvelocity * v_forward, FALSE);
+                       key.velocity = W_CalculateProjectileVelocity(player.velocity, autocvar_g_balance_keyhunt_dropvelocity * v_forward, false);
                        key.pusher = mypusher;
                        key.pushltime = time + autocvar_g_balance_keyhunt_protecttime;
                        if(suicide)
@@ -893,7 +893,7 @@ void kh_EnableTrackingDevice()  // runs after each round
        Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_KEYHUNT);
        Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_KEYHUNT_OTHER);
 
-       kh_tracking_enabled = TRUE;
+       kh_tracking_enabled = true;
 }
 
 void kh_StartRound()  // runs at the start of each round
@@ -935,7 +935,7 @@ void kh_StartRound()  // runs at the start of each round
                kh_Key_Spawn(my_player, 360 * i / kh_teams, i);
        }
 
-       kh_tracking_enabled = FALSE;
+       kh_tracking_enabled = false;
        Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_KEYHUNT_SCAN, autocvar_g_balance_keyhunt_delay_tracking);
        kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_tracking, kh_EnableTrackingDevice);
 }
@@ -1025,18 +1025,18 @@ void kh_finalize()
 
 MUTATOR_HOOKFUNCTION(kh_Key_DropAll)
 {
-       kh_Key_DropAll(self, TRUE);
+       kh_Key_DropAll(self, true);
        return 0;
 }
 
 MUTATOR_HOOKFUNCTION(kh_PlayerDies)
 {
        if(self == other)
-               kh_Key_DropAll(self, TRUE);
+               kh_Key_DropAll(self, true);
        else if(IS_PLAYER(other))
-               kh_Key_DropAll(self, FALSE);
+               kh_Key_DropAll(self, false);
        else
-               kh_Key_DropAll(self, TRUE);
+               kh_Key_DropAll(self, true);
        return 0;
 }
 
index 611f7f065e10be5eda8f984c10166c76ea99fdf6..6b27431c2207cc81f39319b3d6c580477451d2cc 100644 (file)
@@ -1,5 +1,7 @@
-// ALL OF THESE should be removed in the future, as other code should not have
-// to care
+#ifndef GAMEMODE_KEYHUNT_H
+#define GAMEMODE_KEYHUNT_H
+
+// ALL OF THESE should be removed in the future, as other code should not have to care
 
 // used by bots:
 float kh_tracking_enabled;
@@ -9,3 +11,4 @@ float kh_Key_AllOwnedByWhichTeam();
 typedef void(void) kh_Think_t;
 void kh_StartRound();
 void kh_Controller_SetThink(float t, kh_Think_t func);
+#endif
index 0684ac8edb20b90dbbbcc1ceb3d3d66cae1d8201..13b77305a25429c78dd95768701167057b7a699e 100644 (file)
@@ -23,7 +23,7 @@ MUTATOR_HOOKFUNCTION(lms_ResetMap)
        lms_lowest_lives = 999;
        lms_next_place = player_count;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(lms_ResetPlayers)
@@ -33,7 +33,7 @@ MUTATOR_HOOKFUNCTION(lms_ResetPlayers)
        if(IS_PLAYER(self))
                PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives());
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(lms_PlayerPreSpawn)
@@ -43,14 +43,14 @@ MUTATOR_HOOKFUNCTION(lms_PlayerPreSpawn)
        if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
                self.classname = "observer";
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(lms_PlayerDies)
 {
        self.respawn_flags |= RESPAWN_FORCE;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(lms_RemovePlayer)
@@ -67,7 +67,7 @@ MUTATOR_HOOKFUNCTION(lms_RemovePlayer)
                else
                        Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_LMS_FORFEIT, self.netname);
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(lms_ClientConnect)
@@ -81,7 +81,7 @@ MUTATOR_HOOKFUNCTION(lms_ClientConnect)
                self.frags = FRAGS_SPECTATOR;
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(lms_PlayerThink)
@@ -89,20 +89,20 @@ MUTATOR_HOOKFUNCTION(lms_PlayerThink)
        if(self.deadflag == DEAD_DYING)
                self.deadflag = DEAD_RESPAWNING;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(lms_PlayerRegen)
 {
        if(autocvar_g_lms_regenerate)
-               return FALSE;
-       return TRUE;
+               return false;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(lms_ForbidThrowing)
 {
        // forbode!
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(lms_GiveFragsForKill)
@@ -123,7 +123,7 @@ MUTATOR_HOOKFUNCTION(lms_GiveFragsForKill)
        }
        frag_score = 0;
 
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(lms_SetStartItems)
@@ -138,13 +138,13 @@ MUTATOR_HOOKFUNCTION(lms_SetStartItems)
        start_ammo_plasma  = warmup_start_ammo_plasma  = cvar("g_lms_start_ammo_plasma");
        start_ammo_fuel    = warmup_start_ammo_fuel    = cvar("g_lms_start_ammo_fuel");
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(lms_KeepScore)
 {
        // don't clear player score
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(lms_FilterItem)
@@ -153,10 +153,10 @@ MUTATOR_HOOKFUNCTION(lms_FilterItem)
        if(self.classname == "item_health_mega")
        {
                self.max_health = 1;
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(lms_ItemTouch)
@@ -174,7 +174,7 @@ MUTATOR_HOOKFUNCTION(lms_ItemTouch)
 // scoreboard stuff
 void lms_ScoreRules()
 {
-       ScoreRules_basics(0, 0, 0, FALSE);
+       ScoreRules_basics(0, 0, 0, false);
        ScoreInfo_SetLabel_PlayerScore(SP_LMS_LIVES,    "lives",     SFL_SORT_PRIO_SECONDARY);
        ScoreInfo_SetLabel_PlayerScore(SP_LMS_RANK,     "rank",      SFL_LOWER_IS_BETTER | SFL_RANK | SFL_SORT_PRIO_PRIMARY | SFL_ALLOW_HIDE);
        ScoreRules_basics_end();
index 16fda61550823e6a098e27a2f47e1cfe2506550d..474e3e1977eed78b6bf7774333e4efdf0ff9e48e 100644 (file)
@@ -1,8 +1,12 @@
+#ifndef GAMEMODE_LMS_H
+#define GAMEMODE_LMS_H
+
 // scoreboard stuff
-#define SP_LMS_LIVES 4
-#define SP_LMS_RANK 5
+const float SP_LMS_LIVES = 4;
+const float SP_LMS_RANK = 5;
 
 // lives related defs
 float lms_lowest_lives;
 float lms_next_place;
-float LMS_NewPlayerLives();
\ No newline at end of file
+float LMS_NewPlayerLives();
+#endif
index 346ae1eee4493eed30b0649d18a2747d8d824e23..afdb769cf6b0c4025bc6e31f7f175f1557520982 100644 (file)
@@ -8,9 +8,9 @@ vector autocvar_g_nexball_viewmodel_offset;
 void basketball_touch();
 void football_touch();
 void ResetBall();
-#define NBM_NONE 0
-#define NBM_FOOTBALL 2
-#define NBM_BASKETBALL 4
+const float NBM_NONE = 0;
+const float NBM_FOOTBALL = 2;
+const float NBM_BASKETBALL = 4;
 float nexball_mode;
 
 float OtherTeam(float t)  //works only if there are two teams on the map!
@@ -22,12 +22,12 @@ float OtherTeam(float t)  //works only if there are two teams on the map!
        return e.team;
 }
 
-#define ST_NEXBALL_GOALS 1
-#define SP_NEXBALL_GOALS 4
-#define SP_NEXBALL_FAULTS 5
+const float ST_NEXBALL_GOALS = 1;
+const float SP_NEXBALL_GOALS = 4;
+const float SP_NEXBALL_FAULTS = 5;
 void nb_ScoreRules(float teams)
 {
-       ScoreRules_basics(teams, 0, 0, TRUE);
+       ScoreRules_basics(teams, 0, 0, true);
        ScoreInfo_SetLabel_TeamScore(   ST_NEXBALL_GOALS,  "goals", SFL_SORT_PRIO_PRIMARY);
        ScoreInfo_SetLabel_PlayerScore( SP_NEXBALL_GOALS,  "goals", SFL_SORT_PRIO_PRIMARY);
        ScoreInfo_SetLabel_PlayerScore(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER);
@@ -74,7 +74,7 @@ void nexball_setstatus(void)
 
 void relocate_nexball(void)
 {
-       tracebox(self.origin, BALL_MINS, BALL_MAXS, self.origin, TRUE, self);
+       tracebox(self.origin, BALL_MINS, BALL_MAXS, self.origin, true, self);
        if(trace_startsolid)
        {
                vector o;
@@ -82,9 +82,9 @@ void relocate_nexball(void)
                if(!move_out_of_solid(self))
                        objerror("could not get out of solid at all!");
                print("^1NOTE: this map needs FIXING. ", self.classname, " at ", vtos(o - '0 0 1'));
-               print(" needs to be moved out of solid, e.g. by '", ftos(self.origin_x - o_x));
-               print(" ", ftos(self.origin_y - o_y));
-               print(" ", ftos(self.origin_z - o_z), "'\n");
+               print(" needs to be moved out of solid, e.g. by '", ftos(self.origin.x - o.x));
+               print(" ", ftos(self.origin.y - o.y));
+               print(" ", ftos(self.origin.z - o.z), "'\n");
                self.origin = o;
        }
 }
@@ -94,7 +94,7 @@ void DropOwner(void)
        entity ownr;
        ownr = self.owner;
        DropBall(self, ownr.origin, ownr.velocity);
-       makevectors(ownr.v_angle_y * '0 1 0');
+       makevectors(ownr.v_angle.y * '0 1 0');
        ownr.velocity += ('0 0 0.75' - v_forward) * 1000;
        ownr.flags &= ~FL_ONGROUND;
 }
@@ -183,7 +183,7 @@ void DropBall(entity ball, vector org, vector vel)
        }
 
        WaypointSprite_Kill(ball.owner.waypointsprite_attachedforcarrier);
-       WaypointSprite_Spawn("nb-ball", 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, BALL_SPRITECOLOR); // no health bar please
+       WaypointSprite_Spawn("nb-ball", 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER, BALL_SPRITECOLOR); // no health bar please
        WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
 
        ball.owner.ballcarried = world;
@@ -204,7 +204,7 @@ void InitBall(void)
        self.nextthink = time + autocvar_g_nexball_delay_idle + 3;
        self.teamtime = 0;
        self.pusher = world;
-       self.team = FALSE;
+       self.team = false;
        sound(self, CH_TRIGGER, self.noise1, VOL_BASE, ATTEN_NORM);
        WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
        LogNB("init", world);
@@ -281,7 +281,7 @@ void football_touch(void)
        }
        else if(autocvar_g_nexball_football_physics == 2)         // 2nd mod try: totally independant. Really playable!
        {
-               makevectors(other.v_angle_y * '0 1 0');
+               makevectors(other.v_angle.y * '0 1 0');
                self.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up;
        }
        else     // Revenant's original style (from the original mod's disassembly, acknowledged by Revenant)
@@ -430,38 +430,38 @@ void nb_spawnteam(string teamname, float teamcolor)
 
 void nb_spawnteams(void)
 {
-       float t_r = 0, t_b = 0, t_y = 0, t_p = 0;
+       bool t_red = false, t_blue = false, t_yellow = false, t_pink = false;
        entity e;
        for(e = world; (e = find(e, classname, "nexball_goal"));)
        {
                switch(e.team)
                {
                case NUM_TEAM_1:
-                       if(!t_r)
+                       if(!t_red)
                        {
                                nb_spawnteam("Red", e.team-1)   ;
-                               t_r = 1;
+                               t_red = true;
                        }
                        break;
                case NUM_TEAM_2:
-                       if(!t_b)
+                       if(!t_blue)
                        {
                                nb_spawnteam("Blue", e.team-1)  ;
-                               t_b = 1;
+                               t_blue = true;
                        }
                        break;
                case NUM_TEAM_3:
-                       if(!t_y)
+                       if(!t_yellow)
                        {
                                nb_spawnteam("Yellow", e.team-1);
-                               t_y = 1;
+                               t_yellow = true;
                        }
                        break;
                case NUM_TEAM_4:
-                       if(!t_p)
+                       if(!t_pink)
                        {
                                nb_spawnteam("Pink", e.team-1)  ;
-                               t_p = 1;
+                               t_pink = true;
                        }
                        break;
                }
@@ -505,7 +505,7 @@ void SpawnBall(void)
        if(cvar(strcat("g_", self.classname, "_trail")))  //nexball_basketball :p
        {
                self.glow_color = autocvar_g_nexball_trail_color;
-               self.glow_trail = TRUE;
+               self.glow_trail = true;
        }
 
        self.movetype = MOVETYPE_FLY;
@@ -571,9 +571,9 @@ float nb_Goal_Customize()
        entity e, wp_owner;
        e = WaypointSprite_getviewentity(other);
        wp_owner = self.owner;
-       if(SAME_TEAM(e, wp_owner)) { return FALSE; }
+       if(SAME_TEAM(e, wp_owner)) { return false; }
 
-       return TRUE;
+       return true;
 }
 
 void SpawnGoal(void)
@@ -724,7 +724,7 @@ void W_Nexball_Attack(float t)
        if(!(ball = self.ballcarried))
                return;
 
-       W_SetupShot(self, FALSE, 4, "nexball/shoot1.wav", CH_WEAPON_A, 0);
+       W_SetupShot(self, false, 4, "nexball/shoot1.wav", CH_WEAPON_A, 0);
        tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, world);
        if(trace_startsolid)
        {
@@ -747,7 +747,7 @@ void W_Nexball_Attack(float t)
                mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
        }
 
-       DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(self.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, FALSE));
+       DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(self.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
 
 
        //TODO: use the speed_up cvar too ??
@@ -758,7 +758,7 @@ void W_Nexball_Attack2(void)
        if(self.ballcarried.enemy)
        {
                entity _ball = self.ballcarried;
-               W_SetupShot(self, FALSE, 4, "nexball/shoot1.wav", CH_WEAPON_A, 0);
+               W_SetupShot(self, false, 4, "nexball/shoot1.wav", CH_WEAPON_A, 0);
                DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
                _ball.think = W_Nexball_Think;
                _ball.nextthink = time;
@@ -771,7 +771,7 @@ void W_Nexball_Attack2(void)
        entity missile;
        if(!(balls & BALL_BASKET))
                return;
-       W_SetupShot(self, FALSE, 2, "nexball/shoot2.wav", CH_WEAPON_A, 0);
+       W_SetupShot(self, false, 2, "nexball/shoot2.wav", CH_WEAPON_A, 0);
 //     pointparticles(particleeffectnum("grenadelauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
        missile = spawn();
 
@@ -794,7 +794,7 @@ void W_Nexball_Attack2(void)
        missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
        missile.flags = FL_PROJECTILE;
 
-       CSQCProjectile(missile, TRUE, PROJECTILE_ELECTRO, TRUE);
+       CSQCProjectile(missile, true, PROJECTILE_ELECTRO, true);
 }
 
 float ball_customize()
@@ -804,7 +804,7 @@ float ball_customize()
                self.effects &= ~EF_FLAME;
                self.scale = 1;
                self.customizeentityforclient = func_null;
-               return TRUE;
+               return true;
        }
 
        if(other == self.owner)
@@ -821,7 +821,7 @@ float ball_customize()
                self.scale = 1;
        }
 
-       return TRUE;
+       return true;
 }
 
 float w_nexball_weapon(float req)
@@ -870,8 +870,8 @@ float w_nexball_weapon(float req)
        {
                //weapon_setup(WEP_PORTO);
        }
-       // No need to check WR_CHECKAMMO* or WR_AIM, it should always return TRUE
-       return TRUE;
+       // No need to check WR_CHECKAMMO* or WR_AIM, it should always return true
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(nexball_BallDrop)
@@ -894,9 +894,9 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
                        self.ballcarried.customizeentityforclient = ball_customize;
 
                        setorigin(self.ballcarried, self.origin + self.view_ofs +
-                                         v_forward * autocvar_g_nexball_viewmodel_offset_x +
-                                         v_right * autocvar_g_nexball_viewmodel_offset_y +
-                                         v_up * autocvar_g_nexball_viewmodel_offset_z);
+                                         v_forward * autocvar_g_nexball_viewmodel_offset.x +
+                                         v_right * autocvar_g_nexball_viewmodel_offset.y +
+                                         v_up * autocvar_g_nexball_viewmodel_offset.z);
 
                        // 'safe passing'
                        if(autocvar_g_nexball_safepass_maxdist)
@@ -943,7 +943,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
 
        nexball_setstatus();
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn)
@@ -955,7 +955,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn)
        else
                self.weapons = '0 0 0';
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nexball_PlayerPhysics)
@@ -965,31 +965,31 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPhysics)
                self.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed;
                self.stat_sv_maxspeed *= autocvar_g_nexball_basketball_carrier_highspeed;
        }
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nexball_SetStartItems)
 {
        start_items |= IT_UNLIMITED_SUPERWEAPONS; // FIXME BAD BAD BAD BAD HACK, NEXBALL SHOULDN'T ABUSE PORTO'S WEAPON SLOT
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing)
 {
        if(self.weapon == WEP_MORTAR)
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nexball_FilterItem)
 {
        if(self.classname == "droppedweapon")
        if(self.weapon == WEP_MORTAR)
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_DEFINITION(gamemode_nexball)
index 4b0b7eaa15c67a3dd686ce2e00474803730684a8..199e15c3befe5590e21887e5d62667a5961ec4ed 100644 (file)
@@ -1,16 +1,19 @@
+#ifndef GAMEMODE_NEXBALL_H
+#define GAMEMODE_NEXBALL_H
+
 //EF_BRIGHTFIELD|EF_BRIGHTLIGHT|EF_DIMLIGHT|EF_BLUE|EF_RED|EF_FLAME
-#define BALL_EFFECTMASK 1229
-#define BALL_MINS '-16 -16 -16'  // The model is 24*24*24
-#define BALL_MAXS '16 16 16'
-#define BALL_ATTACHORG '3 0 16'
-#define BALL_SPRITECOLOR '.91 .85 .62'
-#define BALL_FOOT   1
-#define BALL_BASKET 2
+const float BALL_EFFECTMASK = 1229;
+const vector BALL_MINS = '-16 -16 -16'; // The model is 24*24*24
+const vector BALL_MAXS = '16 16 16';
+const vector BALL_ATTACHORG = '3 0 16';
+const vector BALL_SPRITECOLOR = '0.91 0.85 0.62';
+const float BALL_FOOT = 1;
+const float BALL_BASKET = 2;
 //spawnflags
-#define GOAL_TOUCHPLAYER 1
+const float GOAL_TOUCHPLAYER = 1;
 //goal types
-#define GOAL_FAULT -1
-#define GOAL_OUT -2
+const float GOAL_FAULT = -1;
+const float GOAL_OUT = -2;
 
 void DropBall(entity ball, vector org, vector vel);
 float autocvar_g_nexball_football_boost_forward;
@@ -31,3 +34,4 @@ float nb_teams;
 .float nb_droptime;
 
 .float teamtime;
+#endif
index 6fd120cd2179b2d47c23cf18eb61a120b4c4d1f9..9ad119166dd6b15374b5c327e2449beb944b43e6 100644 (file)
@@ -1,8 +1,8 @@
 float autocvar_g_onslaught_spawn_at_controlpoints;
 float autocvar_g_onslaught_spawn_at_generator;
 float autocvar_g_onslaught_cp_proxydecap;
-var float autocvar_g_onslaught_cp_proxydecap_distance = 512;
-var float autocvar_g_onslaught_cp_proxydecap_dps = 100;
+float autocvar_g_onslaught_cp_proxydecap_distance = 512;
+float autocvar_g_onslaught_cp_proxydecap_dps = 100;
 
 void onslaught_generator_updatesprite(entity e);
 void onslaught_controlpoint_updatesprite(entity e);
@@ -102,12 +102,12 @@ void onslaught_updatelinks()
        l = findchain(classname, "onslaught_controlpoint");
        while (l)
        {
-               l.islinked = FALSE;
-               l.isshielded = TRUE;
-               l.isgenneighbor_red = FALSE;
-               l.isgenneighbor_blue = FALSE;
-               l.iscpneighbor_red = FALSE;
-               l.iscpneighbor_blue = FALSE;
+               l.islinked = false;
+               l.isshielded = true;
+               l.isgenneighbor_red = false;
+               l.isgenneighbor_blue = false;
+               l.iscpneighbor_red = false;
+               l.iscpneighbor_blue = false;
                dprint(etos(l), " (point) belongs to team ", ftos(l.team), "\n");
                l = l.chain;
        }
@@ -118,10 +118,10 @@ void onslaught_updatelinks()
                dprint(etos(l), " (link) connects ", etos(l.goalentity), " with ", etos(l.enemy), "\n");
                l = l.chain;
        }
-       stop = FALSE;
+       stop = false;
        while (!stop)
        {
-               stop = TRUE;
+               stop = true;
                l = links;
                while (l)
                {
@@ -133,14 +133,14 @@ void onslaught_updatelinks()
                                        {
                                                if (!l.goalentity.islinked)
                                                {
-                                                       stop = FALSE;
-                                                       l.goalentity.islinked = TRUE;
+                                                       stop = false;
+                                                       l.goalentity.islinked = true;
                                                        dprint(etos(l), " (link) is marking ", etos(l.goalentity), " (point) because its team matches ", etos(l.enemy), " (point)\n");
                                                }
                                                else if (!l.enemy.islinked)
                                                {
-                                                       stop = FALSE;
-                                                       l.enemy.islinked = TRUE;
+                                                       stop = false;
+                                                       l.enemy.islinked = true;
                                                        dprint(etos(l), " (link) is marking ", etos(l.enemy), " (point) because its team matches ", etos(l.goalentity), " (point)\n");
                                                }
                                        }
@@ -157,21 +157,21 @@ void onslaught_updatelinks()
                        if (l.goalentity.team != l.enemy.team)
                        {
                                dprint(etos(l), " (link) is unshielding ", etos(l.enemy), " (point) because its team does not match ", etos(l.goalentity), " (point)\n");
-                               l.enemy.isshielded = FALSE;
+                               l.enemy.isshielded = false;
                        }
                        if(l.goalentity.classname == "onslaught_generator")
                        {
                                if(l.goalentity.team == NUM_TEAM_1)
-                                       l.enemy.isgenneighbor_red = TRUE;
+                                       l.enemy.isgenneighbor_red = true;
                                else if(l.goalentity.team == NUM_TEAM_2)
-                                       l.enemy.isgenneighbor_blue = TRUE;
+                                       l.enemy.isgenneighbor_blue = true;
                        }
                        else
                        {
                                if(l.goalentity.team == NUM_TEAM_1)
-                                       l.enemy.iscpneighbor_red = TRUE;
+                                       l.enemy.iscpneighbor_red = true;
                                else if(l.goalentity.team == NUM_TEAM_2)
-                                       l.enemy.iscpneighbor_blue = TRUE;
+                                       l.enemy.iscpneighbor_blue = true;
                        }
                }
                if (l.enemy.islinked)
@@ -179,21 +179,21 @@ void onslaught_updatelinks()
                        if (l.goalentity.team != l.enemy.team)
                        {
                                dprint(etos(l), " (link) is unshielding ", etos(l.goalentity), " (point) because its team does not match ", etos(l.enemy), " (point)\n");
-                               l.goalentity.isshielded = FALSE;
+                               l.goalentity.isshielded = false;
                        }
                        if(l.enemy.classname == "onslaught_generator")
                        {
                                if(l.enemy.team == NUM_TEAM_1)
-                                       l.goalentity.isgenneighbor_red = TRUE;
+                                       l.goalentity.isgenneighbor_red = true;
                                else if(l.enemy.team == NUM_TEAM_2)
-                                       l.goalentity.isgenneighbor_blue = TRUE;
+                                       l.goalentity.isgenneighbor_blue = true;
                        }
                        else
                        {
                                if(l.enemy.team == NUM_TEAM_1)
-                                       l.goalentity.iscpneighbor_red = TRUE;
+                                       l.goalentity.iscpneighbor_red = true;
                                else if(l.enemy.team == NUM_TEAM_2)
-                                       l.goalentity.iscpneighbor_blue = TRUE;
+                                       l.goalentity.iscpneighbor_blue = true;
                        }
                }
                l = l.chain;
@@ -207,14 +207,14 @@ void onslaught_updatelinks()
                        dprint(etos(l), " (generator) is shielded\n");
                        l.enemy.alpha = 1;
                        l.takedamage = DAMAGE_NO;
-                       l.bot_attack = FALSE;
+                       l.bot_attack = false;
                }
                else
                {
                        dprint(etos(l), " (generator) is not shielded\n");
                        l.enemy.alpha = -1;
                        l.takedamage = DAMAGE_AIM;
-                       l.bot_attack = TRUE;
+                       l.bot_attack = true;
                }
                l = l.chain;
        }
@@ -229,7 +229,7 @@ void onslaught_updatelinks()
                        if (l.goalentity)
                        {
                                l.goalentity.takedamage = DAMAGE_NO;
-                               l.goalentity.bot_attack = FALSE;
+                               l.goalentity.bot_attack = false;
                        }
                }
                else
@@ -239,7 +239,7 @@ void onslaught_updatelinks()
                        if (l.goalentity)
                        {
                                l.goalentity.takedamage = DAMAGE_AIM;
-                               l.goalentity.bot_attack = TRUE;
+                               l.goalentity.bot_attack = true;
                        }
                }
                onslaught_controlpoint_updatesprite(l);
@@ -524,11 +524,11 @@ void onslaught_generator_deaththink()
        {
                i = random();
                if(i < 0.3)
-                       ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 11 + '0 0 20', "models/onslaught/gen_gib1.md3", 6, TRUE);
+                       ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 11 + '0 0 20', "models/onslaught/gen_gib1.md3", 6, true);
                else if(i > 0.7)
-                       ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 12 + '0 0 20', "models/onslaught/gen_gib2.md3", 6, TRUE);
+                       ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 12 + '0 0 20', "models/onslaught/gen_gib2.md3", 6, true);
                else
-                       ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 13 + '0 0 20', "models/onslaught/gen_gib3.md3", 6, TRUE);
+                       ons_throwgib(self.origin + '0 0 40', (100 * randomvec() - '1 1 1') * 13 + '0 0 20', "models/onslaught/gen_gib3.md3", 6, true);
        }
 
        // Spawn fire balls
@@ -623,9 +623,9 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage,
                        t = Team_ColoredFullName(attacker.team);
                        bprint(Team_ColoredFullName(self.team), " generator destroyed by ", t, "!\n");
                }
-               self.iscaptured = FALSE;
-               self.islinked = FALSE;
-               self.isshielded = FALSE;
+               self.iscaptured = false;
+               self.islinked = false;
+               self.isshielded = false;
                self.takedamage = DAMAGE_NO; // can't be hurt anymore
                self.event_damage = func_null; // won't do anything if hurt
                self.count = 0; // reset counter
@@ -666,11 +666,11 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage,
                sound(self, CH_TRIGGER, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
                i = random();
                if(i < 0.3)
-                       ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib1.md3", 5, TRUE);
+                       ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib1.md3", 5, true);
                else if(i > 0.7)
-                       ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib2.md3", 5, TRUE);
+                       ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib2.md3", 5, true);
                else
-                       ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib3.md3", 5, TRUE);
+                       ons_throwgib(hitloc + '0 0 20', force * -1, "models/onslaught/gen_gib3.md3", 5, true);
        }
        else
        {
@@ -687,7 +687,7 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage,
        //throw some gibs on damage
        if(random() < damage/200+0.2)
                if(random() < 0.5)
-                       ons_throwgib(hitloc + '0 0 20', randomvec()*360, "models/onslaught/gen_gib1.md3", 5, FALSE);
+                       ons_throwgib(hitloc + '0 0 20', randomvec()*360, "models/onslaught/gen_gib1.md3", 5, false);
 }
 
 // update links after a delay
@@ -732,14 +732,14 @@ void onslaught_generator_updatesprite(entity e)
                if(e.lastshielded)
                {
                        if(e.team == NUM_TEAM_1 || e.team == NUM_TEAM_2)
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, FALSE));
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, false));
                        else
                                WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5');
                }
                else
                {
                        if(e.team == NUM_TEAM_1 || e.team == NUM_TEAM_2)
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, FALSE));
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, false));
                        else
                                WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75');
                }
@@ -819,14 +819,14 @@ void onslaught_controlpoint_updatesprite(entity e)
                if(e.lastshielded)
                {
                        if(e.team == NUM_TEAM_1 || e.team == NUM_TEAM_2)
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, FALSE));
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, false));
                        else
                                WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5');
                }
                else
                {
                        if(e.team == NUM_TEAM_1 || e.team == NUM_TEAM_2)
-                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, FALSE));
+                               WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, false));
                        else
                                WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75');
                }
@@ -843,10 +843,10 @@ void onslaught_generator_reset()
        self.team = self.team_saved;
        self.lasthealth = self.max_health = self.health = autocvar_g_onslaught_gen_health;
        self.takedamage = DAMAGE_AIM;
-       self.bot_attack = TRUE;
-       self.iscaptured = TRUE;
-       self.islinked = TRUE;
-       self.isshielded = TRUE;
+       self.bot_attack = true;
+       self.iscaptured = true;
+       self.islinked = true;
+       self.isshielded = true;
        self.enemy.solid = SOLID_NOT;
        self.think = onslaught_generator_delayed;
        self.nextthink = time + 0.2;
@@ -925,11 +925,11 @@ void spawnfunc_onslaught_generator()
        setsize(self, '-52 -52 -14', '52 52 75');
        setorigin(self, self.origin);
        self.takedamage = DAMAGE_AIM;
-       self.bot_attack = TRUE;
+       self.bot_attack = true;
        self.event_damage = onslaught_generator_damage;
-       self.iscaptured = TRUE;
-       self.islinked = TRUE;
-       self.isshielded = TRUE;
+       self.iscaptured = true;
+       self.islinked = true;
+       self.isshielded = true;
        // helper entity that create fx when generator is damaged
        onslaught_generator_damage_spawn(self);
        // spawn shield model which indicates whether this can be damaged
@@ -987,12 +987,12 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float
 
        if (IS_PLAYER(attacker))
        {
-               nag = FALSE;
+               nag = false;
                if(self.team == NUM_TEAM_1)
                {
                        if(time - ons_notification_time_team1 > 10)
                        {
-                               nag = TRUE;
+                               nag = true;
                                ons_notification_time_team1 = time;
                        }
                }
@@ -1000,12 +1000,12 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float
                {
                        if(time - ons_notification_time_team2 > 10)
                        {
-                               nag = TRUE;
+                               nag = true;
                                ons_notification_time_team2 = time;
                        }
                }
                else
-                       nag = TRUE;
+                       nag = true;
 
                if(nag)
                        play2team(self.team, "onslaught/controlpoint_underattack.wav");
@@ -1037,17 +1037,17 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float
                        string t;
                        t = Team_ColoredFullName(attacker.team);
                        bprint(Team_ColoredFullName(self.team), " ", self.message, " control point destroyed by ", t, "\n");
-                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 25, "models/onslaught/controlpoint_icon_gib1.md3", 3, FALSE);
-                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 3, FALSE);
-                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 3, FALSE);
-                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, FALSE);
-                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, FALSE);
-                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, FALSE);
-                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, FALSE);
+                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 25, "models/onslaught/controlpoint_icon_gib1.md3", 3, false);
+                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 3, false);
+                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 45, "models/onslaught/controlpoint_icon_gib2.md3", 3, false);
+                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, false);
+                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, false);
+                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, false);
+                       ons_throwgib(self.origin, (2 * randomvec() - '1 1 1') * 75, "models/onslaught/controlpoint_icon_gib4.md3", 3, false);
                }
                self.owner.goalentity = world;
-               self.owner.islinked = FALSE;
-               self.owner.iscaptured = FALSE;
+               self.owner.islinked = false;
+               self.owner.iscaptured = false;
                self.owner.team = 0;
                self.owner.colormap = 1024;
 
@@ -1150,54 +1150,54 @@ void onslaught_controlpoint_icon_think()
                self.owner.waslinked = self.owner.islinked;
        }
 
-       if (self.punchangle_x > 0)
+       if (self.punchangle.x > 0)
        {
-               self.punchangle_x = self.punchangle_x - 60 * sys_frametime;
-               if (self.punchangle_x < 0)
+               self.punchangle_x = self.punchangle.x - 60 * sys_frametime;
+               if (self.punchangle.x < 0)
                        self.punchangle_x = 0;
        }
-       else if (self.punchangle_x < 0)
+       else if (self.punchangle.x < 0)
        {
-               self.punchangle_x = self.punchangle_x + 60 * sys_frametime;
-               if (self.punchangle_x > 0)
+               self.punchangle_x = self.punchangle.x + 60 * sys_frametime;
+               if (self.punchangle.x > 0)
                        self.punchangle_x = 0;
        }
 
-       if (self.punchangle_y > 0)
+       if (self.punchangle.y > 0)
        {
-               self.punchangle_y = self.punchangle_y - 60 * sys_frametime;
-               if (self.punchangle_y < 0)
+               self.punchangle_y = self.punchangle.y - 60 * sys_frametime;
+               if (self.punchangle.y < 0)
                        self.punchangle_y = 0;
        }
-       else if (self.punchangle_y < 0)
+       else if (self.punchangle.y < 0)
        {
-               self.punchangle_y = self.punchangle_y + 60 * sys_frametime;
-               if (self.punchangle_y > 0)
+               self.punchangle_y = self.punchangle.y + 60 * sys_frametime;
+               if (self.punchangle.y > 0)
                        self.punchangle_y = 0;
        }
 
-       if (self.punchangle_z > 0)
+       if (self.punchangle.z > 0)
        {
-               self.punchangle_z = self.punchangle_z - 60 * sys_frametime;
-               if (self.punchangle_z < 0)
+               self.punchangle_z = self.punchangle.z - 60 * sys_frametime;
+               if (self.punchangle.z < 0)
                        self.punchangle_z = 0;
        }
-       else if (self.punchangle_z < 0)
+       else if (self.punchangle.z < 0)
        {
-               self.punchangle_z = self.punchangle_z + 60 * sys_frametime;
-               if (self.punchangle_z > 0)
+               self.punchangle_z = self.punchangle.z + 60 * sys_frametime;
+               if (self.punchangle.z > 0)
                        self.punchangle_z = 0;
        }
 
-       self.angles_x = self.punchangle_x;
-       self.angles_y = self.punchangle_y + self.mangle_y;
-       self.angles_z = self.punchangle_z;
-       self.mangle_y = self.mangle_y + 45 * sys_frametime;
+       self.angles_x = self.punchangle.x;
+       self.angles_y = self.punchangle.y + self.mangle.y;
+       self.angles_z = self.punchangle.z;
+       self.mangle_y = self.mangle.y + 45 * sys_frametime;
 
        self.cp_bob_origin_z = 4 * PI * (1 - cos(self.cp_bob_spd));
        self.cp_bob_spd = self.cp_bob_spd + 1.875 * sys_frametime;
-       if(self.cp_bob_dmg_z > 0)
-               self.cp_bob_dmg_z = self.cp_bob_dmg_z - 3 * sys_frametime;
+       if(self.cp_bob_dmg.z > 0)
+               self.cp_bob_dmg_z = self.cp_bob_dmg.z - 3 * sys_frametime;
        else
                self.cp_bob_dmg_z = 0;
        setorigin(self,self.cp_origin + self.cp_bob_origin + self.cp_bob_dmg);
@@ -1235,7 +1235,7 @@ void onslaught_controlpoint_icon_buildthink()
                self.think = onslaught_controlpoint_icon_think;
                sound(self, CH_TRIGGER, "onslaught/controlpoint_built.wav", VOL_BASE, ATTEN_NORM);
                bprint(Team_ColoredFullName(self.team), " captured ", self.owner.message, " control point\n");
-               self.owner.iscaptured = TRUE;
+               self.owner.iscaptured = true;
 
                WaypointSprite_UpdateMaxHealth(self.owner.sprite, self.max_health);
                WaypointSprite_UpdateHealth(self.owner.sprite, self.health);
@@ -1289,7 +1289,7 @@ void onslaught_controlpoint_touch()
        setsize(e, '-32 -32 -32', '32 32 32');
        setorigin(e, self.origin + '0 0 96');
        e.takedamage = DAMAGE_AIM;
-       e.bot_attack = TRUE;
+       e.bot_attack = true;
        e.event_damage = onslaught_controlpoint_icon_damage;
        e.team = other.team;
        e.colormap = 1024 + (e.team - 1) * 17;
@@ -1316,9 +1316,9 @@ void onslaught_controlpoint_reset()
        self.goalentity = world;
        self.team = 0;
        self.colormap = 1024;
-       self.iscaptured = FALSE;
-       self.islinked = FALSE;
-       self.isshielded = TRUE;
+       self.iscaptured = false;
+       self.islinked = false;
+       self.isshielded = true;
        self.enemy.solid = SOLID_NOT;
        self.enemy.colormap = self.colormap;
        self.think = onslaught_controlpoint_think;
@@ -1333,7 +1333,7 @@ void onslaught_controlpoint_reset()
 
        activator = self;
        SUB_UseTargets(); // to reset the structures, playerspawns etc.
-       
+
        CSQCMODEL_AUTOUPDATE();
 }
 
@@ -1386,9 +1386,9 @@ void spawnfunc_onslaught_controlpoint()
        self.touch = onslaught_controlpoint_touch;
        self.team = 0;
        self.colormap = 1024;
-       self.iscaptured = FALSE;
-       self.islinked = FALSE;
-       self.isshielded = TRUE;
+       self.iscaptured = false;
+       self.islinked = false;
+       self.isshielded = true;
 
        // spawn shield model which indicates whether this can be damaged
        self.enemy = spawn();
@@ -1405,7 +1405,7 @@ void spawnfunc_onslaught_controlpoint()
        self.enemy.colormap = self.colormap;
 
        waypoint_spawnforitem(self);
-       
+
        self.think = onslaught_controlpoint_think;
        self.nextthink = time;
 
@@ -1415,7 +1415,7 @@ void spawnfunc_onslaught_controlpoint()
        onslaught_updatelinks();
 
        self.reset = onslaught_controlpoint_reset;
-       
+
        CSQCMODEL_AUTOINIT();
 }
 
@@ -1425,21 +1425,21 @@ float onslaught_link_send(entity to, float sendflags)
        WriteByte(MSG_ENTITY, sendflags);
        if(sendflags & 1)
        {
-               WriteCoord(MSG_ENTITY, self.goalentity.origin_x);
-               WriteCoord(MSG_ENTITY, self.goalentity.origin_y);
-               WriteCoord(MSG_ENTITY, self.goalentity.origin_z);
+               WriteCoord(MSG_ENTITY, self.goalentity.origin.x);
+               WriteCoord(MSG_ENTITY, self.goalentity.origin.y);
+               WriteCoord(MSG_ENTITY, self.goalentity.origin.z);
        }
        if(sendflags & 2)
        {
-               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.origin.x);
+               WriteCoord(MSG_ENTITY, self.enemy.origin.y);
+               WriteCoord(MSG_ENTITY, self.enemy.origin.z);
        }
        if(sendflags & 4)
        {
                WriteByte(MSG_ENTITY, self.clientcolors); // which is goalentity's color + enemy's color * 16
        }
-       return TRUE;
+       return true;
 }
 
 void onslaught_link_checkupdate()
@@ -1520,7 +1520,7 @@ void spawnfunc_onslaught_link()
        if (self.target == "" || self.target2 == "")
                objerror("target and target2 must be set\n");
        InitializeEntity(self, onslaught_link_delayed, INITPRIO_FINDTARGET);
-       Net_LinkEntity(self, FALSE, 0, onslaught_link_send);
+       Net_LinkEntity(self, false, 0, onslaught_link_send);
 }
 
 MUTATOR_HOOKFUNCTION(ons_BuildMutatorsString)
@@ -1539,7 +1539,7 @@ MUTATOR_HOOKFUNCTION(ons_Spawn_Score)
 {
 
     /*
-    float _neer_home = (random() > 0.5 ? TRUE : FALSE);
+    float _neer_home = (random() > 0.5 ? true : false);
 
        RandomSelection_Init();
 
@@ -1579,7 +1579,7 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
     if(random() < 0.5)  // 50/50 chane to use default spawnsystem.
         return 0;
 
-    float _close_to_home = ((random() > 0.5) ? TRUE : FALSE);
+    float _close_to_home = ((random() > 0.5) ? true : false);
     entity _best = world, _trg_gen = world;
     float _score, _best_score = MAX_SHOT_DISTANCE;
 
@@ -1686,13 +1686,13 @@ MUTATOR_HOOKFUNCTION(ons_MonsterThink)
        if (e != world)
                self.team = e.team;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ons_MonsterSpawn)
 {
        entity e, ee = world;
-       
+
        if(self.targetname)
        {
                e = find(world,target,self.targetname);
@@ -1700,7 +1700,7 @@ MUTATOR_HOOKFUNCTION(ons_MonsterSpawn)
         self.use();
     }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_DEFINITION(gamemode_onslaught)
index da5ca4c10e9d23a89f347f3f6e5c306902144e18..7ba8328469765b40513ba9160aceb139b2bf3873 100644 (file)
@@ -29,7 +29,7 @@ void havocbot_role_race()
 
 void race_ScoreRules()
 {
-       ScoreRules_basics(race_teams, 0, 0, FALSE);
+       ScoreRules_basics(race_teams, 0, 0, false);
        if(race_teams)
        {
                ScoreInfo_SetLabel_TeamScore(  ST_RACE_LAPS,    "laps",      SFL_SORT_PRIO_PRIMARY);
@@ -66,26 +66,26 @@ MUTATOR_HOOKFUNCTION(race_PlayerPhysics)
        // ensure nothing EVIL is being done (i.e. div0_evade)
        // this hinders joystick users though
        // but it still gives SOME analog control
-       wishvel_x = fabs(self.movement_x);
-       wishvel_y = fabs(self.movement_y);
-       if(wishvel_x != 0 && wishvel_y != 0 && wishvel_x != wishvel_y)
+       wishvel.x = fabs(self.movement.x);
+       wishvel.y = fabs(self.movement.y);
+       if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y)
        {
-               wishvel_z = 0;
+               wishvel.z = 0;
                wishspeed = vlen(wishvel);
-               if(wishvel_x >= 2 * wishvel_y)
+               if(wishvel.x >= 2 * wishvel.y)
                {
                        // pure X motion
-                       if(self.movement_x > 0)
+                       if(self.movement.x > 0)
                                self.movement_x = wishspeed;
                        else
                                self.movement_x = -wishspeed;
                        self.movement_y = 0;
                }
-               else if(wishvel_y >= 2 * wishvel_x)
+               else if(wishvel.y >= 2 * wishvel.x)
                {
                        // pure Y motion
                        self.movement_x = 0;
-                       if(self.movement_y > 0)
+                       if(self.movement.y > 0)
                                self.movement_y = wishspeed;
                        else
                                self.movement_y = -wishspeed;
@@ -93,18 +93,18 @@ MUTATOR_HOOKFUNCTION(race_PlayerPhysics)
                else
                {
                        // diagonal
-                       if(self.movement_x > 0)
+                       if(self.movement.x > 0)
                                self.movement_x = M_SQRT1_2 * wishspeed;
                        else
                                self.movement_x = -M_SQRT1_2 * wishspeed;
-                       if(self.movement_y > 0)
+                       if(self.movement.y > 0)
                                self.movement_y = M_SQRT1_2 * wishspeed;
                        else
                                self.movement_y = -M_SQRT1_2 * wishspeed;
                }
        }
-       
-       return FALSE;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(race_ResetMap)
@@ -137,8 +137,8 @@ MUTATOR_HOOKFUNCTION(race_ResetMap)
                cvar_set("timelimit", ftos(race_timelimit));
                race_ScoreRules();
        }
-       
-       return FALSE;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(race_PlayerPreThink)
@@ -148,7 +148,7 @@ MUTATOR_HOOKFUNCTION(race_PlayerPreThink)
        if(msg_entity.enemy.race_laptime)
                race_SendNextCheckpoint(msg_entity.enemy, 1);
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(race_ClientConnect)
@@ -175,7 +175,7 @@ MUTATOR_HOOKFUNCTION(race_ClientConnect)
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(race_MakePlayerObserver)
@@ -189,7 +189,7 @@ MUTATOR_HOOKFUNCTION(race_MakePlayerObserver)
        race_PreparePlayer();
        self.race_checkpoint = -1;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(race_PlayerSpawn)
@@ -203,8 +203,8 @@ MUTATOR_HOOKFUNCTION(race_PlayerSpawn)
        self.race_respawn_spotref = spawn_spot;
 
        self.race_place = 0;
-       
-       return FALSE;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(race_PutClientInServer)
@@ -219,20 +219,20 @@ MUTATOR_HOOKFUNCTION(race_PutClientInServer)
 
                race_AbandonRaceCheck(self);
        }
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(race_PlayerDies)
 {
        self.respawn_flags |= RESPAWN_FORCE;
        race_AbandonRaceCheck(self);
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(race_BotRoles)
 {
        self.havocbot_role = havocbot_role_race;
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(race_PlayerPostThink)
@@ -249,21 +249,21 @@ MUTATOR_HOOKFUNCTION(race_PlayerPostThink)
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(race_ForbidClearPlayerScore)
 {
        if(g_race_qualifying)
-               return TRUE; // in qualifying, you don't lose score by observing
+               return true; // in qualifying, you don't lose score by observing
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(race_GetTeamCount)
 {
        ret_float = race_teams;
-       return FALSE;
+       return false;
 }
 
 void race_Initialize()
index 32829a25c9166bd70905b5785f75c4067ca007e5..0e20b9b57a06bdd47ded366efcba576b4e08356f 100644 (file)
@@ -1,8 +1,12 @@
+#ifndef GAMEMODE_RACE_H
+#define GAMEMODE_RACE_H
+
 float g_race_qualifying;
 float race_teams;
 
 // scores
-#define ST_RACE_LAPS 1
-#define SP_RACE_LAPS 4
-#define SP_RACE_TIME 5
-#define SP_RACE_FASTEST 6
+const float ST_RACE_LAPS = 1;
+const float SP_RACE_LAPS = 4;
+const float SP_RACE_TIME = 5;
+const float SP_RACE_FASTEST = 6;
+#endif
index 59f0927e80c98e6d6307772a1425623a7ac7f626..de172873e29255af8f14c0c8ae972758519f5c60 100644 (file)
@@ -48,7 +48,7 @@ void tdm_DelayedInit()
 MUTATOR_HOOKFUNCTION(tdm_GetTeamCount)
 {
        ret_string = "tdm_team";
-       return TRUE;
+       return true;
 }
 
 MUTATOR_DEFINITION(gamemode_tdm)
index 4d990b3cf50608d151a22d771d8b660f54a790f5..08e14199ee3f4d460044f02f056cc2750b2692a0 100644 (file)
@@ -5,7 +5,7 @@ MUTATOR_HOOKFUNCTION(bloodloss_PlayerThink)
        if(IS_PLAYER(self))
        if(self.health <= autocvar_g_bloodloss && self.deadflag == DEAD_NO)
        {
-               self.BUTTON_CROUCH = TRUE;
+               self.BUTTON_CROUCH = true;
 
                if(time >= self.bloodloss_timer)
                {
@@ -14,27 +14,27 @@ MUTATOR_HOOKFUNCTION(bloodloss_PlayerThink)
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(bloodloss_PlayerJump)
 {
        if(self.health <= autocvar_g_bloodloss)
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(bloodloss_BuildMutatorsString)
 {
        ret_string = strcat(ret_string, ":bloodloss");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(bloodloss_BuildMutatorsPrettyString)
 {
        ret_string = strcat(ret_string, ", Blood loss");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_DEFINITION(mutator_bloodloss)
@@ -44,5 +44,5 @@ MUTATOR_DEFINITION(mutator_bloodloss)
        MUTATOR_HOOK(BuildMutatorsString, bloodloss_BuildMutatorsString, CBC_ORDER_ANY);
        MUTATOR_HOOK(BuildMutatorsPrettyString, bloodloss_BuildMutatorsPrettyString, CBC_ORDER_ANY);
 
-       return FALSE;
+       return false;
 }
index 765619df7e488305bc0222f0737d3bdb974c609f..b2f800a27e06c1228d541cbabc47ef221c04ae9d 100644 (file)
@@ -8,7 +8,7 @@ float buffs_BuffModel_Customize()
        same_team = (SAME_TEAM(player, myowner) || SAME_TEAM(player, myowner));
 
        if(myowner.alpha <= 0.5 && !same_team && myowner.alpha != 0)
-               return FALSE;
+               return false;
 
        if(player == myowner || (IS_SPEC(other) && other.enemy == myowner))
        {
@@ -21,24 +21,24 @@ float buffs_BuffModel_Customize()
                self.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
                self.alpha = 1;
        }
-       return TRUE;
+       return true;
 }
 
 // buff item
 float buff_Waypoint_visible_for_player(entity plr)
 {
     if(!self.owner.buff_active && !self.owner.buff_activetime)
-        return FALSE;
+        return false;
 
        if(plr.buffs)
        {
                if(plr.cvar_cl_buffs_autoreplace)
                {
                        if(plr.buffs == self.owner.buffs)
-                               return FALSE;
+                               return false;
                }
                else
-                       return FALSE;
+                       return false;
        }
 
     return WaypointSprite_visible_for_player(plr);
@@ -46,7 +46,7 @@ float buff_Waypoint_visible_for_player(entity plr)
 
 void buff_Waypoint_Spawn(entity e)
 {
-    WaypointSprite_Spawn(Buff_Sprite(e.buffs), 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs_z, world, e.team, e, buff_waypoint, TRUE, RADARICON_POWERUP, e.glowmod);
+    WaypointSprite_Spawn(Buff_Sprite(e.buffs), 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, world, e.team, e, buff_waypoint, true, RADARICON_POWERUP, e.glowmod);
     WaypointSprite_UpdateTeamRadar(e.buff_waypoint, RADARICON_POWERUP, e.glowmod);
     e.buff_waypoint.waypointsprite_visible_for_player = buff_Waypoint_visible_for_player;
 }
@@ -66,22 +66,22 @@ void buff_SetCooldown(float cd)
 void buff_Respawn(entity ent)
 {
        if(gameover) { return; }
-       
+
        vector oldbufforigin = ent.origin;
-       
+
        if(!MoveToRandomMapLocation(ent, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, ((autocvar_g_buffs_random_location_attempts > 0) ? autocvar_g_buffs_random_location_attempts : 10), 1024, 256))
        {
-               entity spot = SelectSpawnPoint(TRUE);
+               entity spot = SelectSpawnPoint(true);
                setorigin(ent, ((spot.origin + '0 0 200') + (randomvec() * 300)));
                ent.angles = spot.angles;
        }
-       
+
        tracebox(ent.origin, ent.mins * 1.5, self.maxs * 1.5, ent.origin, MOVE_NOMONSTERS, ent);
-       
+
        setorigin(ent, trace_endpos); // attempt to unstick
-       
+
        ent.movetype = MOVETYPE_TOSS;
-       
+
        makevectors(ent.angles);
        ent.velocity = '0 0 200';
        ent.angles = '0 0 0';
@@ -90,9 +90,9 @@ void buff_Respawn(entity ent)
 
        pointparticles(particleeffectnum("electro_combo"), oldbufforigin + ((ent.mins + ent.maxs) * 0.5), '0 0 0', 1);
        pointparticles(particleeffectnum("electro_combo"), CENTER_OR_VIEWOFS(ent), '0 0 0', 1);
-       
+
        WaypointSprite_Ping(ent.buff_waypoint);
-       
+
        sound(ent, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
 }
 
@@ -129,11 +129,11 @@ void buff_Touch()
                }
                else { return; } // do nothing
        }
-               
+
        self.owner = other;
-       self.buff_active = FALSE;
+       self.buff_active = false;
        self.lifetime = 0;
-       
+
        Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_BUFF_GOT, self.buffs);
        Send_Notification(NOTIF_ALL_EXCEPT, other, MSG_INFO, INFO_ITEM_BUFF, other.netname, self.buffs);
 
@@ -145,15 +145,15 @@ void buff_Touch()
 float buff_Available(float buffid)
 {
        if(buffid == BUFF_AMMO && ((start_items & IT_UNLIMITED_WEAPON_AMMO) || (start_items & IT_UNLIMITED_AMMO) || (cvar("g_melee_only"))))
-               return FALSE;
+               return false;
 
        if(buffid == BUFF_VAMPIRE && cvar("g_vampire"))
-               return FALSE;
+               return false;
 
        if(!cvar(strcat("g_buffs_", Buff_Name(buffid))))
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 void buff_NewType(entity ent, float cb)
@@ -176,7 +176,7 @@ void buff_Think()
                self.color = Buff_Color(self.buffs);
                self.glowmod = ((self.team) ? Team_ColorRGB(self.team) + '0.1 0.1 0.1' : self.color);
                self.skin = Buff_Skin(self.buffs);
-               
+
                setmodel(self, "models/relics/relic.md3");
 
                if(self.buff_waypoint)
@@ -196,7 +196,7 @@ void buff_Think()
        if(!self.buff_activetime_updated)
        {
                buff_SetCooldown(self.buff_activetime);
-               self.buff_activetime_updated = TRUE;
+               self.buff_activetime_updated = true;
     }
 
        if(!self.buff_active && !self.buff_activetime)
@@ -206,11 +206,11 @@ void buff_Think()
                self.owner = world;
                if(autocvar_g_buffs_randomize)
                        buff_NewType(self, self.buffs);
-                       
+
                if(autocvar_g_buffs_random_location || (self.spawnflags & 1))
                        buff_Respawn(self);
        }
-       
+
        if(self.buff_activetime)
        if(!gameover)
        if((round_handler_IsActive() && !round_handler_IsRoundStarted()) || time >= game_starttime)
@@ -219,7 +219,7 @@ void buff_Think()
 
                if(!self.buff_activetime)
                {
-                       self.buff_active = TRUE;
+                       self.buff_active = true;
                        sound(self, CH_TRIGGER, "misc/strength_respawn.wav", VOL_BASE, ATTN_NORM);
                        pointparticles(particleeffectnum("item_respawn"), CENTER_OR_VIEWOFS(self), '0 0 0', 1);
                }
@@ -240,12 +240,12 @@ void buff_Think()
 
                if(self.team && !self.buff_waypoint)
                        buff_Waypoint_Spawn(self);
-                       
+
                if(self.lifetime)
                if(time >= self.lifetime)
                        buff_Respawn(self);
        }
-    
+
        self.nextthink = time;
        //self.angles_y = time * 110.1;
 }
@@ -264,8 +264,8 @@ void buff_Reset()
        self.owner = world;
        buff_SetCooldown(autocvar_g_buffs_cooldown_activate);
        buff_Waypoint_Reset();
-       self.buff_activetime_updated = FALSE;
-       
+       self.buff_activetime_updated = false;
+
        if(autocvar_g_buffs_random_location || (self.spawnflags & 1))
                buff_Respawn(self);
 }
@@ -273,14 +273,14 @@ void buff_Reset()
 void buff_Init(entity ent)
 {
        if(!cvar("g_buffs")) { remove(self); return; }
-       
+
        if(!teamplay && self.team) { self.team = 0; }
 
        entity oldself = self;
        self = ent;
        if(!self.buffs || buff_Available(self.buffs))
                buff_NewType(self, 0);
-       
+
        self.classname = "item_buff";
        self.solid = SOLID_TRIGGER;
        self.flags = FL_ITEM;
@@ -300,16 +300,16 @@ void buff_Init(entity ent)
        buff_SetCooldown(autocvar_g_buffs_cooldown_activate + game_starttime);
        self.buff_active = !self.buff_activetime;
        self.pflags = PFLAGS_FULLDYNAMIC;
-       
+
        if(self.noalign)
                self.movetype = MOVETYPE_NONE; // reset by random location
 
        setmodel(self, "models/relics/relic.md3");
        setsize(self, BUFF_MIN, BUFF_MAX);
-       
+
        if(cvar("g_buffs_random_location") || (self.spawnflags & 1))
                buff_Respawn(self);
-       
+
        self = oldself;
 }
 
@@ -330,37 +330,37 @@ void buff_SpawnReplacement(entity ent, entity old)
        setorigin(ent, old.origin);
        ent.angles = old.angles;
        ent.noalign = old.noalign;
-       
+
        buff_Init(ent);
 }
 
 // mutator hooks
 MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_SplitHealthArmor)
 {
-       if(frag_deathtype == DEATH_BUFF_VENGEANCE) { return FALSE; } // oh no you don't
+       if(frag_deathtype == DEATH_BUFF_VENGEANCE) { return false; } // oh no you don't
 
        if(frag_target.buffs & BUFF_RESISTANCE)
        {
                vector v = healtharmor_applydamage(50, autocvar_g_buffs_resistance_blockpercent, frag_deathtype, frag_damage);
-               damage_take = v_x;
-               damage_save = v_y;
+               damage_take = v.x;
+               damage_save = v.y;
        }
 
-       return FALSE;
+       return false;
 }
 
 void buff_Vengeance_DelayedDamage()
 {
        if(self.enemy)
                Damage(self.enemy, self.owner, self.owner, self.dmg, DEATH_BUFF_VENGEANCE, self.enemy.origin, '0 0 0');
-       
+
        remove(self);
        return;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate)
 {
-       if(frag_deathtype == DEATH_BUFF_VENGEANCE) { return FALSE; } // oh no you don't
+       if(frag_deathtype == DEATH_BUFF_VENGEANCE) { return false; } // oh no you don't
 
        if(frag_target.buffs & BUFF_SPEED)
        if(frag_target != frag_attacker)
@@ -373,7 +373,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate)
        if(random() <= autocvar_g_buffs_medic_survive_chance)
        if(frag_target.health - autocvar_g_buffs_medic_survive_health > 0) // not if the final result would be less than 0, medic must get health
                frag_damage = frag_target.health - autocvar_g_buffs_medic_survive_health;
-               
+
        if(frag_target.buffs & BUFF_VENGEANCE)
        if(frag_attacker)
        if(frag_attacker != frag_target)
@@ -392,14 +392,14 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate)
        if(frag_attacker != frag_target)
        if(vlen(frag_force))
                frag_force = '0 0 0';
-       
+
        if(frag_attacker.buffs & BUFF_BASH)
        if(vlen(frag_force))
        if(frag_attacker == frag_target)
                frag_force *= autocvar_g_buffs_bash_force_self;
        else
                frag_force *= autocvar_g_buffs_bash_force;
-       
+
        if(frag_attacker.buffs & BUFF_DISABILITY)
        if(frag_target != frag_attacker)
                frag_target.buff_disability_time = time + autocvar_g_buffs_disability_time;
@@ -424,7 +424,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate)
        if(DIFF_TEAM(frag_attacker, frag_target))
                frag_attacker.health = bound(0, frag_attacker.health + bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal, frag_target.health), g_pickup_healthsmall_max);
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_PlayerSpawn)
@@ -433,7 +433,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerSpawn)
        // reset timers here to prevent them continuing after re-spawn
        self.buff_disability_time = 0;
        self.buff_disability_effect_time = 0;
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_PlayerPhysics)
@@ -443,14 +443,14 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerPhysics)
                self.stat_sv_maxspeed *= autocvar_g_buffs_speed_speed;
                self.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_speed_speed;
        }
-       
+
        if(time < self.buff_disability_time)
        {
                self.stat_sv_maxspeed *= autocvar_g_buffs_disability_speed;
                self.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_disability_speed;
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_PlayerJump)
@@ -459,7 +459,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerJump)
                player_jumpheight = autocvar_g_buffs_jump_height;
        self.stat_jumpheight = player_jumpheight;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_MonsterMove)
@@ -470,7 +470,7 @@ MUTATOR_HOOKFUNCTION(buffs_MonsterMove)
                monster_speed_run *= autocvar_g_buffs_disability_speed;
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_PlayerDies)
@@ -479,19 +479,19 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDies)
        {
                Send_Notification(NOTIF_ALL_EXCEPT, self, MSG_INFO, INFO_ITEM_BUFF_LOST, self.netname, self.buffs);
                self.buffs = 0;
-               
+
                if(self.buff_model)
                {
                        remove(self.buff_model);
                        self.buff_model = world;
                }
        }
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_PlayerUseKey)
 {
-       if(MUTATOR_RETURNVALUE || gameover) { return FALSE; }
+       if(MUTATOR_RETURNVALUE || gameover) { return false; }
        if(self.buffs)
        {
                Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_BUFF_DROP, self.buffs);
@@ -499,9 +499,9 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerUseKey)
 
                self.buffs = 0;
                sound(self, CH_TRIGGER, "relics/relic_effect.wav", VOL_BASE, ATTN_NORM);
-               return TRUE;
+               return true;
        }
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_RemovePlayer)
@@ -511,12 +511,12 @@ MUTATOR_HOOKFUNCTION(buffs_RemovePlayer)
                remove(self.buff_model);
                self.buff_model = world;
        }
-       
+
        // also reset timers here to prevent them continuing after spectating
        self.buff_disability_time = 0;
        self.buff_disability_effect_time = 0;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_CustomizeWaypoint)
@@ -527,9 +527,9 @@ MUTATOR_HOOKFUNCTION(buffs_CustomizeWaypoint)
        // but only apply this to real players, not to spectators
        if((self.owner.flags & FL_CLIENT) && (self.owner.buffs & BUFF_INVISIBLE) && (e == other))
        if(DIFF_TEAM(self.owner, e))
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_OnEntityPreSpawn)
@@ -542,34 +542,34 @@ MUTATOR_HOOKFUNCTION(buffs_OnEntityPreSpawn)
                {
                        entity e = spawn();
                        buff_SpawnReplacement(e, self);
-                       return TRUE;
+                       return true;
                }
        }
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_WeaponRate)
 {
        if(self.buffs & BUFF_SPEED)
                weapon_rate *= autocvar_g_buffs_speed_rate;
-               
+
        if(time < self.buff_disability_time)
                weapon_rate *= autocvar_g_buffs_disability_rate;
-       
-       return FALSE;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_PlayerThink)
 {
-       if(gameover || self.deadflag != DEAD_NO) { return FALSE; }
-       
+       if(gameover || self.deadflag != DEAD_NO) { return false; }
+
        if(time < self.buff_disability_time)
        if(time >= self.buff_disability_effect_time)
        {
                pointparticles(particleeffectnum("smoking"), self.origin + ((self.mins + self.maxs) * 0.5), '0 0 0', 1);
                self.buff_disability_effect_time = time + 0.5;
        }
-       
+
        if(self.frozen)
        {
                if(self.buffs)
@@ -578,7 +578,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink)
                        self.buffs = 0;
                }
        }
-               
+
        if((self.buffs & BUFF_INVISIBLE) && (self.oldbuffs & BUFF_INVISIBLE))
        if(self.alpha != autocvar_g_buffs_invisible_alpha)
                self.alpha = autocvar_g_buffs_invisible_alpha;
@@ -602,7 +602,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink)
                        if(!self.ammo_nails) { self.ammo_nails = 20; }
                        if(!self.ammo_fuel) { self.ammo_fuel = 20; }
                }
-               
+
                if(self.oldbuffs & BUFF_INVISIBLE)
                {
                        if(time < self.strength_finished && g_instagib)
@@ -618,7 +618,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink)
                                self.buff_invisible_prev_alpha = self.alpha;
                        self.alpha = autocvar_g_buffs_invisible_alpha;
                }
-               
+
                if(self.oldbuffs & BUFF_FLIGHT)
                        self.gravity = self.buff_flight_prev_gravity;
                else if(self.buffs & BUFF_FLIGHT)
@@ -636,7 +636,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink)
                                setmodel(self.buff_model, "models/relics/relic.md3");
                                setsize(self.buff_model, '0 0 -40', '0 0 40');
                                setattachment(self.buff_model, self, "");
-                               setorigin(self.buff_model, '0 0 1' * (self.buff_model.maxs_z * 1));
+                               setorigin(self.buff_model, '0 0 1' * (self.buff_model.maxs.z * 1));
                                self.buff_model.owner = self;
                                self.buff_model.scale = 0.7;
                                self.buff_model.pflags = PFLAGS_FULLDYNAMIC;
@@ -646,14 +646,14 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink)
                        self.buff_model.color = Buff_Color(self.buffs);
                        self.buff_model.glowmod = ((self.buff_model.team) ? Team_ColorRGB(self.buff_model.team) + '0.1 0.1 0.1' : self.buff_model.color);
                        self.buff_model.skin = Buff_Skin(self.buffs);
-                       
+
                        self.effects |= EF_NOSHADOW;
                }
                else
                {
                        remove(self.buff_model);
                        self.buff_model = world;
-                       
+
                        self.effects &= ~(EF_NOSHADOW);
                }
        }
@@ -663,31 +663,31 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink)
                self.buff_model.effects = self.effects;
                self.buff_model.effects |= EF_LOWPRECISION;
                self.buff_model.effects = self.buff_model.effects & EFMASK_CHEAP; // eat performance
-               
+
                self.buff_model.alpha = self.alpha;
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_SpectateCopy)
 {
        self.buffs = other.buffs;
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_VehicleEnter)
 {
        vh_vehicle.buffs = vh_player.buffs;
        vh_player.buffs = 0;
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_VehicleExit)
 {
        vh_player.buffs = vh_vehicle.buffs;
        vh_vehicle.buffs = 0;
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_PlayerRegen)
@@ -698,29 +698,29 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerRegen)
                regen_mod_limit = regen_mod_max = autocvar_g_buffs_medic_max;
                regen_mod_regen = autocvar_g_buffs_medic_regen;
        }
-       
+
        if(self.buffs & BUFF_SPEED)
                regen_mod_regen = autocvar_g_buffs_speed_regen;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_GetCvars)
 {
        GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_buffs_autoreplace, "cl_buffs_autoreplace");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_BuildMutatorsString)
 {
        ret_string = strcat(ret_string, ":Buffs");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(buffs_BuildMutatorsPrettyString)
 {
        ret_string = strcat(ret_string, ", Buffs");
-       return FALSE;
+       return false;
 }
 
 void buffs_DelayedInit()
@@ -750,7 +750,7 @@ void buffs_Initialize()
 
        addstat(STAT_BUFFS, AS_INT, buffs);
        addstat(STAT_MOVEVARS_JUMPVELOCITY, AS_FLOAT, stat_jumpheight);
-       
+
        InitializeEntity(world, buffs_DelayedInit, INITPRIO_FINDTARGET);
 }
 
@@ -783,5 +783,5 @@ MUTATOR_DEFINITION(mutator_buffs)
                buffs_Initialize();
        }
 
-       return FALSE;
+       return false;
 }
index 66540b87604e3a5b897a25cd019a16f36ff716be..06a76b1bba71c03d0d35e3c7a60dd511d69aff00 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef MUTATOR_BUFFS_H
+#define MUTATOR_BUFFS_H
+
 // buff specific variables \\
 //
 // ammo
@@ -8,7 +11,7 @@
 .float buff_flight_prev_gravity;
 // jump
 .float stat_jumpheight;
-const float STAT_MOVEVARS_JUMPVELOCITY = 250; // engine hack
+//const float STAT_MOVEVARS_JUMPVELOCITY = 250; // engine hack
 // disability
 .float buff_disability_time;
 .float buff_disability_effect_time;
@@ -21,8 +24,9 @@ const float STAT_MOVEVARS_JUMPVELOCITY = 250; // engine hack
 .float oldbuffs; // for updating effects
 .entity buff_model; // controls effects (TODO: make csqc)
 
-#define BUFF_MIN ('-16 -16 -20')
-#define BUFF_MAX ('16 16 20')
+const vector BUFF_MIN = ('-16 -16 -20');
+const vector BUFF_MAX = ('16 16 20');
 
 // client side options
 .float cvar_cl_buffs_autoreplace;
+#endif
index 2ec584db4cb23d265c5b105aceb2dbf6a3f33c7b..21dd71f98b5dfc74302c10c01510b37073ee2fb3 100644 (file)
@@ -5,7 +5,7 @@ MUTATOR_HOOKFUNCTION(campcheck_PlayerDies)
 {
        Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_CAMPCHECK);
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(campcheck_PlayerDamage)
@@ -18,7 +18,7 @@ MUTATOR_HOOKFUNCTION(campcheck_PlayerDamage)
                frag_attacker.campcheck_traveled_distance = autocvar_g_campcheck_distance;
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(campcheck_PlayerThink)
@@ -32,7 +32,7 @@ MUTATOR_HOOKFUNCTION(campcheck_PlayerThink)
 
                // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement)
                dist = self.prevorigin - self.origin;
-               dist_z = 0;
+               dist.z = 0;
                self.campcheck_traveled_distance += fabs(vlen(dist));
 
                if((autocvar_g_campaign && !campaign_bots_may_start) || (time < game_starttime) || (round_handler_IsActive() && !round_handler_IsRoundStarted()))
@@ -56,7 +56,7 @@ MUTATOR_HOOKFUNCTION(campcheck_PlayerThink)
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(campcheck_PlayerSpawn)
@@ -64,13 +64,13 @@ MUTATOR_HOOKFUNCTION(campcheck_PlayerSpawn)
        self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
        self.campcheck_traveled_distance = 0;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(campcheck_BuildMutatorsString)
 {
        ret_string = strcat(ret_string, ":CampCheck");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_DEFINITION(mutator_campcheck)
@@ -81,5 +81,5 @@ MUTATOR_DEFINITION(mutator_campcheck)
        MUTATOR_HOOK(PlayerSpawn, campcheck_PlayerSpawn, CBC_ORDER_ANY);
        MUTATOR_HOOK(BuildMutatorsString, campcheck_BuildMutatorsString, CBC_ORDER_ANY);
 
-       return FALSE;
+       return false;
 }
index b26fe1b9fff657fa13c38d35689ee689153d7c51..ad52d3e2919f29a3563927a4c900ca401f35ee40 100644 (file)
@@ -9,8 +9,7 @@
 .float last_RIGHT_KEY_time;
 
 // these store the movement direction at the time of the dodge action happening.
-.float dodging_direction_x;
-.float dodging_direction_y;
+.vector dodging_direction;
 
 // this indicates the last time a dodge was executed. used to check if another one is allowed
 // and to ramp up the dodge acceleration in the physics hook.
@@ -79,12 +78,12 @@ MUTATOR_HOOKFUNCTION(dodging_PlayerPhysics) {
        // ramp up dodging speed by adding some velocity each frame.. TODO: do it! :D
        if (self.dodging_action == 1) {
                //disable jump key during dodge accel phase
-               if (self.movement_z > 0) self.movement_z = 0;
+               if (self.movement.z > 0) self.movement_z = 0;
 
                self.velocity =
                          self.velocity
-                       + ((self.dodging_direction_y * velocity_difference) * v_right)
-                       + ((self.dodging_direction_x * velocity_difference) * v_forward);
+                       + ((self.dodging_direction.y * velocity_difference) * v_right)
+                       + ((self.dodging_direction.x * velocity_difference) * v_forward);
 
                self.dodging_velocity_gain = self.dodging_velocity_gain - velocity_difference;
        }
@@ -100,7 +99,7 @@ MUTATOR_HOOKFUNCTION(dodging_PlayerPhysics) {
                if (autocvar_sv_dodging_sound == 1)
                        PlayerSound(playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND);
 
-               animdecide_setaction(self, ANIMACTION_JUMP, TRUE);
+               animdecide_setaction(self, ANIMACTION_JUMP, true);
 
                self.dodging_single_action = 0;
        }
@@ -129,22 +128,22 @@ float check_close_to_wall(float threshold) {
        trace_start = self.origin;
 
        trace_end = self.origin + (1000*v_right);
-       tracebox(trace_start, self.mins, self.maxs, trace_end, TRUE, self);
+       tracebox(trace_start, self.mins, self.maxs, trace_end, true, self);
        if (trace_fraction < 1 && vlen (self.origin - trace_endpos) < threshold)
                return 1;
 
        trace_end = self.origin - (1000*v_right);
-       tracebox(trace_start, self.mins, self.maxs, trace_end, TRUE, self);
+       tracebox(trace_start, self.mins, self.maxs, trace_end, true, self);
        if (trace_fraction < 1 && vlen (self.origin - trace_endpos) < threshold)
                return 1;
 
        trace_end = self.origin + (1000*v_forward);
-       tracebox(trace_start, self.mins, self.maxs, trace_end, TRUE, self);
+       tracebox(trace_start, self.mins, self.maxs, trace_end, true, self);
        if (trace_fraction < 1 && vlen (self.origin - trace_endpos) < threshold)
                return 1;
 
        trace_end = self.origin - (1000*v_forward);
-       tracebox(trace_start, self.mins, self.maxs, trace_end, TRUE, self);
+       tracebox(trace_start, self.mins, self.maxs, trace_end, true, self);
        if (trace_fraction < 1 && vlen (self.origin - trace_endpos) < threshold)
                return 1;
 
@@ -163,11 +162,7 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
        // print("dodging_PlayerPhysics\n");
 
        float length;
-       float tap_direction_x;
-       float tap_direction_y;
-
-       tap_direction_x = 0;
-       tap_direction_y = 0;
+       vector tap_direction = '0 0 0';
 
        float frozen_dodging, frozen_no_doubletap;
        frozen_dodging = (self.frozen && autocvar_sv_dodging_frozen);
@@ -187,21 +182,21 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
                && check_close_to_wall(autocvar_sv_dodging_wall_distance_threshold) != 1)
                return 0;
 
-       if (self.movement_x > 0) {
+       if (self.movement.x > 0) {
                // is this a state change?
                if (!(self.pressedkeys & KEY_FORWARD) || frozen_no_doubletap) {
                        if ((time - self.last_FORWARD_KEY_time) < self.cvar_cl_dodging_timeout) {
-                               tap_direction_x = 1.0;
+                               tap_direction.x = 1.0;
                                dodge_detected = 1;
                        }
                        self.last_FORWARD_KEY_time = time;
                }
        }
 
-       if (self.movement_x < 0) {
+       if (self.movement.x < 0) {
                // is this a state change?
                if (!(self.pressedkeys & KEY_BACKWARD) || frozen_no_doubletap) {
-                       tap_direction_x = -1.0;
+                       tap_direction.x = -1.0;
                        if ((time - self.last_BACKWARD_KEY_time) < self.cvar_cl_dodging_timeout)        {
                                dodge_detected = 1;
                        }
@@ -209,10 +204,10 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
                }
        }
 
-       if (self.movement_y > 0) {
+       if (self.movement.y > 0) {
                // is this a state change?
                if (!(self.pressedkeys & KEY_RIGHT) || frozen_no_doubletap) {
-                       tap_direction_y = 1.0;
+                       tap_direction.y = 1.0;
                        if ((time - self.last_RIGHT_KEY_time) < self.cvar_cl_dodging_timeout)   {
                                dodge_detected = 1;
                        }
@@ -220,10 +215,10 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
                }
        }
 
-       if (self.movement_y < 0) {
+       if (self.movement.y < 0) {
                // is this a state change?
                if (!(self.pressedkeys & KEY_LEFT) || frozen_no_doubletap) {
-                       tap_direction_y = -1.0;
+                       tap_direction.y = -1.0;
                        if ((time - self.last_LEFT_KEY_time) < self.cvar_cl_dodging_timeout)    {
                                dodge_detected = 1;
                        }
@@ -239,16 +234,16 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
 
                self.dodging_velocity_gain = autocvar_sv_dodging_horiz_speed;
 
-               self.dodging_direction_x = tap_direction_x;
-               self.dodging_direction_y = tap_direction_y;
+               self.dodging_direction_x = tap_direction.x;
+               self.dodging_direction_y = tap_direction.y;
 
                // normalize the dodging_direction vector.. (unlike UT99) XD
-               length =          self.dodging_direction_x * self.dodging_direction_x;
-               length = length + self.dodging_direction_y * self.dodging_direction_y;
+               length =          self.dodging_direction.x * self.dodging_direction.x;
+               length = length + self.dodging_direction.y * self.dodging_direction.y;
                length = sqrt(length);
 
-               self.dodging_direction_x = self.dodging_direction_x * 1.0/length;
-               self.dodging_direction_y = self.dodging_direction_y * 1.0/length;
+               self.dodging_direction_x = self.dodging_direction.x * 1.0/length;
+               self.dodging_direction_y = self.dodging_direction.y * 1.0/length;
        }
 
        return 0;
index 9840325d97ce8a0ee71ac932242de069a0e3cabf..a8fd6656337f42e8bd5f339344dd1075aabd7b32 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef MUTATOR_DODGING_H
+#define MUTATOR_DODGING_H
+
 float g_dodging;
 
 // set to 1 to indicate dodging has started.. reset by physics hook after dodge has been done..
@@ -5,3 +8,4 @@ float g_dodging;
 
 // the jump part of the dodge cannot be ramped
 .float dodging_single_action;
+#endif
index 4200b2207a9c5872def34c817b6efd3e772ae234..b3502b0f783573c6467ec9752dc13d4d13326f0b 100644 (file)
@@ -24,7 +24,7 @@ void instagib_stop_countdown(entity e)
        if (!e.instagib_needammo)
                return;
        Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_INSTAGIB_FINDAMMO);
-       e.instagib_needammo = FALSE;
+       e.instagib_needammo = false;
 }
 void instagib_ammocheck()
 {
@@ -39,7 +39,7 @@ void instagib_ammocheck()
                instagib_stop_countdown(self);
        else
        {
-               self.instagib_needammo = TRUE;
+               self.instagib_needammo = true;
                if (self.health <= 5)
                {
                        Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
@@ -106,14 +106,14 @@ MUTATOR_HOOKFUNCTION(instagib_MatchEnd)
        FOR_EACH_PLAYER(head)
                instagib_stop_countdown(head);
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_MonsterLoot)
 {
        other.monster_loot = spawnfunc_item_minst_cells;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_MonsterSpawn)
@@ -121,40 +121,40 @@ MUTATOR_HOOKFUNCTION(instagib_MonsterSpawn)
        // always refill ammo
        if(self.monsterid == MON_MAGE)
                self.skin = 1;
-       
-       return FALSE;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_BotShouldAttack)
 {
        if(checkentity.items & IT_STRENGTH)
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_MakePlayerObserver)
 {
        instagib_stop_countdown(self);
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_PlayerSpawn)
 {
        self.effects |= EF_FULLBRIGHT;
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_PlayerPreThink)
 {
        instagib_ammocheck();
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_PlayerRegen)
 {
        // no regeneration in instagib
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups)
@@ -203,7 +203,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups)
                        Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED);
                }
        }
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_PlayerPhysics)
@@ -211,7 +211,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerPhysics)
        if(self.items & IT_INVINCIBLE)
                self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_SplitHealthArmor)
@@ -219,14 +219,14 @@ MUTATOR_HOOKFUNCTION(instagib_SplitHealthArmor)
        damage_save = 0;
        damage_take = frag_damage;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_ForbidThrowing)
 {
        // weapon dropping on death handled by FilterItem
 
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_PlayerDamage)
@@ -246,25 +246,29 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerDamage)
 
                if(IS_PLAYER(frag_attacker))
                if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER))
+               {
+                       if(frag_target.armorvalue)
+                       {
+                               frag_target.armorvalue -= 1;
+                               frag_damage = 0;
+                               frag_target.damage_dealt += 1;
+                               frag_attacker.damage_dealt += 1; // TODO: change this to a specific hitsound for armor hit
+                               Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, frag_target.armorvalue);
+                       }
+               }
+
+               if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
                {
                        if(frag_deathtype & HITTYPE_SECONDARY)
                        {
                                frag_damage = frag_mirrordamage = 0;
-                               
+
                                if(frag_target != frag_attacker)
                                {
                                        if(frag_target.health > 0) { Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_SECONDARY_NODAMAGE); }
                                        frag_force = '0 0 0';
                                }
                        }
-                       else if(frag_target.armorvalue)
-                       {
-                               frag_target.armorvalue -= 1;
-                               frag_damage = 0;
-                               frag_target.damage_dealt += 1;
-                               frag_attacker.damage_dealt += 1; // TODO: change this to a specific hitsound for armor hit
-                               Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, frag_target.armorvalue);
-                       }
                }
        }
 
@@ -281,10 +285,10 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerDamage)
                frag_mirrordamage = 0;
        }
 
-       if(frag_target.items & IT_STRENGTH)
+       if((frag_target.buffs & BUFF_INVISIBLE) || (frag_target.items & IT_STRENGTH))
                yoda = 1;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_SetStartItems)
@@ -302,18 +306,18 @@ MUTATOR_HOOKFUNCTION(instagib_SetStartItems)
        start_weapons = warmup_start_weapons = WEPSET_VAPORIZER;
        start_items |= IT_UNLIMITED_SUPERWEAPONS;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_FilterItem)
 {
        if(self.classname == "item_cells")
-               return TRUE; // no normal cells?
+               return true; // no normal cells?
 
        if(self.weapon == WEP_VAPORIZER && self.classname == "droppedweapon")
        {
                self.ammo_cells = autocvar_g_instagib_ammo_drop;
-               return FALSE;
+               return false;
        }
 
        if(self.weapon == WEP_DEVASTATOR || self.weapon == WEP_VORTEX)
@@ -325,19 +329,19 @@ MUTATOR_HOOKFUNCTION(instagib_FilterItem)
                self = e;
                spawnfunc_item_minst_cells();
                self = oldself;
-               return TRUE;
+               return true;
        }
 
        if(self.flags & FL_POWERUP)
-               return FALSE;
+               return false;
 
        if(self.ammo_cells > autocvar_g_instagib_ammo_drop && self.classname != "item_minst_cells")
                self.ammo_cells = autocvar_g_instagib_ammo_drop;
 
        if(self.ammo_cells && !self.weapon)
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_CustomizeWaypoint)
@@ -348,9 +352,9 @@ MUTATOR_HOOKFUNCTION(instagib_CustomizeWaypoint)
        // but only apply this to real players, not to spectators
        if((self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other))
        if(DIFF_TEAM(self.owner, e))
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_ItemCountdown)
@@ -361,7 +365,7 @@ MUTATOR_HOOKFUNCTION(instagib_ItemCountdown)
                case IT_NAILS:      item_name = "item-extralife"; item_color = '1 0 0'; break;
                case IT_INVINCIBLE: item_name = "item-speed"; item_color = '1 0 1'; break;
        }
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_ItemTouch)
@@ -395,9 +399,9 @@ MUTATOR_HOOKFUNCTION(instagib_ItemTouch)
 
 MUTATOR_HOOKFUNCTION(instagib_OnEntityPreSpawn)
 {
-       if (!autocvar_g_powerups) { return FALSE; }
+       if (!autocvar_g_powerups) { return false; }
        if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.classname == "item_health_mega"))
-               return FALSE;
+               return false;
 
        entity e = spawn();
 
@@ -413,25 +417,25 @@ MUTATOR_HOOKFUNCTION(instagib_OnEntityPreSpawn)
        e.noalign = self.noalign;
        setorigin(e, self.origin);
 
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_BuildMutatorsString)
 {
        ret_string = strcat(ret_string, ":instagib");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_BuildMutatorsPrettyString)
 {
        ret_string = strcat(ret_string, ", instagib");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(instagib_SetModname)
 {
        modname = "instagib";
-       return TRUE;
+       return true;
 }
 
 MUTATOR_DEFINITION(mutator_instagib)
@@ -459,5 +463,5 @@ MUTATOR_DEFINITION(mutator_instagib)
        MUTATOR_HOOK(BuildMutatorsPrettyString, instagib_BuildMutatorsPrettyString, CBC_ORDER_ANY);
        MUTATOR_HOOK(SetModname, instagib_SetModname, CBC_ORDER_ANY);
 
-       return FALSE;
+       return false;
 }
index c435aba0342c64e9c9fb3e238f2d5982772725d6..b4f9c37716c39c70426d05b5039a4735f84c37e8 100644 (file)
@@ -3,12 +3,12 @@ MUTATOR_HOOKFUNCTION(melee_SetStartItems)
        start_ammo_shells = warmup_start_ammo_shells = 0;
        start_weapons = warmup_start_weapons = WEPSET_SHOTGUN;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(melee_ForbidThrowing)
 {
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(melee_FilterItem)
@@ -17,22 +17,22 @@ MUTATOR_HOOKFUNCTION(melee_FilterItem)
        {
                case IT_5HP:
                case IT_ARMOR_SHARD:
-                       return FALSE;
+                       return false;
        }
 
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(melee_BuildMutatorsString)
 {
        ret_string = strcat(ret_string, ":MeleeOnly");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(melee_BuildMutatorsPrettyString)
 {
        ret_string = strcat(ret_string, ", Melee Only Arena");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_DEFINITION(mutator_melee_only)
@@ -43,5 +43,5 @@ MUTATOR_DEFINITION(mutator_melee_only)
        MUTATOR_HOOK(BuildMutatorsString, melee_BuildMutatorsString, CBC_ORDER_ANY);
        MUTATOR_HOOK(BuildMutatorsPrettyString, melee_BuildMutatorsPrettyString, CBC_ORDER_ANY);
 
-       return FALSE;
+       return false;
 }
index f13ae5c8abeb8468ba895ac36b27a10bdef1ec81..d582c05ce7d39b3150eed52452e49cb99f1e1d78 100644 (file)
@@ -5,9 +5,9 @@ MUTATOR_HOOKFUNCTION(midair_PlayerDamage)
        if(IS_PLAYER(frag_attacker))
        if(IS_PLAYER(frag_target))
        if(time < self.midair_shieldtime)
-               frag_damage = FALSE;
+               frag_damage = false;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(midair_PlayerPowerups)
@@ -19,7 +19,7 @@ MUTATOR_HOOKFUNCTION(midair_PlayerPowerups)
                self.midair_shieldtime = max(self.midair_shieldtime, time + autocvar_g_midair_shieldtime);
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(midair_PlayerSpawn)
@@ -27,19 +27,19 @@ MUTATOR_HOOKFUNCTION(midair_PlayerSpawn)
        if(IS_BOT_CLIENT(self))
                self.bot_moveskill = 0; // disable bunnyhopping
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(midair_BuildMutatorsString)
 {
        ret_string = strcat(ret_string, ":midair");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(midair_BuildMutatorsPrettyString)
 {
        ret_string = strcat(ret_string, ", Midair");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_DEFINITION(mutator_midair)
@@ -50,5 +50,5 @@ MUTATOR_DEFINITION(mutator_midair)
        MUTATOR_HOOK(BuildMutatorsString, midair_BuildMutatorsString, CBC_ORDER_ANY);
        MUTATOR_HOOK(BuildMutatorsPrettyString, midair_BuildMutatorsPrettyString, CBC_ORDER_ANY);
 
-       return FALSE;
+       return false;
 }
index 868ddf246e0b5f0c88c93e7b594e412238110df7..d36f3ecbe82e566a030968198c11564cbefb7a2c 100644 (file)
@@ -6,34 +6,34 @@ MUTATOR_HOOKFUNCTION(multijump_PlayerPhysics)
        if(self.flags & FL_ONGROUND)
                self.multijump_count = 0;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(multijump_PlayerJump)
 {
        if (self.flags & FL_JUMPRELEASED && !(self.flags & FL_ONGROUND)) // jump button pressed this frame and we are in midair
-               self.multijump_ready = TRUE;  // this is necessary to check that we released the jump button and pressed it again
+               self.multijump_ready = true;  // this is necessary to check that we released the jump button and pressed it again
        else
-               self.multijump_ready = FALSE;
+               self.multijump_ready = false;
 
-       if(!player_multijump && self.multijump_ready && (autocvar_g_multijump == -1 || self.multijump_count < autocvar_g_multijump) && self.velocity_z > autocvar_g_multijump_speed)
+       if(!player_multijump && self.multijump_ready && (autocvar_g_multijump == -1 || self.multijump_count < autocvar_g_multijump) && self.velocity.z > autocvar_g_multijump_speed)
        {
                if (autocvar_g_multijump)
                {
                        if (autocvar_g_multijump_add == 0) // in this case we make the z velocity == jumpvelocity
                        {
-                               if (self.velocity_z < autocvar_sv_jumpvelocity)
+                               if (self.velocity.z < autocvar_sv_jumpvelocity)
                                {
-                                       player_multijump = TRUE;
+                                       player_multijump = true;
                                        self.velocity_z = 0;
                                }
                        }
                        else
-                               player_multijump = TRUE;
+                               player_multijump = true;
 
                        if(player_multijump)
                        {
-                               if(self.movement_x != 0 || self.movement_y != 0) // don't remove all speed if player isnt pressing any movement keys
+                               if(self.movement.x != 0 || self.movement.y != 0) // don't remove all speed if player isnt pressing any movement keys
                                {
                                        float curspeed;
                                        vector wishvel, wishdir;
@@ -42,33 +42,33 @@ MUTATOR_HOOKFUNCTION(multijump_PlayerJump)
                                                vlen(vec2(self.velocity)), // current xy speed
                                                vlen(vec2(antilag_takebackavgvelocity(self, max(self.lastteleporttime + sys_frametime, time - 0.25), time))) // average xy topspeed over the last 0.25 secs
                                        );
-                                       makevectors(self.v_angle_y * '0 1 0');
-                                       wishvel = v_forward * self.movement_x + v_right * self.movement_y;
+                                       makevectors(self.v_angle.y * '0 1 0');
+                                       wishvel = v_forward * self.movement.x + v_right * self.movement.y;
                                        wishdir = normalize(wishvel);
 
-                                       self.velocity_x = wishdir_x * curspeed; // allow "dodging" at a multijump
-                                       self.velocity_y = wishdir_y * curspeed;
+                                       self.velocity_x = wishdir.x * curspeed; // allow "dodging" at a multijump
+                                       self.velocity_y = wishdir.y * curspeed;
                                        // keep velocity_z unchanged!
                                }
                                self.multijump_count += 1;
                        }
                }
-               self.multijump_ready = FALSE; // require releasing and pressing the jump button again for the next jump
+               self.multijump_ready = false; // require releasing and pressing the jump button again for the next jump
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(multijump_BuildMutatorsString)
 {
        ret_string = strcat(ret_string, ":multijump");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(multijump_BuildMutatorsPrettyString)
 {
        ret_string = strcat(ret_string, ", Multi jump");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_DEFINITION(mutator_multijump)
@@ -78,5 +78,5 @@ MUTATOR_DEFINITION(mutator_multijump)
        MUTATOR_HOOK(BuildMutatorsString, multijump_BuildMutatorsString, CBC_ORDER_ANY);
        MUTATOR_HOOK(BuildMutatorsPrettyString, multijump_BuildMutatorsPrettyString, CBC_ORDER_ANY);
 
-       return FALSE;
+       return false;
 }
index 91bd53e5aa070d93b78c5e43f289e56aba4c8a6d..60b2acce56053ea2b1d2ab295b393c99737a0df6 100644 (file)
@@ -10,7 +10,7 @@ void nade_timer_think()
 
 void nade_burn_spawn(entity _nade)
 {
-       CSQCProjectile(_nade, TRUE, Nade_ProjectileFromID(_nade.nade_type, TRUE), TRUE);
+       CSQCProjectile(_nade, true, Nade_ProjectileFromID(_nade.nade_type, true), true);
 }
 
 void nade_spawn(entity _nade)
@@ -29,7 +29,7 @@ void nade_spawn(entity _nade)
 
        _nade.effects |= EF_LOWPRECISION;
 
-       CSQCProjectile(_nade, TRUE, Nade_ProjectileFromID(_nade.nade_type, FALSE), TRUE);
+       CSQCProjectile(_nade, true, Nade_ProjectileFromID(_nade.nade_type, false), true);
 }
 
 void napalm_damage(float dist, float damage, float edgedamage, float burntime)
@@ -42,16 +42,16 @@ void napalm_damage(float dist, float damage, float edgedamage, float burntime)
                return;
 
        RandomSelection_Init();
-       for(e = WarpZone_FindRadius(self.origin, dist, TRUE); e; e = e.chain)
+       for(e = WarpZone_FindRadius(self.origin, dist, true); e; e = e.chain)
                if(e.takedamage == DAMAGE_AIM)
                if(self.realowner != e || autocvar_g_nades_napalm_selfdamage)
                if(!IS_PLAYER(e) || !self.realowner || DIFF_TEAM(e, self))
                if(!e.frozen)
                {
                        p = e.origin;
-                       p_x += e.mins_x + random() * (e.maxs_x - e.mins_x);
-                       p_y += e.mins_y + random() * (e.maxs_y - e.mins_y);
-                       p_z += e.mins_z + random() * (e.maxs_z - e.mins_z);
+                       p.x += e.mins.x + random() * (e.maxs.x - e.mins.x);
+                       p.y += e.mins.y + random() * (e.maxs.y - e.mins.y);
+                       p.z += e.mins.z + random() * (e.maxs.z - e.mins.z);
                        d = vlen(WarpZone_UnTransformOrigin(e, self.origin) - p);
                        if(d < dist)
                        {
@@ -115,7 +115,7 @@ void nade_napalm_ball()
        proj.realowner = self.realowner;
        proj.team = self.owner.team;
        proj.classname = "grenade";
-       proj.bot_dodge = TRUE;
+       proj.bot_dodge = true;
        proj.bot_dodgerating = autocvar_g_nades_napalm_ball_damage;
        proj.movetype = MOVETYPE_BOUNCE;
        proj.projectiledeathtype = DEATH_NADE_NAPALM;
@@ -129,9 +129,9 @@ void nade_napalm_ball()
        proj.damageforcescale = autocvar_g_nades_napalm_ball_damageforcescale;
        proj.effects = EF_LOWPRECISION | EF_FLAME;
 
-       kick_x =(random() - 0.5) * 2 * autocvar_g_nades_napalm_ball_spread;
-       kick_y = (random() - 0.5) * 2 * autocvar_g_nades_napalm_ball_spread;
-       kick_z = (random()/2+0.5) * autocvar_g_nades_napalm_ball_spread;
+       kick.x =(random() - 0.5) * 2 * autocvar_g_nades_napalm_ball_spread;
+       kick.y = (random() - 0.5) * 2 * autocvar_g_nades_napalm_ball_spread;
+       kick.z = (random()/2+0.5) * autocvar_g_nades_napalm_ball_spread;
        proj.velocity = kick;
 
        proj.pushltime = time + autocvar_g_nades_napalm_ball_lifetime;
@@ -140,7 +140,7 @@ void nade_napalm_ball()
        proj.flags = FL_PROJECTILE;
        proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
 
-       //CSQCProjectile(proj, TRUE, PROJECTILE_NAPALM_FIRE, TRUE);
+       //CSQCProjectile(proj, true, PROJECTILE_NAPALM_FIRE, true);
 }
 
 
@@ -185,8 +185,8 @@ void napalm_fountain_think()
 void nade_napalm_boom()
 {
        entity fountain;
-       local float c;
-       for (c = 0; c < autocvar_g_nades_napalm_ball_count; c ++)
+       int c;
+       for (c = 0; c < autocvar_g_nades_napalm_ball_count; c++)
                nade_napalm_ball();
 
 
@@ -202,25 +202,25 @@ void nade_napalm_boom()
        fountain.team = self.team;
        fountain.movetype = MOVETYPE_TOSS;
        fountain.projectiledeathtype = DEATH_NADE_NAPALM;
-       fountain.bot_dodge = TRUE;
+       fountain.bot_dodge = true;
        fountain.bot_dodgerating = autocvar_g_nades_napalm_fountain_damage;
        fountain.nade_special_time = time;
        setsize(fountain, '-16 -16 -16', '16 16 16');
-       CSQCProjectile(fountain, TRUE, PROJECTILE_NAPALM_FOUNTAIN, TRUE);
+       CSQCProjectile(fountain, true, PROJECTILE_NAPALM_FOUNTAIN, true);
 }
 
 void nade_ice_freeze(entity freezefield, entity frost_target, float freeze_time)
 {
        frost_target.frozen_by = freezefield.realowner;
        pointparticles(particleeffectnum("electro_impact"), frost_target.origin, '0 0 0', 1);
-       Freeze(frost_target, 1/freeze_time, 3, FALSE);
+       Freeze(frost_target, 1/freeze_time, 3, false);
        if(frost_target.ballcarried)
        if(g_keepaway) { ka_DropEvent(frost_target); }
        else { DropBall(frost_target.ballcarried, frost_target.origin, frost_target.velocity);}
        if(frost_target.flagcarried) { ctf_Handle_Throw(frost_target, world, DROP_THROW); }
        if(frost_target.nade) { toss_nade(frost_target, '0 0 0', time + 0.05); }
-       
-       kh_Key_DropAll(frost_target, FALSE);
+
+       kh_Key_DropAll(frost_target, false);
 }
 
 void nade_ice_think()
@@ -268,9 +268,9 @@ void nade_ice_think()
        float randomw;
        randomw = random()*M_PI*2;
        vector randomp;
-       randomp_x = randomr*cos(randomw);
-       randomp_y = randomr*sin(randomw);
-       randomp_z = 1;
+       randomp.x = randomr*cos(randomw);
+       randomp.y = randomr*sin(randomw);
+       randomp.z = 1;
        pointparticles(particleeffectnum("electro_muzzleflash"), self.origin + randomp, '0 0 0', 1);
 
        if(time >= self.nade_special_time)
@@ -312,7 +312,7 @@ void nade_ice_boom()
        fountain.team = self.team;
        fountain.movetype = MOVETYPE_TOSS;
        fountain.projectiledeathtype = DEATH_NADE_ICE;
-       fountain.bot_dodge = FALSE;
+       fountain.bot_dodge = false;
        setsize(fountain, '-16 -16 -16', '16 16 16');
        fountain.nade_special_time = time+0.3;
        fountain.angles = self.angles;
@@ -341,7 +341,7 @@ void nade_translocate_boom()
        if(self.realowner.vehicle)
                return;
 
-       vector locout = self.origin + '0 0 1' * (1 - self.realowner.mins_z - 24);
+       vector locout = self.origin + '0 0 1' * (1 - self.realowner.mins.z - 24);
        tracebox(locout, self.realowner.mins, self.realowner.maxs, locout, MOVE_NOMONSTERS, self.realowner);
        locout = trace_endpos;
 
@@ -383,9 +383,9 @@ void nade_heal_think()
                remove(self);
                return;
        }
-       
+
        self.nextthink = time;
-       
+
        if(time >= self.nade_special_time)
        {
                self.nade_special_time = time+0.25;
@@ -420,15 +420,15 @@ void nade_heal_touch()
                                        pointparticles(particleeffectnum("healing_fx"), other.origin, '0 0 0', 1);
                                other.health = min(other.health+health_factor, maxhealth);
                        }
-                       other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);  
+                       other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
                }
                else if ( health_factor < 0 )
                {
                        Damage(other,self,self.realowner,-health_factor,DEATH_NADE_HEAL,other.origin,'0 0 0');
                }
-               
+
        }
-       
+
        if ( IS_REAL_CLIENT(other) || (other.vehicle_flags & VHF_ISVEHICLE) )
        {
                entity show_red = (other.vehicle_flags & VHF_ISVEHICLE) ? other.owner : other;
@@ -447,7 +447,7 @@ void nade_heal_boom()
        healer.healer_lifetime = autocvar_g_nades_heal_time; // save the cvar
        healer.ltime = time + healer.healer_lifetime;
        healer.team = self.realowner.team;
-       healer.bot_dodge = FALSE;
+       healer.bot_dodge = false;
        healer.solid = SOLID_TRIGGER;
        healer.touch = nade_heal_touch;
 
@@ -455,9 +455,9 @@ void nade_heal_boom()
        healer.healer_radius = autocvar_g_nades_nade_radius;
        vector size = '1 1 1' * healer.healer_radius / 2;
        setsize(healer,-size,size);
-       
-       Net_LinkEntity(healer, TRUE, 0, healer_send);
-       
+
+       Net_LinkEntity(healer, true, 0, healer_send);
+
        healer.think = nade_heal_think;
        healer.nextthink = time;
        healer.SendFlags |= 1;
@@ -465,8 +465,8 @@ void nade_heal_boom()
 
 void nade_monster_boom()
 {
-       entity e = spawnmonster(self.pokenade_type, 0, self.realowner, self.realowner, self.origin, FALSE, FALSE, 1);
-       
+       entity e = spawnmonster(self.pokenade_type, 0, self.realowner, self.realowner, self.origin, false, false, 1);
+
        if(autocvar_g_nades_pokenade_monster_lifetime > 0)
                e.monster_lifetime = time + autocvar_g_nades_pokenade_monster_lifetime;
        e.monster_skill = MONSTER_SKILL_INSANE;
@@ -551,17 +551,17 @@ void nade_boom()
 
 void nade_touch()
 {
-       float is_weapclip = 0;
+       /*float is_weapclip = 0;
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
        if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
        if (!(trace_dphitcontents & DPCONTENTS_OPAQUE))
-               is_weapclip = 1;
-       if(ITEM_TOUCH_NEEDKILL() || is_weapclip)
+               is_weapclip = 1;*/
+       if(ITEM_TOUCH_NEEDKILL()) // || is_weapclip)
        {
                remove(self);
                return;
        }
-       
+
        PROJECTILE_TOUCH;
 
        //setsize(self, '-2 -2 -2', '2 2 2');
@@ -639,7 +639,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, float deathtyp
        }
 
        self.health -= damage;
-       
+
        if ( self.nade_type != NADE_TYPE_HEAL || IS_PLAYER(attacker) )
                self.realowner = attacker;
 
@@ -662,29 +662,35 @@ void toss_nade(entity e, vector _velocity, float _time)
 
        makevectors(e.v_angle);
 
-       W_SetupShot(e, FALSE, FALSE, "", CH_WEAPON_A, 0);
+       W_SetupShot(e, false, false, "", CH_WEAPON_A, 0);
 
        Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_NADES);
 
-       setorigin(_nade, w_shotorg + (v_right * 25) * -1);
+       vector offset = (v_forward * autocvar_g_nades_throw_offset.x)
+                                 + (v_right * autocvar_g_nades_throw_offset.y)
+                                 + (v_up * autocvar_g_nades_throw_offset.z);
+       if(autocvar_g_nades_throw_offset == '0 0 0')
+               offset = '0 0 0';
+
+       setorigin(_nade, w_shotorg + offset + (v_right * 25) * -1);
        //setmodel(_nade, "models/weapons/v_ok_grenade.md3");
        //setattachment(_nade, world, "");
        PROJECTILE_MAKETRIGGER(_nade);
        setsize(_nade, '-16 -16 -16', '16 16 16');
        _nade.movetype = MOVETYPE_BOUNCE;
 
-       tracebox(_nade.origin, _nade.mins, _nade.maxs, _nade.origin, FALSE, _nade);
+       tracebox(_nade.origin, _nade.mins, _nade.maxs, _nade.origin, false, _nade);
        if (trace_startsolid)
                setorigin(_nade, e.origin);
 
-       if(self.v_angle_x >= 70 && self.v_angle_x <= 110)
+       if(self.v_angle.x >= 70 && self.v_angle.x <= 110 && self.BUTTON_CROUCH)
                _nade.velocity = '0 0 100';
        else if(autocvar_g_nades_nade_newton_style == 1)
                _nade.velocity = e.velocity + _velocity;
        else if(autocvar_g_nades_nade_newton_style == 2)
                _nade.velocity = _velocity;
        else
-               _nade.velocity = W_CalculateProjectileVelocity(e.velocity, _velocity, TRUE);
+               _nade.velocity = W_CalculateProjectileVelocity(e.velocity, _velocity, true);
 
        _nade.touch = nade_touch;
        _nade.health = autocvar_g_nades_nade_health;
@@ -694,11 +700,11 @@ void toss_nade(entity e, vector _velocity, float _time)
        _nade.customizeentityforclient = func_null;
        _nade.exteriormodeltoclient = world;
        _nade.traileffectnum = 0;
-       _nade.teleportable = TRUE;
-       _nade.pushable = TRUE;
+       _nade.teleportable = true;
+       _nade.pushable = true;
        _nade.gravity = 1;
        _nade.missile_flags = MIF_SPLASH | MIF_ARC;
-       _nade.damagedbycontents = TRUE;
+       _nade.damagedbycontents = true;
        _nade.angles = vectoangles(_nade.velocity);
        _nade.flags = FL_PROJECTILE;
        _nade.projectiledeathtype = DEATH_NADE;
@@ -751,7 +757,7 @@ void nades_RemoveBonus(entity player)
 
 float nade_customize()
 {
-       //if(IS_SPEC(other)) { return FALSE; }
+       //if(IS_SPEC(other)) { return false; }
        if(other == self.realowner || (IS_SPEC(other) && other.enemy == self.realowner))
        {
                // somewhat hide the model, but keep the glow
@@ -764,11 +770,11 @@ float nade_customize()
        {
                //self.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
                if(!self.traileffectnum)
-                       self.traileffectnum = particleeffectnum(Nade_TrailEffect(Nade_ProjectileFromID(self.nade_type, FALSE), self.team));
+                       self.traileffectnum = particleeffectnum(Nade_TrailEffect(Nade_ProjectileFromID(self.nade_type, false), self.team));
                self.alpha = 1;
        }
-       
-       return TRUE;
+
+       return true;
 }
 
 void nade_prime()
@@ -797,14 +803,14 @@ void nade_prime()
                n.nade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_nade_type : autocvar_g_nades_nade_type);
                n.pokenade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
        }
-       
+
        n.nade_type = bound(1, n.nade_type, NADE_TYPE_LAST);
 
        setmodel(n, "models/weapons/v_ok_grenade.md3");
        //setattachment(n, self, "bip01 l hand");
        n.exteriormodeltoclient = self;
        n.customizeentityforclient = nade_customize;
-       n.traileffectnum = particleeffectnum(Nade_TrailEffect(Nade_ProjectileFromID(n.nade_type, FALSE), self.team));
+       n.traileffectnum = particleeffectnum(Nade_TrailEffect(Nade_ProjectileFromID(n.nade_type, false), self.team));
        n.colormod = Nade_Color(n.nade_type);
        n.realowner = self;
        n.colormap = self.colormap;
@@ -831,24 +837,24 @@ void nade_prime()
 float CanThrowNade()
 {
        if(self.vehicle)
-               return FALSE;
+               return false;
 
        if(gameover)
-               return FALSE;
+               return false;
 
        if(self.deadflag != DEAD_NO)
-               return FALSE;
+               return false;
 
        if (!autocvar_g_nades)
-               return FALSE; // allow turning them off mid match
+               return false; // allow turning them off mid match
 
        if(forbidWeaponUse())
-               return FALSE;
+               return false;
 
        if (!IS_PLAYER(self))
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 void nades_CheckThrow()
@@ -892,7 +898,7 @@ void nades_Clear(entity player)
 MUTATOR_HOOKFUNCTION(nades_CheckThrow)
 {
        if(MUTATOR_RETURNVALUE) { nades_CheckThrow(); }
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades_VehicleEnter)
@@ -900,19 +906,19 @@ MUTATOR_HOOKFUNCTION(nades_VehicleEnter)
        if(vh_player.nade)
                toss_nade(vh_player, '0 0 100', max(vh_player.nade.wait, time + 0.05));
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades_PlayerPreThink)
 {
-       if(!IS_PLAYER(self)) { return FALSE; }
+       if(!IS_PLAYER(self)) { return false; }
 
        float key_pressed = self.BUTTON_HOOK;
        float time_score;
 
-       if(g_grappling_hook || client_hasweapon(self, WEP_HOOK, FALSE, FALSE) || (weaponsInMap & WEPSET_HOOK))
+       if(g_grappling_hook || client_hasweapon(self, WEP_HOOK, false, false) || (weaponsInMap & WEPSET_HOOK))
                key_pressed = self.button16; // if hook is enabled, use an alternate key
-               
+
        if(self.nade)
        {
                self.nade_timer = bound(0, (time - self.nade.lifetime) / autocvar_g_nades_nade_lifetime, 1);
@@ -921,7 +927,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink)
                self.nade.velocity = self.velocity;
 
                setorigin(self.nade, self.origin + self.view_ofs + v_forward * 8 + v_right * -8 + v_up * 0);
-               self.nade.angles_y = self.angles_y;
+               self.nade.angles_y = self.angles.y;
        }
 
        if(self.nade)
@@ -961,7 +967,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink)
                                time_score = autocvar_g_nades_bonus_score_time_flagcarrier;
                        else
                                time_score = autocvar_g_nades_bonus_score_time;
-                               
+
                        if(key_count)
                                time_score = autocvar_g_nades_bonus_score_time_flagcarrier * key_count; // multiply by the number of keys the player is holding
 
@@ -975,7 +981,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink)
                                self.nade_type = autocvar_g_nades_bonus_type;
                                self.pokenade_type = autocvar_g_nades_pokenade_monster_type;
                        }
-                               
+
                        self.nade_type = bound(1, self.nade_type, NADE_TYPE_LAST);
 
                        if(self.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max)
@@ -1005,7 +1011,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink)
                                if(!o)
                                        o = other;
                                if(self.frozen == 1)
-                                       other.reviving = TRUE;
+                                       other.reviving = true;
                                ++n;
                        }
                }
@@ -1027,11 +1033,11 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink)
                FOR_EACH_PLAYER(other) if(other.reviving)
                {
                        other.revive_progress = self.revive_progress;
-                       other.reviving = FALSE;
+                       other.reviving = false;
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades_PlayerSpawn)
@@ -1050,7 +1056,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerSpawn)
        {
                setorigin(self, self.nade_spawnloc.origin);
                self.nade_spawnloc.cnt -= 1;
-               
+
                if(self.nade_spawnloc.cnt <= 0)
                {
                        remove(self.nade_spawnloc);
@@ -1058,7 +1064,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerSpawn)
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades_PlayerDies)
@@ -1092,7 +1098,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerDies)
 
        nades_RemoveBonus(frag_target);
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades_PlayerDamage)
@@ -1111,8 +1117,8 @@ MUTATOR_HOOKFUNCTION(nades_PlayerDamage)
                Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVED_NADE, frag_target.netname);
                Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_REVIVE_SELF);
        }
-       
-       return FALSE;
+
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades_MonsterDies)
@@ -1122,14 +1128,14 @@ MUTATOR_HOOKFUNCTION(nades_MonsterDies)
        if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
                nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_minor);
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades_RemovePlayer)
 {
        nades_Clear(self);
        nades_RemoveBonus(self);
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades_SpectateCopy)
@@ -1141,7 +1147,7 @@ MUTATOR_HOOKFUNCTION(nades_SpectateCopy)
        self.bonus_nade_score = other.bonus_nade_score;
        self.stat_healing_orb = other.stat_healing_orb;
        self.stat_healing_orb_alpha = other.stat_healing_orb_alpha;
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades_GetCvars)
@@ -1149,19 +1155,19 @@ MUTATOR_HOOKFUNCTION(nades_GetCvars)
        GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_nade_type, "cl_nade_type");
        GetCvars_handleString(get_cvars_s, get_cvars_f, cvar_cl_pokenade_type, "cl_pokenade_type");
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades_BuildMutatorsString)
 {
        ret_string = strcat(ret_string, ":Nades");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(nades_BuildMutatorsPrettyString)
 {
        ret_string = strcat(ret_string, ", Nades");
-       return FALSE;
+       return false;
 }
 
 void nades_Initialize()
@@ -1172,7 +1178,7 @@ void nades_Initialize()
        addstat(STAT_NADE_BONUS_SCORE, AS_FLOAT, bonus_nade_score);
        addstat(STAT_HEALING_ORB, AS_FLOAT, stat_healing_orb);
        addstat(STAT_HEALING_ORB_ALPHA, AS_FLOAT, stat_healing_orb_alpha);
-       
+
        precache_model("models/ok_nade_counter/ok_nade_counter.md3");
        precache_model("models/weapons/h_ok_grenade.iqm");
        precache_model("models/weapons/v_ok_grenade.md3");
@@ -1210,5 +1216,5 @@ MUTATOR_DEFINITION(mutator_nades)
                nades_Initialize();
        }
 
-       return FALSE;
+       return false;
 }
index c6c30c6d53210dfee9143e12646831e7b727f147..1a0dd525219746daed442a03390328ebdff05f62 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef MUTATOR_NADES_H
+#define MUTATOR_NADES_H
+
 .entity nade;
 .entity fake_nade;
 .float nade_timer;
@@ -24,3 +27,4 @@ void(entity player) nades_Clear;
 void(entity player, float score) nades_GiveBonus;
 // Remove all bonus nades from a player
 void(entity player) nades_RemoveBonus;
+#endif
index 3e41c42fe022215ae6152a92b0eb7a7a0ff48065..5aa94b1875d8d070ac6c76250874f586d31fdfcd 100644 (file)
@@ -69,9 +69,9 @@ roflsound "New toys, new toys!" sound.
 .string new_toys;
 
 float autocvar_g_new_toys_autoreplace;
-#define NT_AUTOREPLACE_NEVER 0
-#define NT_AUTOREPLACE_ALWAYS 1
-#define NT_AUTOREPLACE_RANDOM 2
+const float NT_AUTOREPLACE_NEVER = 0;
+const float NT_AUTOREPLACE_ALWAYS = 1;
+const float NT_AUTOREPLACE_RANDOM = 2;
 
 MUTATOR_HOOKFUNCTION(nt_SetModname)
 {
@@ -88,9 +88,9 @@ float nt_IsNewToy(float w)
                case WEP_HLAC:
                case WEP_RIFLE:
                case WEP_SHOCKWAVE:
-                       return TRUE;
+                       return true;
                default:
-                       return FALSE;
+                       return false;
        }
 }
 
index 6a980af08df86e86e60f86b2b393a3ab694d97b1..a0ec6adaa020ca3d2273ee988886fe1e642d14d0 100644 (file)
@@ -12,22 +12,22 @@ float NIX_CanChooseWeapon(float wpn)
        entity e;
        e = get_weaponinfo(wpn);
        if(!e.weapon) // skip dummies
-               return FALSE;
+               return false;
        if(g_weaponarena)
        {
                if(!(g_weaponarena_weapons & WepSet_FromWeapon(wpn)))
-                       return FALSE;
+                       return false;
        }
        else
        {
                if(wpn == WEP_BLASTER && g_nix_with_blaster) // WEAPONTODO: rename to g_nix_with_blaster
-                       return FALSE;
+                       return false;
                if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
-                       return FALSE;
+                       return false;
                if (!(e.spawnflags & WEP_FLAG_NORMAL))
-                       return FALSE;
+                       return false;
        }
-       return TRUE;
+       return true;
 }
 void NIX_ChooseNextWeapon()
 {
@@ -65,7 +65,7 @@ void NIX_GiveCurrentWeapon()
        if(nix_nextchange != self.nix_lastchange_id) // this shall only be called once per round!
        {
                self.ammo_shells = self.ammo_nails = self.ammo_rockets = self.ammo_cells = self.ammo_plasma = self.ammo_fuel = 0;
-               
+
                if(self.items & IT_UNLIMITED_WEAPON_AMMO)
                {
                        switch(e.ammo_field)
@@ -142,8 +142,8 @@ void NIX_GiveCurrentWeapon()
        self.weapons |= WepSet_FromWeapon(nix_weapon);
 
        if(self.switchweapon != nix_weapon)
-               if(!client_hasweapon(self, self.switchweapon, TRUE, FALSE))
-                       if(client_hasweapon(self, nix_weapon, TRUE, FALSE))
+               if(!client_hasweapon(self, self.switchweapon, true, false))
+                       if(client_hasweapon(self, nix_weapon, true, false))
                                W_SwitchWeapon(nix_weapon);
 }
 
@@ -265,7 +265,7 @@ MUTATOR_DEFINITION(mutator_nix)
                        e.ammo_rockets = start_ammo_rockets;
                        e.ammo_fuel = start_ammo_fuel;
                        e.weapons = start_weapons;
-                       if(!client_hasweapon(e, e.weapon, TRUE, FALSE))
+                       if(!client_hasweapon(e, e.weapon, true, false))
                                e.switchweapon = w_getbestweapon(self);
                }
        }
index 22cd79cff3f537a6eb1c367c750a7cb7e3e46b48..78a61510602787209533b227e909982e2d63d304 100644 (file)
@@ -24,7 +24,7 @@ void ok_IncreaseCharge(entity ent, float wep)
 
 float ok_CheckWeaponCharge(entity ent, float wep)
 {
-       if(!ent.ok_use_ammocharge) return TRUE;
+       if(!ent.ok_use_ammocharge) return true;
 
        entity wepent = get_weaponinfo(wep);
 
@@ -51,19 +51,20 @@ MUTATOR_HOOKFUNCTION(ok_PlayerDamage_Calculate)
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ok_PlayerDamage_SplitHealthArmor)
 {
        if(damage_take)
                self.ok_pauseregen_finished = max(self.ok_pauseregen_finished, time + 2);
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ok_PlayerDies)
 {
        entity oldself = self;
+       entity targ = ((frag_attacker) ? frag_attacker : frag_target);
 
        if(self.flags & FL_MONSTER)
        {
@@ -72,22 +73,22 @@ MUTATOR_HOOKFUNCTION(ok_PlayerDies)
        }
 
        self = spawn();
-       self.ok_item = TRUE;
-       self.noalign = TRUE;
-       self.pickup_anyway = TRUE;
+       self.ok_item = true;
+       self.noalign = true;
+       self.pickup_anyway = true;
        spawnfunc_item_armor_small();
        self.movetype = MOVETYPE_TOSS;
        self.gravity = 1;
        self.reset = SUB_Remove;
        setorigin(self, frag_target.origin + '0 0 32');
-       self.velocity = '0 0 200' + normalize(frag_attacker.origin - self.origin) * 500;
+       self.velocity = '0 0 200' + normalize(targ.origin - self.origin) * 500;
        self.classname = "droppedweapon"; // hax
        SUB_SetFade(self, time + 5, 1);
        self = oldself;
 
        self.ok_lastwep = self.switchweapon;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ok_PlayerRegen)
@@ -97,7 +98,7 @@ MUTATOR_HOOKFUNCTION(ok_PlayerRegen)
        {
                self.armorvalue = CalcRotRegen(self.armorvalue, autocvar_g_balance_armor_regenstable, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, 1 * frametime * (time > self.ok_pauseregen_finished), 0, 0, 1, 1 * frametime * (time > self.pauserotarmor_finished), autocvar_g_balance_armor_limit);
                self.health = CalcRotRegen(self.health, autocvar_g_balance_health_regenstable, 0, 100, 1 * frametime * (time > self.ok_pauseregen_finished), 200, 0, autocvar_g_balance_health_rotlinear, 1 * frametime * (time > self.pauserothealth_finished), autocvar_g_balance_health_limit);
-               
+
                float minf, maxf, limitf;
 
                maxf = autocvar_g_balance_fuel_rotstable;
@@ -106,21 +107,21 @@ MUTATOR_HOOKFUNCTION(ok_PlayerRegen)
 
                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 & IT_FUEL_REGEN) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf);
        }
-       return TRUE; // return TRUE anyway, as frozen uses no regen
+       return true; // return true anyway, as frozen uses no regen
 }
 
 MUTATOR_HOOKFUNCTION(ok_ForbidThrowCurrentWeapon)
 {
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(ok_PlayerPreThink)
 {
        if(intermission_running || gameover)
-               return FALSE;
+               return false;
 
        if(self.deadflag != DEAD_NO || !IS_PLAYER(self) || self.frozen)
-               return FALSE;
+               return false;
 
        if(self.ok_lastwep)
        {
@@ -136,7 +137,9 @@ MUTATOR_HOOKFUNCTION(ok_PlayerPreThink)
        {
                self.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor();
                makevectors(self.v_angle);
-               
+
+               int oldwep = self.weapon;
+               self.weapon = WEP_BLASTER;
                W_Blaster_Attack(
                        WEP_BLASTER | HITTYPE_SECONDARY,
                        WEP_CVAR_SEC(vaporizer, shotangle),
@@ -149,9 +152,10 @@ MUTATOR_HOOKFUNCTION(ok_PlayerPreThink)
                        WEP_CVAR_SEC(vaporizer, delay),
                        WEP_CVAR_SEC(vaporizer, lifetime)
                );
+               self.weapon = oldwep;
        }
 
-       self.weapon_blocked = FALSE;
+       self.weapon_blocked = false;
 
        self.ok_ammo_charge = self.ammo_charge[self.weapon];
 
@@ -167,12 +171,12 @@ MUTATOR_HOOKFUNCTION(ok_PlayerPreThink)
                if(self.weaponentity.state != WS_CLEAR)
                        w_ready();
 
-               self.weapon_blocked = TRUE;
+               self.weapon_blocked = true;
        }
 
        self.BUTTON_ATCK2 = 0;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ok_PlayerSpawn)
@@ -189,10 +193,10 @@ MUTATOR_HOOKFUNCTION(ok_PlayerSpawn)
        }
        else
                self.ok_use_ammocharge = 0;
-               
+
        self.ok_pauseregen_finished = time + 2;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ok_OnEntityPreSpawn)
@@ -206,15 +210,15 @@ MUTATOR_HOOKFUNCTION(ok_OnEntityPreSpawn)
                        setorigin(wep, self.origin);
                        setmodel(wep, "models/weapons/g_ok_hmg.md3");
                        wep.classname = "weapon_hmg";
-                       wep.ok_item = TRUE;
+                       wep.ok_item = true;
                        wep.noalign = self.noalign;
                        wep.cnt = self.cnt;
                        wep.team = self.team;
                        wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
-                       wep.pickup_anyway = TRUE;
+                       wep.pickup_anyway = true;
                        wep.think = spawnfunc_weapon_hmg;
                        wep.nextthink = time + 0.1;
-                       return TRUE;
+                       return true;
                }
 
                if(self.classname == "item_invincible")
@@ -223,25 +227,25 @@ MUTATOR_HOOKFUNCTION(ok_OnEntityPreSpawn)
                        setorigin(wep, self.origin);
                        setmodel(wep, "models/weapons/g_ok_rl.md3");
                        wep.classname = "weapon_rpc";
-                       wep.ok_item = TRUE;
+                       wep.ok_item = true;
                        wep.noalign = self.noalign;
                        wep.cnt = self.cnt;
                        wep.team = self.team;
                        wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
-                       wep.pickup_anyway = TRUE;
+                       wep.pickup_anyway = true;
                        wep.think = spawnfunc_weapon_rpc;
                        wep.nextthink = time + 0.1;
-                       return TRUE;
+                       return true;
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ok_ItemRemove)
 {
        if(self.ok_item)
-               return FALSE;
+               return false;
 
        switch(self.items)
        {
@@ -249,7 +253,7 @@ MUTATOR_HOOKFUNCTION(ok_ItemRemove)
                case IT_ARMOR: return !(autocvar_g_overkill_100a_anyway);
        }
 
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(ok_SpectateCopy)
@@ -257,7 +261,7 @@ MUTATOR_HOOKFUNCTION(ok_SpectateCopy)
        self.ammo_charge[self.weapon] = other.ammo_charge[other.weapon];
        self.ok_use_ammocharge = other.ok_use_ammocharge;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ok_StartItems)
@@ -270,25 +274,25 @@ MUTATOR_HOOKFUNCTION(ok_StartItems)
        start_items |= IT_UNLIMITED_WEAPON_AMMO;
        start_weapons = warmup_start_weapons = ok_start_items;
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ok_BuildMutatorsString)
 {
        ret_string = strcat(ret_string, ":OK");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ok_BuildMutatorsPrettyString)
 {
        ret_string = strcat(ret_string, ", Overkill");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(ok_SetModname)
 {
        modname = "Overkill";
-       return TRUE;
+       return true;
 }
 
 void ok_SetCvars()
@@ -321,7 +325,7 @@ void ok_Initialize()
        precache_sound("weapons/dryfire.wav");
 
        addstat(STAT_OK_AMMO_CHARGE, AS_FLOAT, ok_use_ammocharge);
-       addstat(STAT_OK_AMMO_CHARGEPOOl, AS_FLOAT, ok_ammo_charge);
+       addstat(STAT_OK_AMMO_CHARGEPOOL, AS_FLOAT, ok_ammo_charge);
 
        (get_weaponinfo(WEP_RPC)).spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
        (get_weaponinfo(WEP_HMG)).spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
@@ -360,5 +364,5 @@ MUTATOR_DEFINITION(mutator_overkill)
                (get_weaponinfo(WEP_HMG)).spawnflags |= WEP_FLAG_MUTATORBLOCKED;
        }
 
-       return FALSE;
+       return false;
 }
index 98ba99cb5507c3de5f1fed55eaeb1584beb21456..0b418be40b0b71f07f46c53b952c790b42b0eb86 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef MUTATOR_OVERKILL_H
+#define MUTATOR_OVERKILL_H
+
 .vector ok_deathloc;
 .float ok_spawnsys_timer;
 .float ok_lastwep;
@@ -12,3 +15,4 @@
 
 void(entity ent, float wep) ok_DecreaseCharge;
 
+#endif
index c99228673d701cf37b7d67f7aea72a999383d11e..dd2d8556d68fe7801111bc60ac0fd987f84ebea2 100644 (file)
@@ -58,9 +58,9 @@ void physical_item_damage(entity inflictor, entity attacker, float damage, float
 MUTATOR_HOOKFUNCTION(item_spawning)
 {
        if(self.owner == world && autocvar_g_physical_items <= 1)
-               return FALSE;
+               return false;
        if (self.spawnflags & 1) // floating item
-               return FALSE;
+               return false;
 
        // The actual item can't be physical and trigger at the same time, so make it invisible and use a second entity for physics.
        // Ugly hack, but unless SOLID_TRIGGER is gotten to work with MOVETYPE_PHYSICS in the engine it can't be fixed.
@@ -95,7 +95,7 @@ MUTATOR_HOOKFUNCTION(item_spawning)
        self.movetype = MOVETYPE_FOLLOW;
        self.aiment = wep; // attach the original weapon
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_DEFINITION(mutator_physical_items)
index 6d982d5a4c48f32cd71f32136191294862920203..7cf405ef7679cc0331c5d89fb622d42cf1d97f5c 100644 (file)
@@ -5,21 +5,21 @@ MUTATOR_HOOKFUNCTION(pinata_PlayerDies)
        if(self.weapons & WepSet_FromWeapon(j))
        if(self.switchweapon != j)
        if(W_IsWeaponThrowable(j))
-               W_ThrowNewWeapon(self, j, FALSE, self.origin + (self.mins + self.maxs) * 0.5, randomvec() * 175 + '0 0 325');
+               W_ThrowNewWeapon(self, j, false, self.origin + (self.mins + self.maxs) * 0.5, randomvec() * 175 + '0 0 325');
 
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(pinata_BuildMutatorsString)
 {
        ret_string = strcat(ret_string, ":Pinata");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(pinata_BuildMutatorsPrettyString)
 {
        ret_string = strcat(ret_string, ", Piñata");
-       return FALSE;
+       return false;
 }
 
 MUTATOR_DEFINITION(mutator_pinata)
@@ -28,5 +28,5 @@ MUTATOR_DEFINITION(mutator_pinata)
        MUTATOR_HOOK(BuildMutatorsString, pinata_BuildMutatorsString, CBC_ORDER_ANY);
        MUTATOR_HOOK(BuildMutatorsPrettyString, pinata_BuildMutatorsPrettyString, CBC_ORDER_ANY);
 
-       return FALSE;
+       return false;
 }
index 184047189b381532b65f3ca6ca369a8c64f28030..f70ee4ba32c9d01d312a81a81e67ebfc9c34f5e2 100644 (file)
@@ -7,10 +7,10 @@ float gravity_delay;
 
 MUTATOR_HOOKFUNCTION(gravity_StartFrame)
 {
-       if(gameover || !cvar("g_random_gravity")) return FALSE;
-       if(time < gravity_delay) return FALSE;
-       if(time < game_starttime) return FALSE;
-       if(round_handler_IsActive() && !round_handler_IsRoundStarted()) return FALSE;
+       if(gameover || !cvar("g_random_gravity")) return false;
+       if(time < gravity_delay) return false;
+       if(time < game_starttime) return false;
+       if(round_handler_IsActive() && !round_handler_IsRoundStarted()) return false;
 
     if(random() >= autocvar_g_random_gravity_negative_chance)
         cvar_set("sv_gravity", ftos(bound(autocvar_g_random_gravity_min, random() - random() * -autocvar_g_random_gravity_negative, autocvar_g_random_gravity_max)));
@@ -21,7 +21,7 @@ MUTATOR_HOOKFUNCTION(gravity_StartFrame)
 
        dprint("Gravity is now: ", ftos(autocvar_sv_gravity), "\n");
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(gravity_BuildMutatorsString)
@@ -47,5 +47,5 @@ MUTATOR_DEFINITION(mutator_random_gravity)
                cvar_settemp("sv_gravity", cvar_string("sv_gravity")); // settemp current gravity so it's restored on match end
        }
 
-       return FALSE;
+       return false;
 }
index ffae9543b95c663527fe29a6abe49f527453c94f..8dc3bbc6c0ad049c50ed1702825221901a56b635 100644 (file)
@@ -31,10 +31,10 @@ MUTATOR_HOOKFUNCTION(msnt_Spawn_Score)
        if(RandomSelection_chosen_ent)
        {
                spawn_spot.msnt_lookat = RandomSelection_chosen_ent;
-               spawn_score_x += SPAWN_PRIO_NEAR_TEAMMATE_FOUND;
+               spawn_score.x += SPAWN_PRIO_NEAR_TEAMMATE_FOUND;
        }
        else if(self.team == spawn_spot.team)
-               spawn_score_x += SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM; // prefer same team, if we can't find a spawn near teammate
+               spawn_score.x += SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM; // prefer same team, if we can't find a spawn near teammate
 
        return 0;
 }
@@ -136,7 +136,7 @@ MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn)
        else if(spawn_spot.msnt_lookat)
        {
                self.angles = vectoangles(spawn_spot.msnt_lookat.origin - self.origin);
-               self.angles_x = -self.angles_x;
+               self.angles_x = -self.angles.x;
                self.angles_z = 0; // never spawn tilted even if the spot says to
                /*
                sprint(self, "You should be looking at ", spawn_spot.msnt_lookat.netname, "^7.\n");
index 74e17a6a1422fb5b97bb989920dfdb8fa8a13891..1fd1022e72d2131d57edacd22c8ed8e2df2f6c6e 100644 (file)
@@ -1,21 +1,21 @@
 #define _SSMAGIX "SUPERSPEC_OPTIONSFILE_V1"
-#define _ISLOCAL ((edict_num(1) == self) ? TRUE : FALSE)
-
-#define ASF_STRENGTH        1
-#define ASF_SHIELD          2
-#define ASF_MEGA_AR         4
-#define ASF_MEGA_HP         8
-#define ASF_FLAG_GRAB       16
-#define ASF_OBSERVER_ONLY   32
-#define ASF_SHOWWHAT        64
-#define ASF_SSIM            128
-#define ASF_FOLLOWKILLER    256
-#define ASF_ALL             0xFFFFFF
+#define _ISLOCAL ((edict_num(1) == self) ? true : false)
+
+const float ASF_STRENGTH               = 1;
+const float ASF_SHIELD                         = 2;
+const float ASF_MEGA_AR                = 4;
+const float ASF_MEGA_HP                = 8;
+const float ASF_FLAG_GRAB              = 16;
+const float ASF_OBSERVER_ONLY  = 32;
+const float ASF_SHOWWHAT               = 64;
+const float ASF_SSIM                   = 128;
+const float ASF_FOLLOWKILLER   = 256;
+const float ASF_ALL                    = 0xFFFFFF;
 .float autospec_flags;
 
-#define SSF_SILENT          1
-#define SSF_VERBOSE         2
-#define SSF_ITEMMSG         4
+const float SSF_SILENT = 1;
+const float SSF_VERBOSE = 2;
+const float SSF_ITEMMSG = 4;
 .float superspec_flags;
 
 .string superspec_itemfilter; //"classname1 classname2 ..."
@@ -25,7 +25,7 @@ float _spectate(entity _player)
        if(Spectate(_player) == 1)
                self.classname = "spectator";
 
-       return TRUE;
+       return true;
 }
 
 void superspec_save_client_conf()
@@ -79,19 +79,19 @@ float superspec_filteritem(entity _for, entity _item)
        float i;
 
        if(_for.superspec_itemfilter == "")
-               return TRUE;
+               return true;
 
        if(_for.superspec_itemfilter == "")
-               return TRUE;
+               return true;
 
        float l = tokenize_console(_for.superspec_itemfilter);
        for(i = 0; i < l; ++i)
        {
                if(argv(i) == _item.classname)
-                       return TRUE;
+                       return true;
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(superspec_ItemTouch)
@@ -154,10 +154,10 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
     var = strcat(var, text," ^7(^3 ", long, "^7 | ^3", short, " ^7)\n")
 
        if(MUTATOR_RETURNVALUE) // command was already handled?
-               return FALSE;
+               return false;
 
        if(IS_PLAYER(self))
-               return FALSE;
+               return false;
 
        if(cmd_name == "superspec_itemfilter")
        {
@@ -181,7 +181,7 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
                        if(self.superspec_itemfilter == "")
                        {
                                superspec_msg("^3superspec_itemfilter^7 is ^1not^7 set", "\n^3superspec_itemfilter^7 is ^1not^7 set\n", self, "", 1);
-                               return TRUE;
+                               return true;
                        }
                        float i;
                        float l = tokenize_console(self.superspec_itemfilter);
@@ -202,7 +202,7 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
                        self.superspec_itemfilter = strzone(argv(1));
                }
 
-               return TRUE;
+               return true;
        }
 
        if(cmd_name == "superspec")
@@ -220,7 +220,7 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
                                _aspeco = strcat(_aspeco, "^3 item_message ^7(short^5 im^7) makes superspectate print items that were picked up.\n");
                                _aspeco = strcat(_aspeco, "^7    Use cmd superspec_itemfilter \"item_class1 item_class2\" to set up a filter of what to show with ^3item_message.\n");
                                superspec_msg("^2Available Super Spectate ^3options:\n\n\n", "\n^2Available Super Spectate ^3options:\n", self, _aspeco, 1);
-                               return TRUE;
+                               return true;
                        }
 
                        if(argv(1) == "clear")
@@ -259,7 +259,7 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
 
                superspec_msg("^3Current Super Spectate options are:\n\n\n\n\n", "\n^3Current Super Spectate options are:\n", self, _aspeco, 1);
 
-               return TRUE;
+               return true;
        }
 
 /////////////////////
@@ -283,7 +283,7 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
                                _aspeco = strcat(_aspeco, "^3 followkiller ^7(short ^5fk^7) to autospec the killer/off\n");
                                _aspeco = strcat(_aspeco, "^3 all ^7(short ^5aa^7) to turn everything on/off\n");
                                superspec_msg("^2Available Auto Spectate ^3options:\n\n\n", "\n^2Available Auto Spectate ^3options:\n", self, _aspeco, 1);
-                               return TRUE;
+                               return true;
                        }
 
                        float i, _bits = 0, _start = 1;
@@ -335,7 +335,7 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
                OPTIONINFO(self.autospec_flags, _aspeco, ASF_FOLLOWKILLER, "Followkiller", "followkiller", "fk");
 
                superspec_msg("^3Current auto spectate options are:\n\n\n\n\n", "\n^3Current auto spectate options are:\n", self, _aspeco, 1);
-               return TRUE;
+               return true;
        }
 
        if(cmd_name == "followpowerup")
@@ -348,7 +348,7 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
                }
 
                superspec_msg("", "", self, "No active powerup\n", 1);
-               return TRUE;
+               return true;
        }
 
        if(cmd_name == "followstrength")
@@ -361,7 +361,7 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
                }
 
                superspec_msg("", "", self, "No active Strength\n", 1);
-               return TRUE;
+               return true;
        }
 
        if(cmd_name == "followshield")
@@ -374,17 +374,17 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
                }
 
                superspec_msg("", "", self, "No active Shield\n", 1);
-               return TRUE;
+               return true;
        }
 
        if(cmd_name == "followfc")
        {
                if(!g_ctf)
-                       return TRUE;
+                       return true;
 
                entity _player;
                float _team = 0;
-               float found = FALSE;
+               float found = false;
 
                if(cmd_argc == 2)
                {
@@ -398,7 +398,7 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
                {
                        if(_player.flagcarried && (_player.team == _team || _team == 0))
                        {
-                               found = TRUE;
+                               found = true;
                                if(_team == 0 && IS_SPEC(self) && self.enemy == _player)
                                        continue; // already spectating a fc, try to find the other fc
                                return _spectate(_player);
@@ -407,10 +407,10 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
 
                if(!found)
                        superspec_msg("", "", self, "No active flag carrier\n", 1);
-               return TRUE;
+               return true;
        }
 
-       return FALSE;
+       return false;
 #undef OPTIONINFO
 }
 
@@ -437,7 +437,7 @@ void superspec_hello()
 MUTATOR_HOOKFUNCTION(superspec_ClientConnect)
 {
        if(!IS_REAL_CLIENT(self))
-               return FALSE;
+               return false;
 
        string fn = "superspec-local.options";
        float fh;
@@ -453,7 +453,7 @@ MUTATOR_HOOKFUNCTION(superspec_ClientConnect)
        if (!_ISLOCAL)
        {
                if(self.crypto_idfp == "")
-                       return FALSE;
+                       return false;
 
                fn = sprintf("superspec-%s.options", uri_escape(self.crypto_idfp));
        }
@@ -479,7 +479,7 @@ MUTATOR_HOOKFUNCTION(superspec_ClientConnect)
                fclose(fh);
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(superspec_PlayerDies)
@@ -498,13 +498,13 @@ MUTATOR_HOOKFUNCTION(superspec_PlayerDies)
        }
 
        self = _old_self;
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(superspec_ClientDisconnect)
 {
        superspec_save_client_conf();
-       return FALSE;
+       return false;
 }
 
 MUTATOR_DEFINITION(mutator_superspec)
index 5f02a8aba2f38ffd8fb783291d06a02fa7db70bc..fb58b3955cbbbcae1913b3628bce8e354a521dff 100644 (file)
@@ -4,7 +4,7 @@ void PlayerTouchExplode(entity p1, entity p2)
 {
        vector org;
        org = (p1.origin + p2.origin) * 0.5;
-       org_z += (p1.mins_z + p2.mins_z) * 0.5;
+       org.z += (p1.mins.z + p2.mins.z) * 0.5;
 
        sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM);
        pointparticles(particleeffectnum("explosion_small"), org, '0 0 0', 1);
@@ -37,12 +37,12 @@ MUTATOR_HOOKFUNCTION(touchexplode_PlayerThink)
                }
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_DEFINITION(mutator_touchexplode)
 {
        MUTATOR_HOOK(PlayerPreThink, touchexplode_PlayerThink, CBC_ORDER_ANY);
 
-       return FALSE;
+       return false;
 }
index 73317d0c1eea188fc5ec20206c6840c185c77b20..aa45fc1acfb777fea7c1ea078f38767fded15f42 100644 (file)
@@ -8,7 +8,7 @@ MUTATOR_HOOKFUNCTION(vampire_PlayerDamage)
                frag_attacker.health = bound(0, frag_attacker.health, autocvar_g_balance_health_limit);
        }
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(vampire_BuildMutatorsString)
index 0fa2caab27c78bbdb679682d7527be4b97afbb17..0c63015320dc2c2d0b217a8c7aad403cf3ce4f48 100644 (file)
@@ -1,3 +1,11 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "mutators_include.qh"
+    #include "../../common/mapinfo.qh"
+#endif
+
 void mutators_add()
 {
        #define CHECK_MUTATOR_ADD(mut_cvar,mut_name,dependence) \
index 4dcc9df2fab87443a85906eddfe402dac5ca7e52..6d889e24eba2afb38c71dc09ae2f89f5b11f9d6e 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef MUTATORS_H
+#define MUTATORS_H
+
 MUTATOR_DECLARATION(gamemode_assault);
 MUTATOR_DECLARATION(gamemode_ca);
 MUTATOR_DECLARATION(gamemode_keyhunt);
@@ -37,3 +40,4 @@ MUTATOR_DECLARATION(mutator_buffs);
 MUTATOR_DECLARATION(sandbox);
 MUTATOR_DECLARATION(mutator_overkill);
 
+#endif
index 0f52e34f033aa6b9f6f1231f9043494cea3d3e59..95f9604a0d3c298488e0026cef07d45781e6e756 100644 (file)
@@ -1,3 +1,83 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+    #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../warpzonelib/anglestransform.qh"
+    #include "../../warpzonelib/mathlib.qh"
+    #include "../../warpzonelib/common.qh"
+    #include "../../warpzonelib/util_server.qh"
+    #include "../../warpzonelib/server.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/stats.qh"
+    #include "../../common/teams.qh"
+    #include "../../common/util.qh"
+    #include "../../common/nades.qh"
+    #include "../../common/buffs.qh"
+    #include "../../common/test.qh"
+    #include "../../common/counting.qh"
+    #include "../../common/urllib.qh"
+    #include "../../common/command/markup.qh"
+    #include "../../common/command/rpn.qh"
+    #include "../../common/command/generic.qh"
+    #include "../../common/command/shared_defs.qh"
+    #include "../../common/net_notice.qh"
+    #include "../../common/animdecide.qh"
+    #include "../../common/monsters/monsters.qh"
+    #include "../../common/monsters/sv_monsters.qh"
+    #include "../../common/monsters/spawn.qh"
+    #include "../../common/weapons/config.qh"
+    #include "../../common/weapons/weapons.qh"
+    #include "../weapons/accuracy.qh"
+    #include "../weapons/common.qh"
+    #include "../weapons/csqcprojectile.qh"
+    #include "../weapons/hitplot.qh"
+    #include "../weapons/selection.qh"
+    #include "../weapons/spawning.qh"
+    #include "../weapons/throwing.qh"
+    #include "../weapons/tracing.qh"
+    #include "../weapons/weaponstats.qh"
+    #include "../weapons/weaponsystem.qh"
+    #include "../t_items.qh"
+    #include "../autocvars.qh"
+    #include "../constants.qh"
+    #include "../defs.qh"
+    #include "../../common/notifications.qh"
+    #include "../../common/deathtypes.qh"
+    #include "mutators_include.qh"
+    #include "../vehicles/vehicles_def.qh"
+    #include "../campaign.qh"
+    #include "../../common/campaign_common.qh"
+    #include "../../common/mapinfo.qh"
+    #include "../command/common.qh"
+    #include "../command/banning.qh"
+    #include "../command/radarmap.qh"
+    #include "../command/vote.qh"
+    #include "../command/getreplies.qh"
+    #include "../command/cmd.qh"
+    #include "../command/sv_cmd.qh"
+    #include "../../common/csqcmodel_settings.qh"
+    #include "../../csqcmodellib/common.qh"
+    #include "../../csqcmodellib/sv_model.qh"
+    #include "../anticheat.qh"
+    #include "../cheats.qh"
+    #include "../../common/playerstats.qh"
+    #include "../portals.qh"
+    #include "../g_hook.qh"
+    #include "../scores.qh"
+    #include "../spawnpoints.qh"
+    #include "../mapvoting.qh"
+    #include "../ipban.qh"
+    #include "../race.qh"
+    #include "../antilag.qh"
+    #include "../playerdemo.qh"
+    #include "../round_handler.qh"
+    #include "../item_key.qh"
+    #include "../secret.qh"
+    #include "../pathlib/pathlib.qh"
+    #include "../vehicles/vehicles.qh"
+#endif
+
 #include "base.qc"
 #include "gamemode_assault.qc"
 #include "gamemode_ca.qc"
index c869ab69669a6eab1da1abc924c94da93c5bd70e..da723d927963bbfec2941394dd2dcbe736e9b07e 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef MUTATORS_INCLUDE_H
+#define MUTATORS_INCLUDE_H
+
 #include "base.qh"
 #include "mutators.qh"
 #include "gamemode_assault.qh"
@@ -16,3 +19,4 @@
 #include "mutator_overkill.qh"
 #include "mutator_nades.qh"
 #include "mutator_buffs.qh"
+#endif
index e84c6d696a91e691ccadabf6c68cd927febbc97f..f66b5019a603b06402290bd58adaf82d12d87563 100644 (file)
@@ -56,7 +56,7 @@ void sandbox_ObjectFunction_Think()
        }
 
        self.nextthink = time;
-       
+
        CSQCMODEL_AUTOUPDATE();
 }
 
@@ -64,7 +64,7 @@ void sandbox_ObjectFunction_Think()
 entity sandbox_ObjectEdit_Get(float permissions)
 {
        // Returns the traced entity if the player can edit it, and world if not.
-       // If permissions if FALSE, the object is returned regardless of editing rights.
+       // If permissions if false, the object is returned regardless of editing rights.
        // Attached objects are SOLID_NOT and do not get traced.
 
        crosshair_trace_plusvisibletriggers(self);
@@ -165,16 +165,16 @@ entity sandbox_ObjectSpawn(float database)
 
                // set public object information
                e.netname = strzone(self.netname); // name of the owner
-               e.message = strzone(strftime(TRUE, "%d-%m-%Y %H:%M:%S")); // creation time
-               e.message2 = strzone(strftime(TRUE, "%d-%m-%Y %H:%M:%S")); // last editing time
+               e.message = strzone(strftime(true, "%d-%m-%Y %H:%M:%S")); // creation time
+               e.message2 = strzone(strftime(true, "%d-%m-%Y %H:%M:%S")); // last editing time
 
                // set origin and direction based on player position and view angle
                makevectors(self.v_angle);
                WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * autocvar_g_sandbox_editor_distance_spawn, MOVE_NORMAL, self);
                setorigin(e, trace_endpos);
-               e.angles_y = self.v_angle_y;
+               e.angles_y = self.v_angle.y;
        }
-       
+
        oldself = self;
        self = e;
        CSQCMODEL_AUTOINIT();
@@ -363,7 +363,7 @@ void sandbox_Database_Save()
 
        file_name = strcat("sandbox/storage_", autocvar_g_sandbox_storage_name, "_", GetMapname(), ".txt");
        file_get = fopen(file_name, FILE_WRITE);
-       fputs(file_get, strcat("// sandbox storage \"", autocvar_g_sandbox_storage_name, "\" for map \"", GetMapname(), "\" last updated ", strftime(TRUE, "%d-%m-%Y %H:%M:%S")));
+       fputs(file_get, strcat("// sandbox storage \"", autocvar_g_sandbox_storage_name, "\" for map \"", GetMapname(), "\" last updated ", strftime(true, "%d-%m-%Y %H:%M:%S")));
        fputs(file_get, strcat(" containing ", ftos(object_count), " objects\n"));
 
        for(head = world; (head = find(head, classname, "object")); )
@@ -373,7 +373,7 @@ void sandbox_Database_Save()
                        continue;
 
                // use a line of text for each object, listing all properties
-               fputs(file_get, strcat(sandbox_ObjectPort_Save(head, TRUE), "\n"));
+               fputs(file_get, strcat(sandbox_ObjectPort_Save(head, true), "\n"));
        }
        fclose(file_get);
 }
@@ -393,7 +393,7 @@ void sandbox_Database_Load()
        }
        else
        {
-               for(;;)
+               for (;;)
                {
                        file_read = fgets(file_get);
                        if(file_read == "")
@@ -404,7 +404,7 @@ void sandbox_Database_Load()
                                continue;
 
                        entity e;
-                       e = sandbox_ObjectPort_Load(file_read, TRUE);
+                       e = sandbox_ObjectPort_Load(file_read, true);
 
                        if(e.material)
                        {
@@ -422,18 +422,18 @@ void sandbox_Database_Load()
 MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
 {
        if(MUTATOR_RETURNVALUE) // command was already handled?
-               return FALSE;
+               return false;
        if(cmd_name == "g_sandbox")
        {
                if(autocvar_g_sandbox_readonly)
                {
                        print_to(self, "^2SANDBOX - INFO: ^7Sandbox mode is active, but in read-only mode. Sandbox commands cannot be used");
-                       return TRUE;
+                       return true;
                }
                if(cmd_argc < 2)
                {
                        print_to(self, "^2SANDBOX - INFO: ^7Sandbox mode is active. For usage information, type 'sandbox help'");
-                       return TRUE;
+                       return true;
                }
 
                switch(argv(1))
@@ -471,52 +471,52 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                print_to(self, "^3mesh ^7- prints information about the object's mesh, including skeletal bones");
                                print_to(self, "^3attachments ^7- prints information about the object's attachments");
                                print_to(self, "^7The ^1drag object ^7key can be used to grab and carry objects. Players can only grab their own objects");
-                               return TRUE;
+                               return true;
 
                        // ---------------- COMMAND: OBJECT, SPAWN ----------------
                        case "object_spawn":
                                if(time < self.object_flood)
                                {
                                        print_to(self, strcat("^1SANDBOX - WARNING: ^7Flood protection active. Please wait ^3", ftos(self.object_flood - time), " ^7seconds beofore spawning another object"));
-                                       return TRUE;
+                                       return true;
                                }
                                self.object_flood = time + autocvar_g_sandbox_editor_flood;
                                if(object_count >= autocvar_g_sandbox_editor_maxobjects)
                                {
                                        print_to(self, strcat("^1SANDBOX - WARNING: ^7Cannot spawn any more objects. Up to ^3", ftos(autocvar_g_sandbox_editor_maxobjects), " ^7objects may exist at a time"));
-                                       return TRUE;
+                                       return true;
                                }
                                if(cmd_argc < 3)
                                {
                                        print_to(self, "^1SANDBOX - WARNING: ^7Attempted to spawn an object without specifying a model. Please specify the path to your model file after the 'object_spawn' command");
-                                       return TRUE;
+                                       return true;
                                }
                                if (!(fexists(argv(2))))
                                {
                                        print_to(self, "^1SANDBOX - WARNING: ^7Attempted to spawn an object with a non-existent model. Make sure the path to your model file is correct");
-                                       return TRUE;
+                                       return true;
                                }
 
-                               e = sandbox_ObjectSpawn(FALSE);
+                               e = sandbox_ObjectSpawn(false);
                                setmodel(e, argv(2));
 
                                if(autocvar_g_sandbox_info > 0)
                                        print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " spawned an object at origin ^3", vtos(e.origin), "\n"));
-                               return TRUE;
+                               return true;
 
                        // ---------------- COMMAND: OBJECT, REMOVE ----------------
                        case "object_remove":
-                               e = sandbox_ObjectEdit_Get(TRUE);
+                               e = sandbox_ObjectEdit_Get(true);
                                if(e != world)
                                {
                                        if(autocvar_g_sandbox_info > 0)
                                                print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " removed an object at origin ^3", vtos(e.origin), "\n"));
                                        sandbox_ObjectRemove(e);
-                                       return TRUE;
+                                       return true;
                                }
 
                                print_to(self, "^1SANDBOX - WARNING: ^7Object could not be removed. Make sure you are facing an object that you have edit rights over");
-                               return TRUE;
+                               return true;
 
                        // ---------------- COMMAND: OBJECT, DUPLICATE ----------------
                        case "object_duplicate":
@@ -527,42 +527,42 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                                e = sandbox_ObjectEdit_Get(autocvar_g_sandbox_editor_free); // can we copy objects we can't edit?
                                                if(e != world)
                                                {
-                                                       s = sandbox_ObjectPort_Save(e, FALSE);
+                                                       s = sandbox_ObjectPort_Save(e, false);
                                                        s = strreplace("\"", "\\\"", s);
                                                        stuffcmd(self, strcat("set ", argv(3), " \"", s, "\""));
 
                                                        print_to(self, "^2SANDBOX - INFO: ^7Object copied to clipboard");
-                                                       return TRUE;
+                                                       return true;
                                                }
                                                print_to(self, "^1SANDBOX - WARNING: ^7Object could not be copied. Make sure you are facing an object that you have copy rights over");
-                                               return TRUE;
+                                               return true;
 
                                        case "paste":
                                                // spawns a new object using the properties in the player's clipboard cvar
                                                if(time < self.object_flood)
                                                {
                                                        print_to(self, strcat("^1SANDBOX - WARNING: ^7Flood protection active. Please wait ^3", ftos(self.object_flood - time), " ^7seconds beofore spawning another object"));
-                                                       return TRUE;
+                                                       return true;
                                                }
                                                self.object_flood = time + autocvar_g_sandbox_editor_flood;
                                                if(argv(3) == "") // no object in clipboard
                                                {
                                                        print_to(self, "^1SANDBOX - WARNING: ^7No object in clipboard. You must copy an object before you can paste it");
-                                                       return TRUE;
+                                                       return true;
                                                }
                                                if(object_count >= autocvar_g_sandbox_editor_maxobjects)
                                                {
                                                        print_to(self, strcat("^1SANDBOX - WARNING: ^7Cannot spawn any more objects. Up to ^3", ftos(autocvar_g_sandbox_editor_maxobjects), " ^7objects may exist at a time"));
-                                                       return TRUE;
+                                                       return true;
                                                }
-                                               e = sandbox_ObjectPort_Load(argv(3), FALSE);
+                                               e = sandbox_ObjectPort_Load(argv(3), false);
 
                                                print_to(self, "^2SANDBOX - INFO: ^7Object pasted successfully");
                                                if(autocvar_g_sandbox_info > 0)
                                                        print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " pasted an object at origin ^3", vtos(e.origin), "\n"));
-                                               return TRUE;
+                                               return true;
                                }
-                               return TRUE;
+                               return true;
 
                        // ---------------- COMMAND: OBJECT, ATTACH ----------------
                        case "object_attach":
@@ -570,24 +570,24 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                {
                                        case "get":
                                                // select e as the object as meant to be attached
-                                               e = sandbox_ObjectEdit_Get(TRUE);
+                                               e = sandbox_ObjectEdit_Get(true);
                                                if(e != world)
                                                {
                                                        self.object_attach = e;
                                                        print_to(self, "^2SANDBOX - INFO: ^7Object selected for attachment");
-                                                       return TRUE;
+                                                       return true;
                                                }
                                                print_to(self, "^1SANDBOX - WARNING: ^7Object could not be selected for attachment. Make sure you are facing an object that you have edit rights over");
-                                               return TRUE;
+                                               return true;
                                        case "set":
                                                if(self.object_attach == world)
                                                {
                                                        print_to(self, "^1SANDBOX - WARNING: ^7No object selected for attachment. Please select an object to be attached first.");
-                                                       return TRUE;
+                                                       return true;
                                                }
 
                                                // attaches the previously selected object to e
-                                               e = sandbox_ObjectEdit_Get(TRUE);
+                                               e = sandbox_ObjectEdit_Get(true);
                                                if(e != world)
                                                {
                                                        sandbox_ObjectAttach_Set(self.object_attach, e, argv(3));
@@ -595,35 +595,35 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                                        print_to(self, "^2SANDBOX - INFO: ^7Object attached successfully");
                                                        if(autocvar_g_sandbox_info > 1)
                                                                print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " attached objects at origin ^3", vtos(e.origin), "\n"));
-                                                       return TRUE;
+                                                       return true;
                                                }
                                                print_to(self, "^1SANDBOX - WARNING: ^7Object could not be attached to the parent. Make sure you are facing an object that you have edit rights over");
-                                               return TRUE;
+                                               return true;
                                        case "remove":
                                                // removes e if it was attached
-                                               e = sandbox_ObjectEdit_Get(TRUE);
+                                               e = sandbox_ObjectEdit_Get(true);
                                                if(e != world)
                                                {
                                                        sandbox_ObjectAttach_Remove(e);
                                                        print_to(self, "^2SANDBOX - INFO: ^7Child objects detached successfully");
                                                        if(autocvar_g_sandbox_info > 1)
                                                                print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " detached objects at origin ^3", vtos(e.origin), "\n"));
-                                                       return TRUE;
+                                                       return true;
                                                }
                                                print_to(self, "^1SANDBOX - WARNING: ^7Child objects could not be detached. Make sure you are facing an object that you have edit rights over");
-                                               return TRUE;
+                                               return true;
                                }
-                               return TRUE;
+                               return true;
 
                        // ---------------- COMMAND: OBJECT, EDIT ----------------
                        case "object_edit":
                                if(argv(2) == "")
                                {
                                        print_to(self, "^1SANDBOX - WARNING: ^7Too few parameters. You must specify a property to edit");
-                                       return TRUE;
+                                       return true;
                                }
 
-                               e = sandbox_ObjectEdit_Get(TRUE);
+                               e = sandbox_ObjectEdit_Get(true);
                                if(e != world)
                                {
                                        switch(argv(2))
@@ -690,20 +690,20 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                                        break;
                                                default:
                                                        print_to(self, "^1SANDBOX - WARNING: ^7Invalid object property. For usage information, type 'sandbox help'");
-                                                       return TRUE;
+                                                       return true;
                                        }
 
                                        // update last editing time
                                        if(e.message2)  strunzone(e.message2);
-                                       e.message2 = strzone(strftime(TRUE, "%d-%m-%Y %H:%M:%S"));
+                                       e.message2 = strzone(strftime(true, "%d-%m-%Y %H:%M:%S"));
 
                                        if(autocvar_g_sandbox_info > 1)
                                                print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " edited property ^3", argv(2), " ^7of an object at origin ^3", vtos(e.origin), "\n"));
-                                       return TRUE;
+                                       return true;
                                }
 
                                print_to(self, "^1SANDBOX - WARNING: ^7Object could not be edited. Make sure you are facing an object that you have edit rights over");
-                               return TRUE;
+                               return true;
 
                        // ---------------- COMMAND: OBJECT, CLAIM ----------------
                        case "object_claim":
@@ -711,9 +711,9 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                if(self.crypto_idfp == "")
                                {
                                        print_to(self, "^1SANDBOX - WARNING: ^7You do not have a player UID, and cannot claim objects");
-                                       return TRUE;
+                                       return true;
                                }
-                               e = sandbox_ObjectEdit_Get(TRUE);
+                               e = sandbox_ObjectEdit_Get(true);
                                if(e != world)
                                {
                                        // update the owner's name
@@ -729,7 +729,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                        if(e.crypto_idfp == self.crypto_idfp)
                                        {
                                                print_to(self, "^2SANDBOX - INFO: ^7Object is already yours, nothing to claim");
-                                               return TRUE;
+                                               return true;
                                        }
 
                                        if(e.crypto_idfp)       strunzone(e.crypto_idfp);
@@ -738,25 +738,25 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                        print_to(self, "^2SANDBOX - INFO: ^7Object claimed successfully");
                                }
                                print_to(self, "^1SANDBOX - WARNING: ^7Object could not be claimed. Make sure you are facing an object that you have edit rights over");
-                               return TRUE;
+                               return true;
 
                        // ---------------- COMMAND: OBJECT, INFO ----------------
                        case "object_info":
                                // prints public information about the object to the player
-                               e = sandbox_ObjectEdit_Get(FALSE);
+                               e = sandbox_ObjectEdit_Get(false);
                                if(e != world)
                                {
                                        switch(argv(2))
                                        {
                                                case "object":
                                                        print_to(self, strcat("^2SANDBOX - INFO: ^7Object is owned by \"^7", e.netname, "^7\", created \"^3", e.message, "^7\", last edited \"^3", e.message2, "^7\""));
-                                                       return TRUE;
+                                                       return true;
                                                case "mesh":
                                                        s = "";
                                                        FOR_EACH_TAG(e)
                                                                s = strcat(s, "^7\"^5", gettaginfo_name, "^7\", ");
                                                        print_to(self, strcat("^2SANDBOX - INFO: ^7Object mesh is \"^3", e.model, "^7\" at animation frame ^3", ftos(e.frame), " ^7containing the following tags: ", s));
-                                                       return TRUE;
+                                                       return true;
                                                case "attachments":
                                                        // this should show the same info as 'mesh' but for attachments
                                                        s = "";
@@ -776,39 +776,39 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                                                print_to(self, strcat("^2SANDBOX - INFO: ^7Object contains the following ^1", ftos(i), "^7 attachment(s): ", s));
                                                        else
                                                                print_to(self, "^2SANDBOX - INFO: ^7Object contains no attachments");
-                                                       return TRUE;
+                                                       return true;
                                        }
                                }
                                print_to(self, "^1SANDBOX - WARNING: ^7No information could be found. Make sure you are facing an object");
-                               return TRUE;
+                               return true;
 
                        // ---------------- COMMAND: DEFAULT ----------------
                        default:
                                print_to(self, "Invalid command. For usage information, type 'sandbox help'");
-                               return TRUE;
+                               return true;
                }
        }
-       return FALSE;
+       return false;
 }
 
 float autosave_time;
 MUTATOR_HOOKFUNCTION(sandbox_StartFrame)
 {
        if(!autocvar_g_sandbox_storage_autosave)
-               return FALSE;
+               return false;
        if(time < autosave_time)
-               return FALSE;
+               return false;
        autosave_time = time + autocvar_g_sandbox_storage_autosave;
 
        sandbox_Database_Save();
 
-       return TRUE;
+       return true;
 }
 
 MUTATOR_HOOKFUNCTION(sandbox_SetModname)
 {
        modname = "Sandbox";
-       return TRUE;
+       return true;
 }
 
 MUTATOR_DEFINITION(sandbox)
@@ -834,6 +834,6 @@ MUTATOR_DEFINITION(sandbox)
                // nothing to remove
        }
 
-       return FALSE;
+       return false;
 }
 
index d1f5fd35845803996429f922873b37fb7a254986..2f66441f7a00111eaca7ab8b4795ca06c15a65f1 100644 (file)
@@ -117,9 +117,9 @@ vector vsnap(vector point,float fsize)
 {
     vector vret;
 
-    vret_x = rint(point_x / fsize) * fsize;
-    vret_y = rint(point_y / fsize) * fsize;
-    vret_z = ceil(point_z / fsize) * fsize;
+    vret.x = rint(point.x / fsize) * fsize;
+    vret.y = rint(point.y / fsize) * fsize;
+    vret.z = ceil(point.z / fsize) * fsize;
 
     return vret;
 }
@@ -220,8 +220,8 @@ vector pathlib_wateroutnode(vector start,vector end,float doedge)
 
     pathlib_movenode_goodnode = 0;
 
-    end_x = fsnap(end_x, pathlib_gridsize);
-    end_y = fsnap(end_y, pathlib_gridsize);
+    end.x = fsnap(end.x, pathlib_gridsize);
+    end.y = fsnap(end.y, pathlib_gridsize);
 
     traceline(end + ('0 0 0.25' * pathlib_gridsize),end - ('0 0 1' * pathlib_gridsize),MOVE_WORLDONLY,self);
     end = trace_endpos;
@@ -229,7 +229,7 @@ vector pathlib_wateroutnode(vector start,vector end,float doedge)
     if(pointcontents(end - '0 0 1') != CONTENT_SOLID)
         return end;
 
-    for(surface = start ; surface_z < (end_z + 32); ++surface_z)
+    for(surface = start ; surface.z < (end.z + 32); ++surface.z)
     {
         if(pointcontents(surface) == CONTENT_EMPTY)
             break;
@@ -242,7 +242,7 @@ vector pathlib_wateroutnode(vector start,vector end,float doedge)
     if(trace_fraction == 1)
         pathlib_movenode_goodnode = 1;
 
-    if(fabs(surface_z - end_z) > 32)
+    if(fabs(surface.z - end.z) > 32)
         pathlib_movenode_goodnode = 0;
 
     return end;
@@ -255,8 +255,8 @@ vector pathlib_swimnode(vector start,vector end,float doedge)
     if(pointcontents(start) != CONTENT_WATER)
         return end;
 
-    end_x = fsnap(end_x, pathlib_gridsize);
-    end_y = fsnap(end_y, pathlib_gridsize);
+    end.x = fsnap(end.x, pathlib_gridsize);
+    end.y = fsnap(end.y, pathlib_gridsize);
 
     if(pointcontents(end) == CONTENT_EMPTY)
         return pathlib_wateroutnode( start, end);
@@ -272,8 +272,8 @@ vector pathlib_flynode(vector start,vector end)
 {
     pathlib_movenode_goodnode = 0;
 
-    end_x = fsnap(end_x, pathlib_gridsize);
-    end_y = fsnap(end_y, pathlib_gridsize);
+    end.x = fsnap(end.x, pathlib_gridsize);
+    end.y = fsnap(end.y, pathlib_gridsize);
 
     tracebox(start, walknode_boxmin,walknode_boxmax, end, MOVE_WORLDONLY, self);
     if(trace_fraction == 1)
@@ -291,8 +291,8 @@ vector pathlib_walknode(vector start,vector end,float doedge)
 
     s   = start;
     e   = end;
-    e_z = 0;
-    s_z = 0;
+    e.z = 0;
+    s.z = 0;
     direction  = normalize(s - e);
 
     distance    = vlen(start - end);
@@ -340,8 +340,8 @@ vector pathlib_walknode(vector start,vector end,float doedge)
 
     point = last_point + direction * walknode_stepsize * laststep;
 
-    point_x = fsnap(point_x, pathlib_gridsize);
-    point_y = fsnap(point_y, pathlib_gridsize);
+    point.x = fsnap(point.x, pathlib_gridsize);
+    point.y = fsnap(point.y, pathlib_gridsize);
 
     s = point + walknode_stepup;
     e = point - walknode_maxdrop;
@@ -403,8 +403,8 @@ float pathlib_h_manhattan(vector a,vector b)
     //h(n) = D * (abs(n.x-goal.x) + abs(n.y-goal.y))
 
     float h;
-    h  = fabs(a_x - b_x);
-    h += fabs(a_y - b_y);
+    h  = fabs(a.x - b.x);
+    h += fabs(a.y - b.y);
     h *= pathlib_gridsize;
 
     return h;
@@ -419,8 +419,8 @@ float pathlib_h_diagonal(vector a,vector b)
     //h(n) = D * max(abs(n.x-goal.x), abs(n.y-goal.y))
     float h,x,y;
 
-    x = fabs(a_x - b_x);
-    y = fabs(a_y - b_y);
+    x = fabs(a.x - b.x);
+    y = fabs(a.y - b.y);
     h = pathlib_movecost * max(x,y);
 
     return h;
@@ -450,8 +450,8 @@ float pathlib_h_diagonal2(vector a,vector b)
     h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n)))
     */
 
-    x = fabs(a_x - b_x);
-    y = fabs(a_y - b_y);
+    x = fabs(a.x - b.x);
+    y = fabs(a.y - b.y);
 
     h_diag = min(x,y);
     h_str = x + y;
@@ -476,9 +476,9 @@ float pathlib_h_diagonal2sdp(vector preprev,vector prev,vector point,vector end)
     //h_straight(n) = (abs(n.x-goal.x) + abs(n.y-goal.y))
     //h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n)))
 
-    x = fabs(point_x - end_x);
-    y = fabs(point_y - end_y);
-    z = fabs(point_z - end_z);
+    x = fabs(point.x - end.x);
+    y = fabs(point.y - end.y);
+    z = fabs(point.z - end.z);
 
     h_diag = min3(x,y,z);
     h_str = x + y + z;
@@ -506,9 +506,9 @@ float pathlib_h_diagonal3(vector a,vector b)
     //h_straight(n) = (abs(n.x-goal.x) + abs(n.y-goal.y))
     //h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n)))
 
-    x = fabs(a_x - b_x);
-    y = fabs(a_y - b_y);
-    z = fabs(a_z - b_z);
+    x = fabs(a.x - b.x);
+    y = fabs(a.y - b.y);
+    z = fabs(a.z - b.z);
 
     h_diag = min3(x,y,z);
     h_str = x + y + z;
@@ -520,7 +520,7 @@ float pathlib_h_diagonal3(vector a,vector b)
 }
 
 //#define PATHLIB_USE_NODESCRAP
-#define PATHLIB_NODEEXPIRE 0.05
+const float PATHLIB_NODEEXPIRE = 0.05;
 float pathlib_scraplist_cnt;
 entity newnode()
 {
@@ -554,10 +554,10 @@ void dumpnode(entity n)
 
     n.path_next    = world;
     n.path_prev    = world;
-    n.is_path_node = FALSE;
+    n.is_path_node = false;
     n.owner        = scraplist;
 #else
-    //n.is_path_node = FALSE;
+    //n.is_path_node = false;
     n.think        = SUB_Remove;
     n.nextthink    = time;
 #endif
@@ -568,7 +568,7 @@ entity pathlib_mknode(vector where,entity parent)
     entity node;
 
     node              = newnode();
-    node.is_path_node = TRUE;
+    node.is_path_node = true;
     node.owner        = openlist;
     node.path_prev    = parent;
 
@@ -635,7 +635,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go
     node = findradius(where,pathlib_gridsize * 0.75);
     while(node)
     {
-        if(node.is_path_node == TRUE)
+        if(node.is_path_node == true)
         {
             ++pathlib_merge_cnt;
             if(node.owner == openlist)
@@ -727,7 +727,7 @@ void pathlib_close_node(entity node,vector goal)
         if(pathlib_movenode_goodnode)
         {
             goal_node         = node;
-            pathlib_foundgoal = TRUE;
+            pathlib_foundgoal = true;
         }
     }
 }
@@ -782,9 +782,9 @@ float pathlib_expandnode_box(entity node, vector start, vector goal)
 {
     vector v;
 
-    for(v_z = node.origin_z - pathlib_gridsize; v_z <= node.origin_z + pathlib_gridsize; v_z += pathlib_gridsize)
-    for(v_y = node.origin_y - pathlib_gridsize; v_y <= node.origin_y + pathlib_gridsize; v_y += pathlib_gridsize)
-    for(v_x = node.origin_x - pathlib_gridsize; v_x <= node.origin_x + pathlib_gridsize; v_x += pathlib_gridsize)
+    for(v.z = node.origin.z - pathlib_gridsize; v.z <= node.origin.z + pathlib_gridsize; v.z += pathlib_gridsize)
+    for(v.y = node.origin.y - pathlib_gridsize; v.y <= node.origin.y + pathlib_gridsize; v.y += pathlib_gridsize)
+    for(v.x = node.origin.x - pathlib_gridsize; v.x <= node.origin.x + pathlib_gridsize; v.x += pathlib_gridsize)
     {
         if(vlen(v - node.origin))
             pathlib_makenode(node,start,v,goal,pathlib_movecost);
@@ -797,11 +797,11 @@ void pathlib_cleanup()
 {
     entity node;
 
-    node = findfloat(world,is_path_node, TRUE);
+    node = findfloat(world,is_path_node, true);
     while(node)
     {
         dumpnode(node);
-        node = findfloat(node,is_path_node, TRUE);
+        node = findfloat(node,is_path_node, true);
     }
 
     if(openlist)
@@ -929,16 +929,16 @@ entity pathlib_astar(vector from,vector to)
 
     pathlib_edge_check_size = (vlen(walknode_boxmin - walknode_boxmax) * 0.5);
 
-    walknode_boxup    = '0 0 2' * self.maxs_z;
+    walknode_boxup    = '0 0 2' * self.maxs.z;
     walknode_stepsize = 32;
     walknode_stepup   = '0 0 1' * walknode_stepsize;
     walknode_maxdrop  = '0 0 3' * walknode_stepsize;
 
-    from_x = fsnap(from_x,pathlib_gridsize);
-    from_y = fsnap(from_y,pathlib_gridsize);
+    from.x = fsnap(from.x,pathlib_gridsize);
+    from.y = fsnap(from.y,pathlib_gridsize);
 
-    to_x = fsnap(to_x,pathlib_gridsize);
-    to_y = fsnap(to_y,pathlib_gridsize);
+    to.x = fsnap(to.x,pathlib_gridsize);
+    to.y = fsnap(to.y,pathlib_gridsize);
 
     dprint("AStar init. ", ftos(pathlib_scraplist_cnt), " nodes on scrap\n");
     path = pathlib_mknode(from,world);
index 86f32e2189f3a53fc8e7b656ca6098ce00506714..0b2ee4559995671b324050c7664cf0dc2455a5e5 100644 (file)
@@ -34,8 +34,8 @@ float pathlib_h_manhattan(vector a,vector b)
     //h(n) = D * (abs(n.x-goal.x) + abs(n.y-goal.y))
 
     float h;
-    h  = fabs(a_x - b_x);
-    h += fabs(a_y - b_y);
+    h  = fabs(a.x - b.x);
+    h += fabs(a.y - b.y);
     h *= pathlib_gridsize;
 
     return h;
@@ -50,8 +50,8 @@ float pathlib_h_diagonal(vector a,vector b)
     //h(n) = D * max(abs(n.x-goal.x), abs(n.y-goal.y))
     float h,x,y;
 
-    x = fabs(a_x - b_x);
-    y = fabs(a_y - b_y);
+    x = fabs(a.x - b.x);
+    y = fabs(a.y - b.y);
     h = pathlib_movecost * max(x,y);
 
     return h;
@@ -81,8 +81,8 @@ float pathlib_h_diagonal2(vector a,vector b)
     h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n)))
     */
 
-    x = fabs(a_x - b_x);
-    y = fabs(a_y - b_y);
+    x = fabs(a.x - b.x);
+    y = fabs(a.y - b.y);
 
     h_diag = min(x,y);
     h_str = x + y;
@@ -105,9 +105,9 @@ float pathlib_h_diagonal2sdp(vector preprev,vector prev,vector point,vector end)
     //h_straight(n) = (abs(n.x-goal.x) + abs(n.y-goal.y))
     //h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n)))
 
-    x = fabs(point_x - end_x);
-    y = fabs(point_y - end_y);
-    z = fabs(point_z - end_z);
+    x = fabs(point.x - end.x);
+    y = fabs(point.y - end.y);
+    z = fabs(point.z - end.z);
 
     h_diag = min3(x,y,z);
     h_str = x + y + z;
@@ -130,9 +130,9 @@ float pathlib_h_diagonal3(vector a,vector b)
 {
     float h_diag,h_str,h,x,y,z;
 
-    x = fabs(a_x - b_x);
-    y = fabs(a_y - b_y);
-    z = fabs(a_z - b_z);
+    x = fabs(a.x - b.x);
+    y = fabs(a.y - b.y);
+    z = fabs(a.z - b.z);
 
     h_diag = min3(x,y,z);
     h_str = x + y + z;
index d432221f25fe3bf9c2e11c4bf9d5bd8a6343c60f..4f73b24733bcbf75714a07a33db840cb4e9bc8b6 100644 (file)
@@ -65,19 +65,19 @@ void pathlib_showsquare2(entity node ,vector ncolor,float align)
     }
 }
 
-void pathlib_showsquare(vector where,float goodsquare,float lifetime)
+void pathlib_showsquare(vector where,float goodsquare,float _lifetime)
 {
     entity s;
 
-    if(!lifetime)
-        lifetime = time + 30;
+    if(!_lifetime)
+        _lifetime = time + 30;
     else
-        lifetime += time;
+        _lifetime += time;
 
     s           = spawn();
     s.alpha     = 0.25;
     s.think     = SUB_Remove;
-    s.nextthink = lifetime;
+    s.nextthink = _lifetime;
     s.scale     = pathlib_gridsize / 512.001;
     s.solid     = SOLID_NOT;
 
@@ -95,19 +95,19 @@ void pathlib_showsquare(vector where,float goodsquare,float lifetime)
     setorigin(s,where);
 }
 
-void pathlib_showedge(vector where,float lifetime,float rot)
+void pathlib_showedge(vector where,float _lifetime,float rot)
 {
     entity e;
 
-    if(!lifetime)
-        lifetime = time + 30;
+    if(!_lifetime)
+        _lifetime = time + 30;
     else
-        lifetime += time;
+        _lifetime += time;
 
     e           = spawn();
     e.alpha     = 0.25;
     e.think     = SUB_Remove;
-    e.nextthink = lifetime;
+    e.nextthink = _lifetime;
     e.scale     = pathlib_gridsize / 512;
     e.solid     = SOLID_NOT;
     setorigin(e,where);
index a08c66b3ae5f48fd657adf5ee61ac53282177c92..4427f9b7fd03f432fc23a6c9d370ebb36629d672 100644 (file)
@@ -220,9 +220,9 @@ float pathlib_expandnode_box(entity node, vector start, vector goal)
 {
     vector v;
 
-    for(v_z = node.origin_z - pathlib_gridsize; v_z <= node.origin_z + pathlib_gridsize; v_z += pathlib_gridsize)
-    for(v_y = node.origin_y - pathlib_gridsize; v_y <= node.origin_y + pathlib_gridsize; v_y += pathlib_gridsize)
-    for(v_x = node.origin_x - pathlib_gridsize; v_x <= node.origin_x + pathlib_gridsize; v_x += pathlib_gridsize)
+    for(v.z = node.origin.z - pathlib_gridsize; v.z <= node.origin.z + pathlib_gridsize; v.z += pathlib_gridsize)
+    for(v.y = node.origin.y - pathlib_gridsize; v.y <= node.origin.y + pathlib_gridsize; v.y += pathlib_gridsize)
+    for(v.x = node.origin.x - pathlib_gridsize; v.x <= node.origin.x + pathlib_gridsize; v.x += pathlib_gridsize)
     {
         //if(vlen(v - node.origin))
             pathlib_makenode(node,start,v,goal,pathlib_movecost);
index 589ff82a1122f000df835f78d1d4d9e2f8fe26d1..5fef3251f64b568680f124c442a85572d2ee35c0 100644 (file)
@@ -12,11 +12,11 @@ void pathlib_deletepath(entity start)
 }
 
 //#define PATHLIB_NODEEXPIRE 0.05
-#define PATHLIB_NODEEXPIRE 20
+const float PATHLIB_NODEEXPIRE = 20;
 
 void dumpnode(entity n)
 {
-    n.is_path_node = FALSE;
+    n.is_path_node = false;
     n.think        = SUB_Remove;
     n.nextthink    = time;
 }
@@ -38,7 +38,7 @@ entity pathlib_mknode(vector where,entity parent)
 
     node.think        = SUB_Remove;
     node.nextthink    = time + PATHLIB_NODEEXPIRE;
-    node.is_path_node = TRUE;
+    node.is_path_node = true;
     node.owner        = openlist;
     node.path_prev    = parent;
 
@@ -157,7 +157,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go
     node = findradius(where,pathlib_gridsize * 0.5);
     while(node)
     {
-        if(node.is_path_node == TRUE)
+        if(node.is_path_node == true)
         {
             ++pathlib_merge_cnt;
             if(node.owner == openlist)
@@ -255,7 +255,7 @@ void pathlib_close_node(entity node,vector goal)
         if(pathlib_movenode_goodnode)
         {
             goal_node         = node;
-            pathlib_foundgoal = TRUE;
+            pathlib_foundgoal = true;
         }
     }
 }
@@ -268,7 +268,7 @@ void pathlib_cleanup()
 
     entity node;
 
-    node = findfloat(world,is_path_node, TRUE);
+    node = findfloat(world,is_path_node, true);
     while(node)
     {
         /*
@@ -280,7 +280,7 @@ void pathlib_cleanup()
         */
 
         dumpnode(node);
-        node = findfloat(node,is_path_node, TRUE);
+        node = findfloat(node,is_path_node, true);
     }
 
     if(openlist)
@@ -443,12 +443,12 @@ entity pathlib_astar(vector from,vector to)
     //movenode_maxdrop  = '0 0 512';
     movenode_boxup    = '0 0 72';
 
-    from_x = fsnap(from_x, pathlib_gridsize);
-    from_y = fsnap(from_y, pathlib_gridsize);
+    from.x = fsnap(from.x, pathlib_gridsize);
+    from.y = fsnap(from.y, pathlib_gridsize);
     //from_z += 32;
 
-    to_x = fsnap(to_x, pathlib_gridsize);
-    to_y = fsnap(to_y, pathlib_gridsize);
+    to.x = fsnap(to.x, pathlib_gridsize);
+    to.y = fsnap(to.y, pathlib_gridsize);
     //to_z += 32;
 
     dprint("AStar init\n");
index 997eaa4209a95afbf887b06ee23bba53d312a81b..1da6fe16718065a64a0f69ef81767a496399bbaa 100644 (file)
@@ -4,8 +4,8 @@ vector pathlib_wateroutnode(vector start,vector end, float doedge)
 
     pathlib_movenode_goodnode = 0;
 
-    end_x = fsnap(end_x, pathlib_gridsize);
-    end_y = fsnap(end_y, pathlib_gridsize);
+    end.x = fsnap(end.x, pathlib_gridsize);
+    end.y = fsnap(end.y, pathlib_gridsize);
 
     traceline(end + ('0 0 0.25' * pathlib_gridsize),end - ('0 0 1' * pathlib_gridsize),MOVE_WORLDONLY,self);
     end = trace_endpos;
@@ -13,7 +13,7 @@ vector pathlib_wateroutnode(vector start,vector end, float doedge)
     if (!(pointcontents(end - '0 0 1') == CONTENT_SOLID))
         return end;
 
-    for(surface = start ; surface_z < (end_z + 32); ++surface_z)
+    for(surface = start ; surface.z < (end.z + 32); ++surface.z)
     {
         if(pointcontents(surface) == CONTENT_EMPTY)
             break;
@@ -26,7 +26,7 @@ vector pathlib_wateroutnode(vector start,vector end, float doedge)
     if(trace_fraction == 1)
         pathlib_movenode_goodnode = 1;
 
-    if(fabs(surface_z - end_z) > 32)
+    if(fabs(surface.z - end.z) > 32)
         pathlib_movenode_goodnode = 0;
 
     return end;
@@ -39,8 +39,8 @@ vector pathlib_swimnode(vector start,vector end, float doedge)
     if(pointcontents(start) != CONTENT_WATER)
         return end;
 
-    end_x = fsnap(end_x, pathlib_gridsize);
-    end_y = fsnap(end_y, pathlib_gridsize);
+    end.x = fsnap(end.x, pathlib_gridsize);
+    end.y = fsnap(end.y, pathlib_gridsize);
 
     if(pointcontents(end) == CONTENT_EMPTY)
         return pathlib_wateroutnode( start, end, doedge);
@@ -56,8 +56,8 @@ vector pathlib_flynode(vector start,vector end, float doedge)
 {
     pathlib_movenode_goodnode = 0;
 
-    end_x = fsnap(end_x, pathlib_gridsize);
-    end_y = fsnap(end_y, pathlib_gridsize);
+    end.x = fsnap(end.x, pathlib_gridsize);
+    end.y = fsnap(end.y, pathlib_gridsize);
 
     tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self);
     if(trace_fraction == 1)
@@ -84,10 +84,10 @@ vector pathlib_walknode(vector start,vector end,float doedge)
 
     pathlib_movenode_goodnode = 0;
 
-    end_x = fsnap(end_x,pathlib_gridsize);
-    end_y = fsnap(end_y,pathlib_gridsize);
-    start_x = fsnap(start_x,pathlib_gridsize);
-    start_y = fsnap(start_y,pathlib_gridsize);
+    end.x = fsnap(end.x,pathlib_gridsize);
+    end.y = fsnap(end.y,pathlib_gridsize);
+    start.x = fsnap(start.x,pathlib_gridsize);
+    start.y = fsnap(start.y,pathlib_gridsize);
 
     // Find the floor
     traceline(start + movenode_stepup, start - movenode_maxdrop, MOVE_WORLDONLY, self);
@@ -128,8 +128,8 @@ vector pathlib_walknode(vector start,vector end,float doedge)
     }
 
     point = last_point + (direction * movenode_stepsize);
-    point_x = fsnap(point_x,pathlib_gridsize);
-    point_y = fsnap(point_y,pathlib_gridsize);
+    point.x = fsnap(point.x,pathlib_gridsize);
+    point.y = fsnap(point.y,pathlib_gridsize);
 
     //dprint("end_x:  ",ftos(end_x),  "  end_y:  ",ftos(end_y),"\n");
     //dprint("point_x:",ftos(point_x),"  point_y:",ftos(point_y),"\n\n");
index 9f443b0ac7659e0d16a81af1a1a3e031132ccb81..231c14f21bbbf6b6c8464a62d857ba593394116d 100644 (file)
@@ -11,14 +11,14 @@ void pathlib_wpp_close(entity wp)
         best_open_node = world;
 
     if(wp == goal_node)
-        pathlib_foundgoal = TRUE;
+        pathlib_foundgoal = true;
 }
 
 float pathlib_wpp_opencb(entity wp, entity child, float cost)
 {
 
     if(child.pathlib_list == closedlist)
-        return FALSE;
+        return false;
 
        // FIXME! wp.wp##mincost is NOT distance. Make it distance or add a field for distance to be used here (for better speed)
        cost = vlen(child.origin - wp.origin);
@@ -32,21 +32,21 @@ float pathlib_wpp_opencb(entity wp, entity child, float cost)
 
 
     if(child == goal_node)
-        pathlib_foundgoal = TRUE;
+        pathlib_foundgoal = true;
 
     ++pathlib_open_cnt;
 
     if(best_open_node.pathlib_node_f > child.pathlib_node_f)
         best_open_node = child;
 
-    return TRUE;
+    return true;
 }
 
 float pathlib_wpp_openncb(entity wp, entity child, float cost)
 {
 
     if(child.pathlib_list == closedlist)
-        return FALSE;
+        return false;
 
        // FIXME! wp.wp##mincost is NOT distance. Make it distance or add a field for distance to be used here (for better speed)
        cost = vlen(child.origin - wp.origin);
@@ -58,14 +58,14 @@ float pathlib_wpp_openncb(entity wp, entity child, float cost)
     child.pathlib_node_f = child.pathlib_node_g + child.pathlib_node_h;
 
     if(child == goal_node)
-        pathlib_foundgoal = TRUE;
+        pathlib_foundgoal = true;
 
     ++pathlib_open_cnt;
 
     if(best_open_node.pathlib_node_f > child.pathlib_node_f)
         best_open_node = child;
 
-    return TRUE;
+    return true;
 }
 
 float pathlib_wpp_expand(entity wp)
@@ -138,7 +138,7 @@ entity pathlib_waypointpath(entity wp_from, entity wp_to, float callback)
        pathlib_movecost_diag   = vlen('1 1 0' * pathlib_movecost);
 
        if (!pathlib_wpp_waypointcallback)
-               callback = FALSE;
+               callback = false;
 
        if (callback)
                pathlib_wpp_open = pathlib_wpp_opencb;
@@ -156,7 +156,7 @@ entity pathlib_waypointpath(entity wp_from, entity wp_to, float callback)
     pathlib_closed_cnt       = 0;
     pathlib_open_cnt         = 0;
     pathlib_searched_cnt     = 0;
-    pathlib_foundgoal      = FALSE;
+    pathlib_foundgoal      = false;
 
     dprint("pathlib_waypointpath init\n");
 
index d1b6667d715f4a6075f992f999ceb846a608e339..d0029bfc4809be08e2d93195781100a082c755ad 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef PATHLIB_H
+#define PATHLIB_H
+
 .entity pathlib_list;
 .entity path_next;
 .entity path_prev;
@@ -5,9 +8,9 @@
 #define inwater(point) (pointcontents(point) == CONTENT_WATER)
 #define medium spawnshieldtime
 
-#define PLIB_FORWARD '0 1 0'
+const vector PLIB_FORWARD = '0 1 0';
 //#define PLIB_BACK    '0 -1 0'
-#define PLIB_RIGHT   '1 0 0'
+const vector PLIB_RIGHT = '1 0 0';
 //#define PLIB_LEFT    '-1 0 0'
 
 #define DEBUGPATHING
@@ -28,16 +31,16 @@ entity start_node;
 .float pathlib_node_f;
 .float pathlib_node_c;
 
-#define pathlib_node_edgeflag_unknown        0
-#define pathlib_node_edgeflag_left           2
-#define pathlib_node_edgeflag_right          4
-#define pathlib_node_edgeflag_forward        8
-#define pathlib_node_edgeflag_back           16
-#define pathlib_node_edgeflag_backleft       32
-#define pathlib_node_edgeflag_backright      64
-#define pathlib_node_edgeflag_forwardleft    128
-#define pathlib_node_edgeflag_forwardright   256
-#define pathlib_node_edgeflag_none           512
+const float pathlib_node_edgeflag_unknown              = 0;
+const float pathlib_node_edgeflag_left                         = 2;
+const float pathlib_node_edgeflag_right                = 4;
+const float pathlib_node_edgeflag_forward              = 8;
+const float pathlib_node_edgeflag_back                         = 16;
+const float pathlib_node_edgeflag_backleft             = 32;
+const float pathlib_node_edgeflag_backright    = 64;
+const float pathlib_node_edgeflag_forwardleft  = 128;
+const float pathlib_node_edgeflag_forwardright         = 256;
+const float pathlib_node_edgeflag_none                         = 512;
 .float pathlib_node_edgeflags;
 
 float pathlib_open_cnt;
@@ -55,7 +58,7 @@ float pathlib_movecost_waterfactor;
 float pathlib_foundgoal;
 
 float pathlib_starttime;
-#define pathlib_maxtime 60
+const float pathlib_maxtime = 60;
 
 entity best_open_node;
 
@@ -116,3 +119,4 @@ var float  pathlib_wpp_waypointcallback(entity wp, entity wp_prev);
 #include "expandnode.qc"
 #include "main.qc"
 #include "path_waypoint.qc"
+#endif
index 7a0aec8652ed0ae8f32b2594da45ad49459a6165..7bdc70877420a38d60bd7ce7b3da04e99abe4c28 100644 (file)
@@ -7,9 +7,9 @@ vector vsnap(vector point,float fsize)
 {
     vector vret;
 
-    vret_x = rint(point_x / fsize) * fsize;
-    vret_y = rint(point_y / fsize) * fsize;
-    vret_z = ceil(point_z / fsize) * fsize;
+    vret.x = rint(point.x / fsize) * fsize;
+    vret.y = rint(point.y / fsize) * fsize;
+    vret.z = ceil(point.z / fsize) * fsize;
 
     return vret;
 }
@@ -68,13 +68,13 @@ entity pathlib_nodeatpoint(vector where)
 
     ++pathlib_searched_cnt;
 
-    where_x = fsnap(where_x,pathlib_gridsize);
-    where_y = fsnap(where_y,pathlib_gridsize);
+    where.x = fsnap(where.x,pathlib_gridsize);
+    where.y = fsnap(where.y,pathlib_gridsize);
 
     node = findradius(where,pathlib_gridsize * 0.5);
     while(node)
     {
-        if(node.is_path_node == TRUE)
+        if(node.is_path_node == true)
             return node;
 
         node = node.chain;
index 631c10dcbb67fb36bacf638882abe4710f70a76f..4d58a95f6ff0bc82da280d6f60bc22628d389f4b 100644 (file)
@@ -1,10 +1,19 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "defs.qh"
+    #include "playerdemo.qh"
+#endif
+
 .float playerdemo_fh;
 .float playerdemo_mode;
 .float playerdemo_starttime;
 .float playerdemo_time;
-#define PLAYERDEMO_MODE_OFF 0
-#define PLAYERDEMO_MODE_READING 1
-#define PLAYERDEMO_MODE_WRITING 2
+const float PLAYERDEMO_MODE_OFF = 0;
+const float PLAYERDEMO_MODE_READING = 1;
+const float PLAYERDEMO_MODE_WRITING = 2;
 void playerdemo_init()
 {
        self.playerdemo_mode = PLAYERDEMO_MODE_OFF;
index b790683675003ee00ab3e6de59dcd0e05e04fac9..8aecd483ed0f71057442b001f104fc973e4552c9 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef PLAYERDEMO_H
+#define PLAYERDEMO_H
+
 void playerdemo_init();
 void playerdemo_shutdown();
 void playerdemo_write();
@@ -5,3 +8,4 @@ float playerdemo_read();
 
 void playerdemo_open_read(string f);
 void playerdemo_open_write(string f);
+#endif
index aff0652d4a569061d7fb39a43d654185f264b229..53c77ecceefc089e6215e93fd2d9bc771205bc3a 100644 (file)
@@ -1,7 +1,27 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../warpzonelib/anglestransform.qh"
+    #include "../warpzonelib/util_server.qh"
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "autocvars.qh"
+    #include "defs.qh"
+    #include "../common/notifications.qh"
+    #include "../common/deathtypes.qh"
+    #include "mutators/mutators_include.qh"
+    #include "../csqcmodellib/sv_model.qh"
+    #include "portals.qh"
+    #include "g_hook.qh"
+#endif
+
 #define PORTALS_ARE_NOT_SOLID
 
-#define SAFENUDGE '1 1 1'
-#define SAFERNUDGE '8 8 8'
+const vector SAFENUDGE = '1 1 1';
+const vector SAFERNUDGE = '8 8 8';
 
 .vector portal_transform;
 .vector portal_safe_origin;
@@ -13,9 +33,9 @@ float PlayerEdgeDistance(entity p, vector v)
 {
        vector vbest;
 
-       if(v_x < 0) vbest_x = p.mins_x; else vbest_x = p.maxs_x;
-       if(v_y < 0) vbest_y = p.mins_y; else vbest_y = p.maxs_y;
-       if(v_z < 0) vbest_z = p.mins_z; else vbest_z = p.maxs_z;
+       if(v.x < 0) vbest.x = p.mins.x; else vbest.x = p.maxs.x;
+       if(v.y < 0) vbest.y = p.mins.y; else vbest.y = p.maxs.y;
+       if(v.z < 0) vbest.z = p.mins.z; else vbest.z = p.maxs.z;
 
        return vbest * v;
 }
@@ -36,7 +56,7 @@ vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle)
 
        // PLAYERS use different math
 #ifndef POSITIVE_PITCH_IS_DOWN
-       ang_x = -ang_x;
+       ang.x = -ang.x;
 #endif
 
        //print("reference: ", vtos(AnglesTransform_ApplyToVAngles(transform, ang)), "\n");
@@ -44,7 +64,7 @@ vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle)
        fixedmakevectors(ang);
        old_forward = v_forward;
        old_up = v_up;
-       fixedmakevectors(ang_y * '0 1 0');
+       fixedmakevectors(ang.y * '0 1 0');
        old_yawforward = v_forward;
 
        // their aiming directions are portalled...
@@ -59,14 +79,14 @@ vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle)
        //
        // new_up could now point forward OR backward... which direction to choose?
 
-       if(new_forward_z > 0.7 || new_forward_z < -0.7) // far up; in this case, the "up" vector points backwards
+       if(new_forward.z > 0.7 || new_forward.z < -0.7) // far up; in this case, the "up" vector points backwards
        {
                // new_yawforward and new_yawup define the new aiming half-circle
                // we "just" need to find out whether new_up or -new_up is in that half circle
                ang = fixedvectoangles(new_forward); // this still gets us a nice pitch value...
                if(new_up * new_yawforward < 0)
                        new_up = -1 * new_up;
-               ang_y = vectoyaw(new_up); // this vector is the yaw we want
+               ang.y = vectoyaw(new_up); // this vector is the yaw we want
                //print("UP/DOWN path: ", vtos(ang), "\n");
        }
        else
@@ -77,9 +97,9 @@ vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle)
        }
 
 #ifndef POSITIVE_PITCH_IS_DOWN
-       ang_x = -ang_x;
+       ang.x = -ang.x;
 #endif
-       ang_z = vangle_z;
+       ang.z = vangle.z;
        return ang;
 }
 
@@ -216,9 +236,9 @@ float Portal_WillHitPlane(vector eorg, vector emins, vector emaxs, vector evel,
        vector v;
 
        dist = (eorg - porg) * pnorm;
-       dist += min(emins_x * pnorm_x, emaxs_x * pnorm_x);
-       dist += min(emins_y * pnorm_y, emaxs_y * pnorm_y);
-       dist += min(emins_z * pnorm_z, emaxs_z * pnorm_z);
+       dist += min(emins.x * pnorm.x, emaxs.x * pnorm.x);
+       dist += min(emins.y * pnorm.y, emaxs.y * pnorm.y);
+       dist += min(emins.z * pnorm.z, emaxs.z * pnorm.z);
        if(dist < -1) // other side?
                return 0;
 #ifdef PORTALS_ARE_NOT_SOLID
@@ -286,7 +306,7 @@ void Portal_Touch()
                                return; // cannot go through someone else's portal
        fixedmakevectors(self.mangle);
        g = frametime * '0 0 -1' * autocvar_sv_gravity;
-       if(!Portal_WillHitPlane(other.origin, other.mins, other.maxs, other.velocity + g, self.origin, v_forward, self.maxs_x))
+       if(!Portal_WillHitPlane(other.origin, other.mins, other.maxs, other.velocity + g, self.origin, v_forward, self.maxs.x))
                return;
 
        /*
@@ -424,7 +444,7 @@ void Portal_Damage(entity inflictor, entity attacker, float damage, float deatht
 
 void Portal_Think_TryTeleportPlayer(entity e, vector g)
 {
-       if(!Portal_WillHitPlane(e.origin, e.mins, e.maxs, e.velocity + g, self.origin, v_forward, self.maxs_x))
+       if(!Portal_WillHitPlane(e.origin, e.mins, e.maxs, e.velocity + g, self.origin, v_forward, self.maxs.x))
                return;
 
        // if e would hit the portal in a frame...
@@ -493,7 +513,7 @@ float Portal_Customize()
        {
                self.modelindex = self.savemodelindex;
        }
-       return TRUE;
+       return true;
 }
 
 // cleanup:
@@ -612,7 +632,7 @@ entity Portal_Spawn(entity own, vector org, vector ang)
        setorigin(portal, org);
        portal.mangle = ang;
        portal.angles = ang;
-       portal.angles_x = -portal.angles_x; // is a bmodel
+       portal.angles_x = -portal.angles.x; // is a bmodel
        portal.think = Portal_Think;
        portal.nextthink = 0;
        portal.portal_activatetime = time + 0.1;
index cd0bc0408097b737ee604ef1bd9aa654232ce42a..68ff068a77788aa0f28fb6bddd333a61e9de48d4 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef PORTALS_H
+#define PORTALS_H
+
 .float portal_id;
 .entity portal_in, portal_out;
 
@@ -9,3 +12,4 @@ void Portal_ClearWithID(entity own, float id);
 
 vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle);
 void Portal_ClearAll_PortalsOnly(entity own);
+#endif
index 68ded63d8836a71f8411f309b10fff654471eb89..527c427124f162f2df61320d6e9d85ea29c4ec6f 100644 (file)
-../../progs.dat // output filename
+../../progs.dat
 
 ../common/util-pre.qh
 sys-pre.qh
-../dpdefs/progsdefs.qc
-../dpdefs/dpextensions.qc
+../dpdefs/progsdefs.qh
+../dpdefs/dpextensions.qh
 sys-post.qh
 
-../warpzonelib/anglestransform.qh
-../warpzonelib/mathlib.qh
-../warpzonelib/common.qh
-../warpzonelib/util_server.qh
-../warpzonelib/server.qh
-../common/constants.qh
-../common/stats.qh
-../common/teams.qh
-../common/util.qh
-../common/nades.qh
-../common/buffs.qh
-../common/test.qh
-../common/counting.qh
-../common/urllib.qh
-../common/command/markup.qh
-../common/command/rpn.qh
-../common/command/generic.qh
-../common/command/shared_defs.qh
-../common/net_notice.qh
-../common/animdecide.qh
-../common/monsters/monsters.qh
-../common/monsters/sv_monsters.qh
-../common/monsters/spawn.qh
-
-../common/weapons/config.qh
-../common/weapons/weapons.qh // TODO
-weapons/accuracy.qh
-weapons/common.qh
-weapons/csqcprojectile.qh // TODO
-weapons/hitplot.qh
-weapons/selection.qh
-weapons/spawning.qh
-weapons/throwing.qh
-weapons/tracing.qh
-weapons/weaponstats.qh
-weapons/weaponsystem.qh
-
-t_items.qh
-
-autocvars.qh
-constants.qh
-defs.qh                // Should rename this, it has fields and globals
-
-../common/notifications.qh // must be after autocvars
-../common/deathtypes.qh // must be after notifications
-
-../common/turrets/config.qh
-../common/turrets/turrets.qh
-../common/turrets/sv_turrets.qh
-../common/turrets/util.qc
-
-mutators/mutators_include.qh
-
-//// tZork Vehicles ////
-vehicles/vehicles_def.qh
-
-campaign.qh
-../common/campaign_common.qh
-../common/mapinfo.qh
-
-command/common.qh
-command/banning.qh
-command/radarmap.qh
-command/vote.qh
-command/getreplies.qh
-command/cmd.qh
-command/sv_cmd.qh
-
-
-../common/csqcmodel_settings.qh
-../csqcmodellib/common.qh
-../csqcmodellib/sv_model.qh
+anticheat.qc
+antilag.qc
+// assault.qc
+campaign.qc
+cheats.qc
+cl_client.qc
+cl_impulse.qc
+cl_physics.qc
+cl_player.qc
 csqceffects.qc
-
-anticheat.qh
-cheats.qh
-../common/playerstats.qh
-
-portals.qh
-
-g_hook.qh // TODO
-
-scores.qh
-
-spawnpoints.qh
-
-mapvoting.qh
-
-ipban.qh
-
-race.qh
-
-antilag.qh
-
-playerdemo.qh
-
-round_handler.qh
-
-// singleplayer stuff
-item_key.qh
-secret.qh
-
-scores_rules.qc
-
-miscfunctions.qc
-
-mutators/mutators.qc
-
-waypointsprites.qc
-
-bot/bot.qc
-
+// ctf.qc
+// domination.qc
+ent_cs.qc
+func_breakable.qc
+g_casings.qc
+g_damage.qc
+g_hook.qc
+g_models.qc
 g_subs.qc
-
 g_tetris.qc
-
-//runematch.qc
-
+g_triggers.qc
 g_violence.qc
-g_damage.qc
-
-teamplay.qc
-
-cl_physics.qc
-
-// tZork's libs
-movelib.qc
-steerlib.qc
-pathlib/pathlib.qh
-
 g_world.qc
-g_casings.qc
-
+ipban.qc
+item_key.qc
 mapvoting.qc
-
+miscfunctions.qc
+// mode_onslaught.qc
+movelib.qc
+// nexball.qc
+playerdemo.qc
+portals.qc
+race.qc
+round_handler.qc
+// runematch.qc
+scores.qc
+scores_rules.qc
+secret.qc
+spawnpoints.qc
+steerlib.qc
+sv_main.qc
+target_music.qc
+target_spawn.qc
+teamplay.qc
+t_halflife.qc
+t_items.qc
 t_jumppads.qc
+t_plats.qc
+t_quake3.qc
+t_quake.qc
+t_swamp.qc
 t_teleporters.qc
+waypointsprites.qc
 
-sv_main.qc
+bot/bot.qc
 
-g_triggers.qc
-g_models.qc
+command/banning.qc
+command/cmd.qc
+command/common.qc
+command/getreplies.qc
+command/radarmap.qc
+command/sv_cmd.qc
+command/vote.qc
 
-// singleplayer stuff
-item_key.qc
-secret.qc
+mutators/mutators_include.qc
+mutators/mutators.qc
 
 weapons/accuracy.qc
 weapons/common.qc
@@ -163,104 +83,38 @@ weapons/throwing.qc
 weapons/tracing.qc
 weapons/weaponstats.qc
 weapons/weaponsystem.qc
-../common/weapons/config.qc
-../common/weapons/weapons.qc // TODO
 
-t_items.qc
-cl_impulse.qc
-
-ent_cs.qc
-
-cl_player.qc
-cl_client.qc
-t_plats.qc
-antilag.qc
-
-//ctf.qc
-//domination.qc
-//mode_onslaught.qc
-//nexball.qc
-g_hook.qc
-
-t_swamp.qc
-
-campaign.qc
+../common/animdecide.qc
+../common/buffs.qc
 ../common/campaign_file.qc
 ../common/campaign_setup.qc
-../common/urllib.qc
-
+../common/command/generic.qc
 ../common/command/markup.qc
 ../common/command/rpn.qc
-../common/command/generic.qc
-../common/net_notice.qc
-
-command/common.qc
-command/banning.qc
-command/radarmap.qc
-command/vote.qc
-command/getreplies.qc
-command/cmd.qc
-command/sv_cmd.qc
-
-//assault.qc
-
-ipban.qc
-
 ../common/mapinfo.qc
-
-t_quake3.qc
-t_halflife.qc
-t_quake.qc
-
-race.qc
-
-
-//// tZork Vehicles ////
-vehicles/vehicles.qh
-
-scores.qc
-
-spawnpoints.qc
-
-portals.qc
-
-target_spawn.qc
-func_breakable.qc
-target_music.qc
-
+../common/monsters/monsters.qc
+../common/monsters/spawn.qc
+../common/monsters/sv_monsters.qc
 ../common/nades.qc
-../common/buffs.qc
-
-../csqcmodellib/sv_model.qc
-
-playerdemo.qc
-
-anticheat.qc
-cheats.qc
+../common/net_notice.qc
+../common/notifications.qc
 ../common/playerstats.qc
-
-round_handler.qc
-
+../common/test.qc
+../common/urllib.qc
+../common/util.qc
 ../common/turrets/sv_turrets.qc
 ../common/turrets/config.qc
+../common/turrets/util.qc
 ../common/turrets/turrets.qc
 ../common/turrets/checkpoint.qc
 ../common/turrets/targettrigger.qc
+../common/weapons/config.qc
+../common/weapons/weapons.qc // TODO
 
-../common/monsters/sv_monsters.qc
-../common/monsters/monsters.qc
-
-../common/monsters/spawn.qc
-
-mutators/mutators_include.qc
+../csqcmodellib/sv_model.qc
 
 ../warpzonelib/anglestransform.qc
-../warpzonelib/mathlib.qc
 ../warpzonelib/common.qc
-../warpzonelib/util_server.qc
+../warpzonelib/mathlib.qc
 ../warpzonelib/server.qc
-
-../common/animdecide.qc
-../common/test.qc
-../common/util.qc
-../common/notifications.qc
+../warpzonelib/util_server.qc
index 1c12058d0d9019ee4bb0ae36366a4db58c588c96..bb7f0eccc2297ad547b06181fa225d3957ad318d 100644 (file)
@@ -1,3 +1,7 @@
+#include "race.qh"
+
+void W_Porto_Fail(float failhard);
+
 float race_readTime(string map, float pos)
 {
        string rr = (g_cts) ? CTS_RECORD : RACE_RECORD;
@@ -67,7 +71,7 @@ string race_readName(string map, float pos)
 }
 
 
-#define MAX_CHECKPOINTS 255
+const float MAX_CHECKPOINTS = 255;
 
 void spawnfunc_target_checkpoint();
 
@@ -689,11 +693,11 @@ void checkpoint_use()
 float race_waypointsprite_visible_for_player(entity e)
 {
        if(e.race_checkpoint == -1 || self.owner.race_checkpoint == -2)
-               return TRUE;
+               return true;
        else if(e.race_checkpoint == self.owner.race_checkpoint)
-               return TRUE;
+               return true;
        else
-               return FALSE;
+               return false;
 }
 
 float have_verified;
@@ -722,7 +726,7 @@ void trigger_race_checkpoint_verify()
                        // race only (middle of the race)
                        g_race_qualifying = 0;
                        self.race_place = 0;
-                       if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, FALSE))
+                       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"));
 
                        if(i == 0)
@@ -730,7 +734,7 @@ void trigger_race_checkpoint_verify()
                                // qualifying only
                                g_race_qualifying = 1;
                                self.race_place = race_lowest_place_spawn;
-                               if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, FALSE))
+                               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"));
 
                                // race only (initial spawn)
@@ -738,7 +742,7 @@ void trigger_race_checkpoint_verify()
                                for(p = 1; p <= race_highest_place_spawn; ++p)
                                {
                                        self.race_place = p;
-                                       if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, FALSE))
+                                       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"));
                                }
                        }
@@ -750,7 +754,7 @@ void trigger_race_checkpoint_verify()
                self.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))
+               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
@@ -877,7 +881,7 @@ vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector
                        return '-1 0 0';
                // try reusing the previous spawn
                if(self == player.race_respawn_spotref || spot == player.race_respawn_spotref)
-                       current_x += SPAWN_PRIO_RACE_PREVIOUS_SPAWN;
+                       current.x += SPAWN_PRIO_RACE_PREVIOUS_SPAWN;
                if(self.race_checkpoint == 0)
                {
                        float pl;
@@ -905,7 +909,7 @@ void spawnfunc_trigger_race_checkpoint()
                self.touch = checkpoint_touch;
 
        o = (self.absmin + self.absmax) * 0.5;
-       tracebox(o, PL_MIN, PL_MAX, o - '0 0 1' * (o_z - self.absmin_z), MOVE_NORMAL, self);
+       tracebox(o, PL_MIN, PL_MAX, o - '0 0 1' * (o.z - self.absmin.z), MOVE_NORMAL, self);
        waypoint_spawnforitem_force(self, trace_endpos);
        self.nearestwaypointtimeout = time + 1000000000;
 
@@ -954,7 +958,7 @@ void spawnfunc_target_checkpoint() // defrag entity
                self.touch = checkpoint_touch;
 
        o = (self.absmin + self.absmax) * 0.5;
-       tracebox(o, PL_MIN, PL_MAX, o - '0 0 1' * (o_z - self.absmin_z), MOVE_NORMAL, self);
+       tracebox(o, PL_MIN, PL_MAX, o - '0 0 1' * (o.z - self.absmin.z), MOVE_NORMAL, self);
        waypoint_spawnforitem_force(self, trace_endpos);
        self.nearestwaypointtimeout = time + 1000000000;
 
index 09b4b36ce4aadbb1619ae6d56c1d1b2df8a54143..bfdc9be4305b80f27265d4c526694a51cfd6ee1e 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef RACE_H
+#define RACE_H
+
 float race_spawns;
 float race_highest_place_spawn; // number of places; a place higher gets spawned at 0
 float race_lowest_place_spawn; // where to spawn in qualifying
@@ -26,3 +29,4 @@ float race_GetFractionalLapCount(entity e);
 float race_readTime(string map, float pos);
 string race_readUID(string map, float pos);
 string race_readName(string map, float pos);
+#endif
index af69e8e9e55d30a826f56d4bb6d78c384435ff39..70d2d144d984c5c3220c0d8da9cc7a9c25f159dc 100644 (file)
@@ -1,3 +1,13 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../common/util.qh"
+    #include "defs.qh"
+    #include "round_handler.qh"
+#endif
+
 void round_handler_Think()
 {
        float f;
@@ -17,10 +27,10 @@ void round_handler_Think()
 
        if(self.wait)
        {
-               self.wait = FALSE;
+               self.wait = false;
                self.cnt = self.count + 1; // init countdown
                round_starttime = time + self.count;
-               reset_map(TRUE);
+               reset_map(true);
        }
 
        if(self.cnt > 0) // countdown running
@@ -52,7 +62,7 @@ void round_handler_Think()
                if(self.canRoundEnd())
                {
                        // schedule a new round
-                       self.wait = TRUE;
+                       self.wait = true;
                        self.nextthink = time + self.delay;
                }
                else
@@ -93,14 +103,14 @@ void round_handler_Spawn(float() canRoundStart_func, float() canRoundEnd_func, v
        round_handler.canRoundStart = canRoundStart_func;
        round_handler.canRoundEnd = canRoundEnd_func;
        round_handler.roundStart = roundStart_func;
-       round_handler.wait = FALSE;
+       round_handler.wait = false;
        round_handler_Init(5, 5, 180);
        round_handler.nextthink = time;
 }
 
 void round_handler_Reset(float next_think)
 {
-       round_handler.wait = FALSE;
+       round_handler.wait = false;
        if(round_handler.count)
        if(round_handler.cnt < round_handler.count + 1)
                round_handler.cnt = round_handler.count + 1;
index 22a91dc2c6dca767072fca80c2575c1fa3c4a2e1..448788442842ab2bd631abb1daefbcf3a0a7678a 100644 (file)
@@ -1,7 +1,10 @@
+#ifndef ROUND_HANDLER_H
+#define ROUND_HANDLER_H
+
 entity round_handler;
 .float delay; // stores delay from round end to countdown start
 .float count; // stores initial number of the countdown
-.float wait; // it's set to TRUE when round ends, to FALSE when countdown starts
+.float wait; // it's set to true when round ends, to false when countdown starts
 .float cnt;    // its initial value is .count + 1, then decreased while counting down
                        // reaches 0 when the round starts
 .float round_timelimit;
@@ -21,3 +24,4 @@ void round_handler_Remove();
 #define round_handler_IsRoundStarted() (!round_handler.wait && !round_handler.cnt)
 #define round_handler_GetEndTime() (round_handler.round_endtime)
 
+#endif
index 620ce8ce50e3a4a38812ab85b38b8fc1b2c4b195..8f9da8b061d581bf609d34c3cf4c9ae84f877ede 100644 (file)
@@ -1,3 +1,5 @@
+#include "scores.qh"
+
 .entity scorekeeper;
 entity teamscorekeepers[16];
 string scores_label[MAX_SCORE];
@@ -14,31 +16,31 @@ vector ScoreField_Compare(entity t1, entity t2, .float field, float fieldflags,
 {
        if(!strict && !(fieldflags & SFL_SORT_PRIO_MASK)) // column does not sort
                return previous;
-       if((fieldflags & SFL_SORT_PRIO_MASK) < previous_y)
+       if((fieldflags & SFL_SORT_PRIO_MASK) < previous.y)
                return previous;
        if(t1.field == t2.field)
                return previous;
 
-       previous_y = fieldflags & SFL_SORT_PRIO_MASK;
+       previous.y = fieldflags & SFL_SORT_PRIO_MASK;
 
        if(fieldflags & SFL_ZERO_IS_WORST)
        {
                if(t1.field == 0)
                {
-                       previous_x = -1;
+                       previous.x = -1;
                        return previous;
                }
                else if(t2.field == 0)
                {
-                       previous_x = +1;
+                       previous.x = +1;
                        return previous;
                }
        }
 
        if(fieldflags & SFL_LOWER_IS_BETTER)
-               previous_x = (t2.field - t1.field);
+               previous.x = (t2.field - t1.field);
        else
-               previous_x = (t1.field - t2.field);
+               previous.x = (t1.field - t2.field);
 
        return previous;
 }
@@ -75,7 +77,7 @@ float TeamScore_SendEntity(entity to, float sendflags)
                                WriteChar(MSG_ENTITY, self.(teamscores[i]));
                }
 
-       return TRUE;
+       return true;
 }
 
 void TeamScore_Spawn(float t, string name)
@@ -85,7 +87,7 @@ void TeamScore_Spawn(float t, string name)
        ts.classname = "csqc_score_team";
        ts.netname = name; // not used yet, FIXME
        ts.team = t;
-       Net_LinkEntity(ts, FALSE, 0, TeamScore_SendEntity);
+       Net_LinkEntity(ts, false, 0, TeamScore_SendEntity);
        teamscorekeepers[t - 1] = ts;
        ++teamscores_entities_count;
        PlayerStats_GameReport_AddTeam(t);
@@ -136,10 +138,10 @@ float TeamScore_Compare(entity t1, entity t2, float strict)
                result = ScoreField_Compare(t1, t2, f, teamscores_flags[i], result, strict);
        }
 
-       if (result_x == 0 && strict)
-               result_x = t1.team - t2.team;
+       if (result.x == 0 && strict)
+               result.x = t1.team - t2.team;
 
-       return result_x;
+       return result.x;
 }
 
 /*
@@ -193,7 +195,7 @@ float ScoreInfo_SendEntity(entity to, float sf)
                WriteString(MSG_ENTITY, teamscores_label[i]);
                WriteByte(MSG_ENTITY, teamscores_flags[i]);
        }
-       return TRUE;
+       return true;
 }
 
 void ScoreInfo_Init(float teams)
@@ -206,7 +208,7 @@ void ScoreInfo_Init(float teams)
        {
                scores_initialized = spawn();
                scores_initialized.classname = "ent_client_scoreinfo";
-               Net_LinkEntity(scores_initialized, FALSE, 0, ScoreInfo_SendEntity);
+               Net_LinkEntity(scores_initialized, false, 0, ScoreInfo_SendEntity);
        }
        if(teams >= 1)
                TeamScore_Spawn(NUM_TEAM_1, "Red");
@@ -250,7 +252,7 @@ float PlayerScore_SendEntity(entity to, float sendflags)
                                WriteChar(MSG_ENTITY, self.(scores[i]));
                }
 
-       return TRUE;
+       return true;
 }
 
 float PlayerScore_Clear(entity player)
@@ -314,7 +316,7 @@ void PlayerScore_Attach(entity player)
                error("player already has a scorekeeper");
        sk = spawn();
        sk.owner = player;
-       Net_LinkEntity(sk, FALSE, 0, PlayerScore_SendEntity);
+       Net_LinkEntity(sk, false, 0, PlayerScore_SendEntity);
        player.scorekeeper = sk;
 }
 
@@ -373,10 +375,10 @@ float PlayerScore_Compare(entity t1, entity t2, float strict)
                result = ScoreField_Compare(t1, t2, f, scores_flags[i], result, strict);
        }
 
-       if (result_x == 0 && strict)
-               result_x = num_for_edict(t1.owner) - num_for_edict(t2.owner);
+       if (result.x == 0 && strict)
+               result.x = num_for_edict(t1.owner) - num_for_edict(t2.owner);
 
-       return result_x;
+       return result.x;
 }
 
 void WinningConditionHelper()
@@ -773,8 +775,8 @@ float TeamScore_GetCompareValue(float t)
        return s;
 }
 
-#define NAMEWIDTH 22
-#define SCORESWIDTH 58
+const float NAMEWIDTH = 22;
+const float SCORESWIDTH = 58;
 // TODO put this somewhere in common?
 string Score_NicePrint_ItemColor(float vflags)
 {
@@ -833,7 +835,7 @@ void Score_NicePrint_Player(entity to, entity p, float w)
        sk = p.scorekeeper;
 
        s = strcat(s, p.netname);
-       for(;;)
+       for (;;)
        {
                i = strlennocol(s) - NAMEWIDTH;
                if(i > 0)
index c26a4d295ea78cc9ab977d447f336ce7dbcd424f..ff0555cad6cf4d24a27dc9089a327d45dc9bed97 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef SCORES_H
+#define SCORES_H
+
 entity scores_initialized; // non-world when scores labels/rules have been set
 .float scores[MAX_SCORE];
 .float teamscores[MAX_TEAMSCORE];
@@ -124,3 +127,4 @@ string GetTeamScoreString(float tm, float shortString);
  * nospectators: exclude spectators
  */
 entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators);
+#endif
index 6343625c0fd0e8f1c2e79f0b03b1fd6eb54711ba..4d5296c81603503cafd812c5b5d59c29e1e7786e 100644 (file)
@@ -1,4 +1,14 @@
-float c1, c2, c3, c4;
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../common/constants.qh"
+    #include "autocvars.qh"
+    #include "defs.qh"
+    #include "scores.qh"
+#endif
+
+//float c1, c2, c3, c4;
 void CheckAllowedTeams (entity for_whom);
 
 // NOTE: SP_ constants may not be >= MAX_SCORE; ST_constants may not be >= MAX_TEAMSCORE
@@ -37,10 +47,9 @@ void ScoreRules_generic()
        if(teamplay)
        {
                CheckAllowedTeams(world);
-               ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE);
+               ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
        }
        else
-               ScoreRules_basics(0, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE);
+               ScoreRules_basics(0, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
        ScoreRules_basics_end();
 }
-
index 06f7e075ddcc241a0323b6d5a7a31efbf5f8d5ec..30fbedc4948a27187949b09a43348ed7fe5c9040 100644 (file)
@@ -1,4 +1,11 @@
-
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../common/util.qh"
+    #include "defs.qh"
+    #include "secret.qh"
+#endif
 
 void secrets_setstatus() {
        self.stat_secrets_total = secrets_total;
index dd94b192195634c277aa16615de1da490a5b0ef6..6e6ae0b9acd9450f04a28ddce544607ab7d0b22f 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef SECRET_H
+#define SECRET_H
+
 /**
  * Total number of secrets on the map.
  */
@@ -16,4 +19,4 @@ float secrets_found;
  * update secrets status.
  */
 void secrets_setstatus();
-
+#endif
index 3f4e72c3b3f584b67c0cc4de06f9f033d568f6db..253c70fbe071eff1be2f03a54c64bd18a7d06b58 100644 (file)
@@ -1,13 +1,30 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../warpzonelib/util_server.qh"
+    #include "../common/constants.qh"
+    #include "../common/teams.qh"
+    #include "../common/util.qh"
+    #include "autocvars.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "mutators/mutators_include.qh"
+    #include "spawnpoints.qh"
+    #include "race.qh"
+#endif
+
 float SpawnPoint_Send(entity to, float sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT);
 
        WriteByte(MSG_ENTITY, self.team);
-       WriteShort(MSG_ENTITY, self.origin_x);
-       WriteShort(MSG_ENTITY, self.origin_y);
-       WriteShort(MSG_ENTITY, self.origin_z);
+       WriteShort(MSG_ENTITY, self.origin.x);
+       WriteShort(MSG_ENTITY, self.origin.y);
+       WriteShort(MSG_ENTITY, self.origin.z);
 
-       return TRUE;
+       return true;
 }
 
 float SpawnEvent_Send(entity to, float sf)
@@ -19,17 +36,17 @@ float SpawnEvent_Send(entity to, float sf)
        if(autocvar_g_spawn_alloweffects)
        {
                WriteByte(MSG_ENTITY, num_for_edict(self.owner));
-               WriteShort(MSG_ENTITY, self.owner.origin_x);
-               WriteShort(MSG_ENTITY, self.owner.origin_y);
-               WriteShort(MSG_ENTITY, self.owner.origin_z);
-               send = TRUE;
+               WriteShort(MSG_ENTITY, self.owner.origin.x);
+               WriteShort(MSG_ENTITY, self.owner.origin.y);
+               WriteShort(MSG_ENTITY, self.owner.origin.z);
+               send = true;
        }
        else if((to == self.owner) || (IS_SPEC(to) && (to.enemy == self.owner)) )
        {
                WriteByte(MSG_ENTITY, 0);
-               send = TRUE;
+               send = true;
        }
-       else { send = FALSE; }
+       else { send = false; }
 
        return send;
 }
@@ -50,7 +67,7 @@ void relocate_spawnpoint()
     // nudge off the floor
     setorigin(self, self.origin + '0 0 1');
 
-    tracebox(self.origin, PL_MIN, PL_MAX, self.origin, TRUE, self);
+    tracebox(self.origin, PL_MIN, PL_MAX, self.origin, true, self);
     if (trace_startsolid)
     {
         vector o;
@@ -60,9 +77,9 @@ void relocate_spawnpoint()
         if (!move_out_of_solid(self))
             objerror("could not get out of solid at all!");
         print("^1NOTE: this map needs FIXING. Spawnpoint at ", vtos(o - '0 0 1'));
-        print(" needs to be moved out of solid, e.g. by '", ftos(self.origin_x - o_x));
-        print(" ", ftos(self.origin_y - o_y));
-        print(" ", ftos(self.origin_z - o_z), "'\n");
+        print(" needs to be moved out of solid, e.g. by '", ftos(self.origin.x - o.x));
+        print(" ", ftos(self.origin.y - o.y));
+        print(" ", ftos(self.origin.z - o.z), "'\n");
         if (autocvar_g_spawnpoints_auto_move_out_of_solid)
         {
             if (!spawnpoint_nag)
@@ -127,7 +144,7 @@ void relocate_spawnpoint()
                ||
                autocvar_g_spawn_useallspawns
        )
-       { Net_LinkEntity(self, FALSE, 0, SpawnPoint_Send); }
+       { Net_LinkEntity(self, false, 0, SpawnPoint_Send); }
 }
 
 void spawnfunc_info_player_survivor (void)
@@ -205,7 +222,7 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck)
                                self = ent;
                                spawn_score = ent.spawn_evalfunc(oldself, spot, spawn_score);
                                self = oldself;
-                               if(spawn_score_x < 0)
+                               if(spawn_score.x < 0)
                                        return spawn_score;
                        }
                }
@@ -239,7 +256,7 @@ entity Spawn_FilterOutBadSpots(entity firstspot, float mindist, float teamcheck)
 
        for(spot = firstspot; spot; spot = spot.chain)
        {
-               if(spot.spawnpoint_score_x >= 0) // spawning allowed here
+               if(spot.spawnpoint_score.x >= 0) // spawning allowed here
                {
                        if(spotlistend)
                                spotlistend.chain = spot;
@@ -262,7 +279,7 @@ entity Spawn_WeightedPoint(entity firstspot, float lower, float upper, float exp
 
        RandomSelection_Init();
        for(spot = firstspot; spot; spot = spot.chain)
-               RandomSelection_Add(spot, 0, string_null, pow(bound(lower, spot.spawnpoint_score_y, upper), exponent) * spot.cnt, (spot.spawnpoint_score_y >= lower) * 0.5 + spot.spawnpoint_score_x);
+               RandomSelection_Add(spot, 0, string_null, pow(bound(lower, spot.spawnpoint_score.y, upper), exponent) * spot.cnt, (spot.spawnpoint_score.y >= lower) * 0.5 + spot.spawnpoint_score.x);
 
        return RandomSelection_chosen_ent;
 }
index 607629e42578834ed10e98c99ac66b28c82a8148..beab71c7ad104db99c7a87a593ce4bcd13191c28 100644 (file)
@@ -1,5 +1,9 @@
+#ifndef SPAWNPOINTS_H
+#define SPAWNPOINTS_H
+
 .vector spawnpoint_score;
 float spawnpoint_nag;
 float SpawnEvent_Send(entity to, float sf);
 entity Spawn_FilterOutBadSpots(entity firstspot, float mindist, float teamcheck);
 entity SelectSpawnPoint (float anypoint);
+#endif
index 2f59924df6e894c9a4d96a8281fb671bec802abb..ec76dfef2cda72354df3d1557fdd30e71f19dd7b 100644 (file)
@@ -1,3 +1,10 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+    #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+#endif
+
 .vector steerto;
 
 /**
@@ -169,13 +176,13 @@ vector steerlib_dodge(vector point,vector dodge_dir,float min_distance)
     Group will move towards the unified direction while keeping close to eachother.
 **/
 .float flock_id;
-vector steerlib_flock(float radius, float standoff,float separation_force,float flock_force)
+vector steerlib_flock(float _radius, float standoff,float separation_force,float flock_force)
 {
     entity flock_member;
     vector push = '0 0 0', pull = '0 0 0';
     float ccount = 0;
 
-    flock_member = findradius(self.origin,radius);
+    flock_member = findradius(self.origin, _radius);
     while(flock_member)
     {
         if(flock_member != self)
@@ -183,7 +190,7 @@ vector steerlib_flock(float radius, float standoff,float separation_force,float
         {
             ++ccount;
             push = push + (steerlib_repell(flock_member.origin,standoff) * separation_force);
-            pull = pull + (steerlib_arrive(flock_member.origin + flock_member.velocity,radius) * flock_force);
+            pull = pull + (steerlib_arrive(flock_member.origin + flock_member.velocity, _radius) * flock_force);
         }
         flock_member = flock_member.chain;
     }
@@ -195,13 +202,13 @@ vector steerlib_flock(float radius, float standoff,float separation_force,float
     Group will move towards the unified direction while keeping close to eachother.
     xy only version (for ground movers).
 **/
-vector steerlib_flock2d(float radius, float standoff,float separation_force,float flock_force)
+vector steerlib_flock2d(float _radius, float standoff,float separation_force,float flock_force)
 {
     entity flock_member;
     vector push = '0 0 0', pull = '0 0 0';
     float ccount = 0;
 
-    flock_member = findradius(self.origin,radius);
+    flock_member = findradius(self.origin,_radius);
     while(flock_member)
     {
         if(flock_member != self)
@@ -209,13 +216,13 @@ vector steerlib_flock2d(float radius, float standoff,float separation_force,floa
         {
             ++ccount;
             push = push + (steerlib_repell(flock_member.origin, standoff) * separation_force);
-            pull = pull + (steerlib_arrive(flock_member.origin + flock_member.velocity, radius) * flock_force);
+            pull = pull + (steerlib_arrive(flock_member.origin + flock_member.velocity, _radius) * flock_force);
         }
         flock_member = flock_member.chain;
     }
 
-    push_z = 0;
-    pull_z = 0;
+    push.z = 0;
+    pull.z = 0;
 
     return push + (pull * (1 / ccount));
 }
@@ -226,13 +233,13 @@ vector steerlib_flock2d(float radius, float standoff,float separation_force,floa
 
     This results in a aligned movement (?!) much like flocking.
 **/
-vector steerlib_swarm(float radius, float standoff,float separation_force,float swarm_force)
+vector steerlib_swarm(float _radius, float standoff,float separation_force,float swarm_force)
 {
     entity swarm_member;
     vector force = '0 0 0', center = '0 0 0';
     float ccount = 0;
 
-    swarm_member = findradius(self.origin,radius);
+    swarm_member = findradius(self.origin,_radius);
 
     while(swarm_member)
     {
@@ -246,7 +253,7 @@ vector steerlib_swarm(float radius, float standoff,float separation_force,float
     }
 
     center = center * (1 / ccount);
-    force = force + (steerlib_arrive(center,radius) * swarm_force);
+    force = force + (steerlib_arrive(center,_radius) * swarm_force);
 
     return force;
 }
@@ -420,7 +427,7 @@ vector steerlib_beamsteer(vector dir, float length, float step, float step_up, f
     float bm_forward, bm_right, bm_left,p;
     vector vr,vl;
 
-    dir_z *= 0.15;
+    dir.z *= 0.15;
     vr = vectoangles(dir);
     //vr_x *= -1;
 
@@ -508,9 +515,9 @@ void flocker_think()
     vector dodgemove,swarmmove;
     vector reprellmove,wandermove,newmove;
 
-    self.angles_x = self.angles_x * -1;
+    self.angles_x = self.angles.x * -1;
     makevectors(self.angles);
-    self.angles_x = self.angles_x * -1;
+    self.angles_x = self.angles.x * -1;
 
     dodgemove   = steerlib_traceavoid(0.35,1000);
     swarmmove   = steerlib_flock(500,75,700,500);
@@ -585,9 +592,9 @@ void flocker_hunter_think()
     entity e,ee;
     float d,bd;
 
-    self.angles_x = self.angles_x * -1;
+    self.angles_x = self.angles.x * -1;
     makevectors(self.angles);
-    self.angles_x = self.angles_x * -1;
+    self.angles_x = self.angles.x * -1;
 
     if(self.enemy)
     if(vlen(self.enemy.origin - self.origin) < 64)
index b25528e1645ccf1f635a20e5ae2866dc05eaf045..c2d3dc7dd855c3eb3f84e6f0dd0efde296a30e09 100644 (file)
@@ -1,10 +1,34 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../warpzonelib/common.qh"
+    #include "../warpzonelib/server.qh"
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "weapons/csqcprojectile.qh"
+    #include "autocvars.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "../common/deathtypes.qh"
+    #include "mutators/mutators_include.qh"
+    #include "vehicles/vehicles_def.qh"
+    #include "../common/mapinfo.qh"
+    #include "command/common.qh"
+    #include "../csqcmodellib/sv_model.qh"
+    #include "anticheat.qh"
+    #include "g_hook.qh"
+#endif
+
 void CreatureFrame (void)
 {
        entity oldself;
        float dm;
 
        oldself = self;
-       for(self = world; (self = findfloat(self, damagedbycontents, TRUE)); )
+       for(self = world; (self = findfloat(self, damagedbycontents, true)); )
        {
                if (self.movetype == MOVETYPE_NOCLIP) { continue; }
 
@@ -210,10 +234,10 @@ void StartFrame (void)
        skill = autocvar_skill;
 
        // detect when the pre-game countdown (if any) has ended and the game has started
-       game_delay = (time < game_starttime) ? TRUE : FALSE;
+       game_delay = (time < game_starttime) ? true : false;
 
-       if(game_delay_last == TRUE)
-       if(game_delay == FALSE)
+       if(game_delay_last == true)
+       if(game_delay == false)
        if(autocvar_sv_eventlog)
                GameLogEcho(":startdelay_ended");
 
@@ -379,20 +403,20 @@ void SV_OnEntityPreSpawnFunction()
        else if (self.angles == '0 -2 0')
                self.angles = '+90 0 0';
 
-       if(self.originjitter_x != 0)
-               self.origin_x = self.origin_x + (random() * 2 - 1) * self.originjitter_x;
-       if(self.originjitter_y != 0)
-               self.origin_y = self.origin_y + (random() * 2 - 1) * self.originjitter_y;
-       if(self.originjitter_z != 0)
-               self.origin_z = self.origin_z + (random() * 2 - 1) * self.originjitter_z;
-       if(self.anglesjitter_x != 0)
-               self.angles_x = self.angles_x + (random() * 2 - 1) * self.anglesjitter_x;
-       if(self.anglesjitter_y != 0)
-               self.angles_y = self.angles_y + (random() * 2 - 1) * self.anglesjitter_y;
-       if(self.anglesjitter_z != 0)
-               self.angles_z = self.angles_z + (random() * 2 - 1) * self.anglesjitter_z;
+       if(self.originjitter.x != 0)
+               self.origin_x = self.origin.x + (random() * 2 - 1) * self.originjitter.x;
+       if(self.originjitter.y != 0)
+               self.origin_y = self.origin.y + (random() * 2 - 1) * self.originjitter.y;
+       if(self.originjitter.z != 0)
+               self.origin_z = self.origin.z + (random() * 2 - 1) * self.originjitter.z;
+       if(self.anglesjitter.x != 0)
+               self.angles_x = self.angles.x + (random() * 2 - 1) * self.anglesjitter.x;
+       if(self.anglesjitter.y != 0)
+               self.angles_y = self.angles.y + (random() * 2 - 1) * self.anglesjitter.y;
+       if(self.anglesjitter.z != 0)
+               self.angles_z = self.angles.z + (random() * 2 - 1) * self.anglesjitter.z;
        if(self.anglejitter != 0)
-               self.angles_y = self.angles_y + (random() * 2 - 1) * self.anglejitter;
+               self.angles_y = self.angles.y + (random() * 2 - 1) * self.anglejitter;
 
        if(MUTATOR_CALLHOOK(OnEntityPreSpawn))
        {
index 9c389da4392455956528709533d398bcf1af8ee1..3143699f2d7b18064466b4e3df3714850cd590c4 100644 (file)
@@ -1,6 +1,6 @@
-#pragma noref 0
+#ifndef SERVER_SYS_POST_H
+#define SERVER_SYS_POST_H
 
-#undef ATTEN_NORM
 #undef objerror
 #undef droptofloor
 #undef sound
@@ -9,6 +9,10 @@
 #undef cvar_string
 #undef cvar
 
-var float(string var) cvar;
-var string(string var) cvar_string;
-var void(string var, string val) cvar_set;
+var float(string name) cvar;
+var string(string name) cvar_string;
+var void(string name, string value) cvar_set;
+
+#pragma noref 0
+
+#endif
index 1907cb2bb944ce0e692f46c1fba47207ca54bbf4..bfdcdb860e267fff7a385d17fa76cd4c6fa4c3ab 100644 (file)
@@ -1,6 +1,6 @@
-#define SVQC
+#ifndef SERVER_SYS_PRE_H
+#define SERVER_SYS_PRE_H
 
-#define ATTEN_NORM builtin_ATTEN_NORM
 #define objerror builtin_objerror
 #define droptofloor builtin_droptofloor
 #define sound builtin_sound
@@ -10,3 +10,5 @@
 #define cvar builtin_cvar
 
 #pragma noref 1
+
+#endif
index bb2254c977d91e4cd427b5d3e6c2c3fcfea115a0..681c5dc7d3f0998788b485baf38bd495d49a9682 100644 (file)
@@ -1,3 +1,11 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../warpzonelib/util_server.qh"
+    #include "defs.qh"
+    #include "vehicles/vehicles_def.qh"
+#endif
 
 .float  roomtype;
 .float  radius;
index 4455d3fb46a3128ecf541c8d4558286341eb8a4e..03af802e71c12d8b762c0e34df606ba8c096ee3d 100644 (file)
@@ -1,3 +1,33 @@
+#if defined(CSQC)
+    #include "../dpdefs/csprogsdefs.qh"
+    #include "../common/util.qh"
+    #include "../common/buffs.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "../client/autocvars.qh"
+    #include "../client/movetypes.qh"
+    #include "../client/main.qh"
+    #include "../csqcmodellib/common.qh"
+    #include "../csqcmodellib/cl_model.qh"
+    #include "t_items.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+    #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../warpzonelib/util_server.qh"
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "../common/monsters/monsters.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "weapons/weaponsystem.qh"
+    #include "t_items.qh"
+    #include "autocvars.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "../common/notifications.qh"
+    #include "../common/deathtypes.qh"
+    #include "mutators/mutators_include.qh"
+#endif
+
 #ifdef CSQC
 void ItemDraw()
 {
@@ -48,7 +78,7 @@ void ItemDrawSimple()
 
 void ItemRead(float _IsNew)
 {
-    float sf = ReadByte();
+    int sf = ReadByte();
 
     if(sf & ISF_LOCATION)
     {
@@ -212,26 +242,26 @@ float ItemSend(entity to, float sf)
        //WriteByte(MSG_ENTITY, self.cnt);
     if(sf & ISF_LOCATION)
     {
-        WriteCoord(MSG_ENTITY, self.origin_x);
-        WriteCoord(MSG_ENTITY, self.origin_y);
-        WriteCoord(MSG_ENTITY, self.origin_z);
+        WriteCoord(MSG_ENTITY, self.origin.x);
+        WriteCoord(MSG_ENTITY, self.origin.y);
+        WriteCoord(MSG_ENTITY, self.origin.z);
     }
 
     if(sf & ISF_ANGLES)
     {
-        WriteCoord(MSG_ENTITY, self.angles_x);
-        WriteCoord(MSG_ENTITY, self.angles_y);
-        WriteCoord(MSG_ENTITY, self.angles_z);
+        WriteCoord(MSG_ENTITY, self.angles.x);
+        WriteCoord(MSG_ENTITY, self.angles.y);
+        WriteCoord(MSG_ENTITY, self.angles.z);
     }
 
     if(sf & ISF_SIZE)
     {
-        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);
+        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);
     }
 
     if(sf & ISF_STATUS)
@@ -252,12 +282,12 @@ float ItemSend(entity to, float sf)
 
     if(sf & ISF_DROP)
     {
-        WriteCoord(MSG_ENTITY, self.velocity_x);
-        WriteCoord(MSG_ENTITY, self.velocity_y);
-        WriteCoord(MSG_ENTITY, self.velocity_z);
+        WriteCoord(MSG_ENTITY, self.velocity.x);
+        WriteCoord(MSG_ENTITY, self.velocity.y);
+        WriteCoord(MSG_ENTITY, self.velocity.z);
     }
 
-    return TRUE;
+    return true;
 }
 
 void ItemUpdate(entity item)
@@ -270,34 +300,34 @@ float have_pickup_item(void)
        if(self.flags & FL_POWERUP)
        {
                if(autocvar_g_powerups > 0)
-                       return TRUE;
+                       return true;
                if(autocvar_g_powerups == 0)
-                       return FALSE;
+                       return false;
        }
        else
        {
                if(autocvar_g_pickup_items > 0)
-                       return TRUE;
+                       return true;
                if(autocvar_g_pickup_items == 0)
-                       return FALSE;
+                       return false;
                if(g_weaponarena)
                        if(self.weapons || (self.items & IT_AMMO)) // no item or ammo pickups in weaponarena
-                               return FALSE;
+                               return false;
        }
-       return TRUE;
+       return true;
 }
 
 /*
 float Item_Customize()
 {
        if(self.spawnshieldtime)
-               return TRUE;
+               return true;
        if(self.weapons & ~other.weapons)
        {
                self.colormod = '0 0 0';
                self.glowmod = self.colormod;
                self.alpha = 0.5 + 0.5 * g_ghost_items; // halfway more alpha
-               return TRUE;
+               return true;
        }
        else
        {
@@ -306,10 +336,10 @@ float Item_Customize()
                        self.colormod = stov(autocvar_g_ghost_items_color);
                        self.glowmod = self.colormod;
                        self.alpha = g_ghost_items;
-                       return TRUE;
+                       return true;
                }
                else
-                       return FALSE;
+                       return false;
        }
 }
 */
@@ -395,7 +425,7 @@ void Item_Respawn (void)
 
        self.think = Item_Think;
        self.nextthink = time;
-       
+
        //pointparticles(particleeffectnum("item_respawn"), self.origin + self.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1);
        pointparticles(particleeffectnum("item_respawn"), self.origin + 0.5 * (self.mins + self.maxs), '0 0 0', 1);
 }
@@ -440,7 +470,7 @@ void Item_RespawnCountdown (void)
                        }
                        if(name)
                        {
-                               WaypointSprite_Spawn(name, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE, RADARICON_POWERUP, rgb);
+                               WaypointSprite_Spawn(name, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_POWERUP, rgb);
                                if(self.waypointsprite_attached)
                                        WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, time + ITEM_RESPAWN_TICKS);
                        }
@@ -508,7 +538,7 @@ void Item_ScheduleInitialRespawn(entity e)
 float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax, float mode)
 {
        if (!item.ammotype)
-               return FALSE;
+               return false;
 
        if (item.spawnshieldtime)
        {
@@ -528,7 +558,7 @@ float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax
                }
        }
 
-       return FALSE;
+       return false;
 
 :YEAH
        switch(mode)
@@ -545,7 +575,7 @@ float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax
                default:
                        break;
        }
-       return TRUE;
+       return true;
 }
 
 float Item_GiveTo(entity item, entity player)
@@ -556,17 +586,17 @@ float Item_GiveTo(entity item, entity player)
        float i;
 
        // if nothing happens to player, just return without taking the item
-       pickedup = FALSE;
-       _switchweapon = FALSE;
+       pickedup = false;
+       _switchweapon = false;
        // in case the player has autoswitch enabled do the following:
        // if the player is using their best weapon before items are given, they
        // probably want to switch to an even better weapon after items are given
        if (player.autoswitch)
        if (player.switchweapon == w_getbestweapon(player))
-               _switchweapon = TRUE;
+               _switchweapon = true;
 
        if (!(player.weapons & WepSet_FromWeapon(player.switchweapon)))
-               _switchweapon = TRUE;
+               _switchweapon = true;
 
        pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL);
        pickedup |= Item_GiveAmmoTo(item, player, ammo_shells, g_pickup_shells_max, ITEM_MODE_NONE);
@@ -585,7 +615,7 @@ float Item_GiveTo(entity item, entity player)
 
                if (it || (item.spawnshieldtime && item.pickup_anyway))
                {
-                       pickedup = TRUE;
+                       pickedup = true;
                        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                        if(it & WepSet_FromWeapon(i))
                        {
@@ -597,24 +627,24 @@ float Item_GiveTo(entity item, entity player)
 
        if((it = (item.items - (item.items & player.items)) & IT_PICKUPMASK))
        {
-               pickedup = TRUE;
+               pickedup = true;
                player.items |= it;
                Send_Notification(NOTIF_ONE, player, MSG_INFO, INFO_ITEM_WEAPON_GOT, item.netname);
        }
 
        if (item.strength_finished)
        {
-               pickedup = TRUE;
+               pickedup = true;
                player.strength_finished = max(player.strength_finished, time) + item.strength_finished;
        }
        if (item.invincible_finished)
        {
-               pickedup = TRUE;
+               pickedup = true;
                player.invincible_finished = max(player.invincible_finished, time) + item.invincible_finished;
        }
        if (item.superweapons_finished)
        {
-               pickedup = TRUE;
+               pickedup = true;
                player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished;
        }
 
@@ -622,7 +652,7 @@ float Item_GiveTo(entity item, entity player)
 
        // always eat teamed entities
        if(item.team)
-               pickedup = TRUE;
+               pickedup = true;
 
        if (!pickedup)
                return 0;
@@ -832,7 +862,7 @@ float weapon_pickupevalfunc(entity player, entity item)
 float commodity_pickupevalfunc(entity player, entity item)
 {
        float c, i;
-       float need_shells = FALSE, need_nails = FALSE, need_rockets = FALSE, need_cells = FALSE, need_plasma = FALSE, need_fuel = FALSE;
+       float need_shells = false, need_nails = false, need_rockets = false, need_cells = false, need_plasma = false, need_fuel = false;
        entity wi;
        c = 0;
 
@@ -845,17 +875,17 @@ float commodity_pickupevalfunc(entity player, entity item)
                        continue;
 
                if(wi.items & IT_SHELLS)
-                       need_shells = TRUE;
+                       need_shells = true;
                else if(wi.items & IT_NAILS)
-                       need_nails = TRUE;
+                       need_nails = true;
                else if(wi.items & IT_ROCKETS)
-                       need_rockets = TRUE;
+                       need_rockets = true;
                else if(wi.items & IT_CELLS)
-                       need_cells = TRUE;
+                       need_cells = true;
                else if(wi.items & IT_PLASMA)
-                       need_plasma = TRUE;
+                       need_plasma = true;
                else if(wi.items & IT_FUEL)
-                       need_fuel = TRUE;
+                       need_fuel = true;
        }
 
        // TODO: figure out if the player even has the weapon this ammo is for?
@@ -903,7 +933,7 @@ void Item_Damage(entity inflictor, entity attacker, float damage, float deathtyp
 
 void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue)
 {
-       startitem_failed = FALSE;
+       startitem_failed = false;
 
        if(self.model == "")
                self.model = itemmodel;
@@ -933,7 +963,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
 
        if(MUTATOR_CALLHOOK(FilterItem)) // error means we do not want the item
        {
-               startitem_failed = TRUE;
+               startitem_failed = true;
                remove(self);
                return;
        }
@@ -973,7 +1003,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                traceline(self.origin, self.origin, MOVE_NORMAL, self);
                if (trace_dpstartcontents & DPCONTENTS_NODROP)
                {
-                       startitem_failed = TRUE;
+                       startitem_failed = true;
                        remove(self);
                        return;
                }
@@ -982,7 +1012,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
        {
                if(!have_pickup_item())
                {
-                       startitem_failed = TRUE;
+                       startitem_failed = true;
                        remove (self);
                        return;
                }
@@ -1006,7 +1036,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                        else
                                setsize (self, '-16 -16 0', '16 16 32');
 
-                       // note droptofloor returns FALSE if stuck/or would fall too far
+                       // note droptofloor returns false if stuck/or would fall too far
                        droptofloor();
                        waypoint_spawnforitem(self);
                }
@@ -1019,7 +1049,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                {
                        // target_give not yet supported; maybe later
                        print("removed targeted ", self.classname, "\n");
-                       startitem_failed = TRUE;
+                       startitem_failed = true;
                        remove (self);
                        return;
                }
@@ -1038,7 +1068,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                                        error("Mapper sucks.");
                                }
                        }
-                       self.is_item = TRUE;
+                       self.is_item = true;
                }
 
                weaponsInMap |= WepSet_FromWeapon(weaponid);
@@ -1058,7 +1088,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                        self.target = "###item###"; // for finding the nearest item using find()
        }
 
-       self.bot_pickup = TRUE;
+       self.bot_pickup = true;
        self.bot_pickupevalfunc = pickupevalfunc;
        self.bot_pickupbasevalue = pickupbasevalue;
        self.mdl = self.model;
@@ -1108,8 +1138,8 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
        else
                Item_Reset();
 
-    Net_LinkEntity(self, FALSE, 0, ItemSend);
-       
+    Net_LinkEntity(self, false, 0, ItemSend);
+
        self.SendFlags |= ISF_SIZE;
        if(self.angles)
                self.SendFlags |= ISF_ANGLES;
@@ -1117,7 +1147,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
        // call this hook after everything else has been done
        if(MUTATOR_CALLHOOK(Item_Spawn))
        {
-               startitem_failed = TRUE;
+               startitem_failed = true;
                remove(self);
                return;
        }
@@ -1136,9 +1166,9 @@ void spawnfunc_item_bullets (void) {
        if(autocvar_sv_q3acompat_machineshotgunswap)
        if(self.classname != "droppedweapon")
        {
-               weaponswapping = TRUE;
+               weaponswapping = true;
                spawnfunc_item_shells();
-               weaponswapping = FALSE;
+               weaponswapping = false;
                return;
        }
 
@@ -1171,9 +1201,9 @@ void spawnfunc_item_shells (void) {
        if(autocvar_sv_q3acompat_machineshotgunswap)
        if(self.classname != "droppedweapon")
        {
-               weaponswapping = TRUE;
+               weaponswapping = true;
                spawnfunc_item_bullets();
-               weaponswapping = FALSE;
+               weaponswapping = false;
                return;
        }
 
@@ -1315,6 +1345,7 @@ void spawnfunc_target_items (void)
 {
        float n, i, j;
        entity e;
+       string s;
 
        self.use = target_items_use;
        if(!self.strength_finished)
@@ -1353,7 +1384,8 @@ void spawnfunc_target_items (void)
                                for(j = WEP_FIRST; j <= WEP_LAST; ++j)
                                {
                                        e = get_weaponinfo(j);
-                                       if(argv(i) == e.netname)
+                                       s = W_UndeprecateName(argv(i));
+                                       if(s == e.netname)
                                        {
                                                self.weapons |= WepSet_FromWeapon(j);
                                                if(self.spawnflags == 0 || self.spawnflags == 2)
@@ -1390,10 +1422,7 @@ void spawnfunc_target_items (void)
                else
                {
                        error("invalid spawnflags");
-#ifdef GMQCC
-                       itemprefix = string_null;
-                       valueprefix = string_null;
-#endif
+                       itemprefix = valueprefix = string_null;
                }
 
                self.netname = "";
@@ -1589,10 +1618,10 @@ float GiveItems(entity e, float beginarg, float endarg)
 
        got = 0;
 
-       _switchweapon = FALSE;
+       _switchweapon = false;
        if (e.autoswitch)
                if (e.switchweapon == w_getbestweapon(e))
-                       _switchweapon = TRUE;
+                       _switchweapon = true;
 
        e.strength_finished = max(0, e.strength_finished - time);
        e.invincible_finished = max(0, e.invincible_finished - time);
@@ -1776,7 +1805,7 @@ float GiveItems(entity e, float beginarg, float endarg)
                e.superweapons_finished += time;
 
        if (!(e.weapons & WepSet_FromWeapon(e.switchweapon)))
-               _switchweapon = TRUE;
+               _switchweapon = true;
        if(_switchweapon)
                W_SwitchWeapon_Force(e, w_getbestweapon(e));
 
index 13cc3796fe1a0539a3bd779e0efec7971f21cdfb..bb914234e1c26bf8abfe8d385ce718bc1d36f0de 100644 (file)
@@ -1,76 +1,78 @@
+#ifndef T_ITEMS_H
+#define T_ITEMS_H
+
 // constants
-#define WANT_CONST /* we WANT these to be constant, but it conflicts with the declaration in dpdefs/progsdefs.qc */
-const      float IT_UNLIMITED_WEAPON_AMMO     =       1; // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
-const      float IT_UNLIMITED_SUPERWEAPONS    =       2; // when this bit is set, superweapons don't expire. Checkpoints can give this powerup.
-const      float IT_CTF_SHIELDED              =       4; // set for the flag shield
-const      float IT_USING_JETPACK             =       8; // confirmation that button is pressed
-const      float IT_JETPACK                   =      16; // actual item
-const      float IT_FUEL_REGEN                =      32; // fuel regeneration trigger
+const int IT_UNLIMITED_WEAPON_AMMO             =       1; // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
+const int IT_UNLIMITED_SUPERWEAPONS            =       2; // when this bit is set, superweapons don't expire. Checkpoints can give this powerup.
+const int IT_CTF_SHIELDED                      =       4; // set for the flag shield
+const int IT_USING_JETPACK                     =       8; // confirmation that button is pressed
+const int IT_JETPACK                           =      16; // actual item
+const int IT_FUEL_REGEN                        =      32; // fuel regeneration trigger
 // where is 64... ?
-const      float IT_FUEL                      =     128;
-WANT_CONST float IT_SHELLS                    =     256;
-WANT_CONST float IT_NAILS                     =     512;
-WANT_CONST float IT_ROCKETS                   =    1024;
-WANT_CONST float IT_CELLS                     =    2048;
-const      float IT_SUPERWEAPON               =    4096;
-const      float IT_STRENGTH                  =    8192;
-const      float IT_INVINCIBLE                =   16384;
-const      float IT_HEALTH                    =   32768;
-const      float IT_PLASMA                    =   65536;
+const int IT_FUEL                                      =     128;
+const int IT_SHELLS                                    =     256;
+const int IT_NAILS                                     =     512;
+const int IT_ROCKETS                                   =    1024;
+const int IT_CELLS                                     =    2048;
+const int IT_SUPERWEAPON                               =    4096;
+const int IT_STRENGTH                                  =    8192;
+const int IT_INVINCIBLE                                =   16384;
+const int IT_HEALTH                                    =   32768;
+const int IT_PLASMA                                    =   65536;
 
 // shared value space (union):
        // for items:
-       WANT_CONST float IT_KEY1                  =  131072;
-       WANT_CONST float IT_KEY2                  =  262144;
+       const int IT_KEY1                                       =  131072;
+       const int IT_KEY2                                       =  262144;
        // for players:
-       const      float IT_RED_FLAG_TAKEN        =   32768;
-       const      float IT_RED_FLAG_LOST         =   65536;
-       const      float IT_RED_FLAG_CARRYING     =   98304;
-       const      float IT_BLUE_FLAG_TAKEN       =  131072;
-       const      float IT_BLUE_FLAG_LOST        =  262144;
-       const      float IT_BLUE_FLAG_CARRYING    =  393216;
+       const int IT_RED_FLAG_TAKEN             =   32768;
+       const int IT_RED_FLAG_LOST              =   65536;
+       const int IT_RED_FLAG_CARRYING          =   98304;
+       const int IT_BLUE_FLAG_TAKEN            =  131072;
+       const int IT_BLUE_FLAG_LOST             =  262144;
+       const int IT_BLUE_FLAG_CARRYING         =  393216;
 // end
 
-const      float IT_5HP                       =  524288;
-const      float IT_25HP                      = 1048576;
-const      float IT_ARMOR_SHARD               = 2097152;
-const      float IT_ARMOR                     = 4194304;
+const int IT_5HP                               =  524288;
+const int IT_25HP                              = 1048576;
+const int IT_ARMOR_SHARD                       = 2097152;
+const int IT_ARMOR                             = 4194304;
 
 // item masks
-const      float IT_AMMO                      =    3968; // IT_FUEL | IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_PLASMA;
-const      float IT_PICKUPMASK                =      51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately
-const      float IT_UNLIMITED_AMMO            =       3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO;
+const int IT_AMMO                              =    3968; // IT_FUEL | IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_PLASMA;
+const int IT_PICKUPMASK                        =      51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately
+const int IT_UNLIMITED_AMMO                    =       3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO;
 
-const float AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel
+const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel
 
 // item networking
-#define ISF_LOCATION 2
-#define ISF_MODEL    4
-#define ISF_STATUS   8
-    #define ITS_STAYWEP   1
-    #define ITS_ANIMATE1  2
-    #define ITS_ANIMATE2  4
-    #define ITS_AVAILABLE 8
-    #define ITS_ALLOWFB   16
-    #define ITS_ALLOWSI   32
-    #define ITS_POWERUP   64
-#define ISF_COLORMAP 16
-#define ISF_DROP 32
-#define ISF_ANGLES 64
-#define ISF_SIZE 128
-
-.float ItemStatus;
+const int ISF_LOCATION                         = 2;
+const int ISF_MODEL                            = 4;
+const int ISF_STATUS                   = 8;
+    const int ITS_STAYWEP              = 1;
+    const int ITS_ANIMATE1             = 2;
+    const int ITS_ANIMATE2             = 4;
+    const int ITS_AVAILABLE    = 8;
+    const int ITS_ALLOWFB              = 16;
+    const int ITS_ALLOWSI              = 32;
+    const int ITS_POWERUP              = 64;
+const int ISF_COLORMAP                         = 16;
+const int ISF_DROP                             = 32;
+const int ISF_ANGLES                   = 64;
+const int ISF_SIZE                             = 128;
+
+.int ItemStatus;
 
 #ifdef CSQC
 
-var float  autocvar_cl_animate_items = 1;
-var float  autocvar_cl_ghost_items = 0.45;
-var vector autocvar_cl_ghost_items_color = '-1 -1 -1';
-var float  autocvar_cl_fullbright_items = 0;
-var vector autocvar_cl_weapon_stay_color = '2 0.5 0.5';
-var float  autocvar_cl_weapon_stay_alpha = 0.75;
-var float  autocvar_cl_simple_items = 0;
-var string autocvar_cl_simpleitems_postfix = "_simple";
+float  autocvar_cl_animate_items = 1;
+float  autocvar_cl_ghost_items = 0.45;
+vector autocvar_cl_ghost_items_color = '-1 -1 -1';
+float  autocvar_cl_fullbright_items = 0;
+vector autocvar_cl_weapon_stay_color = '2 0.5 0.5';
+float  autocvar_cl_weapon_stay_alpha = 0.75;
+float  autocvar_cl_simple_items = 0;
+string autocvar_cl_simpleitems_postfix = "_simple";
 .float  spawntime;
 .float  gravity;
 .vector colormod;
@@ -88,7 +90,7 @@ float ItemSend(entity to, float sf);
 
 float have_pickup_item(void);
 
-#define ITEM_RESPAWN_TICKS 10
+const float ITEM_RESPAWN_TICKS = 10;
 
 #define ITEM_RESPAWNTIME(i)         ((i).respawntime + crandom() * (i).respawntimejitter)
        // range: respawntime - respawntimejitter .. respawntime + respawntimejitter
@@ -142,11 +144,11 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
 
 void target_items_use (void);
 
-#define OP_SET 0
-#define OP_MIN 1
-#define OP_MAX 2
-#define OP_PLUS 3
-#define OP_MINUS 4
+const float OP_SET = 0;
+const float OP_MIN = 1;
+const float OP_MAX = 2;
+const float OP_PLUS = 3;
+const float OP_MINUS = 4;
 
 float GiveWeapon(entity e, float wpn, float op, float val);
 
@@ -167,3 +169,4 @@ void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .floa
 
 float GiveItems(entity e, float beginarg, float endarg);
 #endif
+#endif
index f52b492a7042d520c03c80764ef8b2f75d1258ca..92af1cdd093b0733fe922e4423d96da706693457 100644 (file)
@@ -1,13 +1,4 @@
-const float PUSH_ONCE                  = 1;
-const float PUSH_SILENT                = 2;
-
-.float pushltime;
-.float istypefrag;
-.float height;
-
-void() SUB_UseTargets;
-
-float trigger_push_calculatevelocity_flighttime;
+#include "t_jumppads.qh"
 
 void trigger_push_use()
 {
@@ -40,7 +31,7 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht)
        if(other.gravity)
                grav *= other.gravity;
 
-       zdist = torg_z - org_z;
+       zdist = torg.z - org.z;
        sdist = vlen(torg - org - zdist * '0 0 1');
        sdir = normalize(torg - org - zdist * '0 0 1');
 
@@ -81,10 +72,10 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht)
        vector solution;
        solution = solve_quadratic(0.5 * grav, -vz, zdist); // equation "z(ti) = zdist"
        // ALWAYS solvable because jumpheight >= zdist
-       if(!solution_z)
-               solution_y = solution_x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0)
+       if(!solution.z)
+               solution.y = solution.x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0)
        if(zdist == 0)
-               solution_x = solution_y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually)
+               solution.x = solution.y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually)
 
        if(zdist < 0)
        {
@@ -94,14 +85,14 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht)
                        // almost straight line type
                        // jump apex is before the jump
                        // we must take the larger one
-                       trigger_push_calculatevelocity_flighttime = solution_y;
+                       trigger_push_calculatevelocity_flighttime = solution.y;
                }
                else
                {
                        // regular jump
                        // jump apex is during the jump
                        // we must take the larger one too
-                       trigger_push_calculatevelocity_flighttime = solution_y;
+                       trigger_push_calculatevelocity_flighttime = solution.y;
                }
        }
        else
@@ -112,14 +103,14 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht)
                        // almost straight line type
                        // jump apex is after the jump
                        // we must take the smaller one
-                       trigger_push_calculatevelocity_flighttime = solution_x;
+                       trigger_push_calculatevelocity_flighttime = solution.x;
                }
                else
                {
                        // regular jump
                        // jump apex is during the jump
                        // we must take the larger one
-                       trigger_push_calculatevelocity_flighttime = solution_y;
+                       trigger_push_calculatevelocity_flighttime = solution.y;
                }
        }
        vs = sdist / trigger_push_calculatevelocity_flighttime;
@@ -180,12 +171,10 @@ void trigger_push_touch()
                }
                if(IS_REAL_CLIENT(other) || IS_BOT_CLIENT(other))
                {
-                       float i;
-                       float found;
-                       found = FALSE;
-                       for(i = 0; i < other.jumppadcount && i < NUM_JUMPPADSUSED; ++i)
+                       bool found = false;
+                       for(int i = 0; i < other.jumppadcount && i < NUM_JUMPPADSUSED; ++i)
                                if(other.(jumppadsused[i]) == self)
-                                       found = TRUE;
+                                       found = true;
                        if(!found)
                        {
                                other.(jumppadsused[other.jumppadcount % NUM_JUMPPADSUSED]) = self;
@@ -201,10 +190,10 @@ void trigger_push_touch()
                                other.lastteleporttime = time;
 
                        if (other.deadflag == DEAD_NO)
-                               animdecide_setaction(other, ANIMACTION_JUMP, TRUE);
+                               animdecide_setaction(other, ANIMACTION_JUMP, true);
                }
                else
-                       other.jumppadcount = TRUE;
+                       other.jumppadcount = true;
 
                // reset tracking of who pushed you into a hazard (for kill credit)
                other.pushltime = 0;
@@ -246,7 +235,6 @@ void trigger_push_touch()
        }
 }
 
-.vector dest;
 void trigger_push_findtarget()
 {
        entity e, t;
@@ -254,7 +242,7 @@ void trigger_push_findtarget()
 
        // first calculate a typical start point for the jump
        org = (self.absmin + self.absmax) * 0.5;
-       org_z = self.absmax_z - PL_MIN_z;
+       org.z = self.absmax.z - PL_MIN_z;
 
        if (self.target)
        {
diff --git a/qcsrc/server/t_jumppads.qh b/qcsrc/server/t_jumppads.qh
new file mode 100644 (file)
index 0000000..9d66e98
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef T_JUMPPADS_H
+#define T_JUMPPADS_H
+
+const float PUSH_ONCE          = 1;
+const float PUSH_SILENT                = 2;
+
+.float pushltime;
+.float istypefrag;
+.float height;
+
+void() SUB_UseTargets;
+
+float trigger_push_calculatevelocity_flighttime;
+
+void trigger_push_use();
+
+/*
+       trigger_push_calculatevelocity
+
+       Arguments:
+         org - origin of the object which is to be pushed
+         tgt - target entity (can be either a point or a model entity; if it is
+               the latter, its midpoint is used)
+         ht  - jump height, measured from the higher one of org and tgt's midpoint
+
+       Returns: velocity for the jump
+       the global trigger_push_calculatevelocity_flighttime is set to the total
+       jump time
+ */
+
+vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
+
+void trigger_push_touch();
+
+.vector dest;
+void trigger_push_findtarget();
+
+/*
+ * ENTITY PARAMETERS:
+ *
+ *   target:  target of jump
+ *   height:  the absolute value is the height of the highest point of the jump
+ *            trajectory above the higher one of the player and the target.
+ *            the sign indicates whether the highest point is INSIDE (positive)
+ *            or OUTSIDE (negative) of the jump trajectory. General rule: use
+ *            positive values for targets mounted on the floor, and use negative
+ *            values to target a point on the ceiling.
+ *   movedir: if target is not set, this * speed * 10 is the velocity to be reached.
+ */
+void spawnfunc_trigger_push();
+
+void spawnfunc_target_push();
+void spawnfunc_info_notnull();
+void spawnfunc_target_position();
+#endif
index 315abe152f50b2d9074b28d1e214fa8d1f199053..5b9433af4f2aac3cd7c64f73840cf64a75a6c9e1 100644 (file)
@@ -1,3 +1,22 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../warpzonelib/mathlib.qh"
+    #include "../warpzonelib/common.qh"
+    #include "../warpzonelib/util_server.qh"
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "../common/notifications.qh"
+    #include "../common/deathtypes.qh"
+    #include "command/common.qh"
+    #include "../csqcmodellib/sv_model.qh"
+#endif
+
 .float dmgtime2;
 void generic_plat_blocked()
 {
@@ -37,24 +56,24 @@ void plat_spawn_inside_trigger()
 
        tmin = self.absmin + '25 25 0';
        tmax = self.absmax - '25 25 -8';
-       tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
+       tmin.z = tmax.z - (self.pos1_z - self.pos2_z + 8);
        if (self.spawnflags & PLAT_LOW_TRIGGER)
-               tmax_z = tmin_z + 8;
+               tmax.z = tmin.z + 8;
 
-       if (self.size_x <= 50)
+       if (self.size.x <= 50)
        {
-               tmin_x = (self.mins_x + self.maxs_x) / 2;
-               tmax_x = tmin_x + 1;
+               tmin.x = (self.mins.x + self.maxs.x) / 2;
+               tmax.x = tmin.x + 1;
        }
-       if (self.size_y <= 50)
+       if (self.size.y <= 50)
        {
-               tmin_y = (self.mins_y + self.maxs_y) / 2;
-               tmax_y = tmin_y + 1;
+               tmin.y = (self.mins.y + self.maxs.y) / 2;
+               tmax.y = tmin.y + 1;
        }
 
-       if(tmin_x < tmax_x)
-               if(tmin_y < tmax_y)
-                       if(tmin_z < tmax_z)
+       if(tmin.x < tmax.x)
+               if(tmin.y < tmax.y)
+                       if(tmin.z < tmax.z)
                        {
                                setsize (trigger, tmin, tmax);
                                return;
@@ -196,15 +215,15 @@ float set_platmovetype(entity e, string s)
 
        if(n > 2)
                if(argv(2) == "force")
-                       return TRUE; // no checking, return immediately
+                       return true; // no checking, return immediately
 
        if(!cubic_speedfunc_is_sane(e.platmovetype_start, e.platmovetype_end))
        {
                objerror("Invalid platform move type; platform would go in reverse, which is not allowed.");
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
 void spawnfunc_path_corner()
@@ -270,11 +289,11 @@ void spawnfunc_func_plat()
        if (!self.lip)
                self.lip = 16;
        if (!self.height)
-               self.height = self.size_z - self.lip;
+               self.height = self.size.z - self.lip;
 
        self.pos1 = self.origin;
        self.pos2 = self.origin;
-       self.pos2_z = self.origin_z - self.height;
+       self.pos2_z = self.origin.z - self.height;
 
        self.reset = plat_reset;
        plat_reset();
@@ -309,13 +328,13 @@ void train_wait()
                else // linear movement
                        ang = targ.origin - (self.origin - self.view_ofs); // use the origin of the next path_corner
                ang = vectoangles(ang);
-               ang_x = -ang_x; // flip up / down orientation
+               ang.x = -ang.x; // flip up / down orientation
 
                if(self.wait > 0) // slow turning
                        SUB_CalcAngleMove(ang, TSPEED_TIME, self.ltime - time + self.wait, train_wait);
                else // instant turning
                        SUB_CalcAngleMove(ang, TSPEED_TIME, 0.0000001, train_wait);
-               self.train_wait_turning = TRUE;
+               self.train_wait_turning = true;
                return;
        }
 
@@ -324,7 +343,7 @@ void train_wait()
 
        if(self.wait < 0 || self.train_wait_turning) // no waiting or we already waited while turning
        {
-               self.train_wait_turning = FALSE;
+               self.train_wait_turning = false;
                train_next();
        }
        else
@@ -417,10 +436,10 @@ void spawnfunc_func_train()
        if (!InitMovingBrushTrigger())
                return;
        self.effects |= EF_LOWPRECISION;
-       
+
        if (self.spawnflags & 2)
        {
-               self.platmovetype_turn = TRUE;
+               self.platmovetype_turn = true;
                self.view_ofs = '0 0 0'; // don't offset a rotating train, origin works differently now
        }
        else
@@ -536,7 +555,7 @@ void func_bobbing_controller_think()
 
        // calculate sinewave using makevectors
        makevectors((self.nextthink * self.owner.cnt + self.owner.phase * 360) * '0 1 0');
-       v = self.owner.destvec + self.owner.movedir * v_forward_y;
+       v = self.owner.destvec + self.owner.movedir * v_forward.y;
        if(self.owner.classname == "func_bobbing") // don't brake stuff if the func_bobbing was killtarget'ed
                // * 10 so it will arrive in 0.1 sec
                self.owner.velocity = (v - self.owner.origin) * 10;
@@ -620,11 +639,11 @@ void func_pendulum_controller_think()
 
        // calculate sinewave using makevectors
        makevectors((self.nextthink * self.owner.freq + self.owner.phase) * '0 360 0');
-       v = self.owner.speed * v_forward_y + self.cnt;
+       v = self.owner.speed * v_forward.y + self.cnt;
        if(self.owner.classname == "func_pendulum") // don't brake stuff if the func_bobbing was killtarget'ed
        {
                // * 10 so it will arrive in 0.1 sec
-               self.owner.avelocity_z = (remainder(v - self.owner.angles_z, 360)) * 10;
+               self.owner.avelocity_z = (remainder(v - self.owner.angles.z, 360)) * 10;
        }
 }
 
@@ -662,11 +681,11 @@ void spawnfunc_func_pendulum()
        if(!self.freq)
        {
                // find pendulum length (same formula as Q3A)
-               self.freq = 1 / (M_PI * 2) * sqrt(autocvar_sv_gravity / (3 * max(8, fabs(self.mins_z))));
+               self.freq = 1 / (M_PI * 2) * sqrt(autocvar_sv_gravity / (3 * max(8, fabs(self.mins.z))));
        }
 
        // copy initial angle
-       self.cnt = self.angles_z;
+       self.cnt = self.angles.z;
 
        // wait for targets to spawn
        controller = spawn();
@@ -991,22 +1010,16 @@ ACTIVATION FUNCTIONS
 */
 
 float door_check_keys(void) {
-       local entity door;
-
-
-       if (self.owner)
-               door = self.owner;
-       else
-               door = self;
+       entity door = self.owner ? self.owner : self;
 
        // no key needed
        if (!door.itemkeys)
-               return TRUE;
+               return true;
 
        // this door require a key
        // only a player can have a key
        if (!IS_PLAYER(other))
-               return FALSE;
+               return false;
 
        if (item_keys_usekey(door, other)) {
                // some keys were used
@@ -1028,9 +1041,9 @@ float door_check_keys(void) {
                // door is now unlocked
                play2(other, "misc/talk.wav");
                Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_UNLOCKED);
-               return TRUE;
+               return true;
        } else
-               return FALSE;
+               return false;
 }
 
 
@@ -1323,19 +1336,19 @@ entity LinkDoors_nextent(entity cur, entity near, entity pass)
 float LinkDoors_isconnected(entity e1, entity e2, entity pass)
 {
        float DELTA = 4;
-       if (e1.absmin_x > e2.absmax_x + DELTA)
-               return FALSE;
-       if (e1.absmin_y > e2.absmax_y + DELTA)
-               return FALSE;
-       if (e1.absmin_z > e2.absmax_z + DELTA)
-               return FALSE;
-       if (e2.absmin_x > e1.absmax_x + DELTA)
-               return FALSE;
-       if (e2.absmin_y > e1.absmax_y + DELTA)
-               return FALSE;
-       if (e2.absmin_z > e1.absmax_z + DELTA)
-               return FALSE;
-       return TRUE;
+       if (e1.absmin.x > e2.absmax.x + DELTA)
+               return false;
+       if (e1.absmin.y > e2.absmax.y + DELTA)
+               return false;
+       if (e1.absmin.z > e2.absmax.z + DELTA)
+               return false;
+       if (e2.absmin.x > e1.absmax.x + DELTA)
+               return false;
+       if (e2.absmin.y > e1.absmax.y + DELTA)
+               return false;
+       if (e2.absmin.z > e1.absmax.z + DELTA)
+               return false;
+       return true;
 }
 
 /*
@@ -1394,18 +1407,18 @@ void LinkDoors()
                        self.targetname = t.targetname;
                if((t.message != "") && (self.message == ""))
                        self.message = t.message;
-               if (t.absmin_x < cmins_x)
-                       cmins_x = t.absmin_x;
-               if (t.absmin_y < cmins_y)
-                       cmins_y = t.absmin_y;
-               if (t.absmin_z < cmins_z)
-                       cmins_z = t.absmin_z;
-               if (t.absmax_x > cmaxs_x)
-                       cmaxs_x = t.absmax_x;
-               if (t.absmax_y > cmaxs_y)
-                       cmaxs_y = t.absmax_y;
-               if (t.absmax_z > cmaxs_z)
-                       cmaxs_z = t.absmax_z;
+               if (t.absmin.x < cmins.x)
+                       cmins.x = t.absmin.x;
+               if (t.absmin.y < cmins.y)
+                       cmins.y = t.absmin.y;
+               if (t.absmin.z < cmins.z)
+                       cmins.z = t.absmin.z;
+               if (t.absmax.x > cmaxs.x)
+                       cmaxs.x = t.absmax.x;
+               if (t.absmax.y > cmaxs.y)
+                       cmaxs.y = t.absmax.y;
+               if (t.absmax.z > cmaxs.z)
+                       cmaxs.z = t.absmax.z;
                if(t.enemy == self)
                        break;
        }
@@ -1480,8 +1493,8 @@ void door_reset()
 }
 
 // spawnflags require key (for now only func_door)
-#define SPAWNFLAGS_GOLD_KEY 8
-#define SPAWNFLAGS_SILVER_KEY 16
+const float SPAWNFLAGS_GOLD_KEY = 8;
+const float SPAWNFLAGS_SILVER_KEY = 16;
 void spawnfunc_func_door()
 {
        // Quake 1 keys compatibility
@@ -1614,9 +1627,9 @@ void spawnfunc_func_door_rotating()
        else // Z
                self.movedir = '0 1 0';
 
-       if (self.angles_y==0) self.angles_y = 90;
+       if (self.angles.y ==0) self.angles_y = 90;
 
-       self.movedir = self.movedir * self.angles_y;
+       self.movedir = self.movedir * self.angles.y;
        self.angles = '0 0 0';
 
        self.max_health = self.health;
@@ -1708,7 +1721,7 @@ void fd_secret_use()
        string message_save;
 
        self.health = 10000;
-       self.bot_attack = TRUE;
+       self.bot_attack = true;
 
        // exit if still moving around...
        if (self.origin != self.oldorigin)
@@ -1955,7 +1968,7 @@ void func_fourier_controller_think()
        for(i = 0; i < n; ++i)
        {
                makevectors((t * stof(argv(i*5)) + stof(argv(i*5+1)) * 360) * '0 1 0');
-               v = v + ('1 0 0' * stof(argv(i*5+2)) + '0 1 0' * stof(argv(i*5+3)) + '0 0 1' * stof(argv(i*5+4))) * self.owner.height * v_forward_y;
+               v = v + ('1 0 0' * stof(argv(i*5+2)) + '0 1 0' * stof(argv(i*5+3)) + '0 0 1' * stof(argv(i*5+4))) * self.owner.height * v_forward.y;
        }
 
        if(self.owner.classname == "func_fourier") // don't brake stuff if the func_fourier was killtarget'ed
index 219a6ae231162ed9b467ade90f7aa294c78e5f77..9b25c8860905440b3b724ec09c261a6fcfbbc14a 100644 (file)
@@ -1,3 +1,5 @@
+#include "../common/weapons/weapons.qc"
+
 //***********************
 //QUAKE 1 ENTITIES - So people can play quake1 maps with the xonotic weapons
 //***********************
index 7c1a582879ea5f3a64cc68de0869c075994df2ae..ed90bf054c0c1aeeed5668afd43c3b3e0eb09d26 100644 (file)
@@ -1,3 +1,5 @@
+#include "../common/weapons/weapons.qc"
+
 //***********************
 //QUAKE 3 ENTITIES - So people can play quake3 maps with the xonotic weapons
 //***********************
@@ -23,11 +25,11 @@ void spawnfunc_ammo_cells()          { spawnfunc_item_rockets();        }
 
 // Rail -> Vortex
 void spawnfunc_weapon_railgun()      { spawnfunc_weapon_vortex();          }
-void spawnfunc_ammo_slugs()          { spawnfunc_item_plasma();          }
+void spawnfunc_ammo_slugs()          { spawnfunc_item_cells();          }
 
 // BFG -> Crylink
 void spawnfunc_weapon_bfg()          { spawnfunc_weapon_crylink();      }
-void spawnfunc_ammo_bfg()            { spawnfunc_item_plasma();          }
+void spawnfunc_ammo_bfg()            { spawnfunc_item_cells();          }
 
 // RL -> RL
 void spawnfunc_ammo_rockets()        { spawnfunc_item_rockets();        }
index e481dc6349018f2b28a539d4d3be7594daac9a11..b63e7ffe31ee332ffc61c2f3eb5b789dbdf5ff97 100644 (file)
@@ -1,3 +1,13 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../warpzonelib/util_server.qh"
+    #include "../common/weapons/weapons.qh"
+    #include "defs.qh"
+    #include "../common/deathtypes.qh"
+#endif
+
 /*
 *              t_swamp.c
 *              Adds spawnfunc_trigger_swamp and suppoart routines for xonotic 1.2.1+
index 5bed9ec930030747e981ae09a17a3e0d935dd7f2..53704a06f7e35a6c5b64923d9f10af9b4395552a 100644 (file)
@@ -1,32 +1,29 @@
+#include "t_teleporters.qh"
+
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+    #include "../warpzonelib/common.qh"
+    #include "../warpzonelib/util_server.qh"
+    #include "../warpzonelib/server.qh"
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "weapons/csqcprojectile.qh"
+    #include "autocvars.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "../common/deathtypes.qh"
+    #include "vehicles/vehicles_def.qh"
+    #include "../common/mapinfo.qh"
+    #include "anticheat.qh"
+#endif
+
 void trigger_teleport_use()
 {
        if(teamplay)
                self.team = activator.team;
 }
 
-#define TDEATHLOOP(o) \
-       entity head; \
-       vector deathmin; \
-       vector deathmax; \
-       float deathradius; \
-       deathmin = (o) + player.mins; \
-       deathmax = (o) + player.maxs; \
-       if(telefragmin != telefragmax) \
-       { \
-               if(deathmin_x > telefragmin_x) deathmin_x = telefragmin_x; \
-               if(deathmin_y > telefragmin_y) deathmin_y = telefragmin_y; \
-               if(deathmin_z > telefragmin_z) deathmin_z = telefragmin_z; \
-               if(deathmax_x < telefragmax_x) deathmax_x = telefragmax_x; \
-               if(deathmax_y < telefragmax_y) deathmax_y = telefragmax_y; \
-               if(deathmax_z < telefragmax_z) deathmax_z = telefragmax_z; \
-       } \
-       deathradius = max(vlen(deathmin), vlen(deathmax)); \
-       for(head = findradius(o, deathradius); head; head = head.chain) \
-               if(head != player) \
-                       if(head.takedamage) \
-                               if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
-
-
 float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax)
 {
        if (IS_PLAYER(player) && player.health >= 1)
@@ -41,7 +38,7 @@ float check_tdeath(entity player, vector org, vector telefragmin, vector telefra
        }
        return 0;
 }
-float tdeath_hit;
+
 void tdeath(entity player, entity teleporter, entity telefragger, vector telefragmin, vector telefragmax)
 {
        TDEATHLOOP(player.origin)
@@ -66,21 +63,6 @@ void spawn_tdeath(vector v0, entity e, vector v)
        tdeath(e, e, e, '0 0 0', '0 0 0');
 }
 
-.entity pusher;
-#define TELEPORT_FLAG_SOUND 1
-#define TELEPORT_FLAG_PARTICLES 2
-#define TELEPORT_FLAG_TDEATH 4
-#define TELEPORT_FLAG_FORCE_TDEATH 8
-
-#define TELEPORT_FLAGS_WARPZONE   0
-#define TELEPORT_FLAGS_PORTAL     (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH | TELEPORT_FLAG_FORCE_TDEATH)
-#define TELEPORT_FLAGS_TELEPORTER (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH)
-
-// types for .teleportable entity setting
-#define TELEPORT_NORMAL 1 // play sounds/effects etc
-#define TELEPORT_SIMPLE 2 // only do teleport, nothing special
-
-void Reset_ArcBeam(entity player, vector forward);
 void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags)
 {
        entity telefragger;
@@ -114,7 +96,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
        setorigin (player, to);
        player.oldorigin = to; // don't undo the teleport by unsticking
        player.angles = to_angles;
-       player.fixangle = TRUE;
+       player.fixangle = true;
        player.velocity = to_velocity;
        BITXOR_ASSIGN(player.effects, EF_TELEPORT_BIT);
 
@@ -170,7 +152,7 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
                        p = 1;
                        if(autocvar_g_telefrags_avoid)
                        {
-                               locout = e.origin + '0 0 1' * (1 - player.mins_z - 24);
+                               locout = e.origin + '0 0 1' * (1 - player.mins.z - 24);
                                if(check_tdeath(player, locout, '0 0 0', '0 0 0'))
                                        p = 0;
                        }
@@ -191,7 +173,7 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
                if(vlen(player.velocity) > autocvar_g_teleport_maxspeed)
                        player.velocity = normalize(player.velocity) * max(0, autocvar_g_teleport_maxspeed);
 
-       locout = e.origin + '0 0 1' * (1 - player.mins_z - 24);
+       locout = e.origin + '0 0 1' * (1 - player.mins.z - 24);
        TeleportPlayer(teleporter, player, locout, e.mangle, v_forward * vlen(player.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
 
        return e;
@@ -313,8 +295,6 @@ entity Teleport_Find(vector mi, vector ma)
        return world;
 }
 
-entity teleport_first;
-.entity teleport_next;
 void spawnfunc_trigger_teleport (void)
 {
        self.angles = '0 0 0';
diff --git a/qcsrc/server/t_teleporters.qh b/qcsrc/server/t_teleporters.qh
new file mode 100644 (file)
index 0000000..03e3c3f
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef T_TELEPORTERS_H
+#define T_TELEPORTERS_H
+
+void trigger_teleport_use();
+
+#define TDEATHLOOP(o) \
+       entity head; \
+       vector deathmin; \
+       vector deathmax; \
+       float deathradius; \
+       deathmin = (o) + player.mins; \
+       deathmax = (o) + player.maxs; \
+       if(telefragmin != telefragmax) \
+       { \
+               if(deathmin.x > telefragmin.x) deathmin.x = telefragmin.x; \
+               if(deathmin.y > telefragmin.y) deathmin.y = telefragmin.y; \
+               if(deathmin.z > telefragmin.z) deathmin.z = telefragmin.z; \
+               if(deathmax.x < telefragmax.x) deathmax.x = telefragmax.x; \
+               if(deathmax.y < telefragmax.y) deathmax.y = telefragmax.y; \
+               if(deathmax.z < telefragmax.z) deathmax.z = telefragmax.z; \
+       } \
+       deathradius = max(vlen(deathmin), vlen(deathmax)); \
+       for(head = findradius(o, deathradius); head; head = head.chain) \
+               if(head != player) \
+                       if(head.takedamage) \
+                               if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
+
+
+float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax);
+float tdeath_hit;
+void tdeath(entity player, entity teleporter, entity telefragger, vector telefragmin, vector telefragmax);
+
+void spawn_tdeath(vector v0, entity e, vector v);
+
+.entity pusher;
+const float TELEPORT_FLAG_SOUND = 1;
+const float TELEPORT_FLAG_PARTICLES = 2;
+const float TELEPORT_FLAG_TDEATH = 4;
+const float TELEPORT_FLAG_FORCE_TDEATH = 8;
+
+#define TELEPORT_FLAGS_WARPZONE   0
+#define TELEPORT_FLAGS_PORTAL     (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH | TELEPORT_FLAG_FORCE_TDEATH)
+#define TELEPORT_FLAGS_TELEPORTER (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH)
+
+// types for .teleportable entity setting
+const float TELEPORT_NORMAL = 1; // play sounds/effects etc
+const float TELEPORT_SIMPLE = 2; // only do teleport, nothing special
+
+void Reset_ArcBeam(entity player, vector forward);
+void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags);
+
+entity Simple_TeleportPlayer(entity teleporter, entity player);
+
+void Teleport_Touch (void);
+
+void spawnfunc_info_teleport_destination (void);
+
+void spawnfunc_misc_teleporter_dest (void);
+
+void spawnfunc_target_teleporter (void);
+
+void teleport_findtarget (void);
+
+entity Teleport_Find(vector mi, vector ma);
+
+entity teleport_first;
+.entity teleport_next;
+void spawnfunc_trigger_teleport (void);
+
+void WarpZone_PostTeleportPlayer_Callback(entity pl);
+#endif
index cd1b374e6b247fab04cf6d8d85cfea5f67c7da6f..94bc92f69ceaed1d8af9775bf9de5a4d057269fc 100644 (file)
@@ -1,3 +1,13 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../common/constants.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+#endif
+
 .float lifetime;
 // values:
 //   volume
@@ -74,28 +84,28 @@ float trigger_music_SendEntity(entity to, float sf)
        WriteByte(MSG_ENTITY, sf);
        if(sf & 4)
        {
-               WriteCoord(MSG_ENTITY, self.origin_x);
-               WriteCoord(MSG_ENTITY, self.origin_y);
-               WriteCoord(MSG_ENTITY, self.origin_z);
+               WriteCoord(MSG_ENTITY, self.origin.x);
+               WriteCoord(MSG_ENTITY, self.origin.y);
+               WriteCoord(MSG_ENTITY, self.origin.z);
        }
        if(sf & 1)
        {
                if(self.model != "null")
                {
                        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);
+                       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);
                }
                else
                {
                        WriteShort(MSG_ENTITY, 0);
-                       WriteCoord(MSG_ENTITY, self.maxs_x);
-                       WriteCoord(MSG_ENTITY, self.maxs_y);
-                       WriteCoord(MSG_ENTITY, self.maxs_z);
+                       WriteCoord(MSG_ENTITY, self.maxs.x);
+                       WriteCoord(MSG_ENTITY, self.maxs.y);
+                       WriteCoord(MSG_ENTITY, self.maxs.z);
                }
                WriteByte(MSG_ENTITY, self.volume * 255.0);
                WriteByte(MSG_ENTITY, self.fade_time * 16.0);
@@ -130,5 +140,5 @@ void spawnfunc_trigger_music()
        self.use = trigger_music_use;
        self.reset = trigger_music_reset;
 
-       Net_LinkEntity(self, FALSE, 0, trigger_music_SendEntity);
+       Net_LinkEntity(self, false, 0, trigger_music_SendEntity);
 }
index 4da6b13bbbb948060ec40541307eeffddf84be95..b4b9b1830509f846efa7aa64f3d701600a07974b 100644 (file)
@@ -1,3 +1,12 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "../common/util.qh"
+    #include "defs.qh"
+#endif
+
 // spawner entity
 // "classname" "target_spawn"
 // "message" "fieldname value fieldname value ..."
@@ -39,13 +48,13 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
                value = argv(i+1);
                if(key == "$")
                {
-                       data_x = -1;
-                       data_y = FIELD_STRING;
+                       data.x = -1;
+                       data.y = FIELD_STRING;
                }
                else
                {
                        data = stov(db_get(TemporaryDB, strcat("/target_spawn/field/", key)));
-                       if(data_y == 0) // undefined field, i.e., invalid type
+                       if(data.y == 0) // undefined field, i.e., invalid type
                        {
                                print("target_spawn: invalid/unknown entity key ", key, " specified, ignored!\n");
                                continue;
@@ -169,7 +178,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
 
                                if(valueoffset != "")
                                {
-                                       switch(data_y)
+                                       switch(data.y)
                                        {
                                                case FIELD_STRING:
                                                        value = strcat(value, valueoffset);
@@ -188,7 +197,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
 
                                if(valueoffsetrandom != "")
                                {
-                                       switch(data_y)
+                                       switch(data.y)
                                        {
                                                case FIELD_FLOAT:
                                                        value = ftos(stof(value) + random() * stof(valueoffsetrandom));
@@ -220,12 +229,15 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
 
                        self = oldself;
                        activator = oldactivator;
+
+                       // We called an external function, so we have to re-tokenize msg.
+                       n = tokenize_console(msg);
                }
                else
                {
-                       if(data_y == FIELD_VECTOR)
+                       if(data.y == FIELD_VECTOR)
                                value = strreplace("'", "", value); // why?!?
-                       putentityfieldstring(data_x, e, value);
+                       putentityfieldstring(data.x, e, value);
                }
        }
 }
@@ -313,7 +325,7 @@ void initialize_field_db()
                        ft = entityfieldtype(i);
                        new = i * '1 0 0' + ft * '0 1 0' + '0 0 1';
                        prev = stov(db_get(TemporaryDB, strcat("/target_spawn/field/", fn)));
-                       if(prev_y == 0)
+                       if(prev.y == 0)
                        {
                                db_put(TemporaryDB, strcat("/target_spawn/field/", fn), vtos(new));
                                if(fn == "target_spawn_spawnfunc")
index 2f6963bf71b9f0d85c1a86cae7fcafffebadc602..ba1b4e6eedacb91412044bd0529c472ac3ffb977 100644 (file)
@@ -1,20 +1,10 @@
-string cache_mutatormsg;
-string cache_lastmutatormsg;
-
-// client counts for each team
-float c1, c2, c3, c4;
-// # of bots on those teams
-float cb1, cb2, cb3, cb4;
-
-//float audit_teams_time;
+#include "teamplay.qh"
 
 void TeamchangeFrags(entity e)
 {
        PlayerScore_Clear(e);
 }
 
-void entcs_init();
-
 void LogTeamchange(float player_id, float team_number, float type)
 {
        if(!autocvar_sv_eventlog)
@@ -595,11 +585,11 @@ float TeamSmallerEqThanTeam(float ta, float tb, entity e)
 
        // invalid
        if(ca < 0 || cb < 0)
-               return FALSE;
+               return false;
 
        // equal
        if(ta == tb)
-               return TRUE;
+               return true;
 
        if(IS_REAL_CLIENT(e))
        {
@@ -613,10 +603,10 @@ float TeamSmallerEqThanTeam(float ta, float tb, entity e)
        // keep teams alive (teams of size 0 always count as smaller, ignoring score)
        if(ca < 1)
                if(cb >= 1)
-                       return TRUE;
+                       return true;
        if(ca >= 1)
                if(cb < 1)
-                       return FALSE;
+                       return false;
 
        // first, normalize
        f = max(ca, cb, 1);
@@ -735,7 +725,7 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam)
                // otherwise end up on the smallest team (handled below)
        }
 
-       smallest = FindSmallestTeam(pl, TRUE);
+       smallest = FindSmallestTeam(pl, true);
 
        if(!only_return_best && !pl.bot_forced_team)
        {
@@ -812,7 +802,7 @@ void SV_ChangeTeam(float _color)
        if(scolor == dcolor)
        {
                //bprint("same team change\n");
-               SetPlayerTeam(self, dteam, steam, TRUE);
+               SetPlayerTeam(self, dteam, steam, true);
                return;
        }
 
@@ -840,7 +830,7 @@ void SV_ChangeTeam(float _color)
                TeamchangeFrags(self);
        }
 
-       SetPlayerTeam(self, dteam, steam, FALSE);
+       SetPlayerTeam(self, dteam, steam, false);
 
        if(IS_PLAYER(self) && steam != dteam)
        {
@@ -984,7 +974,7 @@ void ShufflePlayerOutOfTeam (float source_team)
 
        // move the player to the new team
        TeamchangeFrags(selected);
-       SetPlayerTeam(selected, smallestteam, source_team, FALSE);
+       SetPlayerTeam(selected, smallestteam, source_team, false);
 
        if(selected.deadflag == DEAD_NO)
                Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE, selected.origin, '0 0 0');
diff --git a/qcsrc/server/teamplay.qh b/qcsrc/server/teamplay.qh
new file mode 100644 (file)
index 0000000..8ce6eae
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef TEAMPLAY_H
+#define TEAMPLAY_H
+
+string cache_mutatormsg;
+string cache_lastmutatormsg;
+
+// client counts for each team
+//float c1, c2, c3, c4;
+// # of bots on those teams
+float cb1, cb2, cb3, cb4;
+
+//float audit_teams_time;
+
+void TeamchangeFrags(entity e);
+
+void entcs_init();
+
+void LogTeamchange(float player_id, float team_number, float type);
+
+void default_delayedinit();
+
+void ActivateTeamplay();
+
+void InitGameplayMode();
+
+string GetClientVersionMessage();
+
+string getwelcomemessage(void);
+
+void SetPlayerColors(entity pl, float _color);
+
+void SetPlayerTeam(entity pl, float t, float s, float noprint);
+
+// set c1...c4 to show what teams are allowed
+void CheckAllowedTeams (entity for_whom);
+
+float PlayerValue(entity p);
+
+// c1...c4 should be set to -1 (not allowed) or 0 (allowed).
+// teams that are allowed will now have their player counts stored in c1...c4
+void GetTeamCounts(entity ignore);
+
+float TeamSmallerEqThanTeam(float ta, float tb, entity e);
+
+// returns # of smallest team (1, 2, 3, 4)
+// NOTE: Assumes CheckAllowedTeams has already been called!
+float FindSmallestTeam(entity pl, float ignore_pl);
+
+float JoinBestTeam(entity pl, float only_return_best, float forcebestteam);
+
+//void() ctf_playerchanged;
+void SV_ChangeTeam(float _color);
+
+void ShufflePlayerOutOfTeam (float source_team);
+#endif
diff --git a/qcsrc/server/tturrets/system/system_main.qc b/qcsrc/server/tturrets/system/system_main.qc
deleted file mode 100644 (file)
index d56a81b..0000000
+++ /dev/null
@@ -1,1378 +0,0 @@
-#define cvar_base "g_turrets_unit_"
-.float clientframe;
-void turrets_setframe(float _frame, float client_only)
-{
-    if((client_only ? self.clientframe : self.frame ) != _frame)
-    {
-        self.SendFlags |= TNSF_ANIM;
-        self.anim_start_time = time;
-    }
-
-     if(client_only)
-        self.clientframe = _frame;
-    else
-        self.frame = _frame;
-
-}
-
-float turret_send(entity to, float sf)
-{
-
-       WriteByte(MSG_ENTITY, ENT_CLIENT_TURRET);
-       WriteByte(MSG_ENTITY, sf);
-       if(sf & TNSF_SETUP)
-       {
-           WriteByte(MSG_ENTITY, self.turret_type);
-
-           WriteCoord(MSG_ENTITY, self.origin_x);
-           WriteCoord(MSG_ENTITY, self.origin_y);
-           WriteCoord(MSG_ENTITY, self.origin_z);
-
-           WriteAngle(MSG_ENTITY, self.angles_x);
-           WriteAngle(MSG_ENTITY, self.angles_y);
-    }
-
-    if(sf & TNSF_ANG)
-    {
-        WriteShort(MSG_ENTITY, rint(self.tur_head.angles_x));
-        WriteShort(MSG_ENTITY, rint(self.tur_head.angles_y));
-    }
-
-    if(sf & TNSF_AVEL)
-    {
-        WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_x));
-        WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_y));
-    }
-
-    if(sf & TNSF_MOVE)
-    {
-        WriteShort(MSG_ENTITY, rint(self.origin_x));
-        WriteShort(MSG_ENTITY, rint(self.origin_y));
-        WriteShort(MSG_ENTITY, rint(self.origin_z));
-
-        WriteShort(MSG_ENTITY, rint(self.velocity_x));
-        WriteShort(MSG_ENTITY, rint(self.velocity_y));
-        WriteShort(MSG_ENTITY, rint(self.velocity_z));
-
-        WriteShort(MSG_ENTITY, rint(self.angles_y));
-    }
-
-    if(sf & TNSF_ANIM)
-    {
-        WriteCoord(MSG_ENTITY, self.anim_start_time);
-        WriteByte(MSG_ENTITY, self.frame);
-    }
-
-    if(sf & TNSF_STATUS)
-    {
-        WriteByte(MSG_ENTITY, self.team);
-
-        if(self.health <= 0)
-            WriteByte(MSG_ENTITY, 0);
-        else
-            WriteByte(MSG_ENTITY, ceil((self.health / self.tur_health) * 255));
-    }
-
-       return TRUE;
-}
-
-void load_unit_settings(entity ent, string unitname, float is_reload)
-{
-    string sbase;
-
-    if (ent == world)
-        return;
-
-    if (!ent.turret_scale_damage)    ent.turret_scale_damage  = 1;
-    if (!ent.turret_scale_range)     ent.turret_scale_range   = 1;
-    if (!ent.turret_scale_refire)    ent.turret_scale_refire  = 1;
-    if (!ent.turret_scale_ammo)      ent.turret_scale_ammo    = 1;
-    if (!ent.turret_scale_aim)       ent.turret_scale_aim     = 1;
-    if (!ent.turret_scale_health)    ent.turret_scale_health  = 1;
-    if (!ent.turret_scale_respawn)   ent.turret_scale_respawn = 1;
-
-    sbase = strcat(cvar_base,unitname);
-    if (is_reload)
-    {
-        ent.enemy = world;
-        ent.tur_head.avelocity = '0 0 0';
-
-        ent.tur_head.angles = '0 0 0';
-    }
-
-    ent.health      = cvar(strcat(sbase,"_health")) * ent.turret_scale_health;
-    ent.respawntime = cvar(strcat(sbase,"_respawntime")) * ent.turret_scale_respawn;
-
-    ent.shot_dmg          = cvar(strcat(sbase,"_shot_dmg")) * ent.turret_scale_damage;
-    ent.shot_refire       = cvar(strcat(sbase,"_shot_refire")) * ent.turret_scale_refire;
-    ent.shot_radius       = cvar(strcat(sbase,"_shot_radius")) * ent.turret_scale_damage;
-    ent.shot_speed        = cvar(strcat(sbase,"_shot_speed"));
-    ent.shot_spread       = cvar(strcat(sbase,"_shot_spread"));
-    ent.shot_force        = cvar(strcat(sbase,"_shot_force")) * ent.turret_scale_damage;
-    ent.shot_volly        = cvar(strcat(sbase,"_shot_volly"));
-    ent.shot_volly_refire = cvar(strcat(sbase,"_shot_volly_refire")) * ent.turret_scale_refire;
-
-    ent.target_range         = cvar(strcat(sbase,"_target_range")) * ent.turret_scale_range;
-    ent.target_range_min     = cvar(strcat(sbase,"_target_range_min")) * ent.turret_scale_range;
-    ent.target_range_optimal = cvar(strcat(sbase,"_target_range_optimal")) * ent.turret_scale_range;
-    //ent.target_range_fire    = cvar(strcat(sbase,"_target_range_fire")) * ent.turret_scale_range;
-
-    ent.target_select_rangebias  = cvar(strcat(sbase,"_target_select_rangebias"));
-    ent.target_select_samebias   = cvar(strcat(sbase,"_target_select_samebias"));
-    ent.target_select_anglebias  = cvar(strcat(sbase,"_target_select_anglebias"));
-    ent.target_select_playerbias = cvar(strcat(sbase,"_target_select_playerbias"));
-    //ent.target_select_fov = cvar(cvar_gets(sbase,"_target_select_fov"));
-
-    ent.ammo_max      = cvar(strcat(sbase,"_ammo_max")) * ent.turret_scale_ammo;
-    ent.ammo_recharge = cvar(strcat(sbase,"_ammo_recharge")) * ent.turret_scale_ammo;
-
-    ent.aim_firetolerance_dist = cvar(strcat(sbase,"_aim_firetolerance_dist"));
-    ent.aim_speed    = cvar(strcat(sbase,"_aim_speed")) * ent.turret_scale_aim;
-    ent.aim_maxrot   = cvar(strcat(sbase,"_aim_maxrot"));
-    ent.aim_maxpitch = cvar(strcat(sbase,"_aim_maxpitch"));
-
-    ent.track_type        = cvar(strcat(sbase,"_track_type"));
-    ent.track_accel_pitch = cvar(strcat(sbase,"_track_accel_pitch"));
-    ent.track_accel_rot   = cvar(strcat(sbase,"_track_accel_rot"));
-    ent.track_blendrate   = cvar(strcat(sbase,"_track_blendrate"));
-
-    if(is_reload)
-        if(ent.turret_respawnhook)
-            ent.turret_respawnhook();
-}
-
-void turret_projectile_explode()
-{
-
-    self.takedamage = DAMAGE_NO;
-    self.event_damage = func_null;
-#ifdef TURRET_DEBUG
-    float d;
-    d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
-    self.owner.tur_dbg_dmg_t_h = self.owner.tur_dbg_dmg_t_h + d;
-    self.owner.tur_dbg_dmg_t_f = self.owner.tur_dbg_dmg_t_f + self.owner.shot_dmg;
-#else
-    RadiusDamage (self, self.realowner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
-#endif
-    remove(self);
-}
-
-void turret_projectile_touch()
-{
-    PROJECTILE_TOUCH;
-    turret_projectile_explode();
-}
-
-void turret_projectile_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
-{
-    self.velocity  += vforce;
-    self.health    -= damage;
-    //self.realowner  = attacker; // Dont change realowner, it does not make much sense for turrets
-    if(self.health <= 0)
-        W_PrepareExplosionByDamage(self.owner, turret_projectile_explode);
-}
-
-entity turret_projectile(string _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
-{
-    entity proj;
-
-    sound (self, CH_WEAPON_A, _snd, VOL_BASE, ATTEN_NORM);
-    proj                 = spawn ();
-    setorigin(proj, self.tur_shotorg);
-    setsize(proj, '-0.5 -0.5 -0.5' * _size, '0.5 0.5 0.5' * _size);
-    proj.owner           = self;
-    proj.realowner       = self;
-    proj.bot_dodge       = TRUE;
-    proj.bot_dodgerating = self.shot_dmg;
-    proj.think           = turret_projectile_explode;
-    proj.touch           = turret_projectile_touch;
-    proj.nextthink       = time + 9;
-    proj.movetype        = MOVETYPE_FLYMISSILE;
-    proj.velocity        = normalize(self.tur_shotdir_updated + randomvec() * self.shot_spread) * self.shot_speed;
-    proj.flags           = FL_PROJECTILE;
-    proj.enemy           = self.enemy;
-    proj.totalfrags      = _death;
-    PROJECTILE_MAKETRIGGER(proj);
-    if(_health)
-    {
-        proj.health         = _health;
-        proj.takedamage     = DAMAGE_YES;
-        proj.event_damage   = turret_projectile_damage;
-    }
-    else
-        proj.flags |= FL_NOTARGET;
-
-    CSQCProjectile(proj, _cli_anim, _proj_type, _cull);
-
-    return proj;
-}
-
-/**
-** updates enemy distances, predicted impact point/time
-** and updated aim<->predict impact distance.
-**/
-void turret_do_updates(entity t_turret)
-{
-    vector enemy_pos;
-    entity oldself;
-
-    oldself = self;
-    self = t_turret;
-
-    enemy_pos = real_origin(self.enemy);
-
-    turret_tag_fire_update();
-
-    self.tur_shotdir_updated = v_forward;
-    self.tur_dist_enemy  = vlen(self.tur_shotorg - enemy_pos);
-    self.tur_dist_aimpos = vlen(self.tur_shotorg - self.tur_aimpos);
-
-    /*if((self.firecheck_flags & TFL_FIRECHECK_VERIFIED) && (self.enemy))
-    {
-        oldpos = self.enemy.origin;
-        setorigin(self.enemy, self.tur_aimpos);
-        tracebox(self.tur_shotorg, '-1 -1 -1', '1 1 1', self.tur_shotorg + (self.tur_shotdir_updated * self.tur_dist_aimpos), MOVE_NORMAL,self);
-        setorigin(self.enemy, oldpos);
-
-        if(trace_ent == self.enemy)
-            self.tur_dist_impact_to_aimpos = 0;
-        else
-            self.tur_dist_impact_to_aimpos = vlen(trace_endpos - self.tur_aimpos);
-    }
-    else*/
-        tracebox(self.tur_shotorg, '-1 -1 -1','1 1 1', self.tur_shotorg + (self.tur_shotdir_updated * self.tur_dist_aimpos), MOVE_NORMAL,self);
-
-       self.tur_dist_impact_to_aimpos = vlen(trace_endpos - self.tur_aimpos) - (vlen(self.enemy.maxs - self.enemy.mins) * 0.5);
-       self.tur_impactent             = trace_ent;
-       self.tur_impacttime            = vlen(self.tur_shotorg - trace_endpos) / self.shot_speed;
-
-    self = oldself;
-}
-
-/*
-vector turret_fovsearch_pingpong()
-{
-    vector wish_angle;
-    if(self.phase < time)
-    {
-        if( self.tur_head.phase )
-            self.tur_head.phase = 0;
-        else
-            self.tur_head.phase = 1;
-        self.phase = time + 5;
-    }
-
-    if( self.tur_head.phase)
-        wish_angle = self.idle_aim + '0 1 0' * (self.aim_maxrot * (self.target_select_fov / 360));
-    else
-        wish_angle = self.idle_aim - '0 1 0' * (self.aim_maxrot * (self.target_select_fov / 360));
-
-    return wish_angle;
-}
-
-vector turret_fovsearch_steprot()
-{
-    vector wish_angle;
-    //float rot_add;
-
-    wish_angle   = self.tur_head.angles;
-    wish_angle_x = self.idle_aim_x;
-
-    if (self.phase < time)
-    {
-        //rot_add = self.aim_maxrot / self.target_select_fov;
-        wish_angle_y += (self.target_select_fov * 2);
-
-        if(wish_angle_y > 360)
-            wish_angle_y = wish_angle_y - 360;
-
-         self.phase = time + 1.5;
-    }
-
-    return wish_angle;
-}
-
-vector turret_fovsearch_random()
-{
-    vector wish_angle;
-
-    if (self.phase < time)
-    {
-        wish_angle_y = random() * self.aim_maxrot;
-        if(random() < 0.5)
-            wish_angle_y *= -1;
-
-        wish_angle_x = random() * self.aim_maxpitch;
-        if(random() < 0.5)
-            wish_angle_x *= -1;
-
-        self.phase = time + 5;
-
-        self.tur_aimpos = wish_angle;
-    }
-
-    return self.idle_aim + self.tur_aimpos;
-}
-*/
-
-/**
-** Handles head rotation according to
-** the units .track_type and .track_flags
-**/
-.float turret_framecounter;
-void turret_stdproc_track()
-{
-    vector target_angle; // This is where we want to aim
-    vector move_angle;   // This is where we can aim
-    float f_tmp;
-    vector v1, v2;
-    v1 = self.tur_head.angles;
-    v2 = self.tur_head.avelocity;
-
-    if (self.track_flags == TFL_TRACK_NO)
-        return;
-
-    if (!self.active)
-        target_angle = self.idle_aim - ('1 0 0' * self.aim_maxpitch);
-    else if (self.enemy == world)
-    {
-        if(time > self.lip)
-            target_angle = self.idle_aim + self.angles;
-        else
-            target_angle = vectoangles(normalize(self.tur_aimpos - self.tur_shotorg));
-    }
-    else
-    {
-        target_angle = vectoangles(normalize(self.tur_aimpos - self.tur_shotorg));
-    }
-
-    self.tur_head.angles_x = anglemods(self.tur_head.angles_x);
-    self.tur_head.angles_y = anglemods(self.tur_head.angles_y);
-
-    // Find the diffrence between where we currently aim and where we want to aim
-    //move_angle = target_angle - (self.angles + self.tur_head.angles);
-    //move_angle = shortangle_vxy(move_angle,(self.angles + self.tur_head.angles));
-
-    move_angle = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(self.angles), AnglesTransform_FromAngles(target_angle))) - self.tur_head.angles;
-    move_angle = shortangle_vxy(move_angle, self.tur_head.angles);
-
-    switch(self.track_type)
-    {
-        case TFL_TRACKTYPE_STEPMOTOR:
-            f_tmp = self.aim_speed * self.ticrate; // dgr/sec -> dgr/tic
-            if (self.track_flags & TFL_TRACK_PITCH)
-            {
-                self.tur_head.angles_x += bound(-f_tmp,move_angle_x, f_tmp);
-                if(self.tur_head.angles_x > self.aim_maxpitch)
-                    self.tur_head.angles_x = self.aim_maxpitch;
-
-                if(self.tur_head.angles_x  < -self.aim_maxpitch)
-                    self.tur_head.angles_x = self.aim_maxpitch;
-            }
-
-            if (self.track_flags & TFL_TRACK_ROT)
-            {
-                self.tur_head.angles_y += bound(-f_tmp, move_angle_y, f_tmp);
-                if(self.tur_head.angles_y > self.aim_maxrot)
-                    self.tur_head.angles_y = self.aim_maxrot;
-
-                if(self.tur_head.angles_y  < -self.aim_maxrot)
-                    self.tur_head.angles_y = self.aim_maxrot;
-            }
-
-            // CSQC
-            self.SendFlags  |= TNSF_ANG;
-
-            return;
-
-        case TFL_TRACKTYPE_FLUIDINERTIA:
-            f_tmp = self.aim_speed * self.ticrate; // dgr/sec -> dgr/tic
-            move_angle_x = bound(-self.aim_speed, move_angle_x * self.track_accel_pitch * f_tmp, self.aim_speed);
-            move_angle_y = bound(-self.aim_speed, move_angle_y * self.track_accel_rot * f_tmp, self.aim_speed);
-            move_angle = (self.tur_head.avelocity * self.track_blendrate) + (move_angle * (1 - self.track_blendrate));
-            break;
-
-        case TFL_TRACKTYPE_FLUIDPRECISE:
-
-            move_angle_y = bound(-self.aim_speed, move_angle_y, self.aim_speed);
-            move_angle_x = bound(-self.aim_speed, move_angle_x, self.aim_speed);
-
-            break;
-    }
-
-    //  pitch
-    if (self.track_flags & TFL_TRACK_PITCH)
-    {
-        self.tur_head.avelocity_x = move_angle_x;
-        if((self.tur_head.angles_x + self.tur_head.avelocity_x * self.ticrate) > self.aim_maxpitch)
-        {
-            self.tur_head.avelocity_x = 0;
-            self.tur_head.angles_x = self.aim_maxpitch;
-
-            self.SendFlags  |= TNSF_ANG;
-        }
-
-        if((self.tur_head.angles_x + self.tur_head.avelocity_x * self.ticrate) < -self.aim_maxpitch)
-        {
-            self.tur_head.avelocity_x = 0;
-            self.tur_head.angles_x = -self.aim_maxpitch;
-
-            self.SendFlags  |= TNSF_ANG;
-        }
-    }
-
-    //  rot
-    if (self.track_flags & TFL_TRACK_ROT)
-    {
-        self.tur_head.avelocity_y = move_angle_y;
-
-        if((self.tur_head.angles_y + self.tur_head.avelocity_y * self.ticrate) > self.aim_maxrot)
-        {
-            self.tur_head.avelocity_y = 0;
-            self.tur_head.angles_y = self.aim_maxrot;
-
-            self.SendFlags  |= TNSF_ANG;
-        }
-
-        if((self.tur_head.angles_y + self.tur_head.avelocity_y * self.ticrate) < -self.aim_maxrot)
-        {
-            self.tur_head.avelocity_y = 0;
-            self.tur_head.angles_y = -self.aim_maxrot;
-
-            self.SendFlags  |= TNSF_ANG;
-        }
-    }
-
-    self.SendFlags  |= TNSF_AVEL;
-
-    // Force a angle update every 10'th frame
-    self.turret_framecounter += 1;
-    if(self.turret_framecounter >= 10)
-    {
-        self.SendFlags |= TNSF_ANG;
-        self.turret_framecounter = 0;
-    }
-}
-
-
-/*
- + = implemented
- - = not implemented
-
- + TFL_FIRECHECK_NO
- + TFL_FIRECHECK_WORLD
- + TFL_FIRECHECK_DEAD
- + TFL_FIRECHECK_DISTANCES
- - TFL_FIRECHECK_LOS
- + TFL_FIRECHECK_AIMDIST
- + TFL_FIRECHECK_REALDIST
- - TFL_FIRECHECK_ANGLEDIST
- - TFL_FIRECHECK_TEAMCECK
- + TFL_FIRECHECK_AFF
- + TFL_FIRECHECK_OWM_AMMO
- + TFL_FIRECHECK_OTHER_AMMO
- + TFL_FIRECHECK_REFIRE
-*/
-
-/**
-** Preforms pre-fire checks based on the uints firecheck_flags
-**/
-float turret_stdproc_firecheck()
-{
-    // This one just dont care =)
-    if (self.firecheck_flags & TFL_FIRECHECK_NO)
-        return 1;
-
-    if (self.enemy == world)
-        return 0;
-
-    // Ready?
-    if (self.firecheck_flags & TFL_FIRECHECK_REFIRE)
-        if (self.attack_finished_single > time) return 0;
-
-    // Special case: volly fire turret that has to fire a full volly if a shot was fired.
-    if (self.shoot_flags & TFL_SHOOT_VOLLYALWAYS)
-        if (self.volly_counter != self.shot_volly)
-                       if(self.ammo >= self.shot_dmg)
-                               return 1;
-
-    // Lack of zombies makes shooting dead things unnecessary :P
-    if (self.firecheck_flags & TFL_FIRECHECK_DEAD)
-        if (self.enemy.deadflag != DEAD_NO)
-            return 0;
-
-    // Own ammo?
-    if (self.firecheck_flags & TFL_FIRECHECK_OWM_AMMO)
-        if (self.ammo < self.shot_dmg)
-            return 0;
-
-    // Other's ammo? (support-supply units)
-    if (self.firecheck_flags & TFL_FIRECHECK_OTHER_AMMO)
-        if (self.enemy.ammo >= self.enemy.ammo_max)
-            return 0;
-
-       // Target of opertunity?
-       if(turret_validate_target(self, self.tur_impactent, self.target_validate_flags) > 0)
-       {
-               self.enemy = self.tur_impactent;
-               return 1;
-       }
-
-    if (self.firecheck_flags & TFL_FIRECHECK_DISTANCES)
-    {
-        // To close?
-        if (self.tur_dist_aimpos < self.target_range_min)
-                       if(turret_validate_target(self, self.tur_impactent, self.target_validate_flags) > 0)
-                               return 1; // Target of opertunity?
-                       else
-                               return 0;
-    }
-
-    // Try to avoid FF?
-    if (self.firecheck_flags & TFL_FIRECHECK_AFF)
-        if (self.tur_impactent.team == self.team)
-            return 0;
-
-    // aim<->predicted impact
-    if (self.firecheck_flags & TFL_FIRECHECK_AIMDIST)
-        if (self.tur_dist_impact_to_aimpos > self.aim_firetolerance_dist)
-            return 0;
-
-    // Volly status
-    if (self.shot_volly > 1)
-        if (self.volly_counter == self.shot_volly)
-            if (self.ammo < (self.shot_dmg * self.shot_volly))
-                return 0;
-
-    /*if(self.firecheck_flags & TFL_FIRECHECK_VERIFIED)
-        if(self.tur_impactent != self.enemy)
-            return 0;*/
-
-    return 1;
-}
-
-/*
- + TFL_TARGETSELECT_NO
- + TFL_TARGETSELECT_LOS
- + TFL_TARGETSELECT_PLAYERS
- + TFL_TARGETSELECT_MISSILES
- - TFL_TARGETSELECT_TRIGGERTARGET
- + TFL_TARGETSELECT_ANGLELIMITS
- + TFL_TARGETSELECT_RANGELIMTS
- + TFL_TARGETSELECT_TEAMCHECK
- - TFL_TARGETSELECT_NOBUILTIN
- + TFL_TARGETSELECT_OWNTEAM
-*/
-
-/**
-** Evaluate a entity for target valitity based on validate_flags
-** NOTE: the caller must check takedamage before calling this, to inline this check.
-**/
-float turret_validate_target(entity e_turret, entity e_target, float validate_flags)
-{
-    vector v_tmp;
-
-    //if(!validate_flags & TFL_TARGETSELECT_NOBUILTIN)
-    //    return -0.5;
-
-    if(e_target.owner == e_turret)
-        return -0.5;
-
-    if (!checkpvs(e_target.origin, e_turret))
-        return -1;
-
-    if (!e_target)
-        return -2;
-
-       if(g_onslaught)
-               if (substring(e_target.classname, 0, 10) == "onslaught_") // don't attack onslaught targets, that's the player's job!
-                       return - 3;
-
-    if (validate_flags & TFL_TARGETSELECT_NO)
-        return -4;
-
-    // If only this was used more..
-    if (e_target.flags & FL_NOTARGET)
-        return -5;
-
-    // Cant touch this
-    if(e_target.vehicle_flags & VHF_ISVEHICLE)
-    {
-        if (e_target.vehicle_health <= 0)
-            return -6;
-    }
-    else if (e_target.health <= 0)
-        return -6;
-
-    // player
-    if (IS_CLIENT(e_target))
-    {
-        if (!(validate_flags & TFL_TARGETSELECT_PLAYERS))
-            return -7;
-
-        if (e_target.deadflag != DEAD_NO)
-            return -8;
-    }
-
-       // enemy turrets
-       if (validate_flags & TFL_TARGETSELECT_NOTURRETS)
-        if (e_target.turret_firefunc || e_target.owner.tur_head == e_target)
-            if(e_target.team != e_turret.team) // Dont break support units.
-                return -9;
-
-    // Missile
-    if (e_target.flags & FL_PROJECTILE)
-        if (!(validate_flags & TFL_TARGETSELECT_MISSILES))
-            return -10;
-
-    if (validate_flags & TFL_TARGETSELECT_MISSILESONLY)
-        if (!(e_target.flags & FL_PROJECTILE))
-            return -10.5;
-
-    // Team check
-    if (validate_flags & TFL_TARGETSELECT_TEAMCHECK)
-    {
-        if (validate_flags & TFL_TARGETSELECT_OWNTEAM)
-        {
-            if (e_target.team != e_turret.team)
-                return -11;
-
-            if (e_turret.team != e_target.owner.team)
-                return -12;
-        }
-        else
-        {
-            if (e_target.team == e_turret.team)
-                return -13;
-
-            if (e_turret.team == e_target.owner.team)
-                return -14;
-        }
-    }
-
-    // Range limits?
-    tvt_dist = vlen(e_turret.origin - real_origin(e_target));
-    if (validate_flags & TFL_TARGETSELECT_RANGELIMTS)
-    {
-        if (tvt_dist < e_turret.target_range_min)
-            return -15;
-
-        if (tvt_dist > e_turret.target_range)
-            return -16;
-    }
-
-    // Can we even aim this thing?
-    tvt_thadv = angleofs3(e_turret.tur_head.origin, e_turret.angles + e_turret.tur_head.angles, e_target);
-    tvt_tadv  = shortangle_vxy(angleofs(e_turret, e_target), e_turret.angles);
-    tvt_thadf = vlen(tvt_thadv);
-    tvt_tadf  = vlen(tvt_tadv);
-
-    /*
-    if(validate_flags & TFL_TARGETSELECT_FOV)
-    {
-        if(e_turret.target_select_fov < tvt_thadf)
-            return -21;
-    }
-    */
-
-    if (validate_flags & TFL_TARGETSELECT_ANGLELIMITS)
-    {
-        if (fabs(tvt_tadv_x) > e_turret.aim_maxpitch)
-            return -17;
-
-        if (fabs(tvt_tadv_y) > e_turret.aim_maxrot)
-            return -18;
-    }
-
-    // Line of sight?
-    if (validate_flags & TFL_TARGETSELECT_LOS)
-    {
-        v_tmp = real_origin(e_target) + ((e_target.mins + e_target.maxs) * 0.5);
-
-        traceline(e_turret.origin + '0 0 16', v_tmp, 0, e_turret);
-
-        if (e_turret.aim_firetolerance_dist < vlen(v_tmp - trace_endpos))
-            return -19;
-    }
-
-    if (e_target.classname == "grapplinghook")
-        return -20;
-
-    /*
-    if (e_target.classname == "func_button")
-        return -21;
-    */
-
-#ifdef TURRET_DEBUG_TARGETSELECT
-    dprint("Target:",e_target.netname," is a valid target for ",e_turret.netname,"\n");
-#endif
-
-    return 1;
-}
-
-entity turret_select_target()
-{
-    entity e;        // target looper entity
-    float  score;    // target looper entity score
-    entity e_enemy;  // currently best scoreing target
-    float  m_score;  // currently best scoreing target's score
-
-    m_score = 0;
-    if(self.enemy && self.enemy.takedamage && turret_validate_target(self,self.enemy,self.target_validate_flags) > 0)
-    {
-        e_enemy = self.enemy;
-        m_score = self.turret_score_target(self,e_enemy) * self.target_select_samebias;
-    }
-    else
-        e_enemy = self.enemy = world;
-
-    e = findradius(self.origin, self.target_range);
-
-    // Nothing to aim at?
-    if (!e)
-               return world;
-
-    while (e)
-    {
-               if(e.takedamage)
-               {
-                   float f = turret_validate_target(self, e, self.target_select_flags);
-                   //dprint("F is: ", ftos(f), "\n");
-                       if ( f > 0)
-                       {
-                               score = self.turret_score_target(self,e);
-                               if ((score > m_score) && (score > 0))
-                               {
-                                       e_enemy = e;
-                                       m_score = score;
-                               }
-                       }
-               }
-        e = e.chain;
-    }
-
-    return e_enemy;
-}
-
-void turret_think()
-{
-    entity e;
-
-    self.nextthink = time + self.ticrate;
-
-    // ONS uses somewhat backwards linking.
-    if (teamplay)
-    {
-        if (g_onslaught)
-            if (self.target)
-            {
-                e = find(world, targetname,self.target);
-                if (e != world)
-                    self.team = e.team;
-            }
-
-        if (self.team != self.tur_head.team)
-            turret_stdproc_respawn();
-    }
-
-#ifdef TURRET_DEBUG
-    if (self.tur_dbg_tmr1 < time)
-    {
-        if (self.enemy) paint_target (self.enemy,128,self.tur_dbg_rvec,0.9);
-        paint_target(self,256,self.tur_dbg_rvec,0.9);
-        self.tur_dbg_tmr1 = time + 1;
-    }
-#endif
-
-    // Handle ammo
-    if (!(self.spawnflags & TSF_NO_AMMO_REGEN))
-    if (self.ammo < self.ammo_max)
-        self.ammo = min(self.ammo + self.ammo_recharge, self.ammo_max);
-
-    // Inactive turrets needs to run the think loop,
-    // So they can handle animation and wake up if need be.
-    if (!self.active)
-    {
-        turret_stdproc_track();
-        return;
-    }
-
-    // This is typicaly used for zaping every target in range
-    // turret_fusionreactor uses this to recharge friendlys.
-    if (self.shoot_flags & TFL_SHOOT_HITALLVALID)
-    {
-        // Do a self.turret_fire for every valid target.
-        e = findradius(self.origin,self.target_range);
-        while (e)
-        {
-                       if(e.takedamage)
-                       {
-                               if (turret_validate_target(self,e,self.target_validate_flags))
-                               {
-                                       self.enemy = e;
-
-                                       turret_do_updates(self);
-
-                                       if (self.turret_firecheckfunc())
-                                               turret_fire();
-                               }
-                       }
-
-            e = e.chain;
-        }
-        self.enemy = world;
-    }
-    else if(self.shoot_flags & TFL_SHOOT_CUSTOM)
-    {
-        // This one is doing something.. oddball. assume its handles what needs to be handled.
-
-        // Predict?
-        if (!(self.aim_flags & TFL_AIM_NO))
-            self.tur_aimpos = turret_stdproc_aim_generic();
-
-        // Turn & pitch?
-        if (!(self.track_flags & TFL_TRACK_NO))
-            turret_stdproc_track();
-
-        turret_do_updates(self);
-
-        // Fire?
-        if (self.turret_firecheckfunc())
-            turret_fire();
-    }
-    else
-    {
-        // Special case for volly always. if it fired once it must compleate the volly.
-        if(self.shoot_flags & TFL_SHOOT_VOLLYALWAYS)
-            if(self.volly_counter != self.shot_volly)
-            {
-                // Predict or whatnot
-                if (!(self.aim_flags & TFL_AIM_NO))
-                    self.tur_aimpos = turret_stdproc_aim_generic();
-
-                // Turn & pitch
-                if (!(self.track_flags & TFL_TRACK_NO))
-                    turret_stdproc_track();
-
-                turret_do_updates(self);
-
-                // Fire!
-                if (self.turret_firecheckfunc() != 0)
-                    turret_fire();
-
-                if(self.turret_postthink)
-                    self.turret_postthink();
-
-                return;
-            }
-
-        // Check if we have a vailid enemy, and try to find one if we dont.
-
-        // g_turrets_targetscan_maxdelay forces a target re-scan at least this often
-        float do_target_scan = 0;
-        if((self.target_select_time + autocvar_g_turrets_targetscan_maxdelay) < time)
-            do_target_scan = 1;
-
-        // Old target (if any) invalid?
-        if(self.target_validate_time < time)
-        if (turret_validate_target(self, self.enemy, self.target_validate_flags) <= 0)
-        {
-               self.enemy = world;
-               self.target_validate_time = time + 0.5;
-               do_target_scan = 1;
-        }
-
-        // But never more often then g_turrets_targetscan_mindelay!
-        if (self.target_select_time + autocvar_g_turrets_targetscan_mindelay > time)
-            do_target_scan = 0;
-
-        if(do_target_scan)
-        {
-            self.enemy = turret_select_target();
-            self.target_select_time = time;
-        }
-
-        // No target, just go to idle, do any custom stuff and bail.
-        if (self.enemy == world)
-        {
-            // Turn & pitch
-            if (!(self.track_flags & TFL_TRACK_NO))
-                turret_stdproc_track();
-
-            // do any per-turret stuff
-            if(self.turret_postthink)
-                self.turret_postthink();
-
-            // And bail.
-            return;
-        }
-        else
-            self.lip = time + autocvar_g_turrets_aimidle_delay; // Keep track of the last time we had a target.
-
-        // Predict?
-        if (!(self.aim_flags & TFL_AIM_NO))
-            self.tur_aimpos = turret_stdproc_aim_generic();
-
-        // Turn & pitch?
-        if (!(self.track_flags & TFL_TRACK_NO))
-            turret_stdproc_track();
-
-        turret_do_updates(self);
-
-        // Fire?
-        if (self.turret_firecheckfunc())
-            turret_fire();
-    }
-
-    // do any custom per-turret stuff
-    if(self.turret_postthink)
-        self.turret_postthink();
-}
-
-void turret_fire()
-{
-    if (autocvar_g_turrets_nofire != 0)
-        return;
-
-    self.turret_firefunc();
-
-    self.attack_finished_single = time + self.shot_refire;
-    self.ammo -= self.shot_dmg;
-    self.volly_counter = self.volly_counter - 1;
-
-    if (self.volly_counter <= 0)
-    {
-        self.volly_counter = self.shot_volly;
-
-        if (self.shoot_flags & TFL_SHOOT_CLEARTARGET)
-            self.enemy = world;
-
-        if (self.shot_volly > 1)
-            self.attack_finished_single = time + self.shot_volly_refire;
-    }
-
-#ifdef TURRET_DEBUG
-    if (self.enemy) paint_target3(self.tur_aimpos, 64, self.tur_dbg_rvec, self.tur_impacttime + 0.25);
-#endif
-}
-
-void turret_stdproc_fire()
-{
-    dprint("^1Bang, ^3your dead^7 ",self.enemy.netname,"! ^1(turret with no real firefunc)\n");
-}
-
-/*
-    When .used a turret switch team to activator.team.
-    If activator is world, the turret go inactive.
-*/
-void turret_stdproc_use()
-{
-    dprint("Turret ",self.netname, " used by ", activator.classname, "\n");
-
-    self.team = activator.team;
-
-    if(self.team == 0)
-        self.active = ACTIVE_NOT;
-    else
-        self.active = ACTIVE_ACTIVE;
-
-}
-
-void turret_link()
-{
-    Net_LinkEntity(self, TRUE, 0, turret_send);
-    self.think      = turret_think;
-    self.nextthink  = time;
-    self.tur_head.effects = EF_NODRAW;
-}
-
-void turrets_manager_think()
-{
-    self.nextthink = time + 1;
-
-    entity e;
-    if (autocvar_g_turrets_reloadcvars == 1)
-    {
-        e = nextent(world);
-        while (e)
-        {
-            if (e.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
-            {
-                load_unit_settings(e,e.cvar_basename,1);
-                if(e.turret_postthink)
-                    e.turret_postthink();
-            }
-
-            e = nextent(e);
-        }
-        cvar_set("g_turrets_reloadcvars","0");
-    }
-}
-
-/*
-* Standard turret initialization. use this!
-* (unless you have a very good reason not to)
-* if the return value is 0, the turret should be removed.
-*/
-float turret_stdproc_init (string cvar_base_name, string base, string head, float _turret_type)
-{
-       entity e, ee = world;
-
-    // Are turrets allowed?
-    if (autocvar_g_turrets == 0)
-        return 0;
-
-    if(_turret_type < 1 || _turret_type > TID_LAST)
-    {
-        dprint("Invalid / Unkown turret type\"", ftos(_turret_type), "\", aborting!\n");
-        return 0;
-    }
-    self.turret_type = _turret_type;
-
-    e = find(world, classname, "turret_manager");
-    if (!e)
-    {
-        e = spawn();
-        e.classname = "turret_manager";
-        e.think = turrets_manager_think;
-        e.nextthink = time + 2;
-    }
-
-    if (!(self.spawnflags & TSF_SUSPENDED))
-        builtin_droptofloor(); // why can't we use regular droptofloor here?
-
-    // Terrainbase spawnflag. This puts a enlongated model
-    // under the turret, so it looks ok on uneaven surfaces.
-    /*  TODO: Handle this with CSQC
-    if (self.spawnflags & TSF_TERRAINBASE)
-    {
-        entity tb;
-        tb = spawn();
-        setmodel(tb,"models/turrets/terrainbase.md3");
-        setorigin(tb,self.origin);
-        tb.solid = SOLID_BBOX;
-    }
-    */
-
-    self.cvar_basename = cvar_base_name;
-    load_unit_settings(self, self.cvar_basename, 0);
-
-    self.effects = EF_NODRAW;
-
-    // Handle turret teams.
-    if (!teamplay)
-               self.team = MAX_SHOT_DISTANCE; // Group all turrets into the same team, so they dont kill eachother.
-       else if(g_onslaught && self.targetname)
-       {
-               e = find(world,target,self.targetname);
-               if(e != world)
-               {
-                       self.team = e.team;
-                       ee = e;
-               }
-       }
-       else if(!self.team)
-               self.team = MAX_SHOT_DISTANCE; // Group all turrets into the same team, so they dont kill eachother.
-
-    /*
-    * Try to guess some reasonaly defaults
-    * for missing params and do sanety checks
-    * thise checks could produce some "interesting" results
-    * if it hits a glitch in my logic :P so try to set as mutch
-    * as possible beforehand.
-    */
-    if (!self.ticrate)
-    {
-        if (self.turrcaps_flags & TFL_TURRCAPS_SUPPORT)
-            self.ticrate = 0.2;     // Support units generaly dont need to have a high speed ai-loop
-        else
-            self.ticrate = 0.1;     // 10 fps for normal turrets
-    }
-
-    self.ticrate = bound(sys_frametime, self.ticrate, 60);  // keep it sane
-
-// General stuff
-    if (self.netname == "")
-        self.netname = self.classname;
-
-    if (!self.respawntime)
-        self.respawntime = 60;
-    self.respawntime = max(-1, self.respawntime);
-
-    if (!self.health)
-        self.health = 1000;
-    self.tur_health = max(1, self.health);
-    self.bot_attack = TRUE;
-    self.monster_attack = TRUE;
-
-    if (!self.turrcaps_flags)
-        self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_MEDPROJ | TFL_TURRCAPS_PLAYERKILL;
-
-    if (!self.damage_flags)
-        self.damage_flags = TFL_DMG_YES | TFL_DMG_RETALIATE | TFL_DMG_AIMSHAKE;
-
-// Shot stuff.
-    if (!self.shot_refire)
-        self.shot_refire = 1;
-    self.shot_refire = bound(0.01, self.shot_refire, 9999);
-
-    if (!self.shot_dmg)
-        self.shot_dmg  = self.shot_refire * 50;
-    self.shot_dmg = max(1, self.shot_dmg);
-
-    if (!self.shot_radius)
-        self.shot_radius = self.shot_dmg * 0.5;
-    self.shot_radius = max(1, self.shot_radius);
-
-    if (!self.shot_speed)
-        self.shot_speed = 2500;
-    self.shot_speed = max(1, self.shot_speed);
-
-    if (!self.shot_spread)
-        self.shot_spread = 0.0125;
-    self.shot_spread = bound(0.0001, self.shot_spread, 500);
-
-    if (!self.shot_force)
-        self.shot_force = self.shot_dmg * 0.5 + self.shot_radius * 0.5;
-    self.shot_force = bound(0.001, self.shot_force, 5000);
-
-    if (!self.shot_volly)
-        self.shot_volly = 1;
-    self.shot_volly = bound(1, self.shot_volly, floor(self.ammo_max / self.shot_dmg));
-
-    if (!self.shot_volly_refire)
-        self.shot_volly_refire = self.shot_refire * self.shot_volly;
-    self.shot_volly_refire = bound(self.shot_refire, self.shot_volly_refire, 60);
-
-    if (!self.firecheck_flags)
-        self.firecheck_flags = TFL_FIRECHECK_DEAD | TFL_FIRECHECK_DISTANCES |
-                               TFL_FIRECHECK_LOS | TFL_FIRECHECK_AIMDIST | TFL_FIRECHECK_TEAMCECK |
-                               TFL_FIRECHECK_OWM_AMMO | TFL_FIRECHECK_REFIRE;
-
-// Range stuff.
-    if (!self.target_range)
-        self.target_range = self.shot_speed * 0.5;
-    self.target_range = bound(0, self.target_range, MAX_SHOT_DISTANCE);
-
-    if (!self.target_range_min)
-        self.target_range_min = self.shot_radius * 2;
-    self.target_range_min = bound(0, self.target_range_min, MAX_SHOT_DISTANCE);
-
-    if (!self.target_range_optimal)
-        self.target_range_optimal = self.target_range * 0.5;
-    self.target_range_optimal = bound(0, self.target_range_optimal, MAX_SHOT_DISTANCE);
-
-
-// Aim stuff.
-    if (!self.aim_maxrot)
-        self.aim_maxrot = 90;
-    self.aim_maxrot = bound(0, self.aim_maxrot, 360);
-
-    if (!self.aim_maxpitch)
-        self.aim_maxpitch = 20;
-    self.aim_maxpitch = bound(0, self.aim_maxpitch, 90);
-
-    if (!self.aim_speed)
-        self.aim_speed = 36;
-    self.aim_speed  = bound(0.1, self.aim_speed, 1000);
-
-    if (!self.aim_firetolerance_dist)
-        self.aim_firetolerance_dist  = 5 + (self.shot_radius * 2);
-    self.aim_firetolerance_dist = bound(0.1, self.aim_firetolerance_dist, MAX_SHOT_DISTANCE);
-
-    if (!self.aim_flags)
-    {
-        self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
-        if(self.turrcaps_flags & TFL_TURRCAPS_RADIUSDMG)
-            self.aim_flags |= TFL_AIM_GROUNDGROUND;
-    }
-
-    if (!self.track_type)
-        self.track_type = TFL_TRACKTYPE_STEPMOTOR;
-
-    if (self.track_type != TFL_TRACKTYPE_STEPMOTOR)
-    {
-        // Fluid / Ineria mode. Looks mutch nicer.
-        // Can reduce aim preformance alot, needs a bit diffrent aimspeed
-
-        if (!self.aim_speed)
-            self.aim_speed = 180;
-        self.aim_speed = bound(0.1, self.aim_speed, 1000);
-
-        if (!self.track_accel_pitch)
-            self.track_accel_pitch = 0.5;
-
-        if (!self.track_accel_rot)
-            self.track_accel_rot   = 0.5;
-
-        if (!self.track_blendrate)
-            self.track_blendrate   = 0.35;
-    }
-
-    if (!self.track_flags)
-        self.track_flags = TFL_TRACK_PITCH | TFL_TRACK_ROT;
-
-
-// Target selection stuff.
-    if (!self.target_select_rangebias)
-        self.target_select_rangebias = 1;
-    self.target_select_rangebias = bound(-10, self.target_select_rangebias, 10);
-
-    if (!self.target_select_samebias)
-        self.target_select_samebias = 1;
-    self.target_select_samebias = bound(-10, self.target_select_samebias, 10);
-
-    if (!self.target_select_anglebias)
-        self.target_select_anglebias = 1;
-    self.target_select_anglebias = bound(-10, self.target_select_anglebias, 10);
-
-    if (!self.target_select_missilebias)
-        self.target_select_missilebias = -10;
-
-    self.target_select_missilebias = bound(-10, self.target_select_missilebias, 10);
-    self.target_select_playerbias = bound(-10, self.target_select_playerbias, 10);
-
-    if (!self.target_select_flags)
-    {
-            self.target_select_flags = TFL_TARGETSELECT_LOS | TFL_TARGETSELECT_TEAMCHECK
-                                     | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_ANGLELIMITS;
-
-        if (self.turrcaps_flags & TFL_TURRCAPS_MISSILEKILL)
-            self.target_select_flags |= TFL_TARGETSELECT_MISSILES;
-
-        if (self.turrcaps_flags & TFL_TURRCAPS_PLAYERKILL)
-            self.target_select_flags |= TFL_TARGETSELECT_PLAYERS;
-        //else
-        //    self.target_select_flags = TFL_TARGETSELECT_NO;
-    }
-
-    self.target_validate_flags = self.target_select_flags;
-
-// Ammo stuff
-    if (!self.ammo_max)
-        self.ammo_max = self.shot_dmg * 10;
-    self.ammo_max = max(self.shot_dmg, self.ammo_max);
-
-    if (!self.ammo)
-        self.ammo = self.shot_dmg * 5;
-    self.ammo = bound(0,self.ammo, self.ammo_max);
-
-    if (!self.ammo_recharge)
-        self.ammo_recharge = self.shot_dmg * 0.5;
-    self.ammo_recharge = max(0 ,self.ammo_recharge);
-
-    // Convert the recharge from X per sec to X per ticrate
-    self.ammo_recharge = self.ammo_recharge * self.ticrate;
-
-    if (!self.ammo_flags)
-        self.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE;
-
-// Damage stuff
-    if(self.spawnflags & TSL_NO_RESPAWN)
-        if (!(self.damage_flags & TFL_DMG_DEATH_NORESPAWN))
-            self.damage_flags |= TFL_DMG_DEATH_NORESPAWN;
-
-// Offsets & origins
-    if (!self.tur_shotorg)   self.tur_shotorg = '50 0 50';
-
-    if (!self.health)
-        self.health = 150;
-
-// Game hooks
-       if(MUTATOR_CALLHOOK(TurretSpawn))
-               return 0;
-
-// End of default & sanety checks, start building the turret.
-
-// Spawn extra bits
-    self.tur_head         = spawn();
-    self.tur_head.netname = self.tur_head.classname = "turret_head";
-    self.tur_head.team    = self.team;
-    self.tur_head.owner   = self;
-
-    setmodel(self, base);
-    setmodel(self.tur_head, head);
-
-    setsize(self, '-32 -32 0', '32 32 64');
-    setsize(self.tur_head, '0 0 0', '0 0 0');
-
-    setorigin(self.tur_head, '0 0 0');
-    setattachment(self.tur_head, self, "tag_head");
-
-    self.tur_health          = self.health;
-    self.solid               = SOLID_BBOX;
-    self.tur_head.solid      = SOLID_NOT;
-    self.takedamage          = DAMAGE_AIM;
-    self.tur_head.takedamage = DAMAGE_NO;
-    self.movetype            = MOVETYPE_NOCLIP;
-    self.tur_head.movetype   = MOVETYPE_NOCLIP;
-
-    // Defend mode?
-    if (!self.tur_defend)
-    if (self.target != "")
-    {
-        self.tur_defend = find(world, targetname, self.target);
-        if (self.tur_defend == world)
-        {
-            self.target = "";
-            dprint("Turret has invalid defendpoint!\n");
-        }
-    }
-
-    // In target defend mode, aim on the spot to defend when idle.
-    if (self.tur_defend)
-        self.idle_aim  = self.tur_head.angles + angleofs(self.tur_head, self.tur_defend);
-    else
-        self.idle_aim  = '0 0 0';
-
-    // Attach stdprocs. override when and what needed
-    self.turret_firecheckfunc   = turret_stdproc_firecheck;
-    self.turret_firefunc        = turret_stdproc_fire;
-    self.event_damage           = turret_stdproc_damage;
-
-    if (self.turrcaps_flags & TFL_TURRCAPS_SUPPORT)
-        self.turret_score_target    = turret_stdproc_targetscore_support;
-    else
-        self.turret_score_target    = turret_stdproc_targetscore_generic;
-
-    self.use = turret_stdproc_use;
-
-    ++turret_count;
-    self.nextthink = time + 1;
-    self.nextthink +=  turret_count * sys_frametime;
-
-    self.tur_head.team = self.team;
-    self.view_ofs = '0 0 0';
-
-#ifdef TURRET_DEBUG
-    self.tur_dbg_start = self.nextthink;
-    while (vlen(self.tur_dbg_rvec) < 2)
-        self.tur_dbg_rvec  = randomvec() * 4;
-
-    self.tur_dbg_rvec_x = fabs(self.tur_dbg_rvec_x);
-    self.tur_dbg_rvec_y = fabs(self.tur_dbg_rvec_y);
-    self.tur_dbg_rvec_z = fabs(self.tur_dbg_rvec_z);
-#endif
-
-    // Its all good.
-    self.turrcaps_flags |= TFL_TURRCAPS_ISTURRET;
-
-    self.classname = "turret_main";
-
-    self.active = ACTIVE_ACTIVE;
-
-    // In ONS mode, and linked to a ONS ent. need to call the use to set team.
-    if (g_onslaught && ee)
-    {
-        activator = ee;
-        self.use();
-    }
-
-       turret_link();
-       turret_stdproc_respawn();
-    turret_tag_fire_update();
-
-    return 1;
-}
-
-
diff --git a/qcsrc/server/tturrets/units/unit_ewheel.qc b/qcsrc/server/tturrets/units/unit_ewheel.qc
deleted file mode 100644 (file)
index e8e677a..0000000
+++ /dev/null
@@ -1,310 +0,0 @@
-#define ewheel_amin_stop 0
-#define ewheel_amin_fwd_slow 1
-#define ewheel_amin_fwd_fast 2
-#define ewheel_amin_bck_slow 3
-#define ewheel_amin_bck_fast 4
-
-void ewheel_attack()
-{
-    float i;
-    entity _mis;
-
-    for (i = 0; i < 1; ++i)
-    {
-        turret_do_updates(self);
-
-        _mis = turret_projectile("weapons/lasergun_fire.wav", 1, 0, DEATH_TURRET_EWHEEL, PROJECTILE_BLASTER, TRUE, TRUE); // WEAPONTODO: this is not a projectile made by the blaster, add separate effect for it
-        _mis.missile_flags = MIF_SPLASH;
-
-        pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
-
-        self.tur_head.frame += 2;
-
-        if (self.tur_head.frame > 3)
-            self.tur_head.frame = 0;
-    }
-
-}
-//#define EWHEEL_FANCYPATH
-void ewheel_move_path()
-{
-#ifdef EWHEEL_FANCYPATH
-    // Are we close enougth to a path node to switch to the next?
-    if (vlen(self.origin  - self.pathcurrent.origin) < 64)
-        if (self.pathcurrent.path_next == world)
-        {
-            // Path endpoint reached
-            pathlib_deletepath(self.pathcurrent.owner);
-            self.pathcurrent = world;
-
-            if (self.pathgoal)
-            {
-                if (self.pathgoal.use)
-                    self.pathgoal.use();
-
-                if (self.pathgoal.enemy)
-                {
-                    self.pathcurrent = pathlib_astar(self.pathgoal.origin,self.pathgoal.enemy.origin);
-                    self.pathgoal = self.pathgoal.enemy;
-                }
-            }
-            else
-                self.pathgoal = world;
-        }
-        else
-            self.pathcurrent = self.pathcurrent.path_next;
-
-#else
-    if (vlen(self.origin - self.pathcurrent.origin) < 64)
-        self.pathcurrent = self.pathcurrent.enemy;
-#endif
-
-    if (self.pathcurrent)
-    {
-
-        self.moveto = self.pathcurrent.origin;
-        self.steerto = steerlib_attract2(self.moveto, 0.5, 500, 0.95);
-
-        movelib_move_simple(v_forward, autocvar_g_turrets_unit_ewheel_speed_fast, 0.4);
-    }
-}
-
-void  ewheel_move_enemy()
-{
-
-    float newframe;
-
-    self.steerto = steerlib_arrive(self.enemy.origin,self.target_range_optimal);
-
-    //self.steerto = steerlib_standoff(self.enemy.origin,self.target_range_optimal);
-    //self.steerto = steerlib_beamsteer(self.steerto,1024,64,68,256);
-    self.moveto  = self.origin + self.steerto * 128;
-
-    if (self.tur_dist_enemy > self.target_range_optimal)
-    {
-        if ( self.tur_head.spawnshieldtime < 1 )
-        {
-            newframe = ewheel_amin_fwd_fast;
-            movelib_move_simple(v_forward, autocvar_g_turrets_unit_ewheel_speed_fast, 0.4);
-        }
-        else if (self.tur_head.spawnshieldtime < 2)
-        {
-
-            newframe = ewheel_amin_fwd_slow;
-            movelib_move_simple(v_forward, autocvar_g_turrets_unit_ewheel_speed_slow, 0.4);
-       }
-        else
-        {
-            newframe = ewheel_amin_fwd_slow;
-            movelib_move_simple(v_forward, autocvar_g_turrets_unit_ewheel_speed_slower, 0.4);
-        }
-    }
-    else if (self.tur_dist_enemy < self.target_range_optimal * 0.5)
-    {
-        newframe = ewheel_amin_bck_slow;
-        movelib_move_simple(v_forward * -1, autocvar_g_turrets_unit_ewheel_speed_slow, 0.4);
-    }
-    else
-    {
-        newframe = ewheel_amin_stop;
-        movelib_beak_simple(autocvar_g_turrets_unit_ewheel_speed_stop);
-    }
-
-    turrets_setframe(newframe , FALSE);
-
-    /*if(self.frame != newframe)
-    {
-        self.frame = newframe;
-        self.SendFlags |= TNSF_ANIM;
-        self.anim_start_time = time;
-    }*/
-}
-
-
-void ewheel_move_idle()
-{
-    if(self.frame != 0)
-    {
-        self.SendFlags |= TNSF_ANIM;
-        self.anim_start_time = time;
-    }
-
-    self.frame = 0;
-    if (vlen(self.velocity))
-        movelib_beak_simple(autocvar_g_turrets_unit_ewheel_speed_stop);
-}
-
-void ewheel_postthink()
-{
-    float vz;
-    vector wish_angle, real_angle;
-
-    vz = self.velocity_z;
-
-    self.angles_x = anglemods(self.angles_x);
-    self.angles_y = anglemods(self.angles_y);
-
-    fixedmakevectors(self.angles);
-
-    wish_angle = normalize(self.steerto);
-    wish_angle = vectoangles(wish_angle);
-    real_angle = wish_angle - self.angles;
-    real_angle = shortangle_vxy(real_angle, self.tur_head.angles);
-
-    self.tur_head.spawnshieldtime = fabs(real_angle_y);
-    real_angle_y  = bound(-self.tur_head.aim_speed, real_angle_y, self.tur_head.aim_speed);
-    self.angles_y = (self.angles_y + real_angle_y);
-
-    if(self.enemy)
-        ewheel_move_enemy();
-    else if(self.pathcurrent)
-        ewheel_move_path();
-    else
-        ewheel_move_idle();
-
-
-    self.velocity_z = vz;
-
-    if(vlen(self.velocity))
-        self.SendFlags |= TNSF_MOVE;
-}
-
-void ewheel_respawnhook()
-{
-    entity e;
-
-    // Respawn is called & first spawn to, to set team. need to make sure we do not move the initial spawn.
-    if(self.movetype != MOVETYPE_WALK)
-               return;
-
-    self.velocity = '0 0 0';
-    self.enemy = world;
-
-    setorigin(self, self.pos1);
-
-    if (self.target != "")
-    {
-        e = find(world,targetname,self.target);
-        if (!e)
-        {
-            dprint("Initital waypoint for ewheel does NOT exsist, fix your map!\n");
-            self.target = "";
-        }
-
-        if (e.classname != "turret_checkpoint")
-            dprint("Warning: not a turrret path\n");
-        else
-        {
-
-#ifdef EWHEEL_FANCYPATH
-            self.pathcurrent = WALKER_PATH(self.origin,e.origin);
-            self.pathgoal = e;
-#else
-            self.pathcurrent  = e;
-#endif
-        }
-    }
-}
-
-void ewheel_diehook()
-{
-    self.velocity = '0 0 0';
-
-#ifdef EWHEEL_FANCYPATH
-    if (self.pathcurrent)
-        pathlib_deletepath(self.pathcurrent.owner);
-#endif
-    self.pathcurrent = world;
-}
-
-void turret_ewheel_dinit()
-{
-    entity e;
-
-    if (self.netname == "")
-        self.netname     = "eWheel Turret";
-
-    if (self.target != "")
-    {
-        e = find(world,targetname,self.target);
-        if (!e)
-        {
-            bprint("Warning! initital waypoint for ewheel does NOT exsist!\n");
-            self.target = "";
-        }
-
-        if (e.classname != "turret_checkpoint")
-            dprint("Warning: not a turrret path\n");
-        else
-            self.goalcurrent = e;
-    }
-
-    self.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;
-    self.turrcaps_flags = TFL_TURRCAPS_PLAYERKILL | TFL_TURRCAPS_MOVE | TFL_TURRCAPS_ROAM ;
-    self.turret_respawnhook = ewheel_respawnhook;
-
-    self.turret_diehook = ewheel_diehook;
-
-    if (turret_stdproc_init("ewheel_std", "models/turrets/ewheel-base2.md3", "models/turrets/ewheel-gun1.md3", TID_EWHEEL) == 0)
-    {
-        remove(self);
-        return;
-    }
-
-    self.frame = 1;
-    self.target_select_flags   = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-    self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-    self.iscreature = TRUE;
-    self.teleportable = TELEPORT_NORMAL;
-    self.damagedbycontents = TRUE;
-    self.movetype   = MOVETYPE_WALK;
-    self.solid      = SOLID_SLIDEBOX;
-    self.takedamage = DAMAGE_AIM;
-    self.idle_aim   = '0 0 0';
-    self.pos1       = self.origin;
-
-    setsize(self, '-32 -32 0', '32 32 48');
-
-    // Our fire routine
-    self.turret_firefunc  = ewheel_attack;
-    self.turret_postthink = ewheel_postthink;
-    self.tur_head.frame = 1;
-
-    // Convert from dgr / sec to dgr / tic
-    self.tur_head.aim_speed = autocvar_g_turrets_unit_ewheel_turnrate;
-    self.tur_head.aim_speed = self.tur_head.aim_speed / (1 / self.ticrate);
-
-    //setorigin(self,self.origin + '0 0 128');
-    if (self.target != "")
-    {
-        e = find(world,targetname,self.target);
-        if (!e)
-        {
-            dprint("Initital waypoint for ewheel does NOT exsist, fix your map!\n");
-            self.target = "";
-        }
-
-        if (e.classname != "turret_checkpoint")
-            dprint("Warning: not a turrret path\n");
-        else
-        {
-#ifdef EWHEEL_FANCYPATH
-            self.pathcurrent = WALKER_PATH(self.origin, e.origin);
-            self.pathgoal = e;
-#else
-            self.pathcurrent = e;
-#endif
-        }
-    }
-}
-
-void spawnfunc_turret_ewheel()
-{
-    g_turrets_common_precash();
-
-    precache_model ("models/turrets/ewheel-base2.md3");
-    precache_model ("models/turrets/ewheel-gun1.md3");
-
-    self.think = turret_ewheel_dinit;
-    self.nextthink = time + 0.5;
-}
diff --git a/qcsrc/server/tturrets/units/unit_flac.qc b/qcsrc/server/tturrets/units/unit_flac.qc
deleted file mode 100644 (file)
index 3c9e558..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-void spawnfunc_turret_flac();
-void turret_flac_dinit();
-void turret_flac_attack();
-
-void turret_flac_projectile_think_explode()
-{
-    if(self.enemy != world)
-    if(vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 3)
-        setorigin(self,self.enemy.origin + randomvec() * self.owner.shot_radius);
-
-#ifdef TURRET_DEBUG
-    float d;
-    d = RadiusDamage (self, self.owner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
-    self.owner.tur_dbg_dmg_t_h = self.owner.tur_dbg_dmg_t_h + d;
-    self.owner.tur_dbg_dmg_t_f = self.owner.tur_dbg_dmg_t_f + self.owner.shot_dmg;
-#else
-    RadiusDamage (self, self.realowner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
-#endif
-    remove(self);
-}
-
-void turret_flac_attack()
-{
-    entity proj;
-
-    turret_tag_fire_update();
-
-    proj = turret_projectile("weapons/hagar_fire.wav", 5, 0, DEATH_TURRET_FLAC, PROJECTILE_HAGAR, TRUE, TRUE);
-    pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
-    proj.think      = turret_flac_projectile_think_explode;
-    proj.nextthink  = time + self.tur_impacttime + (random() * 0.01 - random() * 0.01);
-    proj.missile_flags = MIF_SPLASH | MIF_PROXY;
-
-    self.tur_head.frame = self.tur_head.frame + 1;
-    if (self.tur_head.frame >= 4)
-        self.tur_head.frame = 0;
-
-}
-
-void turret_flac_dinit()
-{
-    if (self.netname == "")
-        self.netname  = "FLAC Cannon";
-
-    self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_FASTPROJ | TFL_TURRCAPS_MISSILEKILL;
-    self.ammo_flags     = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
-    self.aim_flags      = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
-
-    if (turret_stdproc_init("flac_std", "models/turrets/base.md3", "models/turrets/flac.md3", TID_FLAC) == 0)
-    {
-        remove(self);
-        return;
-    }
-    setsize(self.tur_head,'-32 -32 0','32 32 64');
-
-    self.damage_flags |= TFL_DMG_HEADSHAKE;
-    self.target_select_flags |= TFL_TARGETSELECT_NOTURRETS | TFL_TARGETSELECT_MISSILESONLY;
-
-    // Our fire routine
-    self.turret_firefunc  = turret_flac_attack;
-
-}
-/*QUAKED turret_flac (0 .5 .8) ?
-*/
-
-void spawnfunc_turret_flac()
-{
-    precache_model ("models/turrets/base.md3");
-    precache_model ("models/turrets/flac.md3");
-
-    self.think = turret_flac_dinit;
-    self.nextthink = time + 0.5;
-}
-
diff --git a/qcsrc/server/tturrets/units/unit_machinegun.qc b/qcsrc/server/tturrets/units/unit_machinegun.qc
deleted file mode 100644 (file)
index d235dfb..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-void spawnfunc_turret_machinegun();
-void turret_machinegun_std_init();
-void turret_machinegun_attack();
-
-//.float bulletcounter;
-void turret_machinegun_attack()
-{
-    fireBullet (self.tur_shotorg, self.tur_shotdir_updated,self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_MACHINEGUN, 0);
-
-    W_MachineGun_MuzzleFlash(); // WEAPONTODO
-    setattachment(self.muzzle_flash, self.tur_head, "tag_fire");
-}
-
-
-void turret_machinegun_std_init()
-{
-    if (self.netname == "")      self.netname     = "Machinegun Turret";
-
-    self.ammo_flags = TFL_AMMO_BULLETS | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;
-    self.turrcaps_flags = TFL_TURRCAPS_PLAYERKILL;
-    self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
-
-    self.turrcaps_flags |= TFL_TURRCAPS_HITSCAN;
-
-    if (turret_stdproc_init("machinegun_std", "models/turrets/base.md3", "models/turrets/machinegun.md3", TID_MACHINEGUN) == 0)
-    {
-        remove(self);
-        return;
-    }
-
-    self.damage_flags |= TFL_DMG_HEADSHAKE;
-       self.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK;
-
-    // Our fire routine
-    self.turret_firefunc  = turret_machinegun_attack;
-
-}
-
-
-/*QUAKED turret_machinegun (0 .5 .8) ?
-* machinegun turret. does what you'd expect
-*/
-void spawnfunc_turret_machinegun()
-{
-    precache_model ("models/turrets/machinegun.md3");
-    precache_model ("models/turrets/base.md3");
-    precache_sound ("weapons/uzi_fire.wav");
-
-    self.think = turret_machinegun_std_init;
-    self.nextthink = time + 0.5;
-}
-
diff --git a/qcsrc/server/tturrets/units/unit_plasma.qc b/qcsrc/server/tturrets/units/unit_plasma.qc
deleted file mode 100644 (file)
index 26a3dc0..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-void spawnfunc_turret_plasma();
-void spawnfunc_turret_plasma_dual();
-
-void turret_plasma_std_init();
-void turret_plasma_dual_init();
-
-void turret_plasma_attack();
-
-
-void turret_plasma_postthink()
-{
-    if (self.tur_head.frame != 0)
-        self.tur_head.frame = self.tur_head.frame + 1;
-
-    if (self.tur_head.frame > 5)
-        self.tur_head.frame = 0;
-}
-
-void turret_plasma_dual_postthink()
-{
-    if ((self.tur_head.frame != 0) && (self.tur_head.frame != 3))
-        self.tur_head.frame = self.tur_head.frame + 1;
-
-    if (self.tur_head.frame > 6)
-        self.tur_head.frame = 0;
-}
-
-void turret_plasma_minsta_attack (void)
-{
-       float flying;
-       flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
-
-       FireRailgunBullet (self.tur_shotorg, self.tur_shotorg + self.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000,
-                                          800, 0, 0, 0, 0, DEATH_TURRET_PLASMA);
-
-
-       pointparticles(particleeffectnum("nex_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
-
-       // teamcolor / hit beam effect
-       vector v;
-       v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
-       if(teamplay)
-       {
-           switch(self.team)
-           {
-            case NUM_TEAM_1:   // Red
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), self.tur_shotorg, v);
-                break;
-            case NUM_TEAM_2:   // Blue
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), self.tur_shotorg, v);
-                break;
-            case NUM_TEAM_3:   // Yellow
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), self.tur_shotorg, v);
-                break;
-            case NUM_TEAM_4:   // Pink
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), self.tur_shotorg, v);
-                break;
-           }
-       }
-       else
-        WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), self.tur_shotorg, v);
-    if (self.tur_head.frame == 0)
-        self.tur_head.frame = 1;
-}
-
-void turret_plasma_attack()
-{
-    entity missile = turret_projectile("weapons/hagar_fire.wav", 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE);
-    missile.missile_flags = MIF_SPLASH;
-
-    pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
-    if (self.tur_head.frame == 0)
-        self.tur_head.frame = 1;
-}
-
-void turret_plasma_dual_attack()
-{
-    entity missile = turret_projectile("weapons/hagar_fire.wav", 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE);
-    missile.missile_flags = MIF_SPLASH;
-    pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
-    self.tur_head.frame += 1;
-}
-
-void turret_plasma_std_init()
-{
-    if (self.netname == "")      self.netname     = "Plasma Cannon";
-
-    // What ammo to use
-    self.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;
-
-    // How to aim
-    self.aim_flags      = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE | TFL_AIM_GROUNDGROUND;
-    self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_MEDPROJ | TFL_TURRCAPS_PLAYERKILL;
-
-    if (turret_stdproc_init("plasma_std", "models/turrets/base.md3", "models/turrets/plasma.md3", TID_PLASMA) == 0)
-    {
-        remove(self);
-        return;
-    }
-
-    self.damage_flags    |= TFL_DMG_HEADSHAKE;
-    self.firecheck_flags |= TFL_FIRECHECK_AFF;
-
-    // Our fireing routine
-    if(g_instagib)
-        self.turret_firefunc  = turret_plasma_minsta_attack;
-    else
-        self.turret_firefunc  = turret_plasma_attack;
-
-    // Custom per turret frame stuff. usualy animation.
-    self.turret_postthink = turret_plasma_postthink;
-    turret_do_updates(self);
-}
-
-
-void turret_plasma_dual_init()
-{
-    if (self.netname == "")      self.netname     = "Dual Plasma Cannon";
-
-    // What ammo to use
-    self.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;
-
-    // How to aim at targets
-    self.aim_flags      = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE  | TFL_AIM_GROUNDGROUND ;
-    self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_MEDPROJ | TFL_TURRCAPS_PLAYERKILL;
-
-    if (turret_stdproc_init("plasma_dual", "models/turrets/base.md3", "models/turrets/plasmad.md3", TID_PLASMA_DUAL) == 0)
-    {
-        remove(self);
-        return;
-    }
-
-    self.damage_flags    |= TFL_DMG_HEADSHAKE;
-    self.firecheck_flags |= TFL_FIRECHECK_AFF;
-
-    // Our fireing routine
-    self.turret_firefunc  = turret_plasma_dual_attack;
-
-    // Custom per turret frame stuff. usualy animation.
-    self.turret_postthink = turret_plasma_dual_postthink;
-}
-
-
-/*
-* Basic moderate (std) or fast (dual) fireing, short-mid range energy cannon.
-* Not too mutch of a therat on its own, but can be rather dangerous in groups.
-* Regenerates ammo slowly, support with a fusionreactor(s) to do some real damage.
-*/
-
-/*QUAKED turret_plasma (0 .5 .8) ?
-*/
-void spawnfunc_turret_plasma()
-{
-    g_turrets_common_precash();
-    precache_model ("models/turrets/plasma.md3");
-    precache_model ("models/turrets/base.md3");
-
-    self.think = turret_plasma_std_init;
-    self.nextthink = time + 0.5;
-}
-
-/*QUAKED turret_plasma_dual (0 .5 .8) ?
-*/
-void spawnfunc_turret_plasma_dual()
-{
-
-    precache_model ("models/turrets/plasmad.md3");
-    precache_model ("models/turrets/base.md3");
-
-    self.think = turret_plasma_dual_init;
-    self.nextthink = time + 0.5;
-}
-
diff --git a/qcsrc/server/tturrets/units/unit_walker.qc b/qcsrc/server/tturrets/units/unit_walker.qc
deleted file mode 100644 (file)
index a91daa1..0000000
+++ /dev/null
@@ -1,643 +0,0 @@
-#define ANIM_NO         0
-#define ANIM_TURN       1
-#define ANIM_WALK       2
-#define ANIM_RUN        3
-#define ANIM_STRAFE_L   4
-#define ANIM_STRAFE_R   5
-#define ANIM_JUMP       6
-#define ANIM_LAND       7
-#define ANIM_PAIN       8
-#define ANIM_MEELE      9
-#define ANIM_SWIM       10
-#define ANIM_ROAM       11
-.float animflag;
-
-#define WALKER_MIN '-70 -70 0'
-#define WALKER_MAX '70 70 95'
-
-#define WALKER_PATH(s,e) pathlib_astar(s,e)
-
-float walker_firecheck()
-{
-    if (self.animflag == ANIM_MEELE)
-        return 0;
-
-    return turret_stdproc_firecheck();
-}
-
-void walker_meele_do_dmg()
-{
-    vector where;
-    entity e;
-
-    makevectors(self.angles);
-    where = self.origin + v_forward * 128;
-
-    e = findradius(where,32);
-    while (e)
-    {
-        if (turret_validate_target(self, e, self.target_validate_flags))
-            if (e != self && e.owner != self)
-                Damage(e, self, self, autocvar_g_turrets_unit_walker_std_meele_dmg, DEATH_TURRET_WALK_MEELE, '0 0 0', v_forward * autocvar_g_turrets_unit_walker_std_meele_force);
-
-        e = e.chain;
-    }
-}
-
-void walker_setnoanim()
-{
-    turrets_setframe(ANIM_NO, FALSE);
-    self.animflag = self.frame;
-}
-void walker_rocket_explode()
-{
-    RadiusDamage (self, self.owner, autocvar_g_turrets_unit_walker_std_rocket_dmg, 0, autocvar_g_turrets_unit_walker_std_rocket_radius, self, world, autocvar_g_turrets_unit_walker_std_rocket_force, DEATH_TURRET_WALK_ROCKET, world);
-
-    remove (self);
-}
-
-void walker_rocket_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
-{
-    self.health = self.health - damage;
-    self.velocity = self.velocity + vforce;
-
-    if (self.health <= 0)
-        W_PrepareExplosionByDamage(self.owner, walker_rocket_explode);
-}
-
-#define WALKER_ROCKET_MOVE movelib_move_simple(newdir, autocvar_g_turrets_unit_walker_std_rocket_speed, autocvar_g_turrets_unit_walker_std_rocket_turnrate); UpdateCSQCProjectile(self)
-void walker_rocket_loop();
-void walker_rocket_think()
-{
-    vector newdir;
-    float edist;
-    float itime;
-    float m_speed;
-
-    self.nextthink = time;
-
-    edist = vlen(self.enemy.origin - self.origin);
-
-    // Simulate crude guidance
-    if (self.cnt < time)
-    {
-        if (edist < 1000)
-            self.tur_shotorg = randomvec() * min(edist, 64);
-        else
-            self.tur_shotorg = randomvec() * min(edist, 256);
-
-        self.cnt = time + 0.5;
-    }
-
-    if (edist < 128)
-        self.tur_shotorg = '0 0 0';
-
-    if (self.tur_health < time)
-    {
-        self.think      = walker_rocket_explode;
-        self.nextthink  = time;
-        return;
-    }
-
-    if (self.shot_dmg != 1337 && random() < 0.01)
-    {
-        walker_rocket_loop();
-        return;
-    }
-
-    m_speed = vlen(self.velocity);
-
-    // Enemy dead? just keep on the current heading then.
-    if (self.enemy == world || self.enemy.deadflag != DEAD_NO)
-        self.enemy = world;
-
-    if (self.enemy)
-    {
-        itime = max(edist / m_speed, 1);
-        newdir = steerlib_pull(self.enemy.origin + self.tur_shotorg);
-    }
-    else
-        newdir  = normalize(self.velocity);
-
-    WALKER_ROCKET_MOVE;
-}
-
-void walker_rocket_loop3()
-{
-    vector newdir;
-    self.nextthink = time;
-
-    if (self.tur_health < time)
-    {
-        self.think = walker_rocket_explode;
-        return;
-    }
-
-    if (vlen(self.origin - self.tur_shotorg) < 100 )
-    {
-        self.think = walker_rocket_think;
-        return;
-    }
-
-    newdir = steerlib_pull(self.tur_shotorg);
-    WALKER_ROCKET_MOVE;
-
-    self.angles = vectoangles(self.velocity);
-}
-
-void walker_rocket_loop2()
-{
-    vector newdir;
-
-    self.nextthink = time;
-
-    if (self.tur_health < time)
-    {
-        self.think = walker_rocket_explode;
-        return;
-    }
-
-    if (vlen(self.origin - self.tur_shotorg) < 100 )
-    {
-        self.tur_shotorg = self.origin - '0 0 200';
-        self.think = walker_rocket_loop3;
-        return;
-    }
-
-    newdir = steerlib_pull(self.tur_shotorg);
-    WALKER_ROCKET_MOVE;
-}
-
-void walker_rocket_loop()
-{
-    self.nextthink = time;
-    self.tur_shotorg = self.origin + '0 0 300';
-    self.think = walker_rocket_loop2;
-    self.shot_dmg = 1337;
-}
-
-void walker_fire_rocket(vector org)
-{
-    entity rocket;
-
-    fixedmakevectors(self.angles);
-
-    te_explosion (org);
-
-    rocket = spawn ();
-    setorigin(rocket, org);
-
-    sound (self, CH_WEAPON_A, "weapons/hagar_fire.wav", VOL_BASE, ATTEN_NORM);
-    setsize (rocket, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot
-
-    rocket.classname          = "walker_rocket";
-    rocket.owner              = self;
-    rocket.bot_dodge          = TRUE;
-    rocket.bot_dodgerating    = 50;
-    rocket.takedamage         = DAMAGE_YES;
-    rocket.damageforcescale   = 2;
-    rocket.health             = 25;
-    rocket.tur_shotorg        = randomvec() * 512;
-    rocket.cnt                = time + 1;
-    rocket.enemy              = self.enemy;
-
-    if (random() < 0.01)
-        rocket.think          = walker_rocket_loop;
-    else
-        rocket.think          = walker_rocket_think;
-
-    rocket.event_damage       = walker_rocket_damage;
-
-    rocket.nextthink          = time;
-    rocket.movetype           = MOVETYPE_FLY;
-    rocket.velocity           = normalize((v_forward + v_up * 0.5) + (randomvec() * 0.2)) * autocvar_g_turrets_unit_walker_std_rocket_speed;
-    rocket.angles             = vectoangles(rocket.velocity);
-    rocket.touch              = walker_rocket_explode;
-    rocket.flags              = FL_PROJECTILE;
-    rocket.solid              = SOLID_BBOX;
-    rocket.tur_health         = time + 9;
-    rocket.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_GUIDED_HEAT;
-
-    CSQCProjectile(rocket, FALSE, PROJECTILE_ROCKET, FALSE); // no culling, has fly sound
-}
-
-.vector enemy_last_loc;
-.float enemy_last_time;
-void walker_move_to(vector _target, float _dist)
-{
-    switch (self.waterlevel)
-    {
-    case WATERLEVEL_NONE:
-        if (_dist > 500)
-            self.animflag = ANIM_RUN;
-        else
-            self.animflag = ANIM_WALK;
-    case WATERLEVEL_WETFEET:
-    case WATERLEVEL_SWIMMING:
-        if (self.animflag != ANIM_SWIM)
-            self.animflag = ANIM_WALK;
-        else
-            self.animflag = ANIM_SWIM;
-        break;
-    case WATERLEVEL_SUBMERGED:
-        self.animflag = ANIM_SWIM;
-    }
-
-    self.moveto = _target;
-    self.steerto = steerlib_attract2(self.moveto, 0.5, 500, 0.95);
-
-    if(self.enemy)
-    {
-        self.enemy_last_loc = _target;
-        self.enemy_last_time = time;
-    }
-}
-
-//#define WALKER_FANCYPATHING
-
-void walker_move_path()
-{
-#ifdef WALKER_FANCYPATHING
-    // Are we close enougth to a path node to switch to the next?
-    if (vlen(self.origin  - self.pathcurrent.origin) < 64)
-        if (self.pathcurrent.path_next == world)
-        {
-            // Path endpoint reached
-            pathlib_deletepath(self.pathcurrent.owner);
-            self.pathcurrent = world;
-
-            if (self.pathgoal)
-            {
-                if (self.pathgoal.use)
-                    self.pathgoal.use();
-
-                if (self.pathgoal.enemy)
-                {
-                    self.pathcurrent = WALKER_PATH(self.pathgoal.origin,self.pathgoal.enemy.origin);
-                    self.pathgoal = self.pathgoal.enemy;
-                }
-            }
-            else
-                self.pathgoal = world;
-        }
-        else
-            self.pathcurrent = self.pathcurrent.path_next;
-
-    self.moveto = self.pathcurrent.origin;
-    self.steerto = steerlib_attract2(self.moveto,0.5,500,0.95);
-    walker_move_to(self.moveto, 0);
-
-#else
-    if (vlen(self.origin - self.pathcurrent.origin) < 64)
-        self.pathcurrent = self.pathcurrent.enemy;
-
-    if(!self.pathcurrent)
-        return;
-
-    self.moveto = self.pathcurrent.origin;
-    self.steerto = steerlib_attract2(self.moveto, 0.5, 500, 0.95);
-    walker_move_to(self.moveto, 0);
-#endif
-}
-
-.float idletime;
-void walker_postthink()
-{
-    fixedmakevectors(self.angles);
-
-    if (self.spawnflags & TSF_NO_PATHBREAK && self.pathcurrent)
-        walker_move_path();
-    else if (self.enemy == world)
-    {
-        if(self.pathcurrent)
-            walker_move_path();
-        else
-        {
-            if(self.enemy_last_time != 0)
-            {
-                if(vlen(self.origin - self.enemy_last_loc) < 128 || time - self.enemy_last_time > 10)
-                    self.enemy_last_time = 0;
-                else
-                    walker_move_to(self.enemy_last_loc, 0);
-            }
-            else
-            {
-                if(self.animflag != ANIM_NO)
-                {
-                    traceline(self.origin + '0 0 64', self.origin + '0 0 64' + v_forward * 128, MOVE_NORMAL, self);
-
-                    if(trace_fraction != 1.0)
-                        self.tur_head.idletime = -1337;
-                    else
-                    {
-                        traceline(trace_endpos, trace_endpos - '0 0 256', MOVE_NORMAL, self);
-                        if(trace_fraction == 1.0)
-                            self.tur_head.idletime = -1337;
-                    }
-
-                    if(self.tur_head.idletime == -1337)
-                    {
-                        self.moveto = self.origin + randomvec() * 256;
-                        self.tur_head.idletime = 0;
-                    }
-
-                    self.moveto = self.moveto * 0.9 + ((self.origin + v_forward * 500) + randomvec() * 400) * 0.1;
-                    self.moveto_z = self.origin_z + 64;
-                    walker_move_to(self.moveto, 0);
-                }
-
-                if(self.idletime < time)
-                {
-                    if(random() < 0.5 || !(self.spawnflags & TSL_ROAM))
-                    {
-                        self.idletime = time + 1 + random() * 5;
-                        self.moveto = self.origin;
-                        self.animflag = ANIM_NO;
-                    }
-                    else
-                    {
-                        self.animflag = ANIM_WALK;
-                        self.idletime = time + 4 + random() * 2;
-                        self.moveto = self.origin + randomvec() * 256;
-                        self.tur_head.moveto = self.moveto;
-                        self.tur_head.idletime = 0;
-                    }
-                }
-            }
-        }
-    }
-    else
-    {
-        if (self.tur_dist_enemy < autocvar_g_turrets_unit_walker_std_meele_range && self.animflag != ANIM_MEELE)
-        {
-            vector wish_angle;
-
-            wish_angle = angleofs(self, self.enemy);
-            if (self.animflag != ANIM_SWIM)
-            if (fabs(wish_angle_y) < 15)
-            {
-                self.moveto   = self.enemy.origin;
-                self.steerto  = steerlib_attract2(self.moveto, 0.5, 500, 0.95);
-                self.animflag = ANIM_MEELE;
-            }
-        }
-        else if (self.tur_head.attack_finished_single < time)
-        {
-            if(self.tur_head.shot_volly)
-            {
-                self.animflag = ANIM_NO;
-
-                self.tur_head.shot_volly = self.tur_head.shot_volly -1;
-                if(self.tur_head.shot_volly == 0)
-                    self.tur_head.attack_finished_single = time + autocvar_g_turrets_unit_walker_std_rocket_refire;
-                else
-                    self.tur_head.attack_finished_single = time + 0.2;
-
-                if(self.tur_head.shot_volly > 1)
-                    walker_fire_rocket(gettaginfo(self, gettagindex(self, "tag_rocket01")));
-                else
-                    walker_fire_rocket(gettaginfo(self, gettagindex(self, "tag_rocket02")));
-            }
-            else
-            {
-                if (self.tur_dist_enemy > autocvar_g_turrets_unit_walker_std_rockets_range_min)
-                if (self.tur_dist_enemy < autocvar_g_turrets_unit_walker_std_rockets_range)
-                    self.tur_head.shot_volly = 4;
-            }
-        }
-        else
-        {
-            if (self.animflag != ANIM_MEELE)
-                walker_move_to(self.enemy.origin, self.tur_dist_enemy);
-        }
-    }
-
-    //if(self.animflag != ANIM_NO)
-    {
-        vector real_angle;
-        float turny = 0, turnx = 0;
-        float  vz;
-
-        real_angle = vectoangles(self.steerto) - self.angles;
-        vz         = self.velocity_z;
-
-        switch (self.animflag)
-        {
-            case ANIM_NO:
-                movelib_beak_simple(autocvar_g_turrets_unit_walker_speed_stop);
-                break;
-
-            case ANIM_TURN:
-                turny = autocvar_g_turrets_unit_walker_turn;
-                movelib_beak_simple(autocvar_g_turrets_unit_walker_speed_stop);
-                break;
-
-            case ANIM_WALK:
-                turny = autocvar_g_turrets_unit_walker_turn_walk;
-                movelib_move_simple(v_forward, autocvar_g_turrets_unit_walker_speed_walk, 0.6);
-                break;
-
-            case ANIM_RUN:
-                turny = autocvar_g_turrets_unit_walker_turn_run;
-                movelib_move_simple(v_forward, autocvar_g_turrets_unit_walker_speed_run, 0.6);
-                break;
-
-            case ANIM_STRAFE_L:
-                turny = autocvar_g_turrets_unit_walker_turn_strafe;
-                movelib_move_simple(v_right * -1, autocvar_g_turrets_unit_walker_speed_walk, 0.8);
-                break;
-
-            case ANIM_STRAFE_R:
-                turny = autocvar_g_turrets_unit_walker_turn_strafe;
-                movelib_move_simple(v_right, autocvar_g_turrets_unit_walker_speed_walk, 0.8);
-                break;
-
-            case ANIM_JUMP:
-                self.velocity += '0 0 1' * autocvar_g_turrets_unit_walker_speed_jump;
-                break;
-
-            case ANIM_LAND:
-                break;
-
-            case ANIM_PAIN:
-                if(self.frame != ANIM_PAIN)
-                    defer(0.25, walker_setnoanim);
-
-                break;
-
-            case ANIM_MEELE:
-                if(self.frame != ANIM_MEELE)
-                {
-                    defer(0.41, walker_setnoanim);
-                    defer(0.21, walker_meele_do_dmg);
-                }
-
-                movelib_beak_simple(autocvar_g_turrets_unit_walker_speed_stop);
-                break;
-
-            case ANIM_SWIM:
-                turny = autocvar_g_turrets_unit_walker_turn_swim;
-                turnx = autocvar_g_turrets_unit_walker_turn_swim;
-
-                self.angles_x += bound(-10, shortangle_f(real_angle_x, self.angles_x), 10);
-                movelib_move_simple(v_forward, autocvar_g_turrets_unit_walker_speed_swim, 0.3);
-                vz = self.velocity_z + sin(time * 4) * 8;
-                break;
-
-            case ANIM_ROAM:
-                turny = autocvar_g_turrets_unit_walker_turn_walk;
-                movelib_move_simple(v_forward ,autocvar_g_turrets_unit_walker_speed_roam, 0.5);
-                break;
-        }
-
-        if(turny)
-        {
-            turny = bound( turny * -1, shortangle_f(real_angle_y, self.angles_y), turny );
-            self.angles_y += turny;
-        }
-
-        if(turnx)
-        {
-            turnx = bound( turnx * -1, shortangle_f(real_angle_x, self.angles_x), turnx );
-            self.angles_x += turnx;
-        }
-
-        self.velocity_z = vz;
-    }
-
-
-    if(self.origin != self.oldorigin)
-        self.SendFlags |= TNSF_MOVE;
-
-    self.oldorigin = self.origin;
-    turrets_setframe(self.animflag, FALSE);
-}
-
-void walker_attack()
-{
-    sound (self, CH_WEAPON_A, "weapons/uzi_fire.wav", VOL_BASE, ATTEN_NORM);
-    fireBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_WALK_GUN, 0);
-    pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
-}
-
-
-void walker_respawnhook()
-{
-    entity e;
-
-    // Respawn is called & first spawn to, to set team. need to make sure we do not move the initial spawn.
-    if(self.movetype != MOVETYPE_WALK)
-               return;
-
-    setorigin(self, self.pos1);
-    self.angles = self.pos2;
-
-    if (self.target != "")
-    {
-        e = find(world, targetname, self.target);
-        if (!e)
-        {
-            dprint("Warning! initital waypoint for Walker does NOT exsist!\n");
-            self.target = "";
-        }
-
-        if (e.classname != "turret_checkpoint")
-            dprint("Warning: not a turrret path\n");
-        else
-        {
- #ifdef WALKER_FANCYPATHING
-            self.pathcurrent = WALKER_PATH(self.origin, e.origin);
-            self.pathgoal = e;
-#else
-            self.pathcurrent = e;
-#endif
-        }
-    }
-}
-
-void walker_diehook()
-{
-#ifdef WALKER_FANCYPATHING
-    if (self.pathcurrent)
-        pathlib_deletepath(self.pathcurrent.owner);
-#endif
-    self.pathcurrent = world;
-}
-
-void turret_walker_dinit()
-{
-    entity e;
-
-    if (self.netname == "")      self.netname     = "Walker Turret";
-
-    self.ammo_flags = TFL_AMMO_BULLETS | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;
-    self.turrcaps_flags = TFL_TURRCAPS_PLAYERKILL | TFL_TURRCAPS_MOVE ;
-    self.aim_flags = TFL_AIM_LEAD;
-
-    self.turrcaps_flags |= TFL_TURRCAPS_HITSCAN;
-
-
-    self.turret_respawnhook = walker_respawnhook;
-    self.turret_diehook = walker_diehook;
-
-    self.ticrate = 0.05;
-    if (turret_stdproc_init("walker_std", "models/turrets/walker_body.md3", "models/turrets/walker_head_minigun.md3", TID_WALKER) == 0)
-    {
-        remove(self);
-        return;
-    }
-    setsize(self, WALKER_MIN, WALKER_MAX);
-    self.target_select_flags   = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-    self.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMTS | TFL_TARGETSELECT_TEAMCHECK | TFL_TARGETSELECT_LOS;
-    self.iscreature = TRUE;
-    self.teleportable = TELEPORT_NORMAL;
-    self.damagedbycontents = TRUE;
-    self.movetype   = MOVETYPE_WALK;
-    self.solid      = SOLID_SLIDEBOX;
-    self.takedamage = DAMAGE_AIM;
-    setorigin(self, self.origin);
-    tracebox(self.origin + '0 0 128', self.mins, self.maxs, self.origin - '0 0 10000', MOVE_NORMAL, self);
-    setorigin(self, trace_endpos + '0 0 4');
-    self.pos1 = self.origin;
-    self.pos2 = self.angles;
-    self.idle_aim = '0 0 0';
-    self.turret_firecheckfunc = walker_firecheck;
-    self.turret_firefunc      = walker_attack;
-    self.turret_postthink     = walker_postthink;
-
-    if (self.target != "")
-    {
-        e = find(world, targetname, self.target);
-        if (!e)
-        {
-            dprint("Initital waypoint for walker does NOT exsist, fix your map!\n");
-            self.target = "";
-        }
-
-        if (e.classname != "turret_checkpoint")
-            dprint("Warning: not a turrret path\n");
-        else
-        {
-#ifdef WALKER_FANCYPATHING
-            self.pathcurrent = WALKER_PATH(self.origin, e.origin);
-            self.pathgoal = e;
-#else
-            self.pathcurrent = e;
-#endif
-        }
-    }
-}
-
-
-void spawnfunc_turret_walker()
-{
-    g_turrets_common_precash();
-
-    precache_model ("models/turrets/walker_head_minigun.md3");
-    precache_model ("models/turrets/walker_body.md3");
-    precache_model ( "models/turrets/rocket.md3");
-    precache_sound ( "weapons/rocket_impact.wav" );
-
-    self.think = turret_walker_dinit;
-    self.nextthink = time + 0.5;
-}
index c3ebdede4e28b8d69d9f6f61cf22247b614a4d27..9c200d78ac011dbf1e5e00bba37b05ca0cea3e20 100644 (file)
@@ -1,92 +1,13 @@
-#define BRG_SETUP 2
-#define BRG_START 4
-#define BRG_END 8
+#include "bumblebee.qh"
 
 #ifdef SVQC
-// Auto cvars
-float autocvar_g_vehicle_bumblebee_speed_forward;
-float autocvar_g_vehicle_bumblebee_speed_strafe;
-float autocvar_g_vehicle_bumblebee_speed_up;
-float autocvar_g_vehicle_bumblebee_speed_down;
-float autocvar_g_vehicle_bumblebee_turnspeed;
-float autocvar_g_vehicle_bumblebee_pitchspeed;
-float autocvar_g_vehicle_bumblebee_pitchlimit;
-float autocvar_g_vehicle_bumblebee_friction;
-
-float autocvar_g_vehicle_bumblebee_energy;
-float autocvar_g_vehicle_bumblebee_energy_regen;
-float autocvar_g_vehicle_bumblebee_energy_regen_pause;
-
-float autocvar_g_vehicle_bumblebee_health;
-float autocvar_g_vehicle_bumblebee_health_regen;
-float autocvar_g_vehicle_bumblebee_health_regen_pause;
-
-float autocvar_g_vehicle_bumblebee_shield;
-float autocvar_g_vehicle_bumblebee_shield_regen;
-float autocvar_g_vehicle_bumblebee_shield_regen_pause;
-
-float autocvar_g_vehicle_bumblebee_cannon_cost;
-float autocvar_g_vehicle_bumblebee_cannon_damage;
-float autocvar_g_vehicle_bumblebee_cannon_radius;
-float autocvar_g_vehicle_bumblebee_cannon_refire;
-float autocvar_g_vehicle_bumblebee_cannon_speed;
-float autocvar_g_vehicle_bumblebee_cannon_spread;
-float autocvar_g_vehicle_bumblebee_cannon_force;
-
-float autocvar_g_vehicle_bumblebee_cannon_ammo;
-float autocvar_g_vehicle_bumblebee_cannon_ammo_regen;
-float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause;
-
-var float autocvar_g_vehicle_bumblebee_cannon_lock = 0;
-
-float autocvar_g_vehicle_bumblebee_cannon_turnspeed;
-float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down;
-float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up;
-float autocvar_g_vehicle_bumblebee_cannon_turnlimit_in;
-float autocvar_g_vehicle_bumblebee_cannon_turnlimit_out;
-
-
-float autocvar_g_vehicle_bumblebee_raygun_turnspeed;
-float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down;
-float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up;
-float autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides;
-
-float autocvar_g_vehicle_bumblebee_raygun_range;
-float autocvar_g_vehicle_bumblebee_raygun_dps;
-float autocvar_g_vehicle_bumblebee_raygun_aps;
-float autocvar_g_vehicle_bumblebee_raygun_fps;
-
-float autocvar_g_vehicle_bumblebee_raygun;
-float autocvar_g_vehicle_bumblebee_healgun_hps;
-float autocvar_g_vehicle_bumblebee_healgun_hmax;
-float autocvar_g_vehicle_bumblebee_healgun_aps;
-float autocvar_g_vehicle_bumblebee_healgun_amax;
-float autocvar_g_vehicle_bumblebee_healgun_sps;
-float autocvar_g_vehicle_bumblebee_healgun_locktime;
-
-float autocvar_g_vehicle_bumblebee_respawntime;
-
-float autocvar_g_vehicle_bumblebee_blowup_radius;
-float autocvar_g_vehicle_bumblebee_blowup_coredamage;
-float autocvar_g_vehicle_bumblebee_blowup_edgedamage;
-float autocvar_g_vehicle_bumblebee_blowup_forceintensity;
-var vector autocvar_g_vehicle_bumblebee_bouncepain;
-
-var float autocvar_g_vehicle_bumblebee = 0;
-
-
-float bumble_raygun_send(entity to, float sf);
-
-#define BUMB_MIN '-130 -130 -130'
-#define BUMB_MAX '130 130 130'
-
 void bumb_fire_cannon(entity _gun, string _tagname, entity _owner)
 {
        vector v = gettaginfo(_gun, gettagindex(_gun, _tagname));
        vehicles_projectile("bigplasma_muzzleflash", "weapons/flacexp3.wav",
                                                v, normalize(v_forward + randomvec() * autocvar_g_vehicle_bumblebee_cannon_spread) * autocvar_g_vehicle_bumblebee_cannon_speed,
                                                autocvar_g_vehicle_bumblebee_cannon_damage, autocvar_g_vehicle_bumblebee_cannon_radius, autocvar_g_vehicle_bumblebee_cannon_force,  0,
-                                               DEATH_VH_BUMB_GUN, PROJECTILE_BUMBLE_GUN, 0, TRUE, TRUE, _owner);
+                                               DEATH_VH_BUMB_GUN, PROJECTILE_BUMBLE_GUN, 0, true, true, _owner);
 }
 
 float bumb_gunner_frame()
@@ -157,7 +78,7 @@ float bumb_gunner_frame()
                vector vf = real_origin(gun.enemy);
                vector _vel = gun.enemy.velocity;
                if(gun.enemy.movetype == MOVETYPE_WALK)
-                       _vel_z *= 0.1;
+                       _vel.z *= 0.1;
 
 
                ad = vf;
@@ -222,7 +143,7 @@ void bumb_gunner_exit(float _exitflag)
 
                WriteByte(MSG_ONE, SVC_SETVIEWANGLES);
                WriteAngle(MSG_ONE, 0);
-               WriteAngle(MSG_ONE, self.vehicle.angles_y);
+               WriteAngle(MSG_ONE, self.vehicle.angles.y);
                WriteAngle(MSG_ONE, 0);
        }
 
@@ -292,7 +213,7 @@ float bumb_gunner_enter()
        else
        {
                dprint("^1ERROR:^7Tried to enter a fully occupied vehicle!\n");
-               return FALSE;
+               return false;
        }
 
        _gunner            = other;
@@ -321,8 +242,8 @@ float bumb_gunner_enter()
        WriteByte(MSG_ONE, SVC_SETVIEWPORT);
        WriteEntity(MSG_ONE, _gun.vehicle_viewport);
        WriteByte(MSG_ONE, SVC_SETVIEWANGLES);
-       WriteAngle(MSG_ONE, _gun.angles_x + self.angles_x);    // tilt
-       WriteAngle(MSG_ONE, _gun.angles_y + self.angles_y);    // yaw
+       WriteAngle(MSG_ONE, _gun.angles.x + self.angles.x);    // tilt
+       WriteAngle(MSG_ONE, _gun.angles.y + self.angles.y);    // yaw
        WriteAngle(MSG_ONE, 0);                             // roll
        _gun.vehicle_hudmodel.viewmodelforclient = other;
 
@@ -334,28 +255,28 @@ float bumb_gunner_enter()
     other = vh_player;
     _gun = vh_vehicle;
 
-       return TRUE;
+       return true;
 }
 
 float vehicles_valid_pilot()
 {
        if (!IS_PLAYER(other))
-               return FALSE;
+               return false;
 
        if(other.deadflag != DEAD_NO)
-               return FALSE;
+               return false;
 
        if(other.vehicle != world)
-               return FALSE;
+               return false;
 
        if (!IS_REAL_CLIENT(other))
                if(!autocvar_g_vehicles_allow_bots)
-                       return FALSE;
+                       return false;
 
        if(teamplay && other.team != self.team)
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 void bumb_touch()
@@ -392,13 +313,13 @@ void bumb_regen()
                                                                           self.gun2.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime);
 
        if(self.vehicle_flags  & VHF_SHIELDREGEN)
-               vehicles_regen(self.dmg_time, vehicle_shield, autocvar_g_vehicle_bumblebee_shield, autocvar_g_vehicle_bumblebee_shield_regen_pause, autocvar_g_vehicle_bumblebee_shield_regen, frametime, TRUE);
+               vehicles_regen(self.dmg_time, vehicle_shield, autocvar_g_vehicle_bumblebee_shield, autocvar_g_vehicle_bumblebee_shield_regen_pause, autocvar_g_vehicle_bumblebee_shield_regen, frametime, true);
 
        if(self.vehicle_flags  & VHF_HEALTHREGEN)
-               vehicles_regen(self.dmg_time, vehicle_health, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_health_regen_pause, autocvar_g_vehicle_bumblebee_health_regen, frametime, FALSE);
+               vehicles_regen(self.dmg_time, vehicle_health, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_health_regen_pause, autocvar_g_vehicle_bumblebee_health_regen, frametime, false);
 
        if(self.vehicle_flags  & VHF_ENERGYREGEN)
-               vehicles_regen(self.wait, vehicle_energy, autocvar_g_vehicle_bumblebee_energy, autocvar_g_vehicle_bumblebee_energy_regen_pause, autocvar_g_vehicle_bumblebee_energy_regen, frametime, FALSE);
+               vehicles_regen(self.wait, vehicle_energy, autocvar_g_vehicle_bumblebee_energy, autocvar_g_vehicle_bumblebee_energy_regen_pause, autocvar_g_vehicle_bumblebee_energy_regen, frametime, false);
 
 }
 
@@ -428,58 +349,58 @@ float bumb_pilot_frame()
 
        vang = vehic.angles;
        newvel = vectoangles(normalize(trace_endpos - self.origin + '0 0 32'));
-       vang_x *= -1;
-       newvel_x *= -1;
-       if(newvel_x > 180)  newvel_x -= 360;
-       if(newvel_x < -180) newvel_x += 360;
-       if(newvel_y > 180)  newvel_y -= 360;
-       if(newvel_y < -180) newvel_y += 360;
-
-       ftmp = shortangle_f(pilot.v_angle_y - vang_y, vang_y);
+       vang.x *= -1;
+       newvel.x *= -1;
+       if(newvel.x > 180)  newvel.x -= 360;
+       if(newvel.x < -180) newvel.x += 360;
+       if(newvel.y > 180)  newvel.y -= 360;
+       if(newvel.y < -180) newvel.y += 360;
+
+       ftmp = shortangle_f(pilot.v_angle.y - vang.y, vang.y);
        if(ftmp > 180)  ftmp -= 360;
        if(ftmp < -180) ftmp += 360;
-       vehic.avelocity_y = bound(-autocvar_g_vehicle_bumblebee_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_bumblebee_turnspeed);
+       vehic.avelocity_y = bound(-autocvar_g_vehicle_bumblebee_turnspeed, ftmp + vehic.avelocity.y * 0.9, autocvar_g_vehicle_bumblebee_turnspeed);
 
        // Pitch
        ftmp = 0;
-       if(pilot.movement_x > 0 && vang_x < autocvar_g_vehicle_bumblebee_pitchlimit)
+       if(pilot.movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit)
                ftmp = 4;
-       else if(pilot.movement_x < 0 && vang_x > -autocvar_g_vehicle_bumblebee_pitchlimit)
+       else if(pilot.movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit)
                ftmp = -8;
 
-       newvel_x = bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel_x , autocvar_g_vehicle_bumblebee_pitchlimit);
-       ftmp = vang_x - bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel_x + ftmp, autocvar_g_vehicle_bumblebee_pitchlimit);
-       vehic.avelocity_x = bound(-autocvar_g_vehicle_bumblebee_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_bumblebee_pitchspeed);
+       newvel.x = bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel.x , autocvar_g_vehicle_bumblebee_pitchlimit);
+       ftmp = vang.x - bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel.x + ftmp, autocvar_g_vehicle_bumblebee_pitchlimit);
+       vehic.avelocity_x = bound(-autocvar_g_vehicle_bumblebee_pitchspeed, ftmp + vehic.avelocity.x * 0.9, autocvar_g_vehicle_bumblebee_pitchspeed);
 
-       vehic.angles_x = anglemods(vehic.angles_x);
-       vehic.angles_y = anglemods(vehic.angles_y);
-       vehic.angles_z = anglemods(vehic.angles_z);
+       vehic.angles_x = anglemods(vehic.angles.x);
+       vehic.angles_y = anglemods(vehic.angles.y);
+       vehic.angles_z = anglemods(vehic.angles.z);
 
-       makevectors('0 1 0' * vehic.angles_y);
+       makevectors('0 1 0' * vehic.angles.y);
        newvel = vehic.velocity * -autocvar_g_vehicle_bumblebee_friction;
 
-       if(pilot.movement_x != 0)
+       if(pilot.movement.x != 0)
        {
-               if(pilot.movement_x > 0)
+               if(pilot.movement.x > 0)
                        newvel += v_forward  * autocvar_g_vehicle_bumblebee_speed_forward;
-               else if(pilot.movement_x < 0)
+               else if(pilot.movement.x < 0)
                        newvel -= v_forward  * autocvar_g_vehicle_bumblebee_speed_forward;
        }
 
-       if(pilot.movement_y != 0)
+       if(pilot.movement.y != 0)
        {
-               if(pilot.movement_y < 0)
+               if(pilot.movement.y < 0)
                        newvel -= v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
-               else if(pilot.movement_y > 0)
+               else if(pilot.movement.y > 0)
                        newvel += v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
                ftmp = newvel * v_right;
                ftmp *= frametime * 0.1;
-               vehic.angles_z = bound(-15, vehic.angles_z + ftmp, 15);
+               vehic.angles_z = bound(-15, vehic.angles.z + ftmp, 15);
        }
        else
        {
                vehic.angles_z *= 0.95;
-               if(vehic.angles_z >= -1 && vehic.angles_z <= -1)
+               if(vehic.angles.z >= -1 && vehic.angles.z <= -1)
                        vehic.angles_z = 0;
        }
 
@@ -791,8 +712,8 @@ void bumb_die()
 
 void bumb_impact()
 {
-       if(autocvar_g_vehicle_bumblebee_bouncepain_x)
-               vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
+       if(autocvar_g_vehicle_bumblebee_bouncepain.x)
+               vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain.x, autocvar_g_vehicle_bumblebee_bouncepain.y, autocvar_g_vehicle_bumblebee_bouncepain.z);
 }
 
 void bumb_spawn(float _f)
@@ -863,7 +784,7 @@ void bumb_spawn(float _f)
                if(self.gun3.enemy == world)
                {
                        self.gun3.enemy = spawn();
-                       Net_LinkEntity(self.gun3.enemy, TRUE, 0, bumble_raygun_send);
+                       Net_LinkEntity(self.gun3.enemy, true, 0, bumble_raygun_send);
                        self.gun3.enemy.SendFlags = BRG_SETUP;
                        self.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun;
                        self.gun3.enemy.effects = EF_NODRAW | EF_LOWPRECISION;
@@ -913,10 +834,10 @@ void spawnfunc_vehicle_bumblebee()
        if(!vehicle_initialize(
                           "Bumblebee", "models/vehicles/bumblebee_body.dpm",
                           "", "models/vehicles/spiderbot_cockpit.dpm", "", "", "tag_viewport",
-                          HUD_BUMBLEBEE, BUMB_MIN, BUMB_MAX, FALSE,
+                          HUD_BUMBLEBEE, BUMB_MIN, BUMB_MAX, false,
                           bumb_spawn, autocvar_g_vehicle_bumblebee_respawntime,
                           bumb_pilot_frame, bumb_enter, bumb_exit,
-                          bumb_die, bumb_think, FALSE, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_shield))
+                          bumb_die, bumb_think, false, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_shield))
        {
                remove(self);
                return;
@@ -937,19 +858,19 @@ float bumble_raygun_send(entity to, float sf)
 
        if(sf & BRG_START)
        {
-               WriteCoord(MSG_ENTITY, self.hook_start_x);
-               WriteCoord(MSG_ENTITY, self.hook_start_y);
-               WriteCoord(MSG_ENTITY, self.hook_start_z);
+               WriteCoord(MSG_ENTITY, self.hook_start.x);
+               WriteCoord(MSG_ENTITY, self.hook_start.y);
+               WriteCoord(MSG_ENTITY, self.hook_start.z);
        }
 
        if(sf & BRG_END)
        {
-               WriteCoord(MSG_ENTITY, self.hook_end_x);
-               WriteCoord(MSG_ENTITY, self.hook_end_y);
-               WriteCoord(MSG_ENTITY, self.hook_end_z);
+               WriteCoord(MSG_ENTITY, self.hook_end.x);
+               WriteCoord(MSG_ENTITY, self.hook_end.y);
+               WriteCoord(MSG_ENTITY, self.hook_end.z);
        }
 
-       return TRUE;
+       return true;
 }
 #endif // SVQC
 
@@ -1000,7 +921,7 @@ void bumble_raygun_draw()
 
 void bumble_raygun_read(float bIsNew)
 {
-       float sf = ReadByte();
+       int sf = ReadByte();
 
        if(sf & BRG_SETUP)
        {
diff --git a/qcsrc/server/vehicles/bumblebee.qh b/qcsrc/server/vehicles/bumblebee.qh
new file mode 100644 (file)
index 0000000..727cbf2
--- /dev/null
@@ -0,0 +1,142 @@
+#ifndef BUMBLEBEE_H
+#define BUMBLEBEE_H
+
+const int BRG_SETUP = 2;
+const int BRG_START = 4;
+const int BRG_END = 8;
+
+#ifdef SVQC
+// Auto cvars
+float autocvar_g_vehicle_bumblebee_speed_forward;
+float autocvar_g_vehicle_bumblebee_speed_strafe;
+float autocvar_g_vehicle_bumblebee_speed_up;
+float autocvar_g_vehicle_bumblebee_speed_down;
+float autocvar_g_vehicle_bumblebee_turnspeed;
+float autocvar_g_vehicle_bumblebee_pitchspeed;
+float autocvar_g_vehicle_bumblebee_pitchlimit;
+float autocvar_g_vehicle_bumblebee_friction;
+
+float autocvar_g_vehicle_bumblebee_energy;
+float autocvar_g_vehicle_bumblebee_energy_regen;
+float autocvar_g_vehicle_bumblebee_energy_regen_pause;
+
+float autocvar_g_vehicle_bumblebee_health;
+float autocvar_g_vehicle_bumblebee_health_regen;
+float autocvar_g_vehicle_bumblebee_health_regen_pause;
+
+float autocvar_g_vehicle_bumblebee_shield;
+float autocvar_g_vehicle_bumblebee_shield_regen;
+float autocvar_g_vehicle_bumblebee_shield_regen_pause;
+
+float autocvar_g_vehicle_bumblebee_cannon_cost;
+float autocvar_g_vehicle_bumblebee_cannon_damage;
+float autocvar_g_vehicle_bumblebee_cannon_radius;
+float autocvar_g_vehicle_bumblebee_cannon_refire;
+float autocvar_g_vehicle_bumblebee_cannon_speed;
+float autocvar_g_vehicle_bumblebee_cannon_spread;
+float autocvar_g_vehicle_bumblebee_cannon_force;
+
+float autocvar_g_vehicle_bumblebee_cannon_ammo;
+float autocvar_g_vehicle_bumblebee_cannon_ammo_regen;
+float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause;
+
+float autocvar_g_vehicle_bumblebee_cannon_lock = 0;
+
+float autocvar_g_vehicle_bumblebee_cannon_turnspeed;
+float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down;
+float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up;
+float autocvar_g_vehicle_bumblebee_cannon_turnlimit_in;
+float autocvar_g_vehicle_bumblebee_cannon_turnlimit_out;
+
+
+float autocvar_g_vehicle_bumblebee_raygun_turnspeed;
+float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down;
+float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up;
+float autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides;
+
+float autocvar_g_vehicle_bumblebee_raygun_range;
+float autocvar_g_vehicle_bumblebee_raygun_dps;
+float autocvar_g_vehicle_bumblebee_raygun_aps;
+float autocvar_g_vehicle_bumblebee_raygun_fps;
+
+float autocvar_g_vehicle_bumblebee_raygun;
+float autocvar_g_vehicle_bumblebee_healgun_hps;
+float autocvar_g_vehicle_bumblebee_healgun_hmax;
+float autocvar_g_vehicle_bumblebee_healgun_aps;
+float autocvar_g_vehicle_bumblebee_healgun_amax;
+float autocvar_g_vehicle_bumblebee_healgun_sps;
+float autocvar_g_vehicle_bumblebee_healgun_locktime;
+
+float autocvar_g_vehicle_bumblebee_respawntime;
+
+float autocvar_g_vehicle_bumblebee_blowup_radius;
+float autocvar_g_vehicle_bumblebee_blowup_coredamage;
+float autocvar_g_vehicle_bumblebee_blowup_edgedamage;
+float autocvar_g_vehicle_bumblebee_blowup_forceintensity;
+vector autocvar_g_vehicle_bumblebee_bouncepain;
+
+float autocvar_g_vehicle_bumblebee = 0;
+
+
+float bumble_raygun_send(entity to, float sf);
+
+const vector BUMB_MIN = '-130 -130 -130';
+const vector BUMB_MAX = '130 130 130';
+
+void bumb_fire_cannon(entity _gun, string _tagname, entity _owner);
+
+float bumb_gunner_frame();
+
+void bumb_gunner_exit(float _exitflag);
+
+float bumb_gunner_enter();
+
+float vehicles_valid_pilot();
+
+void bumb_touch();
+
+void bumb_regen();
+
+float bumb_pilot_frame();
+
+void bumb_think();
+
+void bumb_enter();
+
+void bumb_exit(float eject);
+
+void bumb_blowup();
+
+void bumb_diethink();
+
+void bumb_die();
+
+void bumb_impact();
+
+void bumb_spawn(float _f);
+
+void spawnfunc_vehicle_bumblebee();
+
+float bumble_raygun_send(entity to, float sf);
+#endif // SVQC
+
+#ifdef CSQC
+/*
+.vector raygun_l1
+.vector raygun_l2;
+.vector raygun_l3;
+*/
+
+void bumble_raygun_draw();
+
+void bumble_raygun_read(float bIsNew);
+
+void bumblebee_draw();
+
+void bumblebee_draw2d();
+
+void bumblebee_read_extra();
+
+void vehicle_bumblebee_assemble();
+#endif //CSQC
+#endif
index fc9cee8657f97e58af04c999e87f3d80e6358052..45c3713af7f2260e3b6ed190fd77528f5194b5d6 100644 (file)
@@ -1,7 +1,9 @@
-#define RACER_MIN '-120 -120 -40'
-#define RACER_MAX '120 120 40'
+const vector RACER_MIN = '-120 -120 -40';
+const vector RACER_MAX = '120 120 40';
 
 #ifdef SVQC
+#include "../../common/turrets/util.qh"
+
 void racer_exit(float eject);
 void racer_enter();
 
@@ -99,20 +101,20 @@ void racer_align4point(float _delta)
    self.velocity += push_vector * _delta;
 
     // Anti ocilation
-    if(self.velocity_z > 0)
+    if(self.velocity.z > 0)
         self.velocity_z *= 1 - autocvar_g_vehicle_racer_upforcedamper * _delta;
 
-    push_vector_x =  (fl_push - bl_push);
+    push_vector.x =  (fl_push - bl_push);
     push_vector_x += (fr_push - br_push);
     push_vector_x *= 360;
 
-    push_vector_z = (fr_push - fl_push);
+    push_vector.z = (fr_push - fl_push);
     push_vector_z += (br_push - bl_push);
     push_vector_z *= 360;
 
     // Apply angle diffrance
-    self.angles_z += push_vector_z * _delta;
-    self.angles_x += push_vector_x * _delta;
+    self.angles_z += push_vector.z * _delta;
+    self.angles_x += push_vector.x * _delta;
 
     // Apply stabilizer
     self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * _delta);
@@ -128,11 +130,11 @@ void racer_fire_cannon(string tagname)
     bolt = vehicles_projectile("wakizashi_gun_muzzleflash", "weapons/lasergun_fire.wav",
                            v, normalize(v_forward + randomvec() * autocvar_g_vehicle_racer_cannon_spread) * autocvar_g_vehicle_racer_cannon_speed,
                            autocvar_g_vehicle_racer_cannon_damage, autocvar_g_vehicle_racer_cannon_radius, autocvar_g_vehicle_racer_cannon_force,  0,
-                           DEATH_VH_WAKI_GUN, PROJECTILE_WAKICANNON, 0, TRUE, TRUE, self.owner);
+                           DEATH_VH_WAKI_GUN, PROJECTILE_WAKICANNON, 0, true, true, self.owner);
 
        // Fix z-aim (for chase mode)
     v = normalize(trace_endpos - bolt.origin);
-    v_forward_z = v_z * 0.5;
+    v_forward.z = v.z * 0.5;
     bolt.velocity = v_forward * autocvar_g_vehicle_racer_cannon_speed;
 }
 
@@ -215,7 +217,7 @@ void racer_rocket_tracker()
     newdir = normalize(predicted_origin - self.origin);
 
     //vector
-       float height_diff = predicted_origin_z - self.origin_z;
+       float height_diff = predicted_origin.z - self.origin.z;
 
     if(vlen(newdir - v_forward) > autocvar_g_vehicle_racer_rocket_locked_maxangle)
     {
@@ -226,7 +228,7 @@ void racer_rocket_tracker()
     }
 
     if(trace_fraction != 1.0 && trace_ent != self.enemy)
-        newdir_z += 16 * sys_frametime;
+        newdir.z += 16 * sys_frametime;
 
     self.velocity = normalize(olddir + newdir * autocvar_g_vehicle_racer_rocket_turnrate) * newvel;
     self.velocity_z -= 800 * sys_frametime;
@@ -242,7 +244,7 @@ void racer_fire_rocket(string tagname, entity trg)
     entity rocket = rocket = vehicles_projectile("wakizashi_rocket_launch", "weapons/rocket_fire.wav",
                            v, v_forward * autocvar_g_vehicle_racer_rocket_speed,
                            autocvar_g_vehicle_racer_rocket_damage, autocvar_g_vehicle_racer_rocket_radius, autocvar_g_vehicle_racer_rocket_force, 3,
-                           DEATH_VH_WAKI_ROCKET, PROJECTILE_WAKIROCKET, 20, FALSE, FALSE, self.owner);
+                           DEATH_VH_WAKI_ROCKET, PROJECTILE_WAKIROCKET, 20, false, false, self.owner);
 
     rocket.lip              = autocvar_g_vehicle_racer_rocket_accel * sys_frametime;
     rocket.wait             = autocvar_g_vehicle_racer_rocket_turnrate;
@@ -288,16 +290,16 @@ float racer_frame()
 
     // Yaw
     ftmp = autocvar_g_vehicle_racer_turnspeed * frametime;
-    ftmp = bound(-ftmp, shortangle_f(player.v_angle_y - racer.angles_y, racer.angles_y), ftmp);
-    racer.angles_y = anglemods(racer.angles_y + ftmp);
+    ftmp = bound(-ftmp, shortangle_f(player.v_angle.y - racer.angles.y, racer.angles.y), ftmp);
+    racer.angles_y = anglemods(racer.angles.y + ftmp);
 
     // Roll
     racer.angles_z += -ftmp * autocvar_g_vehicle_racer_turnroll * frametime;
 
     // Pitch
     ftmp = autocvar_g_vehicle_racer_pitchspeed  * frametime;
-    ftmp = bound(-ftmp, shortangle_f(player.v_angle_x - racer.angles_x, racer.angles_x), ftmp);
-    racer.angles_x = bound(-30, anglemods(racer.angles_x + ftmp), 30);
+    ftmp = bound(-ftmp, shortangle_f(player.v_angle.x - racer.angles.x, racer.angles.x), ftmp);
+    racer.angles_x = bound(-30, anglemods(racer.angles.x + ftmp), 30);
 
     makevectors(racer.angles);
     racer.angles_x *= -1;
@@ -309,10 +311,10 @@ float racer_frame()
     if(vlen(player.movement) != 0)
     {
         if(player.movement_x)
-            df += v_forward * ((player.movement_x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward);
+            df += v_forward * ((player.movement.x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward);
 
         if(player.movement_y)
-            df += v_right * ((player.movement_y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe);
+            df += v_right * ((player.movement.y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe);
 
         if(self.sound_nexttime < time || self.sounds != 1)
         {
@@ -425,13 +427,13 @@ float racer_frame()
     player.vehicle_reload1 = bound(0, 100 * ((time - racer.lip) / (racer.delay - racer.lip)), 100);
 
     if(racer.vehicle_flags  & VHF_SHIELDREGEN)
-        vehicles_regen(racer.dmg_time, vehicle_shield, autocvar_g_vehicle_racer_shield, autocvar_g_vehicle_racer_shield_regen_pause, autocvar_g_vehicle_racer_shield_regen, frametime, TRUE);
+        vehicles_regen(racer.dmg_time, vehicle_shield, autocvar_g_vehicle_racer_shield, autocvar_g_vehicle_racer_shield_regen_pause, autocvar_g_vehicle_racer_shield_regen, frametime, true);
 
     if(racer.vehicle_flags  & VHF_HEALTHREGEN)
-        vehicles_regen(racer.dmg_time, vehicle_health, autocvar_g_vehicle_racer_health, autocvar_g_vehicle_racer_health_regen_pause, autocvar_g_vehicle_racer_health_regen, frametime, FALSE);
+        vehicles_regen(racer.dmg_time, vehicle_health, autocvar_g_vehicle_racer_health, autocvar_g_vehicle_racer_health_regen_pause, autocvar_g_vehicle_racer_health_regen, frametime, false);
 
     if(racer.vehicle_flags  & VHF_ENERGYREGEN)
-        vehicles_regen(racer.wait, vehicle_energy, autocvar_g_vehicle_racer_energy, autocvar_g_vehicle_racer_energy_regen_pause, autocvar_g_vehicle_racer_energy_regen, frametime, FALSE);
+        vehicles_regen(racer.wait, vehicle_energy, autocvar_g_vehicle_racer_energy, autocvar_g_vehicle_racer_energy_regen_pause, autocvar_g_vehicle_racer_energy_regen, frametime, false);
 
 
     VEHICLE_UPDATE_PLAYER(player, health, racer);
@@ -460,10 +462,10 @@ void racer_think()
     tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * autocvar_g_vehicle_racer_springlength), MOVE_NORMAL, self);
 
     vector df = self.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);
+       df.z += (1 - trace_fraction) * autocvar_g_vehicle_racer_hoverpower + sin(time * 2) * (autocvar_g_vehicle_racer_springlength * 2);
 
        self.velocity += df * pushdeltatime;
-    if(self.velocity_z > 0)
+    if(self.velocity.z > 0)
         self.velocity_z *= 1 - autocvar_g_vehicle_racer_upforcedamper * pushdeltatime;
 
     self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
@@ -528,8 +530,8 @@ void racer_exit(float eject)
 
 void racer_impact()
 {
-       if(autocvar_g_vehicle_racer_bouncepain_x)
-               vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
+       if(autocvar_g_vehicle_racer_bouncepain.x)
+               vehicles_impact(autocvar_g_vehicle_racer_bouncepain.x, autocvar_g_vehicle_racer_bouncepain.y, autocvar_g_vehicle_racer_bouncepain.z);
 }
 
 void racer_blowup()
@@ -578,9 +580,9 @@ void racer_die()
     pointparticles(particleeffectnum("explosion_medium"), self.origin, '0 0 0', 1);
 
     if(random() < 0.5)
-        self.avelocity_z  = 32;
+        self.avelocity_z = 32;
     else
-        self.avelocity_z  = -32;
+        self.avelocity_z = -32;
 
     self.avelocity_x = -vlen(self.velocity) * 0.2;
     self.velocity   += '0 0 700';
@@ -667,12 +669,12 @@ void spawnfunc_vehicle_racer()
              "", "", "tag_viewport",
              HUD_WAKIZASHI,
              0.5 * RACER_MIN, 0.5 * RACER_MAX,
-             FALSE,
+             false,
              racer_spawn, autocvar_g_vehicle_racer_respawntime,
              racer_frame,
              racer_enter, racer_exit,
              racer_die,   racer_think,
-             TRUE,
+             true,
              autocvar_g_vehicle_racer_health,
              autocvar_g_vehicle_racer_shield))
     {
index 53e4d35f71c2e5c348ada62f5d84aa9d1389a4c8..4533da6f3b212701e728cecc2709671df0c7c6ee 100644 (file)
@@ -1,10 +1,10 @@
-#define RSM_FIRST 0
-#define RSM_BOMB 0
-#define RSM_FLARE 1
-#define RSM_LAST 1
+const float RSM_FIRST = 0;
+const float RSM_BOMB = 0;
+const float RSM_FLARE = 1;
+const float RSM_LAST = 1;
 
-#define RAPTOR_MIN '-80 -80 0'
-#define RAPTOR_MAX '80 80 70'
+const vector RAPTOR_MIN = '-80 -80 0';
+const vector RAPTOR_MAX = '80 80 70';
 
 #ifdef SVQC
 float autocvar_g_vehicle_raptor;
@@ -145,7 +145,7 @@ void raptor_bomb_burst()
         bomblet.velocity    = normalize(normalize(self.velocity) + (randomvec() * autocvar_g_vehicle_raptor_bomblet_spread)) * vlen(self.velocity);
 
         PROJECTILE_MAKETRIGGER(bomblet);
-        CSQCProjectile(bomblet, TRUE, PROJECTILE_RAPTORBOMBLET, TRUE);
+        CSQCProjectile(bomblet, true, PROJECTILE_RAPTORBOMBLET, true);
     }
 
     remove(self);
@@ -180,8 +180,8 @@ void raptor_bombdrop()
     PROJECTILE_MAKETRIGGER(bomb_1);
     PROJECTILE_MAKETRIGGER(bomb_2);
 
-    CSQCProjectile(bomb_1, TRUE, PROJECTILE_RAPTORBOMB, TRUE);
-    CSQCProjectile(bomb_2, TRUE, PROJECTILE_RAPTORBOMB, TRUE);
+    CSQCProjectile(bomb_1, true, PROJECTILE_RAPTORBOMB, true);
+    CSQCProjectile(bomb_2, true, PROJECTILE_RAPTORBOMB, true);
 }
 
 
@@ -190,7 +190,7 @@ void raptor_fire_cannon(entity gun, string tagname)
     vehicles_projectile("raptor_cannon_muzzleflash", "weapons/lasergun_fire.wav",
                            gettaginfo(gun, gettagindex(gun, tagname)), normalize(v_forward + randomvec() * autocvar_g_vehicle_raptor_cannon_spread) * autocvar_g_vehicle_raptor_cannon_speed,
                            autocvar_g_vehicle_raptor_cannon_damage, autocvar_g_vehicle_raptor_cannon_radius, autocvar_g_vehicle_raptor_cannon_force,  0,
-                           DEATH_VH_RAPT_CANNON, PROJECTILE_RAPTORCANNON, 0, TRUE, TRUE, self.owner);
+                           DEATH_VH_RAPT_CANNON, PROJECTILE_RAPTORCANNON, 0, true, true, self.owner);
 }
 
 void raptor_think()
@@ -231,7 +231,7 @@ void raptor_land()
         self.frame = (hgt / 128) * 25;
 
     self.bomb1.gun1.avelocity_y = 90 + ((self.frame / 25) * 2000);
-    self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y;
+    self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity.y;
 
     if(hgt < 16)
     {
@@ -307,9 +307,9 @@ float raptor_takeoff()
     if(raptor.frame < 25)
     {
         raptor.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / sys_frametime);
-        raptor.velocity_z = min(raptor.velocity_z * 1.5, 256);
+        raptor.velocity_z = min(raptor.velocity.z * 1.5, 256);
         self.bomb1.gun1.avelocity_y = 90 + ((raptor.frame / 25) * 25000);
-        self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y;
+        self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity.y;
         player.BUTTON_ATCK = player.BUTTON_ATCK2 = player.BUTTON_CROUCH = 0;
 
         setorigin(player, raptor.origin + '0 0 32');
@@ -318,13 +318,13 @@ float raptor_takeoff()
         player.PlayerPhysplug = raptor_frame;
 
     if(self.vehicle_flags  & VHF_SHIELDREGEN)
-        vehicles_regen(raptor.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, TRUE);
+        vehicles_regen(raptor.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, true);
 
     if(self.vehicle_flags  & VHF_HEALTHREGEN)
-        vehicles_regen(raptor.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, FALSE);
+        vehicles_regen(raptor.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, false);
 
     if(self.vehicle_flags  & VHF_ENERGYREGEN)
-        vehicles_regen(raptor.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, FALSE);
+        vehicles_regen(raptor.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, false);
 
 
     raptor.bomb1.alpha = raptor.bomb2.alpha = (time - raptor.lip) / (raptor.delay - raptor.lip);
@@ -417,58 +417,58 @@ float raptor_frame()
     vector vang;
     vang = raptor.angles;
     df = vectoangles(normalize(trace_endpos - self.origin + '0 0 32'));
-    vang_x *= -1;
-    df_x *= -1;
-    if(df_x > 180)  df_x -= 360;
-    if(df_x < -180) df_x += 360;
-    if(df_y > 180)  df_y -= 360;
-    if(df_y < -180) df_y += 360;
-
-    ftmp = shortangle_f(player.v_angle_y - vang_y, vang_y);
+    vang.x *= -1;
+    df.x *= -1;
+    if(df.x > 180)  df.x -= 360;
+    if(df.x < -180) df.x += 360;
+    if(df.y > 180)  df.y -= 360;
+    if(df.y < -180) df.y += 360;
+
+    ftmp = shortangle_f(player.v_angle.y - vang.y, vang.y);
     if(ftmp > 180)  ftmp -= 360; if(ftmp < -180) ftmp += 360;
-    raptor.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + raptor.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
+    raptor.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + raptor.avelocity.y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
 
     // Pitch
     ftmp = 0;
-    if(player.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
-    else if(player.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
+    if(player.movement.x > 0 && vang.x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
+    else if(player.movement.x < 0 && vang.x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
 
-    df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
-    ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
-    raptor.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + raptor.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
+    df.x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df.x , autocvar_g_vehicle_raptor_pitchlimit);
+    ftmp = vang.x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df.x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
+    raptor.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + raptor.avelocity.x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
 
-    raptor.angles_x = anglemods(raptor.angles_x);
-    raptor.angles_y = anglemods(raptor.angles_y);
-    raptor.angles_z = anglemods(raptor.angles_z);
+    raptor.angles_x = anglemods(raptor.angles.x);
+    raptor.angles_y = anglemods(raptor.angles.y);
+    raptor.angles_z = anglemods(raptor.angles.z);
 
     if(autocvar_g_vehicle_raptor_movestyle == 1)
-        makevectors('0 1 0' * raptor.angles_y);
+        makevectors('0 1 0' * raptor.angles.y);
     else
         makevectors(player.v_angle);
 
     df = raptor.velocity * -autocvar_g_vehicle_raptor_friction;
 
-    if(player.movement_x != 0)
+    if(player.movement.x != 0)
     {
-        if(player.movement_x > 0)
+        if(player.movement.x > 0)
             df += v_forward  * autocvar_g_vehicle_raptor_speed_forward;
-        else if(player.movement_x < 0)
+        else if(player.movement.x < 0)
             df -= v_forward  * autocvar_g_vehicle_raptor_speed_forward;
     }
 
-    if(player.movement_y != 0)
+    if(player.movement.y != 0)
     {
-        if(player.movement_y < 0)
+        if(player.movement.y < 0)
             df -= v_right * autocvar_g_vehicle_raptor_speed_strafe;
-        else if(player.movement_y > 0)
+        else if(player.movement.y > 0)
             df += v_right * autocvar_g_vehicle_raptor_speed_strafe;
 
-        raptor.angles_z = bound(-30,raptor.angles_z + (player.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
+        raptor.angles_z = bound(-30,raptor.angles.z + (player.movement.y / autocvar_g_vehicle_raptor_speed_strafe),30);
     }
     else
     {
         raptor.angles_z *= 0.95;
-        if(raptor.angles_z >= -1 && raptor.angles_z <= -1)
+        if(raptor.angles.z >= -1 && raptor.angles.z <= -1)
             raptor.angles_z = 0;
     }
 
@@ -516,7 +516,7 @@ float raptor_frame()
             UpdateAuxiliaryXhair(player, vf, '1 0 0', 1);
             vector _vel = raptor.gun1.enemy.velocity;
             if(raptor.gun1.enemy.movetype == MOVETYPE_WALK)
-                _vel_z *= 0.1;
+                _vel.z *= 0.1;
 
             if(autocvar_g_vehicle_raptor_cannon_predicttarget)
             {
@@ -605,13 +605,13 @@ float raptor_frame()
     }
 
     if(self.vehicle_flags  & VHF_SHIELDREGEN)
-        vehicles_regen(raptor.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, TRUE);
+        vehicles_regen(raptor.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, true);
 
     if(self.vehicle_flags  & VHF_HEALTHREGEN)
-        vehicles_regen(raptor.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, FALSE);
+        vehicles_regen(raptor.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, false);
 
     if(self.vehicle_flags  & VHF_ENERGYREGEN)
-        vehicles_regen(raptor.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, FALSE);
+        vehicles_regen(raptor.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, false);
 
     if(raptor.vehicle_weapon2mode == RSM_BOMB)
     {
@@ -751,16 +751,16 @@ void raptor_die()
 
 void raptor_impact()
 {
-       if(autocvar_g_vehicle_raptor_bouncepain_x)
-               vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+       if(autocvar_g_vehicle_raptor_bouncepain.x)
+               vehicles_impact(autocvar_g_vehicle_raptor_bouncepain.x, autocvar_g_vehicle_raptor_bouncepain.y, autocvar_g_vehicle_raptor_bouncepain.z);
 }
 
 // If we dont do this ever now and then, the raptors rotors
 // stop working, presumably due to angle overflow. cute.
 void raptor_rotor_anglefix()
 {
-    self.gun1.angles_y = anglemods(self.gun1.angles_y);
-    self.gun2.angles_y = anglemods(self.gun2.angles_y);
+    self.gun1.angles_y = anglemods(self.gun1.angles.y);
+    self.gun2.angles_y = anglemods(self.gun2.angles.y);
     self.nextthink = time + 15;
 }
 
@@ -776,7 +776,7 @@ float raptor_impulse(float _imp)
                 self.vehicle.vehicle_weapon2mode = RSM_FIRST;
 
             CSQCVehicleSetup(self, 0);
-            return TRUE;
+            return true;
         case 12:
         case 16:
         case 19:
@@ -785,7 +785,7 @@ float raptor_impulse(float _imp)
                 self.vehicle.vehicle_weapon2mode = RSM_LAST;
 
             CSQCVehicleSetup(self, 0);
-            return TRUE;
+            return true;
 
         /*
         case 17: // toss gun, could be used to exit?
@@ -794,7 +794,7 @@ float raptor_impulse(float _imp)
             break;
         */
     }
-    return FALSE;
+    return false;
 }
 
 void raptor_spawn(float _f)
@@ -931,12 +931,12 @@ void spawnfunc_vehicle_raptor()
              "", "tag_hud", "tag_camera",
              HUD_RAPTOR,
              RAPTOR_MIN, RAPTOR_MAX,
-             FALSE,
+             false,
              raptor_spawn, autocvar_g_vehicle_raptor_respawntime,
              raptor_frame,
              raptor_enter, raptor_exit,
              raptor_die,   raptor_think,
-             FALSE,
+             false,
              autocvar_g_vehicle_raptor_health,
              autocvar_g_vehicle_raptor_shield))
     {
index c5eb546e8b9695a505522263c0e35644d231aa71..c969e225ebc3bc21a3d504dfa7c80c9f465c6700 100644 (file)
@@ -69,11 +69,11 @@ vector autocvar_g_vehicle_spiderbot_bouncepain;
 void spiderbot_exit(float eject);
 void spiderbot_enter();
 void spiderbot_spawn(float);
-#define SBRM_FIRST 0
-#define SBRM_VOLLY 0
-#define SBRM_GUIDE 1
-#define SBRM_ARTILLERY 2
-#define SBRM_LAST 2
+const float SBRM_FIRST = 0;
+const float SBRM_VOLLY = 0;
+const float SBRM_GUIDE = 1;
+const float SBRM_ARTILLERY = 2;
+const float SBRM_LAST = 2;
 
 void spiderbot_rocket_artillery()
 {
@@ -143,7 +143,7 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht)
        vector sdir;
 
        grav  = autocvar_sv_gravity;
-       zdist = tgt_z - org_z;
+       zdist = tgt.z - org.z;
        sdist = vlen(tgt - org - zdist * '0 0 1');
        sdir  = normalize(tgt - org - zdist * '0 0 1');
 
@@ -163,10 +163,10 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht)
        vector solution;
        solution = solve_quadratic(0.5 * grav, -vz, zdist); // equation "z(ti) = zdist"
        // ALWAYS solvable because jumpheight >= zdist
-       if(!solution_z)
-               solution_y = solution_x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0)
+       if(!solution.z)
+               solution.y = solution.x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0)
        if(zdist == 0)
-               solution_x = solution_y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually)
+               solution.x = solution.y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually)
 
        if(zdist < 0)
        {
@@ -176,14 +176,14 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht)
                        // almost straight line type
                        // jump apex is before the jump
                        // we must take the larger one
-                       spiberbot_calcartillery_flighttime = solution_y;
+                       spiberbot_calcartillery_flighttime = solution.y;
                }
                else
                {
                        // regular jump
                        // jump apex is during the jump
                        // we must take the larger one too
-                       spiberbot_calcartillery_flighttime = solution_y;
+                       spiberbot_calcartillery_flighttime = solution.y;
                }
        }
        else
@@ -194,14 +194,14 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht)
                        // almost straight line type
                        // jump apex is after the jump
                        // we must take the smaller one
-                       spiberbot_calcartillery_flighttime = solution_x;
+                       spiberbot_calcartillery_flighttime = solution.x;
                }
                else
                {
                        // regular jump
                        // jump apex is during the jump
                        // we must take the larger one
-                       spiberbot_calcartillery_flighttime = solution_y;
+                       spiberbot_calcartillery_flighttime = solution.y;
                }
        }
        vs = sdist / spiberbot_calcartillery_flighttime;
@@ -261,7 +261,7 @@ void spiderbot_rocket_do()
             rocket = vehicles_projectile("spiderbot_rocket_launch", "weapons/rocket_fire.wav",
                                    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, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, FALSE, TRUE, self.owner);
+                                   DEATH_VH_SPID_ROCKET, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner);
             crosshair_trace(self.owner);
             float _dist = (random() * autocvar_g_vehicle_spiderbot_rocket_radius) + vlen(v - trace_endpos);
             _dist -= (random() * autocvar_g_vehicle_spiderbot_rocket_radius) ;
@@ -275,7 +275,7 @@ void spiderbot_rocket_do()
             rocket = vehicles_projectile("spiderbot_rocket_launch", "weapons/rocket_fire.wav",
                                    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, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, FALSE, FALSE, self.owner);
+                                   DEATH_VH_SPID_ROCKET, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, self.owner);
             crosshair_trace(self.owner);
             rocket.pos1       = trace_endpos;
             rocket.nextthink  = time;
@@ -287,12 +287,12 @@ void spiderbot_rocket_do()
             rocket = vehicles_projectile("spiderbot_rocket_launch", "weapons/rocket_fire.wav",
                                    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, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, FALSE, TRUE, self.owner);
+                                   DEATH_VH_SPID_ROCKET, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner);
 
             crosshair_trace(self.owner);
 
             rocket.pos1       = trace_endpos + randomvec() * (0.75 * autocvar_g_vehicle_spiderbot_rocket_radius);
-            rocket.pos1_z       = trace_endpos_z;
+            rocket.pos1_z       = trace_endpos.z;
 
             traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
             float h1 = 0.75 * vlen(v - trace_endpos);
@@ -322,7 +322,7 @@ void spiderbot_rocket_do()
 
 float spiderbot_aiframe()
 {
-    return FALSE;
+    return false;
 }
 
 float spiderbot_frame()
@@ -369,21 +369,21 @@ float spiderbot_frame()
     crosshair_trace(player);
     ad = vectoangles(normalize(trace_endpos - ad));
     ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(spider.angles), AnglesTransform_FromAngles(ad))) - spider.tur_head.angles;
-    ad = AnglesTransform_Normalize(ad, TRUE);
+    ad = AnglesTransform_Normalize(ad, true);
     //UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload2) + ('0 1 0' * (1 - player.vehicle_reload2)), 2);
 
     // Rotate head
     ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
-    ad_y = bound(-ftmp, ad_y, ftmp);
-    spider.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, spider.tur_head.angles_y + ad_y, autocvar_g_vehicle_spiderbot_head_turnlimit);
+    ad.y = bound(-ftmp, ad.y, ftmp);
+    spider.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, spider.tur_head.angles.y + ad.y, autocvar_g_vehicle_spiderbot_head_turnlimit);
 
     // Pitch head
-    ad_x = bound(ftmp * -1, ad_x, ftmp);
-    spider.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, spider.tur_head.angles_x + ad_x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up);
+    ad.x = bound(ftmp * -1, ad.x, ftmp);
+    spider.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, spider.tur_head.angles.x + ad.x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up);
 
 
     //fixedmakevectors(spider.angles);
-    makevectors(spider.angles + '-2 0 0' * spider.angles_x);
+    makevectors(spider.angles + '-2 0 0' * spider.angles.x);
 
     movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
 
@@ -423,29 +423,29 @@ float spiderbot_frame()
             else
             {
                 // Turn Body
-                if(player.movement_x == 0 && player.movement_y != 0)
+                if(player.movement_x == 0 && player.movement.y != 0)
                     ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * sys_frametime;
                 else
                     ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime;
 
-                ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp);
-                spider.angles_y = anglemods(spider.angles_y + ftmp);
+                ftmp = bound(-ftmp, spider.tur_head.angles.y, ftmp);
+                spider.angles_y = anglemods(spider.angles.y + ftmp);
                 spider.tur_head.angles_y -= ftmp;
 
-                if(player.movement_x != 0)
+                if(player.movement.x != 0)
                 {
-                    if(player.movement_x > 0)
+                    if(player.movement.x > 0)
                     {
                         player.movement_x = 1;
                         spider.frame = 0;
                     }
-                    else if(player.movement_x < 0)
+                    else if(player.movement.x < 0)
                     {
                         player.movement_x = -1;
                         spider.frame = 1;
                     }
                     player.movement_y = 0;
-                    movelib_move_simple(normalize(v_forward * player.movement_x),autocvar_g_vehicle_spiderbot_speed_walk,autocvar_g_vehicle_spiderbot_movement_inertia);
+                    movelib_move_simple(normalize(v_forward * player.movement.x),autocvar_g_vehicle_spiderbot_speed_walk,autocvar_g_vehicle_spiderbot_movement_inertia);
 
                     if(self.sound_nexttime < time || self.delay != 1)
                     {
@@ -455,19 +455,19 @@ float spiderbot_frame()
                         //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
                     }
                 }
-                else if(player.movement_y != 0)
+                else if(player.movement.y != 0)
                 {
-                    if(player.movement_y < 0)
+                    if(player.movement.y < 0)
                     {
                         player.movement_y = -1;
                         spider.frame = 2;
                     }
-                    else if(player.movement_y > 0)
+                    else if(player.movement.y > 0)
                     {
                         player.movement_y = 1;
                         spider.frame = 3;
                     }
-                    movelib_move_simple(normalize(v_right * player.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
+                    movelib_move_simple(normalize(v_right * player.movement.y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
                     if(self.sound_nexttime < time || self.delay != 2)
                     {
                         self.delay = 2;
@@ -480,8 +480,8 @@ float spiderbot_frame()
         }
     }
 
-    self.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
-    self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
+    self.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles.x, autocvar_g_vehicle_spiderbot_tiltlimit);
+    self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles.z, autocvar_g_vehicle_spiderbot_tiltlimit);
 
     if(player.BUTTON_ATCK)
     {
@@ -516,7 +516,7 @@ float spiderbot_frame()
             player.vehicle_ammo1 = (spider.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
             spider.gun1.angles_z += 45;
             spider.gun2.angles_z -= 45;
-            if(spider.gun1.angles_z >= 360)
+            if(spider.gun1.angles.z >= 360)
             {
                 spider.gun1.angles_z = 0;
                 spider.gun2.angles_z = 0;
@@ -526,16 +526,16 @@ float spiderbot_frame()
     else
         vehicles_regen(spider.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
                                            autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause,
-                                           autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, FALSE);
+                                           autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, false);
 
 
     spiderbot_rocket_do();
 
     if(self.vehicle_flags  & VHF_SHIELDREGEN)
-        vehicles_regen(spider.dmg_time, vehicle_shield, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_shield_regen, frametime, TRUE);
+        vehicles_regen(spider.dmg_time, vehicle_shield, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_shield_regen, frametime, true);
 
     if(self.vehicle_flags  & VHF_HEALTHREGEN)
-        vehicles_regen(spider.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, frametime, FALSE);
+        vehicles_regen(spider.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, frametime, false);
 
     player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
     player.vehicle_ammo2 = spider.tur_head.frame;
@@ -639,8 +639,8 @@ void spiderbot_exit(float eject)
 
 void spider_impact()
 {
-       if(autocvar_g_vehicle_spiderbot_bouncepain_x)
-               vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
+       if(autocvar_g_vehicle_spiderbot_bouncepain.x)
+               vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain.x, autocvar_g_vehicle_spiderbot_bouncepain.y, autocvar_g_vehicle_spiderbot_bouncepain.z);
 }
 
 void spiderbot_headfade()
@@ -767,7 +767,7 @@ float spiderbot_impulse(float _imp)
 
             //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
             CSQCVehicleSetup(self, 0);
-            return TRUE;
+            return true;
         case 12:
         case 16:
         case 19:
@@ -777,7 +777,7 @@ float spiderbot_impulse(float _imp)
 
             //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
             CSQCVehicleSetup(self, 0);
-            return TRUE;
+            return true;
 
         /*
         case 17: // toss gun, could be used to exit?
@@ -786,7 +786,7 @@ float spiderbot_impulse(float _imp)
             break;
         */
     }
-    return FALSE;
+    return false;
 }
 
 void spiderbot_spawn(float _f)
@@ -867,12 +867,12 @@ void spawnfunc_vehicle_spiderbot()
              "tag_head", "tag_hud", "",
              HUD_SPIDERBOT,
              SPIDERBOT_MIN, SPIDERBOT_MAX,
-             FALSE,
+             false,
              spiderbot_spawn, autocvar_g_vehicle_spiderbot_respawntime,
              spiderbot_frame,
              spiderbot_enter, spiderbot_exit,
              spiderbot_die,   spiderbot_think,
-             FALSE,
+             false,
              autocvar_g_vehicle_spiderbot_health,
              autocvar_g_vehicle_spiderbot_shield))
     {
index 94656c2f4787541d13973dee90cfd70841a9adc4..695e3db750b45672afe50f3671a76b415756dcc7 100644 (file)
@@ -1,13 +1,15 @@
+#include "../../common/turrets/util.qh"
+
 float autocvar_g_vehicles_crush_dmg;
 float autocvar_g_vehicles_crush_force;
 float autocvar_g_vehicles_delayspawn;
 float autocvar_g_vehicles_delayspawn_jitter;
 
-var float autocvar_g_vehicles_vortex_damagerate = 0.5;
-var float autocvar_g_vehicles_machinegun_damagerate = 0.5;
-var float autocvar_g_vehicles_rifle_damagerate = 0.75;
-var float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
-var float autocvar_g_vehicles_tag_damagerate = 5;
+float autocvar_g_vehicles_vortex_damagerate = 0.5;
+float autocvar_g_vehicles_machinegun_damagerate = 0.5;
+float autocvar_g_vehicles_rifle_damagerate = 0.75;
+float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
+float autocvar_g_vehicles_tag_damagerate = 5;
 
 float autocvar_g_vehicles;
 
@@ -33,15 +35,15 @@ float SendAuxiliaryXhair(entity to, float sf)
 
        WriteByte(MSG_ENTITY, self.cnt);
 
-       WriteCoord(MSG_ENTITY, self.origin_x);
-       WriteCoord(MSG_ENTITY, self.origin_y);
-       WriteCoord(MSG_ENTITY, self.origin_z);
+       WriteCoord(MSG_ENTITY, self.origin.x);
+       WriteCoord(MSG_ENTITY, self.origin.y);
+       WriteCoord(MSG_ENTITY, self.origin.z);
 
-    WriteByte(MSG_ENTITY, rint(self.colormod_x * 255));
-    WriteByte(MSG_ENTITY, rint(self.colormod_y * 255));
-    WriteByte(MSG_ENTITY, rint(self.colormod_z * 255));
+    WriteByte(MSG_ENTITY, rint(self.colormod.x * 255));
+    WriteByte(MSG_ENTITY, rint(self.colormod.y * 255));
+    WriteByte(MSG_ENTITY, rint(self.colormod.z * 255));
 
-    return TRUE;
+    return true;
 }
 
 void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, float axh_id)
@@ -60,7 +62,7 @@ void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, float axh_id)
         axh.cnt                 = axh_id;
         axh.drawonlytoclient    = own;
         axh.owner               = own;
-        Net_LinkEntity(axh, FALSE, 0, SendAuxiliaryXhair);
+        Net_LinkEntity(axh, false, 0, SendAuxiliaryXhair);
     }
 
     setorigin(axh, loc);
@@ -420,7 +422,7 @@ entity vehicles_projectile(string _mzlfx, string _mzlsound,
     proj.solid            = SOLID_BBOX;
     proj.movetype         = MOVETYPE_FLYMISSILE;
     proj.flags            = FL_PROJECTILE;
-    proj.bot_dodge        = TRUE;
+    proj.bot_dodge        = true;
     proj.bot_dodgerating  = _dmg;
     proj.velocity         = _vel;
     proj.touch            = vehicles_projectile_explode;
@@ -493,14 +495,14 @@ void vehicles_spawn()
     self.touch              = vehicles_touch;
     self.event_damage       = vehicles_damage;
     self.reset              = vehicles_reset;
-    self.iscreature         = TRUE;
-    self.teleportable       = FALSE; // no teleporting for vehicles, too buggy
-    self.damagedbycontents     = TRUE;
+    self.iscreature         = true;
+    self.teleportable       = false; // no teleporting for vehicles, too buggy
+    self.damagedbycontents     = true;
     self.movetype           = MOVETYPE_WALK;
     self.solid              = SOLID_SLIDEBOX;
     self.takedamage         = DAMAGE_AIM;
        self.deadflag           = DEAD_NO;
-    self.bot_attack         = TRUE;
+    self.bot_attack         = true;
     self.flags              = FL_NOTARGET;
     self.avelocity          = '0 0 0';
     self.velocity           = '0 0 0';
@@ -527,12 +529,12 @@ void vehicles_spawn()
 float vehicles_crushable(entity e)
 {
     if(IS_PLAYER(e))
-        return TRUE;
+        return true;
 
     if(e.flags & FL_MONSTER)
-        return TRUE;
+        return true;
 
-    return FALSE;
+    return false;
 }
 
 void vehicles_impact(float _minspeed, float _speedfac, float _maxpain)
@@ -593,7 +595,7 @@ void vehicles_touch()
 
     vehicles_enter();
 }
-var float autocvar_g_vehicles_allow_bots = 0;
+float autocvar_g_vehicles_allow_bots = 0;
 void vehicles_enter()
 {
    // Remove this when bots know how to use vehicles
@@ -665,7 +667,7 @@ void vehicles_enter()
 
     self.team                 = self.owner.team;
     self.flags               -= FL_NOTARGET;
-    self.monster_attack       = TRUE;
+    self.monster_attack       = true;
 
     if (IS_REAL_CLIENT(other))
     {
@@ -676,14 +678,14 @@ void vehicles_enter()
         WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
         if(self.tur_head)
         {
-            WriteAngle(MSG_ONE, self.tur_head.angles_x + self.angles_x); // tilt
-            WriteAngle(MSG_ONE, self.tur_head.angles_y + self.angles_y); // yaw
+            WriteAngle(MSG_ONE, self.tur_head.angles.x + self.angles.x); // tilt
+            WriteAngle(MSG_ONE, self.tur_head.angles.y + self.angles.y); // yaw
             WriteAngle(MSG_ONE, 0);                                      // roll
         }
         else
         {
-            WriteAngle(MSG_ONE,  self.angles_x * -1); // tilt
-            WriteAngle(MSG_ONE,  self.angles_y);      // yaw
+            WriteAngle(MSG_ONE,  self.angles.x * -1); // tilt
+            WriteAngle(MSG_ONE,  self.angles.y);      // yaw
             WriteAngle(MSG_ONE,  0);                  // roll
         }
     }
@@ -723,7 +725,7 @@ vector vehicles_findgoodexit(vector prefer_spot)
     for(i = 0; i < 100; ++i)
     {
         v = randomvec();
-        v_z = 0;
+        v.z = 0;
         v = v2 + normalize(v) * mysize;
         tracebox(v2, PL_MIN, PL_MAX, v, MOVE_NORMAL, self.owner);
         if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
@@ -772,7 +774,7 @@ void vehicles_exit(float eject)
         return;
     }
 
-    vehicles_exit_running = TRUE;
+    vehicles_exit_running = true;
     if(IS_CLIENT(self))
     {
         _vehicle = self.vehicle;
@@ -781,7 +783,7 @@ void vehicles_exit(float eject)
         {
             _vehicle.vehicle_exit(eject);
             self = _oldself;
-            vehicles_exit_running = FALSE;
+            vehicles_exit_running = false;
             return;
         }
     }
@@ -802,7 +804,7 @@ void vehicles_exit(float eject)
 
             WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
             WriteAngle(MSG_ONE, 0);
-            WriteAngle(MSG_ONE, _vehicle.angles_y);
+            WriteAngle(MSG_ONE, _vehicle.angles.y);
             WriteAngle(MSG_ONE, 0);
         }
 
@@ -843,7 +845,7 @@ void vehicles_exit(float eject)
     sound (_vehicle, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTEN_NORM);
     _vehicle.vehicle_hudmodel.viewmodelforclient = _vehicle;
     _vehicle.phase = time + 1;
-    _vehicle.monster_attack = FALSE;
+    _vehicle.monster_attack = false;
 
     _vehicle.vehicle_exit(eject);
 
@@ -852,7 +854,7 @@ void vehicles_exit(float eject)
     _vehicle.owner = world;
     self = _oldself;
 
-    vehicles_exit_running = FALSE;
+    vehicles_exit_running = false;
 }
 
 
@@ -1070,7 +1072,7 @@ void vehicles_showwp()
            rgb = Team_ColorRGB(self.team);
     else
            rgb = '1 1 1';
-    WaypointSprite_Spawn("vehicle", 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE, RADARICON_POWERUP, rgb);
+    WaypointSprite_Spawn("vehicle", 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_POWERUP, rgb);
     if(self.waypointsprite_attached)
     {
         WaypointSprite_UpdateRule(self.waypointsprite_attached, self.wp00.team, SPRITERULE_DEFAULT);
@@ -1200,7 +1202,7 @@ float vehicle_addplayerslot(    entity _owner,
     setattachment(_slot.vehicle_hudmodel, _slot, "");
     setattachment(_slot.vehicle_viewport, _slot.vehicle_hudmodel, "");
 
-    return TRUE;
+    return true;
 }
 
 float vehicle_initialize(string  net_name,
@@ -1226,7 +1228,7 @@ float vehicle_initialize(string  net_name,
                          float _max_shield)
 {
        if(!autocvar_g_vehicles)
-               return FALSE;
+               return false;
 
     if(self.targetname)
     {
@@ -1288,10 +1290,10 @@ float vehicle_initialize(string  net_name,
     self.tur_head           = spawn();
     self.tur_head.owner     = self;
     self.takedamage         = DAMAGE_AIM;
-    self.bot_attack         = TRUE;
-    self.iscreature         = TRUE;
-    self.teleportable       = FALSE; // no teleporting for vehicles, too buggy
-    self.damagedbycontents     = TRUE;
+    self.bot_attack         = true;
+    self.iscreature         = true;
+    self.teleportable       = false; // no teleporting for vehicles, too buggy
+    self.damagedbycontents     = true;
     self.hud                = vhud;
     self.tur_health          = _max_health;
     self.tur_head.tur_health = _max_shield;
@@ -1350,9 +1352,9 @@ float vehicle_initialize(string  net_name,
     self.tur_head.team = self.team;
 
        if(MUTATOR_CALLHOOK(VehicleSpawn))
-               return FALSE;
+               return false;
 
-    return TRUE;
+    return true;
 }
 
 vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string _tagname,
@@ -1364,12 +1366,12 @@ vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string
     vtag = gettaginfo(_turrret, gettagindex(_turrret, _tagname));
     vtmp = vectoangles(normalize(_target - vtag));
     vtmp = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(_vehic.angles), AnglesTransform_FromAngles(vtmp))) - _turrret.angles;
-    vtmp = AnglesTransform_Normalize(vtmp, TRUE);
+    vtmp = AnglesTransform_Normalize(vtmp, true);
     ftmp = _aimspeed * frametime;
-    vtmp_y = bound(-ftmp, vtmp_y, ftmp);
-    vtmp_x = bound(-ftmp, vtmp_x, ftmp);
-    _turrret.angles_y = bound(_rotlimit_min, _turrret.angles_y + vtmp_y, _rotlimit_max);
-    _turrret.angles_x = bound(_pichlimit_min, _turrret.angles_x + vtmp_x, _pichlimit_max);
+    vtmp.y = bound(-ftmp, vtmp.y, ftmp);
+    vtmp.x = bound(-ftmp, vtmp.x, ftmp);
+    _turrret.angles_y = bound(_rotlimit_min, _turrret.angles.y + vtmp.y, _rotlimit_max);
+    _turrret.angles_x = bound(_pichlimit_min, _turrret.angles.x + vtmp.x, _pichlimit_max);
     return vtag;
 }
 
index 549dfeab7fffcf16b2e33fc48814ff07e330f706..e6b976096dc30d6dfa72dd807649864f9e8f6c2b 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef VEHICLES_H
+#define VEHICLES_H
+
 #ifdef VEHICLES_ENABLED
 #include "vehicles.qc"
 
@@ -8,3 +11,4 @@
 #include "bumblebee.qc"
 #endif
 #endif
+#endif
index 5b82788d165b73ba390bdfe23426fdb9e51566ba..ca40a93e8d9415a5984ce96d59b70fb532adca78 100644 (file)
@@ -1,22 +1,25 @@
+#ifndef VEHICLES_DEF_H
+#define VEHICLES_DEF_H
+
 // #define VEHICLES_USE_ODE
 #define VEHICLES_ENABLED
 #ifdef VEHICLES_ENABLED
 
-.float vehicle_flags;
-const float VHF_ISVEHICLE     = 2;    /// Indicates vehicle
-const float VHF_HASSHIELD     = 4;    /// Vehicle has shileding
-const float VHF_SHIELDREGEN   = 8;    /// Vehicles shield regenerates
-const float VHF_HEALTHREGEN   = 16;   /// Vehicles health regenerates
-const float VHF_ENERGYREGEN   = 32;   /// Vehicles energy regenerates
-const float VHF_DEATHEJECT    = 64;   /// Vehicle ejects pilot upon fatal damage
-const float VHF_MOVE_GROUND   = 128;  /// Vehicle moves on gound
-const float VHF_MOVE_HOVER    = 256;  /// Vehicle hover close to gound
-const float VHF_MOVE_FLY      = 512;  /// Vehicle is airborn
-const float VHF_DMGSHAKE      = 1024; /// Add random velocity each frame if health < 50%
-const float VHF_DMGROLL       = 2048; /// Add random angles each frame if health < 50%
-const float VHF_DMGHEADROLL   = 4096; /// Add random head angles each frame if health < 50%
-const float VHF_MULTISLOT     = 8192; /// Vehicle has multiple player slots
-const float VHF_PLAYERSLOT    = 16384;    /// This ent is a player slot on a multi-person vehicle
+.int vehicle_flags;
+const int VHF_ISVEHICLE     = 2;    /// Indicates vehicle
+const int VHF_HASSHIELD     = 4;    /// Vehicle has shileding
+const int VHF_SHIELDREGEN   = 8;    /// Vehicles shield regenerates
+const int VHF_HEALTHREGEN   = 16;   /// Vehicles health regenerates
+const int VHF_ENERGYREGEN   = 32;   /// Vehicles energy regenerates
+const int VHF_DEATHEJECT    = 64;   /// Vehicle ejects pilot upon fatal damage
+const int VHF_MOVE_GROUND   = 128;  /// Vehicle moves on gound
+const int VHF_MOVE_HOVER    = 256;  /// Vehicle hover close to gound
+const int VHF_MOVE_FLY      = 512;  /// Vehicle is airborn
+const int VHF_DMGSHAKE      = 1024; /// Add random velocity each frame if health < 50%
+const int VHF_DMGROLL       = 2048; /// Add random angles each frame if health < 50%
+const int VHF_DMGHEADROLL   = 4096; /// Add random head angles each frame if health < 50%
+const int VHF_MULTISLOT     = 8192; /// Vehicle has multiple player slots
+const int VHF_PLAYERSLOT    = 16384;    /// This ent is a player slot on a multi-person vehicle
 
 .entity gun1;
 .entity gun2;
@@ -40,7 +43,7 @@ const float VHF_PLAYERSLOT    = 16384;    /// This ent is a player slot on a mul
 .float vehicle_reload2; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload2 value.
 
 .float sound_nexttime;
-#define VOL_VEHICLEENGINE 1
+const float VOL_VEHICLEENGINE = 1;
 
 .float hud;
 .float dmg_time;
@@ -63,8 +66,8 @@ const float SVC_UPDATEENTITY  = 128; // Net.Protocol 0x80
 
 .void() vehicle_enter;  /// Vehicles custom funciton to be executed when owner exit it
 .void() vehicle_die;    /// Vehicles custom function to be executed when vehile die
-#define VHSF_NORMAL 0
-#define VHSF_FACTORY 2
+const float VHSF_NORMAL = 0;
+const float VHSF_FACTORY = 2;
 .void(float _spawnflag) vehicle_spawn;  /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
 .float(float _imp) vehicles_impulse;
 .float vehicle_weapon2mode = volly_counter;
@@ -75,3 +78,4 @@ void(entity e, vector force, vector force_pos) physics_addforce = #541; // apply
 void(entity e, vector torque) physics_addtorque = #542; // add relative torque
 #endif  // VEHICLES_USE_ODE
 #endif  // VEHICLES_ENABLED
+#endif
index 736cc564cc4c81bffaae6096cddc11b46c8ac867..02ebdec920562847fb780067d94da3a9c36267df 100644 (file)
@@ -1,10 +1,19 @@
-..entity owned_by_field;
-.float rule;
-.string model1;
-.string model2;
-.string model3;
-
-.float(entity) waypointsprite_visible_for_player;
+#include "waypointsprites.qh"
+
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+    #include "../common/constants.qh"
+    #include "../common/util.qh"
+    #include "../common/buffs.qh"
+    #include "autocvars.qh"
+    #include "constants.qh"
+    #include "defs.qh"
+    #include "../common/deathtypes.qh"
+    #include "mutators/mutators_include.qh"
+    #include "../common/mapinfo.qh"
+    #include "miscfunctions.qh"
+#endif
 
 void WaypointSprite_UpdateSprites(entity e, string m1, string m2, string m3)
 {
@@ -81,8 +90,6 @@ void WaypointSprite_UpdateTeamRadar(entity e, float icon, vector col)
        e.SendFlags |= 32;
 }
 
-.float waypointsprite_pingtime;
-.float waypointsprite_helpmetime;
 void WaypointSprite_Ping(entity e)
 {
        // anti spam
@@ -94,8 +101,6 @@ void WaypointSprite_Ping(entity e)
        e.SendFlags |= 32;
 }
 
-float waypointsprite_limitedrange, waypointsprite_deployed_lifetime, waypointsprite_deadlifetime;
-
 void WaypointSprite_HelpMePing(entity e)
 {
        WaypointSprite_Ping(e);
@@ -131,6 +136,7 @@ void WaypointSprite_Init()
        waypointsprite_deployed_lifetime = autocvar_sv_waypointsprite_deployed_lifetime;
        waypointsprite_deadlifetime = autocvar_sv_waypointsprite_deadlifetime;
 }
+
 void WaypointSprite_InitClient(entity e)
 {
 }
@@ -168,12 +174,12 @@ void WaypointSprite_Think()
 {
        float doremove;
 
-       doremove = FALSE;
+       doremove = false;
 
        if(self.fade_time)
        {
                if(time >= self.teleport_time)
-                       doremove = TRUE;
+                       doremove = true;
        }
 
        if(self.exteriormodeltoclient)
@@ -190,18 +196,18 @@ float WaypointSprite_visible_for_player(entity e)
        // personal waypoints
        if(self.enemy)
                if(self.enemy != e)
-                       return FALSE;
+                       return false;
 
        // team waypoints
        if(self.team && self.rule == SPRITERULE_DEFAULT)
        {
                if(self.team != e.team)
-                       return FALSE;
+                       return false;
                if (!IS_PLAYER(e))
-                       return FALSE;
+                       return false;
        }
 
-       return TRUE;
+       return true;
 }
 
 entity WaypointSprite_getviewentity(entity e)
@@ -220,14 +226,14 @@ float WaypointSprite_isteammate(entity e, entity e2)
        if(teamplay)
        {
                if(e2.team != e.team)
-                       return FALSE;
+                       return false;
        }
        else
        {
                if(e2 != e)
-                       return FALSE;
+                       return false;
        }
-       return TRUE;
+       return true;
 }
 
 float WaypointSprite_Customize()
@@ -239,7 +245,7 @@ float WaypointSprite_Customize()
        e = WaypointSprite_getviewentity(other);
 
        if(MUTATOR_CALLHOOK(CustomizeWaypoint))
-               return FALSE;
+               return false;
 
        return self.waypointsprite_visible_for_player(e);
 }
@@ -276,9 +282,9 @@ float WaypointSprite_SendEntity(entity to, float sendflags)
 
        if(sendflags & 64)
        {
-               WriteCoord(MSG_ENTITY, self.origin_x);
-               WriteCoord(MSG_ENTITY, self.origin_y);
-               WriteCoord(MSG_ENTITY, self.origin_z);
+               WriteCoord(MSG_ENTITY, self.origin.x);
+               WriteCoord(MSG_ENTITY, self.origin.y);
+               WriteCoord(MSG_ENTITY, self.origin.z);
        }
 
        if(sendflags & 1)
@@ -313,9 +319,9 @@ float WaypointSprite_SendEntity(entity to, float sendflags)
        if(sendflags & 32)
        {
                WriteByte(MSG_ENTITY, self.cnt); // icon on radar
-               WriteByte(MSG_ENTITY, self.colormod_x * 255.0);
-               WriteByte(MSG_ENTITY, self.colormod_y * 255.0);
-               WriteByte(MSG_ENTITY, self.colormod_z * 255.0);
+               WriteByte(MSG_ENTITY, self.colormod.x * 255.0);
+               WriteByte(MSG_ENTITY, self.colormod.y * 255.0);
+               WriteByte(MSG_ENTITY, self.colormod.z * 255.0);
 
                if(WaypointSprite_isteammate(self.owner, WaypointSprite_getviewentity(to)))
                {
@@ -330,7 +336,7 @@ float WaypointSprite_SendEntity(entity to, float sendflags)
                        WriteByte(MSG_ENTITY, 0);
        }
 
-       return TRUE;
+       return true;
 }
 
 void WaypointSprite_Reset()
@@ -343,7 +349,7 @@ void WaypointSprite_Reset()
 
 entity WaypointSprite_Spawn(
        string spr, // sprite
-       float lifetime, float maxdistance, // lifetime, max distance
+       float _lifetime, float maxdistance, // lifetime, max distance
        entity ref, vector ofs, // position
        entity showto, float t, // show to whom? Use a flag to indicate a team
        entity own, .entity ownfield, // remove when own gets killed
@@ -354,8 +360,8 @@ entity WaypointSprite_Spawn(
        entity wp;
        wp = spawn();
        wp.classname = "sprite_waypoint";
-       wp.teleport_time = time + lifetime;
-       wp.fade_time = lifetime;
+       wp.teleport_time = time + _lifetime;
+       wp.fade_time = _lifetime;
        wp.exteriormodeltoclient = ref;
        if(ref)
        {
@@ -384,7 +390,7 @@ entity WaypointSprite_Spawn(
        wp.reset2 = WaypointSprite_Reset;
        wp.cnt = icon;
        wp.colormod = rgb;
-       Net_LinkEntity(wp, FALSE, 0, WaypointSprite_SendEntity);
+       Net_LinkEntity(wp, false, 0, WaypointSprite_SendEntity);
        return wp;
 }
 
@@ -396,10 +402,9 @@ entity WaypointSprite_SpawnFixed(
        float icon, vector rgb // initial icon and color
 )
 {
-       return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, own, ownfield, TRUE, icon, rgb);
+       return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, own, ownfield, true, icon, rgb);
 }
 
-.entity waypointsprite_deployed_fixed;
 entity WaypointSprite_DeployFixed(
        string spr,
        float limited_range,
@@ -416,21 +421,18 @@ entity WaypointSprite_DeployFixed(
                maxdistance = waypointsprite_limitedrange;
        else
                maxdistance = 0;
-       return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, world, ofs, world, t, self, waypointsprite_deployed_fixed, FALSE, icon, rgb);
+       return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, world, ofs, world, t, self, waypointsprite_deployed_fixed, false, icon, rgb);
 }
 
-.entity waypointsprite_deployed_personal;
 entity WaypointSprite_DeployPersonal(
        string spr,
        vector ofs,
        float icon, vector rgb // initial icon and color
 )
 {
-       return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, self, waypointsprite_deployed_personal, FALSE, icon, rgb);
+       return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, self, waypointsprite_deployed_personal, false, icon, rgb);
 }
 
-.entity waypointsprite_attached;
-.entity waypointsprite_attachedforcarrier;
 entity WaypointSprite_Attach(
        string spr,
        float limited_range,
@@ -448,7 +450,7 @@ entity WaypointSprite_Attach(
                maxdistance = waypointsprite_limitedrange;
        else
                maxdistance = 0;
-       return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, self, '0 0 64', world, t, self, waypointsprite_attached, FALSE, icon, rgb);
+       return WaypointSprite_Spawn(spr, waypointsprite_deployed_lifetime, maxdistance, self, '0 0 64', world, t, self, waypointsprite_attached, false, icon, rgb);
 }
 
 entity WaypointSprite_AttachCarrier(
@@ -459,7 +461,7 @@ entity WaypointSprite_AttachCarrier(
 {
        entity e;
        WaypointSprite_Kill(carrier.waypointsprite_attached); // FC overrides attached
-       e = WaypointSprite_Spawn(spr, 0, 0, carrier, '0 0 64', world, carrier.team, carrier, waypointsprite_attachedforcarrier, FALSE, icon, rgb);
+       e = WaypointSprite_Spawn(spr, 0, 0, carrier, '0 0 64', world, carrier.team, carrier, waypointsprite_attachedforcarrier, false, icon, rgb);
        if(e)
        {
                WaypointSprite_UpdateMaxHealth(e, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON) * 2);
diff --git a/qcsrc/server/waypointsprites.qh b/qcsrc/server/waypointsprites.qh
new file mode 100644 (file)
index 0000000..430e583
--- /dev/null
@@ -0,0 +1,113 @@
+#ifndef SERVER_WAYPOINTSPRITES_H
+#define SERVER_WAYPOINTSPRITES_H
+
+..entity owned_by_field;
+.float rule;
+.string model1;
+.string model2;
+.string model3;
+
+.float(entity) waypointsprite_visible_for_player;
+
+void WaypointSprite_UpdateSprites(entity e, string m1, string m2, string m3);
+
+void WaypointSprite_UpdateHealth(entity e, float f);
+
+void WaypointSprite_UpdateMaxHealth(entity e, float f);
+
+void WaypointSprite_UpdateBuildFinished(entity e, float f);
+
+void WaypointSprite_UpdateOrigin(entity e, vector o);
+
+void WaypointSprite_UpdateRule(entity e, float t, float r);
+
+void WaypointSprite_UpdateTeamRadar(entity e, float icon, vector col);
+
+.float waypointsprite_pingtime;
+.float waypointsprite_helpmetime;
+void WaypointSprite_Ping(entity e);
+
+float waypointsprite_limitedrange, waypointsprite_deployed_lifetime, waypointsprite_deadlifetime;
+
+void WaypointSprite_HelpMePing(entity e);
+
+void WaypointSprite_FadeOutIn(entity e, float t);
+
+void WaypointSprite_Init();
+void WaypointSprite_InitClient(entity e);
+
+void WaypointSprite_Kill(entity wp);
+
+void WaypointSprite_Disown(entity wp, float fadetime);
+
+void WaypointSprite_Think();
+
+float WaypointSprite_visible_for_player(entity e);
+
+entity WaypointSprite_getviewentity(entity e);
+
+float WaypointSprite_isteammate(entity e, entity e2);
+
+float WaypointSprite_Customize();
+
+float WaypointSprite_SendEntity(entity to, float sendflags);
+
+void WaypointSprite_Reset();
+
+entity WaypointSprite_Spawn(
+       string spr, // sprite
+       float lifetime, float maxdistance, // lifetime, max distance
+       entity ref, vector ofs, // position
+       entity showto, float t, // show to whom? Use a flag to indicate a team
+       entity own, .entity ownfield, // remove when own gets killed
+       float hideable, // true when it should be controlled by cl_hidewaypoints
+       float icon, vector rgb // initial icon and color
+);
+
+entity WaypointSprite_SpawnFixed(
+       string spr,
+       vector ofs,
+       entity own,
+       .entity ownfield,
+       float icon, vector rgb // initial icon and color
+);
+
+.entity waypointsprite_deployed_fixed;
+entity WaypointSprite_DeployFixed(
+       string spr,
+       float limited_range,
+       vector ofs,
+       float icon, vector rgb // initial icon and color
+);
+
+.entity waypointsprite_deployed_personal;
+entity WaypointSprite_DeployPersonal(
+       string spr,
+       vector ofs,
+       float icon, vector rgb // initial icon and color
+);
+
+.entity waypointsprite_attached;
+.entity waypointsprite_attachedforcarrier;
+entity WaypointSprite_Attach(
+       string spr,
+       float limited_range,
+       float icon, vector rgb // initial icon and color
+);
+
+entity WaypointSprite_AttachCarrier(
+       string spr,
+       entity carrier,
+       float icon, vector rgb // initial icon and color
+);
+
+void WaypointSprite_DetachCarrier(entity carrier);
+
+void WaypointSprite_ClearPersonal();
+
+void WaypointSprite_ClearOwned();
+
+void WaypointSprite_PlayerDead();
+
+void WaypointSprite_PlayerGone();
+#endif
index 98929b1a1cc2eef95755e6b5b796a56fbfe060d3..2557d10d1599d1a3eec2a32457387b4f84048841 100644 (file)
@@ -1,3 +1,18 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/util.qh"
+    #include "../../common/weapons/weapons.qh"
+    #include "accuracy.qh"
+    #include "../autocvars.qh"
+    #include "../constants.qh"
+    #include "../defs.qh"
+    #include "../mutators/mutators_include.qh"
+#endif
+
 float accuracy_byte(float n, float d)
 {
        //printf("accuracy: %d / %d\n", n, d);
@@ -8,9 +23,9 @@ float accuracy_byte(float n, float d)
        return 1 + rint(n * 100.0 / d);
 }
 
-float accuracy_send(entity to, float sf)
+float accuracy_send(entity to, int sf)
 {
-       float w, f;
+       int w, f;
        entity a;
        WriteByte(MSG_ENTITY, ENT_CLIENT_ACCURACY);
 
@@ -25,7 +40,7 @@ float accuracy_send(entity to, float sf)
        // note: zero sendflags can never be sent... so we can use that to say that we send no accuracy!
        WriteInt24_t(MSG_ENTITY, sf);
        if(sf == 0)
-               return TRUE;
+               return true;
        // note: we know that client and server agree about SendFlags...
        for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w)
        {
@@ -36,7 +51,7 @@ float accuracy_send(entity to, float sf)
                else
                        f *= 2;
        }
-       return TRUE;
+       return true;
 }
 
 // init/free
@@ -46,7 +61,7 @@ void accuracy_init(entity e)
        e.accuracy.owner = e;
        e.accuracy.classname = "accuracy";
        e.accuracy.drawonlytoclient = e;
-       Net_LinkEntity(e.accuracy, FALSE, 0, accuracy_send);
+       Net_LinkEntity(e.accuracy, false, 0, accuracy_send);
 }
 
 void accuracy_free(entity e)
@@ -64,7 +79,7 @@ void accuracy_resend(entity e)
 .float hit_time;
 .float fired_time;
 
-void accuracy_add(entity e, float w, float fired, float hit)
+void accuracy_add(entity e, int w, float fired, float hit)
 {
        entity a;
        float b;
@@ -113,13 +128,13 @@ float accuracy_isgooddamage(entity attacker, entity targ)
        if(!targ.frozen)
        if(mutator_check == MUT_ACCADD_INVALID || (mutator_check == MUT_ACCADD_VALID && IS_CLIENT(targ)))
        if(DIFF_TEAM(attacker, targ))
-               return TRUE;
-       return FALSE;
+               return true;
+       return false;
 }
 
 float accuracy_canbegooddamage(entity attacker)
 {
        if(!warmup_stage)
-               return TRUE;
-       return FALSE;
+               return true;
+       return false;
 }
index 4cd43ee8addd1aff66c3e4fc921ad323f0876fbc..03f002f6a9fd59d8576de2050ab60c0dc2aa96d0 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef ACCURACY_H
+#define ACCURACY_H
+
 .float cvar_cl_accuracy_data_share;
 .float cvar_cl_accuracy_data_receive;
 
@@ -23,3 +26,4 @@ void accuracy_add(entity e, float w, float fired, float hit);
 // helper
 float accuracy_isgooddamage(entity attacker, entity targ);
 float accuracy_canbegooddamage(entity attacker);
+#endif
index 6e54cb0601a89df25175edb1a90fa1c44af6cd74..c37fce0ab878a2af37b1963a4c42f1cef229398e 100644 (file)
@@ -1,3 +1,17 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/util.qh"
+    #include "../../common/weapons/weapons.qh"
+    #include "common.qh"
+    #include "../t_items.qh"
+    #include "../autocvars.qh"
+    #include "../defs.qh"
+    #include "../../common/notifications.qh"
+    #include "../../common/deathtypes.qh"
+#endif
 
 void W_GiveWeapon (entity e, float wep)
 {
@@ -34,33 +48,33 @@ float W_CheckProjectileDamage(entity inflictor, entity projowner, float deathtyp
        float is_from_contents = (deathtype == DEATH_SLIME || deathtype == DEATH_LAVA);
        float is_from_owner = (inflictor == projowner);
        float is_from_exception = (exception != -1);
-       
+
        //dprint(strcat("W_CheckProjectileDamage: from_contents ", ftos(is_from_contents), " : from_owner ", ftos(is_from_owner), " : exception ", strcat(ftos(is_from_exception), " (", ftos(exception), "). \n")));
 
        if(autocvar_g_projectiles_damage <= -2)
        {
-               return FALSE; // no damage to projectiles at all, not even with the exceptions
+               return false; // no damage to projectiles at all, not even with the exceptions
        }
        else if(autocvar_g_projectiles_damage == -1)
        {
                if(is_from_exception)
                        return (exception); // if exception is detected, allow it to override
                else
-                       return FALSE; // otherwise, no other damage is allowed
+                       return false; // otherwise, no other damage is allowed
        }
        else if(autocvar_g_projectiles_damage == 0)
        {
                if(is_from_exception)
                        return (exception); // if exception is detected, allow it to override
                else if(!is_from_contents)
-                       return FALSE; // otherwise, only allow damage from contents
-       }       
+                       return false; // otherwise, only allow damage from contents
+       }
        else if(autocvar_g_projectiles_damage == 1)
        {
                if(is_from_exception)
                        return (exception); // if exception is detected, allow it to override
                else if(!(is_from_contents || is_from_owner))
-                       return FALSE; // otherwise, only allow self damage and damage from contents
+                       return false; // otherwise, only allow self damage and damage from contents
        }
        else if(autocvar_g_projectiles_damage == 2) // allow any damage, but override for exceptions
        {
@@ -68,20 +82,20 @@ float W_CheckProjectileDamage(entity inflictor, entity projowner, float deathtyp
                        return (exception); // if exception is detected, allow it to override
        }
 
-       return TRUE; // if none of these return, then allow damage anyway.
+       return true; // if none of these return, then allow damage anyway.
 }
 
 void W_PrepareExplosionByDamage(entity attacker, void() explode)
 {
        self.takedamage = DAMAGE_NO;
        self.event_damage = func_null;
-       
+
        if(IS_CLIENT(attacker) && !autocvar_g_projectiles_keep_owner)
        {
                self.owner = attacker;
                self.realowner = attacker;
        }
-       
+
        // do not explode NOW but in the NEXT FRAME!
        // because recursive calls to RadiusDamage are not allowed
        self.nextthink = time;
index 8f9454ed541b748d8bdb1350e6def24091c7cb36..341f4ff354b44816b7079be2007da282c01fb441 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef WEAPONS_COMMON_H
+#define WEAPONS_COMMON_H
 
 void W_GiveWeapon (entity e, float wep);
 .float prevstrengthsound;
@@ -5,3 +7,4 @@ void W_GiveWeapon (entity e, float wep);
 void W_PlayStrengthSound(entity player);
 float W_CheckProjectileDamage(entity inflictor, entity projowner, float deathtype, float exception);
 void W_PrepareExplosionByDamage(entity attacker, void() explode);
+#endif
index 3dd93c0581a3433a4a16a37bfb75f5438f7a253b..773b7f085bea4e9c275501429895d251d176fca6 100644 (file)
@@ -1,6 +1,19 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/weapons/weapons.qh"
+    #include "csqcprojectile.qh"
+    #include "../t_items.qh"
+    #include "../constants.qh"
+    #include "../defs.qh"
+    #include "../command/common.qh"
+#endif
+
 .float csqcprojectile_type;
 
-float CSQCProjectile_SendEntity(entity to, float sf)
+float CSQCProjectile_SendEntity(entity to, int sf)
 {
        float ft, fr;
 
@@ -30,15 +43,15 @@ float CSQCProjectile_SendEntity(entity to, float sf)
 
        if(sf & 1)
        {
-               WriteCoord(MSG_ENTITY, self.origin_x);
-               WriteCoord(MSG_ENTITY, self.origin_y);
-               WriteCoord(MSG_ENTITY, self.origin_z);
+               WriteCoord(MSG_ENTITY, self.origin.x);
+               WriteCoord(MSG_ENTITY, self.origin.y);
+               WriteCoord(MSG_ENTITY, self.origin.z);
 
                if(sf & 0x80)
                {
-                       WriteCoord(MSG_ENTITY, self.velocity_x);
-                       WriteCoord(MSG_ENTITY, self.velocity_y);
-                       WriteCoord(MSG_ENTITY, self.velocity_z);
+                       WriteCoord(MSG_ENTITY, self.velocity.x);
+                       WriteCoord(MSG_ENTITY, self.velocity.y);
+                       WriteCoord(MSG_ENTITY, self.velocity.z);
                        if(sf & 0x10)
                                WriteCoord(MSG_ENTITY, self.gravity);
                }
@@ -68,7 +81,7 @@ void CSQCProjectile_Check(entity e)
        e.csqcprojectile_oldorigin = e.origin;
 }
 
-void CSQCProjectile(entity e, float clientanimate, float type, float docull)
+void CSQCProjectile(entity e, float clientanimate, int type, float docull)
 {
        Net_LinkEntity(e, docull, 0, CSQCProjectile_SendEntity);
 
index e00c0988b9d8c058b1d2b277048b3edbd7d2dd38..c2ecc3e4d45cd9d9b4e03a810121739ebcabb239 100644 (file)
@@ -1,6 +1,10 @@
+#ifndef CSQCPROJECTILE_H
+#define CSQCPROJECTILE_H
+
 .float csqcprojectile_clientanimate;
 
 void CSQCProjectile(entity e, float clientanimate, float type, float docull);
 void UpdateCSQCProjectile(entity e);
 void UpdateCSQCProjectileAfterTeleport(entity e);
 void CSQCProjectile_Check(entity e);
+#endif
index 685741dabc0cf4be042412decea63555fe344ca7..ec1004cd1dfc2c57d24545332853b7e030954499 100644 (file)
@@ -1,9 +1,21 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../common/weapons/weapons.qh"
+    #include "hitplot.qh"
+    #include "../autocvars.qh"
+    #include "../defs.qh"
+    #include "../antilag.qh"
+#endif
+
 vector W_HitPlotUnnormalizedUntransform(vector screenforward, vector screenright, vector screenup, vector v)
 {
        vector ret;
-       ret_x = screenright * v;
-       ret_y = screenup * v;
-       ret_z = screenforward * v;
+       ret.x = screenright * v;
+       ret.y = screenup * v;
+       ret.z = screenforward * v;
        return ret;
 }
 
@@ -20,14 +32,14 @@ vector W_HitPlotNormalizedUntransform(vector org, entity targ, vector screenforw
        for(i = 0; i < 2; ++i) for(j = 0; j < 2; ++j) for(k = 0; k < 2; ++k)
        {
                thisv = targ.origin;
-               if(i) thisv_x += targ.maxs_x; else thisv_x += targ.mins_x;
-               if(j) thisv_y += targ.maxs_y; else thisv_y += targ.mins_y;
-               if(k) thisv_z += targ.maxs_z; else thisv_z += targ.mins_z;
+               if(i) thisv.x += targ.maxs.x; else thisv.x += targ.mins.x;
+               if(j) thisv.y += targ.maxs.y; else thisv.y += targ.mins.y;
+               if(k) thisv.z += targ.maxs.z; else thisv.z += targ.mins.z;
                thisv = W_HitPlotUnnormalizedUntransform(screenforward, screenright, screenup, thisv);
                if(i || j || k)
                {
-                       if(mi_x > thisv_x) mi_x = thisv_x; if(ma_x < thisv_x) ma_x = thisv_x;
-                       if(mi_y > thisv_y) mi_y = thisv_y; if(ma_y < thisv_y) ma_y = thisv_y;
+                       if(mi.x > thisv.x) mi.x = thisv.x; if(ma.x < thisv.x) ma.x = thisv.x;
+                       if(mi.y > thisv.y) mi.y = thisv.y; if(ma.y < thisv.y) ma.y = thisv.y;
                        //if(mi_z > thisv_z) mi_z = thisv_z; if(ma_z < thisv_z) ma_y = thisv_z;
                }
                else
@@ -38,9 +50,9 @@ vector W_HitPlotNormalizedUntransform(vector org, entity targ, vector screenforw
        }
 
        thisv = W_HitPlotUnnormalizedUntransform(screenforward, screenright, screenup, v);
-       ret_x = (thisv_x - mi_x) / (ma_x - mi_x);
-       ret_y = (thisv_y - mi_y) / (ma_y - mi_y);
-       ret_z = thisv_z - myv_z;
+       ret.x = (thisv.x - mi.x) / (ma.x - mi.x);
+       ret.y = (thisv.y - mi.y) / (ma.y - mi.y);
+       ret.z = thisv.z - myv.z;
        return ret;
 }
 
@@ -65,7 +77,7 @@ void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright,
                        antilag_takeback(trace_ent, time - lag);
                        hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);
                        antilag_restore(trace_ent);
-                       fputs(player.hitplotfh, strcat(ftos(hitplot_x), " ", ftos(hitplot_y), " ", ftos(hitplot_z), " ", ftos(player.switchweapon), "\n"));
+                       fputs(player.hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(player.switchweapon), "\n"));
                        //print(strcat(ftos(hitplot_x), " ", ftos(hitplot_y), " ", ftos(hitplot_z), "\n"));
                }
        }
index 9bc8ff30394233183872630df7f5ba5176996a6e..3b111f1c5433d382e38a0116b49309b65ab79347 100644 (file)
@@ -1,5 +1,9 @@
+#ifndef HITPLOT_H
+#define HITPLOT_H
+
 .float hitplotfh;
 
 void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright, vector screenup);
 void W_HitPlotOpen(entity player);
 void W_HitPlotClose(entity player);
+#endif
index f7f3cde51230e2af87ee885741e67be068b7473d..5ea0a5d9d842c8690cdf979cd7a9c717e5439477 100644 (file)
@@ -1,3 +1,18 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/util.qh"
+    #include "../../common/weapons/weapons.qh"
+    #include "selection.qh"
+    #include "weaponsystem.qh"
+    #include "../t_items.qh"
+    #include "../autocvars.qh"
+    #include "../defs.qh"
+#endif
+
 // switch between weapons
 void Send_WeaponComplain(entity e, float wpn, float type)
 {
@@ -18,7 +33,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
 
        if(wpn == WEP_HOOK && !g_grappling_hook && autocvar_g_nades && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn)))
                complain = 0;
-               
+
        if(complain)
                self.hasweapon_complain_spam = time + 0.2;
 
@@ -26,7 +41,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
        {
                if (complain)
                        sprint(self, "Invalid weapon\n");
-               return FALSE;
+               return false;
        }
        if (cl.weapons & WepSet_FromWeapon(wpn))
        {
@@ -59,10 +74,10 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
                                        play2(cl, "weapons/unavailable.wav");
                                        Send_WeaponComplain (cl, wpn, 0);
                                }
-                               return FALSE;
+                               return false;
                        }
                }
-               return TRUE;
+               return true;
        }
        if (complain)
        {
@@ -85,7 +100,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
                                        WaypointSprite_Spawn(
                                                (get_weaponinfo(wpn)).wpmodel,
                                                1, 0,
-                                               world, e.origin + ('0 0 1' * e.maxs_z) * 1.2,
+                                               world, e.origin + ('0 0 1' * e.maxs.z) * 1.2,
                                                self, 0,
                                                world, enemy,
                                                0,
@@ -101,15 +116,14 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
 
                play2(cl, "weapons/unavailable.wav");
        }
-       return FALSE;
+       return false;
 }
 
 float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain, float skipmissing)
 {
        // We cannot tokenize in this function, as GiveItems calls this
        // function. Thus we must use car/cdr.
-       float weaponwant, first_valid, prev_valid, switchtonext, switchtolast, c;
-       string rest;
+       float weaponwant, first_valid, prev_valid, switchtonext, switchtolast;
        WepSet wepset = '0 0 0';
        switchtonext = switchtolast = 0;
        first_valid = prev_valid = 0;
@@ -124,9 +138,9 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
        if(dir == 0)
                switchtonext = 1;
 
-       c = 0;
+       int c = 0;
 
-       rest = weaponorder;
+       string rest = weaponorder;
        while(rest != "")
        {
                weaponwant = stof(car(rest)); rest = cdr(rest);
@@ -136,13 +150,13 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
                if(wep.impulse != imp)
                        continue;
 
-               float i, have_other = FALSE;
+               float i, have_other = false;
                for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                {
                        if(i != weaponwant)
                        if((get_weaponinfo(i)).impulse == imp || imp < 0)
                        if((pl.weapons & WepSet_FromWeapon(i)) || (weaponsInMap & WepSet_FromWeapon(i)))
-                               have_other = TRUE;
+                               have_other = true;
                }
 
                // skip weapons we don't own that aren't normal and aren't in the map
@@ -153,7 +167,7 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
 
                ++c;
 
-               if(!skipmissing || client_hasweapon(pl, weaponwant, TRUE, FALSE))
+               if(!skipmissing || client_hasweapon(pl, weaponwant, true, false))
                {
                        if(switchtonext)
                                return weaponwant;
@@ -193,13 +207,13 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
                                if(wep.impulse != imp)
                                        continue;
 
-                       float i, have_other = FALSE;
+                       float i, have_other = false;
                        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                        {
                                if(i != weaponwant)
                                if((get_weaponinfo(i)).impulse == imp || imp < 0)
                                if((pl.weapons & WepSet_FromWeapon(i)) || (weaponsInMap & WepSet_FromWeapon(i)))
-                                       have_other = TRUE;
+                                       have_other = true;
                        }
 
                        // skip weapons we don't own that aren't normal and aren't in the map
@@ -211,7 +225,7 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
                        --c;
                        if(c == 0)
                        {
-                               client_hasweapon(pl, weaponwant, TRUE, TRUE);
+                               client_hasweapon(pl, weaponwant, true, true);
                                break;
                        }
                }
@@ -248,7 +262,7 @@ void W_SwitchWeapon(float imp)
 {
        if (self.switchweapon != imp)
        {
-               if (client_hasweapon(self, imp, TRUE, TRUE))
+               if (client_hasweapon(self, imp, true, true))
                        W_SwitchWeapon_Force(self, imp);
                else
                        self.selectweapon = imp; // update selectweapon ANYWAY
@@ -259,7 +273,7 @@ void W_SwitchWeapon(float imp)
 void W_CycleWeapon(string weaponorder, float dir)
 {
        float w;
-       w = W_GetCycleWeapon(self, weaponorder, dir, -1, 1, TRUE);
+       w = W_GetCycleWeapon(self, weaponorder, dir, -1, 1, true);
        if(w > 0)
                W_SwitchWeapon(w);
 }
@@ -297,7 +311,7 @@ void W_PreviousWeapon(float list)
 // previously used if exists and has ammo, (second) best otherwise
 void W_LastWeapon(void)
 {
-       if(client_hasweapon(self, self.cnt, TRUE, FALSE))
+       if(client_hasweapon(self, self.cnt, true, false))
                W_SwitchWeapon(self.cnt);
        else
                W_SwitchToOtherWeapon(self);
index 8e2937f0ca98c859b36614a9a9950e918f673827..69f644c70a0f1e65dde06150f69d03996a762be7 100644 (file)
@@ -1,13 +1,16 @@
+#ifndef SELECTION_H
+#define SELECTION_H
+
 // switch between weapons
 void Send_WeaponComplain(entity e, float wpn, float type);
 
 .float hasweapon_complain_spam;
 float client_hasweapon(entity cl, float wpn, float andammo, float complain);
 
-.float weaponcomplainindex;
+.int weaponcomplainindex;
 float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain, float skipmissing);
 
-#define w_getbestweapon(ent) W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, FALSE, TRUE)
+#define w_getbestweapon(ent) W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, false, true)
 
 void W_SwitchWeapon_Force(entity e, float w);
 
@@ -27,3 +30,4 @@ void W_PreviousWeapon(float list);
 
 // previously used if exists and has ammo, (second) best otherwise
 void W_LastWeapon(void);
+#endif
index 04dd3f6f236efce1f44ddb2cd5ba52e9556d2b7b..ea62fcf19eba9c05d08169e827357b879ef3ba9a 100644 (file)
@@ -1,3 +1,18 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../common/weapons/weapons.qh"
+    #include "spawning.qh"
+    #include "weaponsystem.qh"
+    #include "../t_items.qh"
+    #include "../autocvars.qh"
+    #include "../constants.qh"
+    #include "../defs.qh"
+    #include "../mutators/mutators_include.qh"
+#endif
+
 string W_Apply_Weaponreplace(string in)
 {
        float n = tokenize_console(in);
@@ -8,7 +23,7 @@ string W_Apply_Weaponreplace(string in)
        {
                replacement = "";
                s = argv(i);
-               
+
                for(j = WEP_FIRST; j <= WEP_LAST; ++j)
                {
                        e = get_weaponinfo(j);
@@ -33,7 +48,7 @@ void weapon_defaultspawnfunc(float wpn)
        string s;
        entity oldself;
        float i, j;
-       float f;
+       int f;
 
        if(self.classname != "droppedweapon" && self.classname != "replacedweapon")
        {
@@ -42,7 +57,7 @@ void weapon_defaultspawnfunc(float wpn)
                if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
                {
                        objerror("Attempted to spawn a mutator-blocked weapon rejected");
-                       startitem_failed = TRUE;
+                       startitem_failed = true;
                        return;
                }
 
@@ -54,7 +69,7 @@ void weapon_defaultspawnfunc(float wpn)
                if(s == "")
                {
                        remove(self);
-                       startitem_failed = TRUE;
+                       startitem_failed = true;
                        return;
                }
                t = tokenize_console(s);
@@ -105,7 +120,7 @@ void weapon_defaultspawnfunc(float wpn)
                if(wpn == 0)
                {
                        remove(self);
-                       startitem_failed = TRUE;
+                       startitem_failed = true;
                        return;
                }
        }
@@ -161,7 +176,7 @@ void weapon_defaultspawnfunc(float wpn)
 
        // pickup anyway
        if(g_pickup_weapons_anyway)
-               self.pickup_anyway = TRUE;
+               self.pickup_anyway = true;
 
        f = FL_WEAPON;
 
index c6939e53af268a791e88f29411190442f46e24cb..e9cfad94eb31e83bf5713f624aebfd582d5bbe9e 100644 (file)
@@ -1,3 +1,7 @@
+#ifndef SPAWNING_H
+#define SPAWNING_H
+
 string W_Apply_Weaponreplace(string in);
 
 void weapon_defaultspawnfunc(float wpn);
+#endif
index 552f0355789bd91771f9b710103f01de5154d5aa..6b47a88227fb65a344588de7a96a3459e5e76c73 100644 (file)
@@ -1,3 +1,21 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../common/util.qh"
+    #include "../../common/weapons/weapons.qh"
+    #include "throwing.qh"
+    #include "weaponsystem.qh"
+    #include "../t_items.qh"
+    #include "../autocvars.qh"
+    #include "../constants.qh"
+    #include "../defs.qh"
+    #include "../../common/notifications.qh"
+    #include "../mutators/mutators_include.qh"
+    #include "../../common/mapinfo.qh"
+#endif
+
 void thrown_wep_think()
 {
        self.nextthink = time;
@@ -32,7 +50,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
        wep.owner = wep.enemy = own;
        wep.flags |= FL_TOSSED;
        wep.colormap = own.colormap;
-       
+
        W_DropEvent(WR_DROP,own,wpn,wep);
 
        if(WepSet_FromWeapon(wpn) & WEPSET_SUPERWEAPONS)
@@ -73,8 +91,8 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
        wep.think = thrown_wep_think;
        wep.savenextthink = wep.nextthink;
        wep.nextthink = min(wep.nextthink, time + 0.5);
-       wep.pickup_anyway = TRUE; // these are ALWAYS pickable
-       
+       wep.pickup_anyway = true; // these are ALWAYS pickable
+
        //wa = W_AmmoItemCode(wpn);
        if(ammotype == ammo_none)
        {
@@ -176,7 +194,7 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce)
 
        W_SwitchWeapon_Force(self, w_getbestweapon(self));
        a = W_ThrowNewWeapon(self, w, doreduce, self.origin + delta, velo);
-       
+
        if(!a) return;
        Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_WEAPON_DROP, a, w);
 }
@@ -185,5 +203,5 @@ void SpawnThrownWeapon(vector org, float w)
 {
        if(self.weapons & WepSet_FromWeapon(self.weapon))
                if(W_IsWeaponThrowable(self.weapon))
-                       W_ThrowNewWeapon(self, self.weapon, FALSE, org, randomvec() * 125 + '0 0 200');
+                       W_ThrowNewWeapon(self, self.weapon, false, org, randomvec() * 125 + '0 0 200');
 }
index c09a8f88296c4da90d6743e686d960513f5692be..4994d02aed20a467aed1c6e5500648493d5f7c73 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef THROWING_H
+#define THROWING_H
+
 .float savenextthink;
 void thrown_wep_think();
 
@@ -10,3 +13,4 @@ float W_IsWeaponThrowable(float w);
 void W_ThrowWeapon(vector velo, vector delta, float doreduce);
 
 void SpawnThrownWeapon(vector org, float w);
+#endif
index 55e6d5415e154bf583c1f5892c485a336aea40b8..c3532d3d67a4cf29bde6541827acb005189ca8f0 100644 (file)
@@ -1,3 +1,18 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../warpzonelib/common.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/util.qh"
+    #include "../../common/weapons/weapons.qh"
+    #include "tracing.qh"
+    #include "../autocvars.qh"
+    #include "../defs.qh"
+    #include "../antilag.qh"
+#endif
+
 // this function calculates w_shotorg and w_shotdir based on the weapon model
 // offset, trueaim and antilag, and won't put w_shotorg inside a wall.
 // make sure you call makevectors first (FIXME?)
@@ -37,31 +52,31 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
 
        W_HitPlotAnalysis(ent, v_forward, v_right, v_up);
 
-       if(ent.weaponentity.movedir_x > 0)
+       if(ent.weaponentity.movedir.x > 0)
                vecs = ent.weaponentity.movedir;
        else
                vecs = '0 0 0';
 
-       dv = v_right * -vecs_y + v_up * vecs_z;
+       dv = v_right * -vecs.y + v_up * vecs.z;
        w_shotorg = ent.origin + ent.view_ofs + dv;
 
        // now move the shotorg forward as much as requested if possible
        if(antilag)
        {
                if(ent.antilag_debug)
-                       tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent, ent.antilag_debug);
+                       tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs.x + nudge), MOVE_NORMAL, ent, ent.antilag_debug);
                else
-                       tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent, ANTILAG_LATENCY(ent));
+                       tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs.x + nudge), MOVE_NORMAL, ent, ANTILAG_LATENCY(ent));
        }
        else
-               tracebox(w_shotorg, mi, ma, w_shotorg + v_forward * (vecs_x + nudge), MOVE_NORMAL, ent);
+               tracebox(w_shotorg, mi, ma, w_shotorg + v_forward * (vecs.x + nudge), MOVE_NORMAL, ent);
        w_shotorg = trace_endpos - v_forward * nudge;
        // calculate the shotdir from the chosen shotorg
        w_shotdir = normalize(w_shotend - w_shotorg);
 
        //vector prevdir = w_shotdir;
        //vector prevorg = w_shotorg;
-       //vector prevend = w_shotend; 
+       //vector prevend = w_shotend;
 
        if (antilag)
        if (!ent.cvar_cl_noantilag)
@@ -146,7 +161,7 @@ void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float p
                error("Unowned missile");
 
        dir = dir + upDir * (pUpSpeed / pSpeed);
-       dir_z += pZSpeed / pSpeed;
+       dir.z += pZSpeed / pSpeed;
        pSpeed *= vlen(dir);
        dir = normalize(dir);
 
@@ -158,9 +173,9 @@ void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float p
        }
        mspercallsum -= gettime(GETTIME_HIRES);
        #endif
-       
+
        dir = W_CalculateSpread(dir, spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
-       
+
        #if 0
        mspercallsum += gettime(GETTIME_HIRES);
        mspercallcount += 1;
@@ -207,9 +222,9 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
        while (1)
        {
                if(self.antilag_debug)
-                       WarpZone_traceline_antilag (self, start, end, FALSE, o, self.antilag_debug);
+                       WarpZone_traceline_antilag (self, start, end, false, o, self.antilag_debug);
                else
-                       WarpZone_traceline_antilag (self, start, end, FALSE, o, ANTILAG_LATENCY(self));
+                       WarpZone_traceline_antilag (self, start, end, false, o, ANTILAG_LATENCY(self));
                if(o && WarpZone_trace_firstzone)
                {
                        o = world;
@@ -224,7 +239,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
                        break;
 
                // make the entity non-solid so we can hit the next one
-               trace_ent.railgunhit = TRUE;
+               trace_ent.railgunhit = true;
                trace_ent.railgunhitloc = end;
                trace_ent.railgunhitsolidbackup = trace_ent.solid;
                trace_ent.railgundistance = vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos) - start);
@@ -243,12 +258,12 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
        endq3surfaceflags = trace_dphitq3surfaceflags;
 
        // find all the entities the railgun hit and restore their solid state
-       ent = findfloat(world, railgunhit, TRUE);
+       ent = findfloat(world, railgunhit, true);
        while (ent)
        {
                // restore their solid type
                ent.solid = ent.railgunhitsolidbackup;
-               ent = findfloat(ent, railgunhit, TRUE);
+               ent = findfloat(ent, railgunhit, true);
        }
 
        // spawn a temporary explosion entity for RadiusDamage calls
@@ -281,7 +296,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
        }
 
        // find all the entities the railgun hit and hurt them
-       ent = findfloat(world, railgunhit, TRUE);
+       ent = findfloat(world, railgunhit, true);
        while (ent)
        {
                // get the details we need to call the damage function
@@ -303,11 +318,11 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
 
                ent.railgunhitloc = '0 0 0';
                ent.railgunhitsolidbackup = SOLID_NOT;
-               ent.railgunhit = FALSE;
+               ent.railgunhit = false;
                ent.railgundistance = 0;
 
                // advance to the next entity
-               ent = findfloat(ent, railgunhit, TRUE);
+               ent = findfloat(ent, railgunhit, true);
        }
 
        // calculate hits and fired shots for hitscan
@@ -326,7 +341,7 @@ void fireBullet_trace_callback(vector start, vector hit, vector end)
        fireBullet_last_hit = world;
 }
 
-void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, float tracereffects)
+void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects)
 {
        vector  end;
 
@@ -366,7 +381,7 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
        for (;;)
        {
                // TODO also show effect while tracing
-               WarpZone_TraceBox_ThroughZone(start, '0 0 0', '0 0 0', end, FALSE, WarpZone_trace_forent, world, fireBullet_trace_callback);
+               WarpZone_TraceBox_ThroughZone(start, '0 0 0', '0 0 0', end, false, WarpZone_trace_forent, world, fireBullet_trace_callback);
                dir = WarpZone_TransformVelocity(WarpZone_trace_transform, dir);
                end = WarpZone_TransformOrigin(WarpZone_trace_transform, end);
                start = trace_endpos;
@@ -421,7 +436,7 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
 
                // go through solid!
                // outside the world? forget it
-               if(start_x > world.maxs_x || start_y > world.maxs_y || start_z > world.maxs_z || start_x < world.mins_x || start_y < world.mins_y || start_z < world.mins_z)
+               if(start.x > world.maxs.x || start.y > world.maxs.y || start.z > world.maxs.z || start.x < world.mins.x || start.y < world.mins.y || start.z < world.mins.z)
                        break;
 
                float maxdist;
@@ -441,7 +456,7 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
 
                // move the entity along its velocity until it's out of solid, then let it resume
                // The previously hit entity is ignored here!
-               traceline_inverted (start, start + dir * maxdist, MOVE_NORMAL, WarpZone_trace_forent, TRUE, hit);
+               traceline_inverted (start, start + dir * maxdist, MOVE_NORMAL, WarpZone_trace_forent, true, hit);
                if(trace_fraction == 1) // 1: we never got out of solid
                        break;
 
index 49605e8f2183a4fb694da3cb38e64c74b96e0268..1cab448cb087da8bd89bff9243cd6aebdcf78f37 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef TRACING_H
+#define TRACING_H
+
 vector w_shotorg;
 vector w_shotdir;
 vector w_shotend;
@@ -23,19 +26,19 @@ float mspercallcount;
 
 void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute);
 
-#define W_SetupProjVelocity_Basic(ent,pspeed,pspread) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, pspeed, 0, 0, pspread, FALSE)
+#define W_SetupProjVelocity_Basic(ent,pspeed,pspread) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, pspeed, 0, 0, pspread, false)
 
-#define W_SetupProjVelocity_UP_PRE(ent,wepname,prefix) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wepname, prefix##speed), WEP_CVAR(wepname, prefix##speed_up), WEP_CVAR(wepname, prefix##speed_z), WEP_CVAR(wepname, prefix##spread), FALSE)
-#define W_SetupProjVelocity_UP_PRI(ent,wepname) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wepname, speed), WEP_CVAR_PRI(wepname, speed_up), WEP_CVAR_PRI(wepname, speed_z), WEP_CVAR_PRI(wepname, spread), FALSE)
-#define W_SetupProjVelocity_UP_SEC(ent,wepname) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wepname, speed), WEP_CVAR_SEC(wepname, speed_up), WEP_CVAR_SEC(wepname, speed_z), WEP_CVAR_SEC(wepname, spread), FALSE)
+#define W_SetupProjVelocity_UP_PRE(ent,wepname,prefix) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wepname, prefix##speed), WEP_CVAR(wepname, prefix##speed_up), WEP_CVAR(wepname, prefix##speed_z), WEP_CVAR(wepname, prefix##spread), false)
+#define W_SetupProjVelocity_UP_PRI(ent,wepname) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wepname, speed), WEP_CVAR_PRI(wepname, speed_up), WEP_CVAR_PRI(wepname, speed_z), WEP_CVAR_PRI(wepname, spread), false)
+#define W_SetupProjVelocity_UP_SEC(ent,wepname) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wepname, speed), WEP_CVAR_SEC(wepname, speed_up), WEP_CVAR_SEC(wepname, speed_z), WEP_CVAR_SEC(wepname, spread), false)
 
 #define W_SetupProjVelocity_UP_BOTH(ent,wepname,isprimary) \
        if(isprimary) { W_SetupProjVelocity_UP_PRI(ent, wepname); } \
        else { W_SetupProjVelocity_UP_SEC(ent, wepname); }
 
-#define W_SetupProjVelocity_PRE(ent,wepname,prefix) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wepname, prefix##speed), 0, 0, WEP_CVAR(wepname, prefix##spread), FALSE)
-#define W_SetupProjVelocity_PRI(ent,wepname) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wepname, speed), 0, 0, WEP_CVAR_PRI(wepname, spread), FALSE)
-#define W_SetupProjVelocity_SEC(ent,wepname) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wepname, speed), 0, 0, WEP_CVAR_SEC(wepname, spread), FALSE)
+#define W_SetupProjVelocity_PRE(ent,wepname,prefix) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR(wepname, prefix##speed), 0, 0, WEP_CVAR(wepname, prefix##spread), false)
+#define W_SetupProjVelocity_PRI(ent,wepname) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_PRI(wepname, speed), 0, 0, WEP_CVAR_PRI(wepname, spread), false)
+#define W_SetupProjVelocity_SEC(ent,wepname) W_SetupProjVelocity_Explicit(ent, w_shotdir, v_up, WEP_CVAR_SEC(wepname, speed), 0, 0, WEP_CVAR_SEC(wepname, spread), false)
 
 #define W_SetupProjVelocity_BOTH(ent,wepname,isprimary) \
        if(isprimary) { W_SetupProjVelocity_PRI(ent, wepname); } \
@@ -52,4 +55,5 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
 float 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, float tracereffects);
+void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects);
+#endif
index d83db8b8228df092b2cced72964a41d54279d9d9..64fdc5bb30faddb767064c406780ec6758dcdd13 100644 (file)
@@ -1,3 +1,15 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+       #include "../../dpdefs/dpextensions.qh"
+       #include "../../common/urllib.qh"
+       #include "../../common/weapons/weapons.qh"
+       #include "weaponstats.qh"
+       #include "../autocvars.qh"
+       #include "../defs.qh"
+#endif
+
 void WeaponStats_Init()
 {
        weaponstats_buffer = ((autocvar_sv_weaponstats_file != "") ? buf_create() : -1);
@@ -14,11 +26,11 @@ void WeaponStats_ready(entity fh, entity pass, float status)
                        // we can write
                        prefix = strcat(autocvar_hostname, "\t", GetGametype(), "_", GetMapname(), "\t");
                        url_fputs(fh, "#begin statsfile\n");
-                       url_fputs(fh, strcat("#date ", strftime(TRUE, "%a %b %e %H:%M:%S %Z %Y"), "\n"));
+                       url_fputs(fh, strcat("#date ", strftime(true, "%a %b %e %H:%M:%S %Z %Y"), "\n"));
 #ifdef WATERMARK
                        url_fputs(fh, strcat("#version ", WATERMARK, "\n"));
 #endif
-                       url_fputs(fh, strcat("#config ", ftos(crc16(FALSE, cvar_purechanges)), "\n"));
+                       url_fputs(fh, strcat("#config ", ftos(crc16(false, cvar_purechanges)), "\n"));
                        url_fputs(fh, strcat("#cvar_purechanges ", ftos(cvar_purechanges_count), "\n"));
                        n = tokenizebyseparator(cvar_purechanges, "\n");
                        for(i = 0; i < n; ++i)
@@ -32,7 +44,7 @@ void WeaponStats_ready(entity fh, entity pass, float status)
                                        {
                                                //vector is: kills hits damage
                                                url_fputs(fh, sprintf("%s%d %d\t%d %d\t", prefix, i, ibot, j, jbot));
-                                               url_fputs(fh, sprintf("%d %d %g\n", v_x, v_y, v_z));
+                                               url_fputs(fh, sprintf("%d %d %g\n", v.x, v.y, v.z));
                                        }
                                }
                        url_fputs(fh, "#end\n\n");
index 08ae8dd0a53f56e5ba5bf19efc7f131057eec7d0..0018f190669d533d2397973adc80d66a7e3bc11f 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef WEAPONSTATS_H
+#define WEAPONSTATS_H
+
 float weaponstats_buffer;
 
 void WeaponStats_Init();
@@ -8,3 +11,4 @@ void WeaponStats_LogDamage(float awep, float abot, float vwep, float vbot, float
 void WeaponStats_LogKill(float awep, float abot, float vwep, float vbot);
 
 #define WEAPONSTATS_GETINDEX(awep,abot,vwep,vbot) (((vwep) + (awep) * (WEP_LAST - WEP_FIRST + 1) - (WEP_FIRST + WEP_FIRST * (WEP_LAST - WEP_FIRST + 1))) * 4 + (abot) * 2 + (vbot))
+#endif
index 25fce59a15f510d878355f0b084f2bf0be54bc03..ab85389c5c9dc675e84f4917e21a6c08cf47eb03 100644 (file)
@@ -1,3 +1,24 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../../dpdefs/progsdefs.qh"
+    #include "../../dpdefs/dpextensions.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/util.qh"
+    #include "../../common/animdecide.qh"
+    #include "../../common/monsters/monsters.qh"
+    #include "../../common/weapons/weapons.qh"
+    #include "weaponsystem.qh"
+    #include "../t_items.qh"
+    #include "../autocvars.qh"
+    #include "../defs.qh"
+    #include "../../common/notifications.qh"
+    #include "../mutators/mutators_include.qh"
+    #include "../command/common.qh"
+    #include "../../csqcmodellib/sv_model.qh"
+    #include "../round_handler.qh"
+#endif
+
 /*
 ===========================================================================
 
@@ -21,13 +42,6 @@ float W_WeaponRateFactor()
        return t;
 }
 
-// VorteX: static frame globals
-const float WFRAME_DONTCHANGE = -1;
-const float WFRAME_FIRE1 = 0;
-const float WFRAME_FIRE2 = 1;
-const float WFRAME_IDLE = 2;
-const float WFRAME_RELOAD = 3;
-.float wframe;
 
 void(float fr, float t, void() func) weapon_thinkf;
 
@@ -37,7 +51,7 @@ float CL_Weaponentity_CustomizeEntityForClient()
        if(IS_SPEC(other))
                if(other.enemy == self.owner)
                        self.viewmodelforclient = other;
-       return TRUE;
+       return true;
 }
 
 /*
@@ -231,12 +245,12 @@ void CL_WeaponEntity_SetModel(string name)
 
        self.view_ofs = '0 0 0';
 
-       if(self.movedir_x >= 0)
+       if(self.movedir.x >= 0)
        {
                vector v0;
                v0 = self.movedir;
-               self.movedir = shotorg_adjust(v0, FALSE, FALSE);
-               self.view_ofs = shotorg_adjust(v0, FALSE, TRUE) - v0;
+               self.movedir = shotorg_adjust(v0, false, false);
+               self.view_ofs = shotorg_adjust(v0, false, true) - v0;
        }
        self.owner.stat_shotorg = compressShotOrigin(self.movedir);
        self.movedir = decompressShotOrigin(self.owner.stat_shotorg); // make them match perfectly
@@ -247,7 +261,7 @@ void CL_WeaponEntity_SetModel(string name)
        setorigin(self, self.view_ofs);
        // reset animstate now
        self.wframe = WFRAME_IDLE;
-       setanim(self, self.anim_idle, TRUE, FALSE, TRUE);
+       setanim(self, self.anim_idle, true, false, true);
 }
 
 vector CL_Weapon_GetShotOrg(float wpn)
@@ -267,10 +281,10 @@ vector CL_Weapon_GetShotOrg(float wpn)
 
 void CL_Weaponentity_Think()
 {
-       float tb;
+       int tb;
        self.nextthink = time;
        if (intermission_running)
-               self.frame = self.anim_idle_x;
+               self.frame = self.anim_idle.x;
        if (self.owner.weaponentity != self)
        {
                if (self.weaponentity)
@@ -456,11 +470,11 @@ float weapon_prepareattack_checkammo(float secondary)
                entity mine;
                if(self.weapon == WEP_MINE_LAYER)
                for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self)
-                       return FALSE;
+                       return false;
 
                if(self.weapon == WEP_SHOTGUN)
                if(!secondary && WEP_CVAR(shotgun, secondary) == 1)
-                       return FALSE; // no clicking, just allow
+                       return false; // no clicking, just allow
 
                if(self.weapon == self.switchweapon && time - self.prevdryfire > 1) // only play once BEFORE starting to switch weapons
                {
@@ -489,40 +503,40 @@ float weapon_prepareattack_checkammo(float secondary)
                        W_SwitchToOtherWeapon(self);
                }
 
-               return FALSE;
+               return false;
        }
-       return TRUE;
+       return true;
 }
 .float race_penalty;
 float weapon_prepareattack_check(float secondary, float attacktime)
 {
        if(!weapon_prepareattack_checkammo(secondary))
-               return FALSE;
+               return false;
 
        //if sv_ready_restart_after_countdown is set, don't allow the player to shoot
        //if all players readied up and the countdown is running
        if(time < game_starttime || time < self.race_penalty) {
-               return FALSE;
+               return false;
        }
 
        if (timeout_status == TIMEOUT_ACTIVE) //don't allow the player to shoot while game is paused
-               return FALSE;
+               return false;
 
        // do not even think about shooting if switching
        if(self.switchweapon != self.weapon)
-               return FALSE;
+               return false;
 
        if(attacktime >= 0)
        {
                // don't fire if previous attack is not finished
                if (ATTACK_FINISHED(self) > time + self.weapon_frametime * 0.5)
-                       return FALSE;
+                       return false;
                // don't fire while changing weapon
                if (self.weaponentity.state != WS_READY)
-                       return FALSE;
+                       return false;
        }
 
-       return TRUE;
+       return true;
 }
 float weapon_prepareattack_do(float secondary, float attacktime)
 {
@@ -542,17 +556,17 @@ float weapon_prepareattack_do(float secondary, float attacktime)
        }
        self.bulletcounter += 1;
        //dprint("attack finished ", ftos(ATTACK_FINISHED(self)), "\n");
-       return TRUE;
+       return true;
 }
 float weapon_prepareattack(float secondary, float attacktime)
 {
        if(weapon_prepareattack_check(secondary, attacktime))
        {
                weapon_prepareattack_do(secondary, attacktime);
-               return TRUE;
+               return true;
        }
        else
-               return FALSE;
+               return false;
 }
 
 void weapon_thinkf(float fr, float t, void() func)
@@ -564,12 +578,12 @@ void weapon_thinkf(float fr, float t, void() func)
        if(fr == WFRAME_DONTCHANGE)
        {
                fr = self.weaponentity.wframe;
-               restartanim = FALSE;
+               restartanim = false;
        }
        else if (fr == WFRAME_IDLE)
-               restartanim = FALSE;
+               restartanim = false;
        else
-               restartanim = TRUE;
+               restartanim = true;
 
        of = v_forward;
        or = v_right;
@@ -587,8 +601,8 @@ void weapon_thinkf(float fr, float t, void() func)
                        a = self.weaponentity.anim_fire2;
                else // if (fr == WFRAME_RELOAD)
                        a = self.weaponentity.anim_reload;
-               a_z *= g_weaponratefactor;
-               setanim(self.weaponentity, a, restartanim == FALSE, restartanim, restartanim);
+               a.z *= g_weaponratefactor;
+               setanim(self.weaponentity, a, restartanim == false, restartanim, restartanim);
        }
 
        v_forward = of;
@@ -794,7 +808,7 @@ void W_AttachToShotorg(entity flash, vector offset)
 
        flash.viewmodelforclient = self;
 
-       if(self.weaponentity.oldorigin_x > 0)
+       if(self.weaponentity.oldorigin.x > 0)
        {
                setattachment(xflash, self.exteriorweaponentity, "");
                setorigin(xflash, self.weaponentity.oldorigin + offset);
@@ -957,7 +971,6 @@ void W_Reload(float sent_ammo_min, string sent_sound)
        self.clip_load = self.(weapon_load[self.weapon]) = -1;
 }
 
-entity weapon_dropevent_item;
 void W_DropEvent(float event, entity player, float weapon_type, entity weapon_item)
 {
        entity oldself = self;
index ddb1ee69588aa578c3394b427fa158eb27ab7a96..bb0cea798d96a0afbb4932ac731f95b50e267711 100644 (file)
@@ -1,6 +1,43 @@
-float weaponswapping;
+#ifndef WEAPONSYSTEM_H
+#define WEAPONSYSTEM_H
+
+.float wframe;
+
 float internalteam;
+float weaponswapping;
+entity weapon_dropevent_item;
 
-void W_DropEvent(float event, entity player, float weapon_type, entity weapon_item);
+// VorteX: static frame globals
+const float WFRAME_DONTCHANGE = -1;
+const float WFRAME_FIRE1 = 0;
+const float WFRAME_FIRE2 = 1;
+const float WFRAME_IDLE = 2;
+const float WFRAME_RELOAD = 3;
+
+void CL_SpawnWeaponentity();
+
+vector CL_Weapon_GetShotOrg(float wpn);
 
 float forbidWeaponUse();
+
+void W_AttachToShotorg(entity flash, vector offset);
+
+void W_DecreaseAmmo(float ammo_use);
+
+void W_DropEvent(float event, entity player, float weapon_type, entity weapon_item);
+
+void W_Reload(float sent_ammo_min, string sent_sound);
+
+void W_WeaponFrame();
+
+float W_WeaponRateFactor();
+
+float weapon_prepareattack(float secondary, float attacktime);
+
+float weapon_prepareattack_check(float secondary, float attacktime);
+
+float weapon_prepareattack_do(float secondary, float attacktime);
+
+void weapon_thinkf(float fr, float t, void() func);
+
+#endif
index 982e527f9e7b20a798bbf7a904487480d2bdec25..4709cdc2dfe21586582fb6245eb0e0d12a901592 100644 (file)
@@ -140,11 +140,9 @@ indent_func_def_force_col1               = false    # false/true
 indent_func_call_param                   = true     # false/true
 
 # Same as indent_func_call_param, but for function defs
-# WARNING: Code doesn't seem to use this feature - delete from the config?
-indent_func_def_param                    = false    # false/true
+indent_func_def_param                    = true     # false/true
 
 # Same as indent_func_call_param, but for function protos
-# WARNING: Code doesn't seem to use this feature - delete from the config?
 indent_func_proto_param                  = false    # false/true
 
 # Same as indent_func_call_param, but for class declarations
@@ -160,7 +158,7 @@ indent_func_ctor_var_param               = false    # false/true
 indent_template_param                    = false    # false/true
 
 # Double the indent for indent_func_xxx_param options
-indent_func_param_double                 = true     # false/true
+indent_func_param_double                 = false    # false/true
 
 # Indentation column for standalone 'const' function decl/proto qualifier
 # WARNING: Code doesn't seem to use this feature - delete from the config?
@@ -213,8 +211,7 @@ indent_access_spec                       = 0        # number
 indent_access_spec_body                  = false    # false/true
 
 # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended)
-# WARNING: Code doesn't seem to use this feature - delete from the config?
-indent_paren_nl                          = false    # false/true
+indent_paren_nl                          = false    # false/true #force
 
 # Controls the indent of a close paren after a newline.
 # 0: Indent to body level
@@ -262,10 +259,10 @@ indent_oc_msg_colon                      = 0        # number #ignore
 #
 
 # Add or remove space around arithmetic operator '+', '-', '/', '*', etc
-sp_arith                                 = ignore   # ignore/add/remove/force #force
+sp_arith                                 = add      # ignore/add/remove/force #force
 
 # Add or remove space around assignment operator '=', '+=', etc
-# NOTE: is 54 worse than ignore
+# NOTE: is 64 worse than ignore
 sp_assign                                = add      # ignore/add/remove/force
 
 # Add or remove space around '=' in C++11 lambda capture specifications. Overrides sp_assign
@@ -297,13 +294,13 @@ sp_enum_before_assign                    = ignore   # ignore/add/remove/force #f
 sp_enum_after_assign                     = ignore   # ignore/add/remove/force #force
 
 # Add or remove space around preprocessor '##' concatenation operator. Default=Add
-# NOTE: is 4 worse than ignore
 sp_pp_concat                             = remove   # ignore/add/remove/force
 
 # Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator.
 sp_pp_stringify                          = remove   # ignore/add/remove/force
 
 # Add or remove space before preprocessor '#' stringify operator as in '#define x(y) L#y'.
+# NOTE: is 6 worse than ignore
 sp_before_pp_stringify                   = add      # ignore/add/remove/force
 
 # Add or remove space around boolean operators '&&' and '||'
@@ -311,7 +308,7 @@ sp_before_pp_stringify                   = add      # ignore/add/remove/force
 sp_bool                                  = add      # ignore/add/remove/force
 
 # Add or remove space around compare operator '<', '>', '==', etc
-# NOTE: is 198 worse than ignore
+# NOTE: is 210 worse than ignore
 sp_compare                               = add      # ignore/add/remove/force
 
 # Add or remove space inside '(' and ')'
@@ -335,24 +332,28 @@ sp_before_ptr_star                       = ignore   # ignore/add/remove/force
 
 # Add or remove space before pointer star '*' that isn't followed by a variable name
 # If set to 'ignore', sp_before_ptr_star is used instead.
-sp_before_unnamed_ptr_star               = add      # ignore/add/remove/force
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+sp_before_unnamed_ptr_star               = ignore   # ignore/add/remove/force
 
 # Add or remove space between pointer stars '*'
 # WARNING: Code doesn't seem to use this feature - delete from the config?
 sp_between_ptr_star                      = ignore   # ignore/add/remove/force
 
 # Add or remove space after pointer star '*', if followed by a word.
-sp_after_ptr_star                        = add      # ignore/add/remove/force
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+sp_after_ptr_star                        = ignore   # ignore/add/remove/force
 
 # Add or remove space after a pointer star '*', if followed by a func proto/def.
-sp_after_ptr_star_func                   = add      # ignore/add/remove/force
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+sp_after_ptr_star_func                   = ignore   # ignore/add/remove/force
 
 # Add or remove space after a pointer star '*', if followed by an open paren (function types).
 # WARNING: Code doesn't seem to use this feature - delete from the config?
 sp_ptr_star_paren                        = ignore   # ignore/add/remove/force
 
 # Add or remove space before a pointer star '*', if followed by a func proto/def.
-sp_before_ptr_star_func                  = add      # ignore/add/remove/force
+# WARNING: Code doesn't seem to use this feature - delete from the config?
+sp_before_ptr_star_func                  = ignore   # ignore/add/remove/force
 
 # Add or remove space before a reference sign '&'
 # WARNING: Code doesn't seem to use this feature - delete from the config?
@@ -417,10 +418,10 @@ sp_angle_shift                           = ignore   # ignore/add/remove/force
 sp_permit_cpp11_shift                    = false    # false/true
 
 # Add or remove space before '(' of 'if', 'for', 'switch', and 'while'
-sp_before_sparen                         = remove   # ignore/add/remove/force #force
+sp_before_sparen                         = add      # ignore/add/remove/force #force
 
 # Add or remove space inside if-condition '(' and ')'
-# NOTE: is 42 worse than ignore
+# NOTE: is 68 worse than ignore
 sp_inside_sparen                         = remove   # ignore/add/remove/force
 
 # Add or remove space before if-condition ')'. Overrides sp_inside_sparen.
@@ -430,8 +431,7 @@ sp_inside_sparen_close                   = ignore   # ignore/add/remove/force #f
 sp_inside_sparen_open                    = ignore   # ignore/add/remove/force #force
 
 # Add or remove space after ')' of 'if', 'for', 'switch', and 'while'
-# WARNING: Code doesn't seem to use this feature - delete from the config?
-sp_after_sparen                          = ignore   # ignore/add/remove/force
+sp_after_sparen                          = add      # ignore/add/remove/force
 
 # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while'
 sp_sparen_brace                          = add      # ignore/add/remove/force
@@ -457,7 +457,7 @@ sp_before_semi_for                       = remove   # ignore/add/remove/force
 sp_before_semi_for_empty                 = add      # ignore/add/remove/force
 
 # Add or remove space after ';', except when followed by a comment. Default=Add
-# NOTE: is 56 worse than ignore
+# NOTE: is 42 worse than ignore
 sp_after_semi                            = add      # ignore/add/remove/force
 
 # Add or remove space after ';' in non-empty 'for' statements. Default=Force
@@ -480,7 +480,7 @@ sp_inside_square                         = remove   # ignore/add/remove/force
 sp_after_comma                           = add      # ignore/add/remove/force #force
 
 # Add or remove space before ','
-# NOTE: is 58 worse than ignore
+# NOTE: is 26 worse than ignore
 sp_before_comma                          = remove   # ignore/add/remove/force
 
 # Add or remove space between an open paren and comma: '(,' vs '( ,'
@@ -547,18 +547,18 @@ sp_inside_braces_empty                   = remove   # ignore/add/remove/force
 sp_type_func                             = add      # ignore/add/remove/force
 
 # Add or remove space between function name and '(' on function declaration
-# NOTE: is 30 worse than ignore
+# NOTE: is 138 worse than ignore
 sp_func_proto_paren                      = remove   # ignore/add/remove/force
 
 # Add or remove space between function name and '(' on function definition
-# NOTE: is 400 worse than ignore
+# NOTE: is 236 worse than ignore
 sp_func_def_paren                        = remove   # ignore/add/remove/force
 
 # Add or remove space inside empty function '()'
 sp_inside_fparens                        = remove   # ignore/add/remove/force
 
 # Add or remove space inside function '(' and ')'
-# NOTE: is 78 worse than ignore
+# NOTE: is 68 worse than ignore
 sp_inside_fparen                         = remove   # ignore/add/remove/force
 
 # Add or remove space inside the first parens in the function type: 'void (*x)(...)'
@@ -577,7 +577,7 @@ sp_square_fparen                         = ignore   # ignore/add/remove/force
 sp_fparen_brace                          = add      # ignore/add/remove/force
 
 # Add or remove space between function name and '(' on function calls
-# NOTE: is 940 worse than ignore
+# NOTE: is 436 worse than ignore
 sp_func_call_paren                       = remove   # ignore/add/remove/force
 
 # Add or remove space between function name and '()' on function calls without parameters.
@@ -600,8 +600,7 @@ sp_return_paren                          = ignore   # ignore/add/remove/force
 sp_attribute_paren                       = ignore   # ignore/add/remove/force
 
 # Add or remove space between 'defined' and '(' in '#if defined (FOO)'
-# WARNING: Code doesn't seem to use this feature - delete from the config?
-sp_defined_paren                         = ignore   # ignore/add/remove/force
+sp_defined_paren                         = remove   # ignore/add/remove/force
 
 # Add or remove space between 'throw' and '(' in 'throw (something)'
 # WARNING: Code doesn't seem to use this feature - delete from the config?
@@ -687,7 +686,7 @@ sp_inv                                   = remove   # ignore/add/remove/force
 sp_addr                                  = ignore   # ignore/add/remove/force
 
 # Add or remove space around the '.' or '->' operators. Default=Remove
-# NOTE: is 28 worse than ignore
+# NOTE: is 26 worse than ignore
 sp_member                                = remove   # ignore/add/remove/force
 
 # Add or remove space after the '*' (dereference) operator. Default=Remove
@@ -938,7 +937,7 @@ align_typedef_star_style                 = 0        # number
 align_typedef_amp_style                  = 0        # number
 
 # The span for aligning comments that end lines (0=don't align)
-align_right_cmt_span                     = 2        # number
+align_right_cmt_span                     = indent_columns # number
 
 # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment
 align_right_cmt_mix                      = false    # false/true
@@ -1102,12 +1101,11 @@ nl_var_def_blk_in                        = 0        # number
 
 # Add or remove newline between a function call's ')' and '{', as in:
 # list_for_each(item, &list) { }
-# NOTE: is 28 worse than ignore
+# NOTE: is 23 worse than ignore
 nl_fcall_brace                           = add      # ignore/add/remove/force
 
 # Add or remove newline between 'enum' and '{'
-# WARNING: Code doesn't seem to use this feature - delete from the config?
-nl_enum_brace                            = ignore   # ignore/add/remove/force
+nl_enum_brace                            = remove   # ignore/add/remove/force
 
 # Add or remove newline between 'struct and '{'
 nl_struct_brace                          = add      # ignore/add/remove/force
@@ -1117,7 +1115,7 @@ nl_struct_brace                          = add      # ignore/add/remove/force
 nl_union_brace                           = ignore   # ignore/add/remove/force
 
 # Add or remove newline between 'if' and '{'
-# NOTE: is 231 worse than ignore
+# NOTE: is 136 worse than ignore
 nl_if_brace                              = add      # ignore/add/remove/force
 
 # Add or remove newline between '}' and 'else'
@@ -1150,7 +1148,7 @@ nl_try_brace                             = ignore   # ignore/add/remove/force
 nl_getset_brace                          = ignore   # ignore/add/remove/force
 
 # Add or remove newline between 'for' and '{'
-# NOTE: is 93 worse than ignore
+# NOTE: is 109 worse than ignore
 nl_for_brace                             = add      # ignore/add/remove/force
 
 # Add or remove newline between 'catch' and '{'
@@ -1162,7 +1160,7 @@ nl_catch_brace                           = ignore   # ignore/add/remove/force
 nl_brace_catch                           = ignore   # ignore/add/remove/force
 
 # Add or remove newline between 'while' and '{'
-# NOTE: is 21 worse than ignore
+# NOTE: is 22 worse than ignore
 nl_while_brace                           = add      # ignore/add/remove/force
 
 # Add or remove newline between 'scope (x)' and '{' (D)
@@ -1193,7 +1191,7 @@ nl_do_brace                              = add      # ignore/add/remove/force
 nl_brace_while                           = add      # ignore/add/remove/force #force
 
 # Add or remove newline between 'switch' and '{'
-# NOTE: is 21 worse than ignore
+# NOTE: is 24 worse than ignore
 nl_switch_brace                          = add      # ignore/add/remove/force
 
 # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc.
@@ -1215,7 +1213,7 @@ nl_before_throw                          = ignore   # ignore/add/remove/force
 nl_after_case                            = false    # false/true
 
 # Add or remove a newline between a case ':' and '{'. Overrides nl_after_case.
-# NOTE: is 27 worse than ignore
+# NOTE: is 125 worse than ignore
 nl_case_colon_brace                      = add      # ignore/add/remove/force
 
 # Newline between namespace and {
@@ -1258,11 +1256,11 @@ nl_func_paren                            = remove   # ignore/add/remove/force
 nl_func_def_paren                        = remove   # ignore/add/remove/force
 
 # Add or remove newline after '(' in a function declaration
-# NOTE: is 6 worse than ignore
+# NOTE: is 19 worse than ignore
 nl_func_decl_start                       = remove   # ignore/add/remove/force
 
 # Add or remove newline after '(' in a function definition
-# NOTE: is 23 worse than ignore
+# NOTE: is 26 worse than ignore
 nl_func_def_start                        = remove   # ignore/add/remove/force
 
 # Overrides nl_func_decl_start when there is only one parameter.
@@ -1272,11 +1270,10 @@ nl_func_decl_start_single                = ignore   # ignore/add/remove/force #f
 nl_func_def_start_single                 = ignore   # ignore/add/remove/force #force
 
 # Add or remove newline after each ',' in a function declaration
-# NOTE: is 38 worse than ignore
+# NOTE: is 6 worse than ignore
 nl_func_decl_args                        = remove   # ignore/add/remove/force
 
 # Add or remove newline after each ',' in a function definition
-# NOTE: is 37 worse than ignore
 nl_func_def_args                         = remove   # ignore/add/remove/force
 
 # Add or remove newline before the ')' in a function declaration
@@ -1302,11 +1299,11 @@ nl_func_def_empty                        = remove   # ignore/add/remove/force
 nl_oc_msg_args                           = false    # false/true #ignore
 
 # Add or remove newline between function signature and '{'
-# NOTE: is 156 worse than ignore
+# NOTE: is 159 worse than ignore
 nl_fdef_brace                            = add      # ignore/add/remove/force
 
 # Add or remove a newline between the return keyword and return expression.
-# NOTE: is 15 worse than ignore
+# NOTE: is 6 worse than ignore
 nl_return_expr                           = remove   # ignore/add/remove/force
 
 # Whether to put a newline after semicolons, except in 'for' statements
@@ -1379,7 +1376,6 @@ nl_before_do                             = ignore   # ignore/add/remove/force #f
 nl_after_do                              = ignore   # ignore/add/remove/force #force
 
 # Whether to double-space commented-entries in struct/enum
-# WARNING: Code doesn't seem to use this feature - delete from the config?
 nl_ds_struct_enum_cmt                    = false    # false/true
 
 # Whether to double-space before the close brace of a struct/union/enum
@@ -1496,11 +1492,10 @@ nl_before_c_comment                      = 0        # number
 nl_before_cpp_comment                    = 0        # number
 
 # Whether to force a newline after a multi-line comment.
-# WARNING: Code doesn't seem to use this feature - delete from the config?
 nl_after_multiline_comment               = false    # false/true
 
 # The number of newlines after '}' or ';' of a struct/enum/union definition
-# WARNING: Code doesn't seem to use this feature - delete from the config?
+# WARNING: Best is not unique (0 1)
 nl_after_struct                          = 0        # number
 
 # The number of newlines after '}' or ';' of a class definition
@@ -1552,8 +1547,7 @@ eat_blanks_before_close_brace            = true     # false/true #force
 # 1: Remove most newlines not handled by other config
 # 2: Remove all newlines and reformat completely by config
 # ERROR: nl_remove_extra_newlines = 1 crashes with status 139.
-# ERROR: nl_remove_extra_newlines = 2 crashes with status 139.
-# WARNING: Best is not unique (0 indent_columns)
+# WARNING: Best is not unique (0 3)
 nl_remove_extra_newlines                 = 0        # number
 
 # Whether to put a blank line before 'return' statements, unless after an open brace.
@@ -1579,7 +1573,7 @@ nl_between_annotation                    = ignore   # ignore/add/remove/force
 mod_full_brace_do                        = add      # ignore/add/remove/force
 
 # Add or remove braces on single-line 'for' statement
-# NOTE: is 5 worse than ignore
+# NOTE: is 3 worse than ignore
 mod_full_brace_for                       = remove   # ignore/add/remove/force
 
 # Add or remove braces on single-line function definitions. (Pawn)
@@ -1603,7 +1597,7 @@ mod_full_brace_while                     = remove   # ignore/add/remove/force
 mod_full_brace_using                     = ignore   # ignore/add/remove/force
 
 # Add or remove unnecessary paren on 'return' statement
-# NOTE: is 42 worse than ignore
+# NOTE: is 54 worse than ignore
 mod_paren_on_return                      = remove   # ignore/add/remove/force
 
 # Whether to change optional semicolons to real semicolons
@@ -1650,7 +1644,7 @@ mod_move_case_break                      = false    # false/true
 
 # Will add or remove the braces around a fully braced case statement.
 # Will only remove the braces if there are no variable declarations in the block.
-# NOTE: is 507 worse than ignore
+# NOTE: is 78 worse than ignore
 mod_case_brace                           = remove   # ignore/add/remove/force
 
 # If TRUE, it will remove a void 'return;' that appears as the last statement in a function.
index 3233f6a31cef9d6fbe6b5a14decc5af1654c05e8..e8a455b6ee25548bf67e22c68c15fd3e1626089d 100644 (file)
@@ -1,23 +1,33 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "anglestransform.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "anglestransform.qh"
+#endif
+
 #ifdef POSITIVE_PITCH_IS_DOWN
 vector fixedvectoangles(vector a)
 {
        vector ang;
        ang = vectoangles(a);
-       ang_x = -ang_x;
+       ang.x = -ang.x;
        return ang;
 }
 vector fixedvectoangles2(vector a, vector b)
 {
        vector ang;
        ang = vectoangles2(a, b);
-       ang_x = -ang_x;
+       ang.x = -ang.x;
        return ang;
 }
 #else
 void fixedmakevectors(vector a)
 {
        // a makevectors that actually inverts vectoangles
-       a_x = -a_x;
+       a.x = -a.x;
        makevectors(a);
 }
 #endif
@@ -27,9 +37,9 @@ void fixedmakevectors(vector a)
 vector AnglesTransform_Apply(vector transform, vector v)
 {
        fixedmakevectors(transform);
-       return v_forward * v_x
-               + v_right   * (-v_y)
-               + v_up      * v_z;
+       return v_forward * v.x
+               + v_right   * (-v.y)
+               + v_up      * v.z;
 }
 
 vector AnglesTransform_Multiply(vector t1, vector t2)
@@ -48,12 +58,12 @@ vector AnglesTransform_Invert(vector transform)
        // but these are orthogonal unit vectors!
        // so to invert, we can simply fixedvectoangles the TRANSPOSED matrix
        // TODO is this always -transform?
-       i_forward_x = v_forward_x;
-       i_forward_y = -v_right_x;
-       i_forward_z = v_up_x;
-       i_up_x = v_forward_z;
-       i_up_y = -v_right_z;
-       i_up_z = v_up_z;
+       i_forward.x = v_forward.x;
+       i_forward.y = -v_right.x;
+       i_forward.z = v_up.x;
+       i_up.x = v_forward.z;
+       i_up.y = -v_right.z;
+       i_up.z = v_up.z;
        return fixedvectoangles2(i_forward, i_up);
 }
 
@@ -63,9 +73,9 @@ vector AnglesTransform_TurnDirectionFR(vector transform)
        // changes in-direction to out-direction
        //fixedmakevectors(transform);
        //return fixedvectoangles2(-1 * v_forward, 1 * v_up);
-       transform_x = -transform_x;
-       transform_y = 180 + transform_y;
-       transform_z = -transform_z;
+       transform.x = -transform.x;
+       transform.y = 180 + transform.y;
+       transform.z = -transform.z;
        // pitch: -s +c
        // yaw:   -s -c
        // roll:  -s +c
@@ -78,9 +88,9 @@ vector AnglesTransform_TurnDirectionFU(vector transform)
        // changes in-direction to out-direction
        //fixedmakevectors(transform);
        //return fixedvectoangles2(-1 * v_forward, 1 * v_up);
-       transform_x = -transform_x;
-       transform_y = 180 + transform_y;
-       transform_z = 180 - transform_z;
+       transform.x = -transform.x;
+       transform.y = 180 + transform.y;
+       transform.z = 180 - transform.z;
        return transform;
 }
 
@@ -98,18 +108,18 @@ vector AnglesTransform_Normalize(vector t, float minimize_roll)
 {
        float need_flip;
        // first, bring all angles in their range...
-       t_x = t_x - 360 * rint(t_x / 360);
-       t_y = t_y - 360 * rint(t_y / 360);
-       t_z = t_z - 360 * rint(t_z / 360);
+       t.x = t.x - 360 * rint(t.x / 360);
+       t.y = t.y - 360 * rint(t.y / 360);
+       t.z = t.z - 360 * rint(t.z / 360);
        if(minimize_roll)
-               need_flip = (t_z > 90 || t_z <= -90);
+               need_flip = (t.z > 90 || t.z <= -90);
        else
-               need_flip = (t_x > 90 || t_x < -90); // for pitch we prefer to allow exactly -90 degrees for looking straight down
+               need_flip = (t.x > 90 || t.x < -90); // for pitch we prefer to allow exactly -90 degrees for looking straight down
        if(need_flip)
        {
-               if(t_x >= 0) t_x = 180 - t_x; else t_x = -180 - t_x;
-               if(t_y > 0) t_y -= 180; else t_y += 180;
-               if(t_z > 0) t_z -= 180; else t_z += 180;
+               if(t.x >= 0) t.x = 180 - t.x; else t.x = -180 - t.x;
+               if(t.y > 0) t.y -= 180; else t.y += 180;
+               if(t.z > 0) t.z -= 180; else t.z += 180;
        }
        return t;
 }
@@ -126,21 +136,21 @@ vector AnglesTransform_CancelRoll(vector t)
 
        // FIXME find a better method
 
-       f = fabs(t_x - (-90)) / epsilon;
+       f = fabs(t.x - (-90)) / epsilon;
        if(f < 1)
        {
                //t_x = -90;
-               t_y += t_z;
-               t_z = 0;
+               t.y += t.z;
+               t.z = 0;
        }
        else
        {
-               f = fabs(t_x - 90) / epsilon;
+               f = fabs(t.x - 90) / epsilon;
                if(f < 1)
                {
                        //t_x = 90;
-                       t_y -= t_z;
-                       t_z = 0;
+                       t.y -= t.z;
+                       t.z = 0;
                }
        }
        return t;
@@ -149,9 +159,9 @@ vector AnglesTransform_CancelRoll(vector t)
 #ifdef POSITIVE_PITCH_IS_DOWN
 vector AnglesTransform_ApplyToAngles(vector transform, vector v)
 {
-       v_x = -v_x;
+       v.x = -v.x;
        v = AnglesTransform_Multiply(transform, v);
-       v_x = -v_x;
+       v.x = -v.x;
        return v;
 }
 vector AnglesTransform_ApplyToVAngles(vector transform, vector v)
@@ -161,12 +171,12 @@ vector AnglesTransform_ApplyToVAngles(vector transform, vector v)
 }
 vector AnglesTransform_FromAngles(vector v)
 {
-       v_x = -v_x;
+       v.x = -v.x;
        return v;
 }
 vector AnglesTransform_ToAngles(vector v)
 {
-       v_x = -v_x;
+       v.x = -v.x;
        return v;
 }
 vector AnglesTransform_FromVAngles(vector v)
@@ -185,9 +195,9 @@ vector AnglesTransform_ApplyToAngles(vector transform, vector v)
 }
 vector AnglesTransform_ApplyToVAngles(vector transform, vector v)
 {
-       v_x = -v_x;
+       v.x = -v.x;
        v = AnglesTransform_Multiply(transform, v);
-       v_x = -v_x;
+       v.x = -v.x;
        return v;
 }
 vector AnglesTransform_FromAngles(vector v)
@@ -200,12 +210,12 @@ vector AnglesTransform_ToAngles(vector v)
 }
 vector AnglesTransform_FromVAngles(vector v)
 {
-       v_x = -v_x;
+       v.x = -v.x;
        return v;
 }
 vector AnglesTransform_ToVAngles(vector v)
 {
-       v_x = -v_x;
+       v.x = -v.x;
        return v;
 }
 #endif
index b1c8a85e9da5916983322a5fad1016216e3250d1..0538471018554a79a6d08ac036f4c2cb0f0e29ac 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef ANGLETRANSFORM_H
+#define ANGLETRANSFORM_H
+
 #define POSITIVE_PITCH_IS_DOWN
 
 #ifdef POSITIVE_PITCH_IS_DOWN
@@ -30,3 +33,4 @@ vector AnglesTransform_ToVAngles(vector v);
 // transformed = original * transform + postshift
 vector AnglesTransform_Multiply_GetPostShift(vector sf0, vector st0, vector t1, vector st1);
 vector AnglesTransform_PrePostShift_GetPostShift(vector sf, vector t, vector st);
+#endif
index 9f540bc50a9a59ce73a8ef7d04da683af9a6d4a8..5c2609a7dfbd388d8cb1b1172974b74fd8dbbd5a 100644 (file)
@@ -1,3 +1,13 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "common.qh"
+       #include "client.qh"
+       #include "../client/autocvars.qh"
+       #include "../csqcmodellib/cl_model.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
 void WarpZone_Fade_PreDraw()
 {
        vector org;
@@ -17,8 +27,6 @@ void WarpZone_Fade_PreDraw()
 
 void WarpZone_Read(float isnew)
 {
-       float f;
-
        warpzone_warpzones_exist = 1;
        if (!self.enemy)
        {
@@ -27,7 +35,7 @@ void WarpZone_Read(float isnew)
        }
        self.classname = "trigger_warpzone";
 
-       f = ReadByte();
+       int f = ReadByte();
        self.warpzone_isboxy = (f & 1);
        if(f & 4)
        {
@@ -84,11 +92,10 @@ void WarpZone_Read(float isnew)
 
 void WarpZone_Camera_Read(float isnew)
 {
-       float f;
        warpzone_cameras_exist = 1;
        self.classname = "func_warpzone_camera";
 
-       f = ReadByte();
+       int f = ReadByte();
        if(f & 4)
        {
                self.origin_x = ReadCoord();
@@ -144,9 +151,9 @@ void WarpZone_Teleported_Read(float isnew)
 {
        vector v;
        self.classname = "warpzone_teleported";
-       v_x = ReadCoord();
-       v_y = ReadCoord();
-       v_z = ReadCoord();
+       v.x = ReadCoord();
+       v.y = ReadCoord();
+       v.z = ReadCoord();
        if(!isnew)
                return;
        self.warpzone_transform = v;
@@ -158,7 +165,6 @@ void WarpZone_Teleported_Read(float isnew)
 
 float warpzone_fixingview;
 float warpzone_fixingview_drawexteriormodel;
-float autocvar_chase_active;
 
 void WarpZone_View_Outside()
 {
@@ -188,12 +194,12 @@ vector WarpZone_FixNearClip(vector o, vector c0, vector c1, vector c2, vector c3
        entity e;
        float pd;
 
-       mi_x = min(o_x, c0_x, c1_x, c2_x, c3_x);
-       ma_x = max(o_x, c0_x, c1_x, c2_x, c3_x);
-       mi_y = min(o_y, c0_y, c1_y, c2_y, c3_y);
-       ma_y = max(o_y, c0_y, c1_y, c2_y, c3_y);
-       mi_z = min(o_z, c0_z, c1_z, c2_z, c3_z);
-       ma_z = max(o_z, c0_z, c1_z, c2_z, c3_z);
+       mi.x = min(o.x, c0_x, c1_x, c2_x, c3_x);
+       ma.x = max(o.x, c0_x, c1_x, c2_x, c3_x);
+       mi.y = min(o.y, c0_y, c1_y, c2_y, c3_y);
+       ma.y = max(o.y, c0_y, c1_y, c2_y, c3_y);
+       mi.z = min(o.z, c0_z, c1_z, c2_z, c3_z);
+       ma.z = max(o.z, c0_z, c1_z, c2_z, c3_z);
 
        e = WarpZone_Find(mi, ma);
        if(e)
@@ -226,7 +232,7 @@ void WarpZone_FixPMove()
 }
 
 #ifndef KEEP_ROLL
-var float autocvar_cl_rollkillspeed = 10;
+float autocvar_cl_rollkillspeed = 10;
 #endif
 void WarpZone_FixView()
 {
@@ -257,7 +263,7 @@ void WarpZone_FixView()
        rick = getproperty(VF_CL_VIEWANGLES_Z);
        rick *= f;
        setproperty(VF_CL_VIEWANGLES_Z, rick);
-       ang_z *= f;
+       ang.z *= f;
 #endif
 
        setproperty(VF_ORIGIN, org);
index c0a4ca0f0a70d07caebd9fa4d86aef57db98dbc9..a9f0fe1c2f3b5b56346b56116118f15618d8fcae 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef CLIENT_H
+#define CLIENT_H
+
 void WarpZone_Read(float bIsNewEntity);
 void WarpZone_Camera_Read(float bIsNewEntity);
 void WarpZone_Teleported_Read(float bIsNewEntity);
@@ -10,3 +13,4 @@ void WarpZone_Shutdown();
 
 vector warpzone_save_view_origin;
 vector warpzone_save_view_angles;
+#endif
index 6db41d133997388bc4ef125ca76b0aac6cd33215..aa0de911963a9bc700e6aa3167b2181633d7b7b6 100644 (file)
@@ -1,5 +1,14 @@
-float trace_dphitcontents;
-.float dphitcontentsmask;
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+    #include "common.qh"
+    #include "../server/t_items.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "common.qh"
+    #include "../common/weapons/weapons.qh"
+#endif
 
 void WarpZone_Accumulator_Clear(entity acc)
 {
@@ -32,7 +41,7 @@ void WarpZone_Accumulator_AddInverse(entity acc, entity wz)
 }
 
 .vector(vector, vector) camera_transform;
-var float autocvar_cl_warpzone_usetrace = 1;
+float autocvar_cl_warpzone_usetrace = 1;
 vector WarpZone_camera_transform(vector org, vector ang)
 {
        vector vf, vr, vu;
@@ -263,7 +272,7 @@ void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end,
        sol = -1;
        frac = 0;
        i = 16;
-       for(;;)
+       for (;;)
        {
                if(--i < 1)
                {
@@ -386,7 +395,7 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
        }
        WarpZone_MakeAllSolid();
        i = 16;
-       for(;;)
+       for (;;)
        {
                if(--i < 1)
                {
@@ -469,7 +478,7 @@ void WarpZone_TrailParticles_WithMultiplier_trace_callback(vector from, vector e
        boxparticles(WarpZone_TrailParticles_trace_callback_eff, WarpZone_TrailParticles_trace_callback_own, from, endpos, WarpZone_TrailParticles_trace_callback_own.velocity, WarpZone_TrailParticles_trace_callback_own.velocity, WarpZone_TrailParticles_trace_callback_f, WarpZone_TrailParticles_trace_callback_flags);
 }
 
-void WarpZone_TrailParticles_WithMultiplier(entity own, float eff, vector org, vector end, float f, float boxflags)
+void WarpZone_TrailParticles_WithMultiplier(entity own, float eff, vector org, vector end, float f, int boxflags)
 {
        WarpZone_TrailParticles_trace_callback_own = own;
        WarpZone_TrailParticles_trace_callback_eff = eff;
@@ -508,18 +517,18 @@ vector WarpZone_TransformVAngles(entity wz, vector ang)
 {
 #ifdef KEEP_ROLL
        float roll;
-       roll = ang_z;
-       ang_z = 0;
+       roll = ang.z;
+       ang.z = 0;
 #endif
 
        ang = AnglesTransform_ApplyToVAngles(wz.warpzone_transform, ang);
 
 #ifdef KEEP_ROLL
-       ang = AnglesTransform_Normalize(ang, TRUE);
+       ang = AnglesTransform_Normalize(ang, true);
        ang = AnglesTransform_CancelRoll(ang);
-       ang_z = roll;
+       ang.z = roll;
 #else
-       ang = AnglesTransform_Normalize(ang, FALSE);
+       ang = AnglesTransform_Normalize(ang, false);
 #endif
 
        return ang;
@@ -544,23 +553,23 @@ vector WarpZone_UnTransformVAngles(entity wz, vector ang)
 {
        float roll;
 
-       roll = ang_z;
-       ang_z = 0;
+       roll = ang.z;
+       ang.z = 0;
 
        ang = AnglesTransform_ApplyToVAngles(AnglesTransform_Invert(wz.warpzone_transform), ang);
-       ang = AnglesTransform_Normalize(ang, TRUE);
+       ang = AnglesTransform_Normalize(ang, true);
        ang = AnglesTransform_CancelRoll(ang);
 
-       ang_z = roll;
+       ang.z = roll;
        return ang;
 }
 
 vector WarpZoneLib_NearestPointOnBox(vector mi, vector ma, vector org)
 {
        vector nearest;
-       nearest_x = bound(mi_x, org_x, ma_x);
-       nearest_y = bound(mi_y, org_y, ma_y);
-       nearest_z = bound(mi_z, org_z, ma_z);
+       nearest.x = bound(mi.x, org.x, ma.x);
+       nearest.y = bound(mi.y, org.y, ma.y);
+       nearest.z = bound(mi.z, org.z, ma.z);
        return nearest;
 }
 
index c79ee95d6e02d2d2062b8a35a987de07f0aca3cb..7742db8b9b101f54968503b3f5e238f993120faf 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef WARPZONELIB_COMMON_H
+#define WARPZONELIB_COMMON_H
+
 // uncomment this if your mod uses the roll angle in fixangle
 // #define KEEP_ROLL
 
@@ -16,6 +19,7 @@ float warpzone_cameras_exist;
 .float warpzone_fadestart;
 .float warpzone_fadeend;
 void WarpZone_SetUp(entity e, vector my_org, vector my_ang, vector other_org, vector other_ang);
+void WarpZone_Camera_SetUp(entity e, vector my_org, vector my_ang);
 
 float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig);
 vector WarpZoneLib_NearestPointOnBox(vector mi, vector ma, vector org);
@@ -100,3 +104,4 @@ entity WarpZone_RefSys_SpawnSameRefSys(entity me); // spawn().R = me.R
 #ifndef BITXOR_ASSIGN
 # define BITXOR_ASSIGN(a,b) ((a) = ((a) | (b)) - ((a) & (b)))
 #endif
+#endif
index 42262102e50b16421ae0a80003ba817bf8c34b58..c9cde9072c34210fb2f387f137569dfa35f71d9e 100644 (file)
@@ -1,3 +1,13 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+    #include "mathlib.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "mathlib.qh"
+#endif
+
 int fpclassify(float x)
 {
        if(isnan(x))
@@ -8,25 +18,25 @@ int fpclassify(float x)
                return FP_ZERO;
        return FP_NORMAL;
 }
-int isfinite(float x)
+bool isfinite(float x)
 {
        return !(isnan(x) || isinf(x));
 }
-int isinf(float x)
+bool isinf(float x)
 {
        return (x != 0) && (x + x == x);
 }
-int isnan(float x)
+bool isnan(float x)
 {
        float y;
        y = x;
        return (x != y);
 }
-int isnormal(float x)
+bool isnormal(float x)
 {
        return isfinite(x);
 }
-int signbit(float x)
+bool signbit(float x)
 {
        return (x < 0);
 }
@@ -72,9 +82,9 @@ float expm1(float x)
 vector frexp(float x)
 {
        vector v;
-       v_z = 0;
-       v_y = ilogb(x) + 1;
-       v_x = x / exp2(v_y);
+       v.z = 0;
+       v.y = ilogb(x) + 1;
+       v.x = x / exp2(v.y);
        return v;
 }
 int ilogb(float x)
@@ -146,11 +156,11 @@ vector lgamma(float x)
                // gamma(1-z) * gamma(z) = pi / sin(pi*z)
                // lgamma(1-z) + lgamma(z) = log(pi) - log(sin(pi*z))
                // sign of gamma(1-z) = sign of gamma(z) * sign of sin(pi*z)
-               v_z = sin(M_PI * x);
-               v_x = log(M_PI) - log(fabs(v_z)) - v_x;
-               if(v_z < 0)
-                       v_y = -v_y;
-               v_z = 0;
+               v.z = sin(M_PI * x);
+               v.x = log(M_PI) - log(fabs(v.z)) - v.x;
+               if(v.z < 0)
+                       v.y = -v.y;
+               v.z = 0;
                return v;
        }
        if(x < 1.1)
@@ -162,7 +172,21 @@ float tgamma(float x)
 {
        vector v;
        v = lgamma(x);
-       return exp(v_x) * v_y;
+       return exp(v.x) * v.y;
+}
+
+/**
+ * Pythonic mod:
+ * TODO: %% operator?
+ *
+ *  1 %  2 ==  1
+ * -1 %  2 ==  1
+ *  1 % -2 == -1
+ * -1 % -2 == -1
+ */
+float pymod(float x, float y)
+{
+       return x - y * floor(x / y);
 }
 
 float nearbyint(float x)
@@ -185,9 +209,9 @@ float remainder(float x, float y)
 vector remquo(float x, float y)
 {
        vector v;
-       v_z = 0;
-       v_y = rint(x / y);
-       v_x = x - y * v_y;
+       v.z = 0;
+       v.y = rint(x / y);
+       v.x = x - y * v.y;
        return v;
 }
 
@@ -266,3 +290,11 @@ int isunordered(float x, float y)
 {
        return !(x < y || x == y || x > y);
 }
+
+vector cross(vector a, vector b)
+{
+       return
+               '1 0 0' * (a.y * b.z - a.z * b.y)
+       +       '0 1 0' * (a.z * b.x - a.x * b.z)
+       +       '0 0 1' * (a.x * b.y - a.y * b.x);
+}
index 9c8b969fbaedbb2d2ddb02592617e623235fa676..ddd494de5b8422e5560cb68301d5fada7b43d73d 100644 (file)
@@ -1,21 +1,22 @@
+#ifndef MATHLIB_H
+#define MATHLIB_H
+
 // <math.h>
 
 // The commented-out functions need no implementation because DarkPlaces offers
 // them as builtins. They are listed here anyway for completeness sake.
 
-#define int float
-
-#define FP_NAN 0
-#define FP_INFINITE 1
-#define FP_ZERO 2
-#define FP_SUBNORMAL 3
-#define FP_NORMAL 4
+const int FP_NAN = 0;
+const int FP_INFINITE = 1;
+const int FP_ZERO = 2;
+const int FP_SUBNORMAL = 3;
+const int FP_NORMAL = 4;
 int fpclassify(float x);
-int isfinite(float x);
-int isinf(float x);
-int isnan(float x);
-int isnormal(float x);
-int signbit(float x);
+bool isfinite(float x);
+bool isinf(float x);
+bool isnan(float x);
+bool isnormal(float x);
+bool signbit(float x);
 
 //float acos(float x);
 //float asin(float x);
@@ -59,6 +60,17 @@ float erfc(float x);
 vector lgamma(float x); // value in _x, sign in _y
 float tgamma(float x);
 
+/**
+ * Pythonic mod:
+ * TODO: %% operator?
+ *
+ *  1 %  2 ==  1
+ * -1 %  2 ==  1
+ *  1 % -2 == -1
+ * -1 % -2 == -1
+ */
+float pymod(float x, float y);
+
 //float ceil(float x);
 //float floor(float x);
 float nearbyint(float x);
@@ -87,16 +99,21 @@ int islessequal(float x, float y);
 int islessgreater(float x, float y);
 int isunordered(float x, float y);
 
-#define M_E        2.7182818284590452354   /* e */
-#define M_LOG2E    1.4426950408889634074   /* log_2 e */
-#define M_LOG10E   0.43429448190325182765  /* log_10 e */
-#define M_LN2      0.69314718055994530942  /* log_e 2 */
-#define M_LN10     2.30258509299404568402  /* log_e 10 */
-#define M_PI       3.14159265358979323846  /* pi */
-#define M_PI_2     1.57079632679489661923  /* pi/2 */
-#define M_PI_4     0.78539816339744830962  /* pi/4 */
-#define M_1_PI     0.31830988618379067154  /* 1/pi */
-#define M_2_PI     0.63661977236758134308  /* 2/pi */
-#define M_2_SQRTPI 1.12837916709551257390  /* 2/sqrt(pi) */
-#define M_SQRT2    1.41421356237309504880  /* sqrt(2) */
-#define M_SQRT1_2  0.70710678118654752440  /* 1/sqrt(2) */
+const float M_E        = 2.7182818284590452354;   /* e */
+const float M_LOG2E    = 1.4426950408889634074;   /* log_2 e */
+const float M_LOG10E   = 0.43429448190325182765;  /* log_10 e */
+const float M_LN2      = 0.69314718055994530942;  /* log_e 2 */
+const float M_LN10     = 2.30258509299404568402;  /* log_e 10 */
+const float M_PI       = 3.14159265358979323846;  /* pi */
+const float M_PI_2     = 1.57079632679489661923;  /* pi/2 */
+const float M_PI_4     = 0.78539816339744830962;  /* pi/4 */
+const float M_1_PI     = 0.31830988618379067154;  /* 1/pi */
+const float M_2_PI     = 0.63661977236758134308;  /* 2/pi */
+const float M_2_SQRTPI = 1.12837916709551257390;  /* 2/sqrt(pi) */
+const float M_SQRT2    = 1.41421356237309504880;  /* sqrt(2) */
+const float M_SQRT1_2  = 0.70710678118654752440;  /* 1/sqrt(2) */
+
+// Non-<math.h> stuff follows here.
+vector cross(vector a, vector b);
+
+#endif
index d25c769b08ba7957c0f11460657a2c759df8a564..c4dc7287f1c182e79ac96e009a8000902678043c 100644 (file)
@@ -1,3 +1,17 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+       #include "../dpdefs/dpextensions.qh"
+       #include "common.qh"
+       #include "server.qh"
+       #include "../common/constants.qh"
+       #include "../common/util.qh"
+       #include "../server/constants.qh"
+       #include "../server/defs.qh"
+       #include "../server/command/common.qh"
+#endif
+
 #ifdef WARPZONELIB_KEEPDEBUG
 #define WARPZONELIB_REMOVEHACK
 #endif
@@ -26,7 +40,7 @@ void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector
        setorigin (player, to); // NOTE: this also aborts the move, when this is called by touch
        player.oldorigin = to; // for DP's unsticking
        player.angles = to_angles;
-       player.fixangle = TRUE;
+       player.fixangle = true;
        player.velocity = to_velocity;
 
        BITXOR_ASSIGN(player.effects, EF_TELEPORT_BIT);
@@ -40,10 +54,10 @@ void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector
 float WarpZone_Teleported_Send(entity to, float sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED);
-       WriteCoord(MSG_ENTITY, self.angles_x);
-       WriteCoord(MSG_ENTITY, self.angles_y);
-       WriteCoord(MSG_ENTITY, self.angles_z);
-       return TRUE;
+       WriteCoord(MSG_ENTITY, self.angles.x);
+       WriteCoord(MSG_ENTITY, self.angles.y);
+       WriteCoord(MSG_ENTITY, self.angles.z);
+       return true;
 }
 
 float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
@@ -119,7 +133,7 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
        if(IS_PLAYER(player))
        {
                // instead of fixangle, send the transform to the client for smoother operation
-               player.fixangle = FALSE;
+               player.fixangle = false;
 
                entity ts = spawn();
                setmodel(ts, "null");
@@ -204,11 +218,10 @@ void WarpZone_Touch (void)
 
 float WarpZone_Send(entity to, float sendflags)
 {
-       float f;
        WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE);
 
        // we must send this flag for clientside to match properly too
-       f = 0;
+       int f = 0;
        if(self.warpzone_isboxy)
                BITSET_ASSIGN(f, 1);
        if(self.warpzone_fadestart)
@@ -220,33 +233,33 @@ float WarpZone_Send(entity to, float sendflags)
        // 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, self.origin.x);
+               WriteCoord(MSG_ENTITY, self.origin.y);
+               WriteCoord(MSG_ENTITY, self.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);
+       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));
 
        // 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, 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);
 
        if(f & 2)
        {
@@ -254,12 +267,12 @@ float WarpZone_Send(entity to, float sendflags)
                WriteShort(MSG_ENTITY, self.warpzone_fadeend);
        }
 
-       return TRUE;
+       return true;
 }
 
 float WarpZone_Camera_Send(entity to, float sendflags)
 {
-       float f = 0;
+       int f = 0;
        WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
 
        if(self.warpzone_fadestart)
@@ -271,27 +284,27 @@ float WarpZone_Camera_Send(entity to, float sendflags)
        // 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, self.origin.x);
+               WriteCoord(MSG_ENTITY, self.origin.y);
+               WriteCoord(MSG_ENTITY, self.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);
+       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));
 
        // 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, 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);
 
        if(f & 2)
        {
@@ -299,7 +312,7 @@ float WarpZone_Camera_Send(entity to, float sendflags)
                WriteShort(MSG_ENTITY, self.warpzone_fadeend);
        }
 
-       return TRUE;
+       return true;
 }
 
 #ifdef WARPZONELIB_KEEPDEBUG
@@ -373,7 +386,7 @@ float WarpZone_CheckProjectileImpact(entity player)
 float WarpZone_Projectile_Touch()
 {
        if(other.classname == "trigger_warpzone")
-               return TRUE;
+               return true;
 
        // no further impacts if we teleported this frame!
        // this is because even if we did teleport, the engine still may raise
@@ -382,7 +395,7 @@ float WarpZone_Projectile_Touch()
        // but if this is called from TouchAreaGrid of the projectile moving,
        // then this won't do
        if(time == self.warpzone_teleport_time)
-               return TRUE;
+               return true;
 
 #ifdef WARPZONELIB_KEEPDEBUG
        // this SEEMS to not happen at the moment, but if it did, it would be more reliable
@@ -433,9 +446,9 @@ float WarpZone_Projectile_Touch()
 #endif
 
        if(WarpZone_Projectile_Touch_ImpactFilter_Callback())
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 void WarpZone_InitStep_FindOriginTarget()
@@ -524,7 +537,7 @@ void WarpZone_InitStep_UpdateTransform()
 {
        vector org, ang, norm, point;
        float area;
-       vector tri, a, b, c, p, q, n;
+       vector tri, a, b, c, n;
        float i_s, i_t, n_t;
        string tex;
 
@@ -545,14 +558,10 @@ void WarpZone_InitStep_UpdateTransform()
                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);
-                       p = b - a;
-                       q = c - a;
-                       n =     '1 0 0' * (q_y * p_z - q_z * p_y)
-                       +       '0 1 0' * (q_z * p_x - q_x * p_z)
-                       +       '0 0 1' * (q_x * p_y - q_y * p_x);
+                       a = getsurfacepoint(self, i_s, tri.x);
+                       b = getsurfacepoint(self, i_s, tri.y);
+                       c = getsurfacepoint(self, i_s, tri.z);
+                       n = cross(c - a, b - a);
                        area = area + vlen(n);
                        norm = norm + n;
                        point = point + vlen(n) * (a + b + c);
@@ -570,9 +579,7 @@ void WarpZone_InitStep_UpdateTransform()
                norm = normalize(norm);
        }
 
-#ifdef GMQCC
        ang = '0 0 0';
-#endif
        if(self.aiment)
        {
                org = self.aiment.origin;
@@ -587,7 +594,7 @@ void WarpZone_InitStep_UpdateTransform()
                                norm = -1 * norm;
                        }
                        ang = vectoangles2(norm, v_up); // keep rotation, but turn exactly against plane
-                       ang_x = -ang_x;
+                       ang.x = -ang.x;
                        if(norm * v_forward < 0.99)
                                print("trigger_warpzone near ", vtos(self.aiment.origin), " has been turned to match plane orientation (", vtos(self.aiment.angles), " -> ", vtos(ang), "\n");
                        if(vlen(org - self.aiment.origin) > 0.5)
@@ -598,7 +605,7 @@ void WarpZone_InitStep_UpdateTransform()
        {
                org = point;
                ang = vectoangles(norm);
-               ang_x = -ang_x;
+               ang.x = -ang.x;
        }
        else
                error("cannot infer origin/angles for this warpzone, please use a killtarget or a trigger_warpzone_position");
@@ -668,7 +675,7 @@ void WarpZone_InitStep_FinalizeTransform()
 }
 
 float warpzone_initialized;
-entity warpzone_first;
+//entity warpzone_first;
 entity warpzone_position_first;
 entity warpzone_camera_first;
 .entity warpzone_next;
@@ -836,7 +843,7 @@ void WarpZone_StartFrame()
                if(IS_NOT_A_CLIENT(e))
                {
                        if(warpzone_warpzones_exist)
-                               for(; (e = nextent(e)); )
+                               for (; (e = nextent(e)); )
                                        WarpZone_StoreProjectileData(e);
                        break;
                }
@@ -894,7 +901,7 @@ void WarpZone_PlayerPhysics_FixVAngle(void)
 {
 #ifndef WARPZONE_DONT_FIX_VANGLE
        if(IS_REAL_CLIENT(self))
-       if(self.v_angle_z <= 360) // if not already adjusted
+       if(self.v_angle.z <= 360) // if not already adjusted
        if(time - self.ping * 0.001 < self.warpzone_teleport_time)
        {
                self.v_angle = WarpZone_TransformVAngles(self.warpzone_teleport_zone, self.v_angle);
index 7a301a8b82aff76fcca1c6417d4cfbd440a7d12a..88ad6f508cc3cb930024c8a394dd8be7b563c0e8 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef SERVER_H
+#define SERVER_H
+
 void WarpZone_StartFrame();
 float WarpZone_Projectile_Touch();
 
@@ -6,9 +9,10 @@ void WarpZone_PostTeleportPlayer_Callback(entity pl);
 float WarpZone_Projectile_Touch_ImpactFilter_Callback();
 
 // server must also define a float called ENT_CLIENT_WARPZONE for the initial byte of WarpZone entities
-const float ENT_CLIENT_WARPZONE;
-const float ENT_CLIENT_WARPZONE_CAMERA;
+//const float ENT_CLIENT_WARPZONE;
+//const float ENT_CLIENT_WARPZONE_CAMERA;
 
 void WarpZone_PlayerPhysics_FixVAngle(void);
 
 void WarpZone_PostInitialize_Callback(void);
+#endif
index daa8e6ddc17b4c6d23536066a67d3033141ff103..b94eafbdafd4e422af7dd6eb5c31933156dbb988 100644 (file)
@@ -1,3 +1,13 @@
+#if defined(CSQC)
+#elif defined(MENUQC)
+#elif defined(SVQC)
+       #include "../dpdefs/progsdefs.qh"
+    #include "../dpdefs/dpextensions.qh"
+    #include "common.qh"
+    #include "util_server.qh"
+    #include "../csqcmodellib/sv_model.qh"
+#endif
+
 void WarpZoneLib_MoveOutOfSolid_Expand(entity e, vector by)
 {
        float eps = 0.0625;
@@ -19,11 +29,11 @@ float WarpZoneLib_MoveOutOfSolid(entity e)
        o = e.origin;
        traceline(o, o, MOVE_WORLDONLY, e);
        if (trace_startsolid)
-               return FALSE;
+               return false;
 
        tracebox(o, e.mins, e.maxs, o, MOVE_WORLDONLY, e);
        if (!trace_startsolid)
-               return TRUE;
+               return true;
 
        m0 = e.mins;
        m1 = e.maxs;
@@ -47,10 +57,10 @@ float WarpZoneLib_MoveOutOfSolid(entity e)
        if (trace_startsolid)
        {
                setorigin(e, o);
-               return FALSE;
+               return false;
        }
 
-       return TRUE;
+       return true;
 }
 
 float WarpZoneLib_ExactTrigger_Touch()
@@ -67,8 +77,12 @@ void WarpZoneLib_ExactTrigger_Init()
                makevectors (self.angles);
                self.movedir = v_forward;
        }
-       self.warpzone_isboxy = 1;
-       if(self.model != "")
+       if(self.model == "")
+       {
+               // It's a box! No need to match with exacttriggers.
+               self.warpzone_isboxy = 1;
+       }
+       else
        {
                mi = self.mins;
                ma = self.maxs;
@@ -77,11 +91,11 @@ void WarpZoneLib_ExactTrigger_Init()
                // 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;
                }
-               else
-                       self.warpzone_isboxy = 0; // enable exacttrigger matching
        }
        setorigin(self, self.origin);
        if(self.scale)
index cd5af7fb4ccb24bea3e665d5b59a03e6bdd5cd59..38df7fe0cc804f55c344a368046b4e5adb428fe3 100644 (file)
@@ -1,3 +1,7 @@
+#ifndef UTIL_SERVER_H
+#define UTIL_SERVER_H
+
 float WarpZoneLib_MoveOutOfSolid(entity e);
 float WarpZoneLib_ExactTrigger_Touch();
 void WarpZoneLib_ExactTrigger_Init();
+#endif
diff --git a/qcsrc/whitespace.sh b/qcsrc/whitespace.sh
new file mode 100755 (executable)
index 0000000..a017dc8
--- /dev/null
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+find . -type f -print0 |                                    \
+    xargs -0 sed -i                                         \
+        `# strip trailing spaces`                           \
+        -e 's/[[:space:]]*$//'                              \
+        `# line feed at EOF for #include to work properly`  \
+        -e '$a\'
diff --git a/scripts/luma.shader b/scripts/luma.shader
new file mode 100644 (file)
index 0000000..ab2d0c6
--- /dev/null
@@ -0,0 +1,425 @@
+// models/items
+
+a_bullets_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/a_bullets_luma
+               blendfunc blend
+       }
+}
+
+a_cells_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/a_cells_luma
+               blendfunc blend
+       }
+}
+
+a_plasma_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/a_plasma_luma
+               blendfunc blend
+       }
+}
+
+a_rockets_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/a_rockets_luma
+               blendfunc blend
+       }
+}
+
+a_shells_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/a_shells_luma
+               blendfunc blend
+       }
+}
+
+g_fuel_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/g_fuel_luma
+               blendfunc blend
+       }
+}
+
+g_fuelregen_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/g_fuelregen_luma
+               blendfunc blend
+       }
+}
+
+g_h1_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/g_h1_luma
+               blendfunc blend
+       }
+}
+
+g_h25_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/g_h25_luma
+               blendfunc blend
+       }
+}
+
+g_h50_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/g_h50_luma
+               blendfunc blend
+       }
+}
+
+g_h100_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/g_h100_luma
+               blendfunc blend
+       }
+}
+
+g_invincible_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/g_invincible_luma
+               blendfunc blend
+       }
+}
+
+g_jetpack_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/g_jetpack_luma
+               blendfunc blend
+       }
+}
+
+g_strength_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/g_strength_luma
+               blendfunc blend
+       }
+}
+
+item_armor_big_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/item_armor_big_luma
+               blendfunc blend
+       }
+}
+
+item_armor_large_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/item_armor_large_luma
+               blendfunc blend
+       }
+}
+
+item_armor_medium_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/item_armor_medium_luma
+               blendfunc blend
+       }
+}
+
+item_armor_small_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/items/item_armor_small_luma
+               blendfunc blend
+       }
+}
+
+
+
+
+
+// models/weapons
+
+g_arc_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_arc_luma
+               blendfunc blend
+       }
+}
+
+g_campingrifle_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_campingrifle_luma
+               blendfunc blend
+       }
+}
+
+g_crylink_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_crylink_luma
+               blendfunc blend
+       }
+}
+
+g_electro_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_electro_luma
+               blendfunc blend
+       }
+}
+
+g_fireball_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_fireball_luma
+               blendfunc blend
+       }
+}
+
+g_gl_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_gl_luma
+               blendfunc blend
+       }
+}
+
+g_hagar_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_hagar_luma
+               blendfunc blend
+       }
+}
+
+g_hlac_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_hlac_luma
+               blendfunc blend
+       }
+}
+
+g_hookgun_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_hookgun_luma
+               blendfunc blend
+       }
+}
+
+g_laser_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_laser_luma
+               blendfunc blend
+       }
+}
+
+g_minelayer_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_minelayer_luma
+               blendfunc blend
+       }
+}
+
+g_minstanex_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_minstanex_luma
+               blendfunc blend
+       }
+}
+
+g_nex_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_nex_luma
+               blendfunc blend
+       }
+}
+
+g_porto_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_porto_luma
+               blendfunc blend
+       }
+}
+
+g_rl_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_rl_luma
+               blendfunc blend
+       }
+}
+
+g_seeker_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_seeker_luma
+               blendfunc blend
+       }
+}
+
+g_shockwave_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_shockwave_luma
+               blendfunc blend
+       }
+}
+
+g_shotgun_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_shotgun_luma
+               blendfunc blend
+       }
+}
+
+g_tuba_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_tuba_luma
+               blendfunc blend
+       }
+}
+
+g_uzi_luma
+{
+       deformVertexes autosprite
+       cull none
+       nopicmip
+       {
+               map models/weapons/g_uzi_luma
+               blendfunc blend
+       }
+}
index a2f7c8ac96a93fecaf855d467dfa378c9e299301..39ada82f782b62bbeae93db7926f7be05f9f49d9 100644 (file)
@@ -15,9 +15,12 @@ skill 100
 fraglimit_override 0
 timelimit_override 3
 sv_eventlog 1
+sv_logscores_bots 1
 g_weaponarena all
 g_weaponarena_random 2
+
+// Start!
+
 map g-23
 
-// time ./all run +exec serverbench.cfg | grep ^: > serverbench.log
-// on Linux/Ubuntu, this should always yield a file with the md5sum
+// Used by: ./all serverbench
diff --git a/sound/menu/README b/sound/menu/README
new file mode 100644 (file)
index 0000000..eede58b
--- /dev/null
@@ -0,0 +1,10 @@
+SOUND    PLAYED WHEN
+
+open     opening dialog
+close    closing dialog
+focus    moving focus to new item
+execute  pressing button, enter key, or double click
+select   using checkbox, radiobutton, or similar
+slide    using slider or colorpicker
+clear    clearing inputbox or keybind
+winner   winning single player campaign
diff --git a/sound/menu/clear.wav b/sound/menu/clear.wav
new file mode 100644 (file)
index 0000000..a622af8
Binary files /dev/null and b/sound/menu/clear.wav differ
diff --git a/sound/menu/close.wav b/sound/menu/close.wav
new file mode 100644 (file)
index 0000000..c990fbd
Binary files /dev/null and b/sound/menu/close.wav differ
diff --git a/sound/menu/execute.wav b/sound/menu/execute.wav
new file mode 100644 (file)
index 0000000..58b3d1c
Binary files /dev/null and b/sound/menu/execute.wav differ
diff --git a/sound/menu/focus.wav b/sound/menu/focus.wav
new file mode 100644 (file)
index 0000000..a045d26
Binary files /dev/null and b/sound/menu/focus.wav differ
diff --git a/sound/menu/open.wav b/sound/menu/open.wav
new file mode 100644 (file)
index 0000000..c990fbd
Binary files /dev/null and b/sound/menu/open.wav differ
diff --git a/sound/menu/select.wav b/sound/menu/select.wav
new file mode 100644 (file)
index 0000000..58b3d1c
Binary files /dev/null and b/sound/menu/select.wav differ
diff --git a/sound/menu/slide.wav b/sound/menu/slide.wav
new file mode 100644 (file)
index 0000000..58b3d1c
Binary files /dev/null and b/sound/menu/slide.wav differ
diff --git a/sound/menu/winner.ogg b/sound/menu/winner.ogg
new file mode 100644 (file)
index 0000000..56b114e
Binary files /dev/null and b/sound/menu/winner.ogg differ
diff --git a/sound/misc/menu1.wav b/sound/misc/menu1.wav
deleted file mode 100644 (file)
index a045d26..0000000
Binary files a/sound/misc/menu1.wav and /dev/null differ
diff --git a/sound/misc/menu2.wav b/sound/misc/menu2.wav
deleted file mode 100644 (file)
index 58b3d1c..0000000
Binary files a/sound/misc/menu2.wav and /dev/null differ
diff --git a/sound/misc/mouseclick.wav b/sound/misc/mouseclick.wav
deleted file mode 100644 (file)
index a622af8..0000000
Binary files a/sound/misc/mouseclick.wav and /dev/null differ
index df09de330756e3c2a3f98966e95e54bd7989c6e2..503c23979284e6f796268c6dfbed02b885eec214 100644 (file)
@@ -4,6 +4,7 @@ Ant "Antibody" Zucaro
 Marvin "Mirio" Beck
 Merlijn Hofstra
 Peter "Morphed" Pielak
+Ruszkai "CuBe0wL" Ákos
 Samual "Ares" Lenks
 Tyler "-z-" Mulligan
 Zac "Mario" Jardine
@@ -19,6 +20,7 @@ Jan "zykure" Behrens
 JH0nny
 Łukasz "kuniu the frogg" Polek
 Matthias "matthiaskrgr" Krüger
+Mattia "Melanosuchus" Basaglia
 MrBougo
 Nick "bitbomb" Lucca
 nilyt/nyov
@@ -69,7 +71,7 @@ MintOX
 packer
 Pearce "theShadow" Michal
 Rasmus "FruitieX" Eskola
-Ruszkai "C.Brutail" Ákos
+Ruszkai "CuBe0wL" Ákos
 Severin "sev" Meyer
 
 *Music / Sound FX
@@ -96,7 +98,7 @@ Zac "Mario" Jardine
 
 *Marketing / PR
 Tyler "-z-" Mulligan
-Ruszkai "C.Brutail" Ákos
+Ruszkai "CuBe0wL" Ákos
 Samual "Ares" Lenks
 Saulo "mand1nga" Gil
 
@@ -123,7 +125,6 @@ Dale "graphitemaster" Weiler
 **Other Active Contributors
 Erik "Ablu" Schilling
 Jope "Sless" Withers
-Mattia "Melanosuchus" Basaglia
 Mircea "Taoki" Kitsune
 Robert "ai" Kuroto
 
@@ -143,19 +144,15 @@ set_killer
 
 *Czech
 shogun assassin/woky
+Tomáš "CZHeron" Volavka
 
 *Dutch
 Alexander "freefang" van Dam
 PinkRobot
 vegiburger
 
-*German
-cvcxc
-Erik "Ablu" Schilling
-Jope "Sless" Withers
-Marvin "Mirio" Beck
-Rudolf "divVerent" Polzer
-Yepoleb
+*English (Australia)
+Zac "Mario" Jardine
 
 *Finnish
 Henry "Exitium" Sanmark
@@ -167,6 +164,14 @@ Maxime "Taximus" Paradis
 RedGuff
 Yannick "SpiKe" Le Guen
 
+*German
+cvcxc
+Erik "Ablu" Schilling
+Jope "Sless" Withers
+Marvin "Mirio" Beck
+Rudolf "divVerent" Polzer
+Yepoleb
+
 *Greek
 Γιάννης "Evropi" Α.
 Konstantinos "LDinos" Mihalenas
@@ -174,7 +179,7 @@ Savoritias
 Vindex
 
 *Hungarian
-Ruszkai "C.Brutail" Ákos
+Ruszkai "CuBe0wL" Ákos
 xaN1C4n3
 
 *Japanese
@@ -188,6 +193,7 @@ XCostaX
 
 *Polish
 4m
+Alex "tiprogrammierer.alex" Progger
 Amadeusz "amade/proraide" Sławiński
 
 *Portuguese
@@ -197,9 +203,11 @@ xXxCHAOTICxXx
 *Romanian
 BusterDBK
 Mircea "Taoki" Kitsune
+Tudor "TropiKo" Ionel
 
 *Russian
 Alex "alextalker7" Talker
+Alexandr "zrg"
 Andrei "adem4ik" Stepanov
 gravicappa
 Hot Dog
@@ -218,7 +226,7 @@ Alan "aagp" Garcia
 Ari_tent
 brunodeleo
 Kammy
-roader_gentto
+roader_gentoo
 Rodrigo Mouton Laudin
 SouL