]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/shuffleteams_fix' into 'master'
authorMario <zacjardine@y7mail.com>
Thu, 9 Jul 2015 08:27:12 +0000 (08:27 +0000)
committerMario <zacjardine@y7mail.com>
Thu, 9 Jul 2015 08:27:12 +0000 (08:27 +0000)
shuffleteams: properly detect ca players. It fixes #1471 "Shuffleteams results in uneven teams (CA)"

See merge request !136

193 files changed:
_hud_common.cfg
commands.cfg
defaultXonotic.cfg
gfx/menu/luma/crosshairbutton_c.tga [deleted file]
gfx/menu/luma/crosshairbutton_d.tga [deleted file]
gfx/menu/luma/crosshairbutton_f.tga [deleted file]
gfx/menu/luma/crosshairbutton_n.tga [deleted file]
gfx/menu/luma/skinvalues.txt
gfx/menu/luminos/crosshairbutton_c.tga [deleted file]
gfx/menu/luminos/crosshairbutton_d.tga [deleted file]
gfx/menu/luminos/crosshairbutton_f.tga [deleted file]
gfx/menu/luminos/crosshairbutton_n.tga [deleted file]
gfx/menu/luminos/skinvalues.txt
gfx/menu/wickedx/crosshairbutton_c.tga [deleted file]
gfx/menu/wickedx/crosshairbutton_d.tga [deleted file]
gfx/menu/wickedx/crosshairbutton_f.tga [deleted file]
gfx/menu/wickedx/crosshairbutton_n.tga [deleted file]
gfx/menu/wickedx/skinvalues.txt
gfx/menu/xaw/crosshairbutton_c.tga [deleted file]
gfx/menu/xaw/crosshairbutton_d.tga [deleted file]
gfx/menu/xaw/crosshairbutton_f.tga [deleted file]
gfx/menu/xaw/crosshairbutton_n.tga [deleted file]
gfx/menu/xaw/skinvalues.txt
physics.cfg [new file with mode: 0644]
qcsrc/client/_all.qh
qcsrc/client/autocvars.qh
qcsrc/client/command/all.qc [new file with mode: 0644]
qcsrc/client/command/all.qh [new file with mode: 0644]
qcsrc/client/command/commands.qc [deleted file]
qcsrc/client/command/commands.qh [deleted file]
qcsrc/client/damage.qc
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/client/hud_config.qc
qcsrc/client/main.qc
qcsrc/client/progs.src
qcsrc/client/t_items.qc
qcsrc/client/vehicles/all.qc [new file with mode: 0644]
qcsrc/client/vehicles/all.qh [new file with mode: 0644]
qcsrc/client/vehicles/vehicles.qc [deleted file]
qcsrc/client/vehicles/vehicles.qh [deleted file]
qcsrc/client/view.qc
qcsrc/client/waypointsprites.qc
qcsrc/common/command/all.qc [new file with mode: 0644]
qcsrc/common/command/all.qh [new file with mode: 0644]
qcsrc/common/command/commands.qc [deleted file]
qcsrc/common/command/commands.qh [deleted file]
qcsrc/common/command/generic.qc
qcsrc/common/constants.qh
qcsrc/common/items/all.inc [new file with mode: 0644]
qcsrc/common/items/all.qc [new file with mode: 0644]
qcsrc/common/items/all.qh [new file with mode: 0644]
qcsrc/common/items/inventory.qh [new file with mode: 0644]
qcsrc/common/items/item.qh [new file with mode: 0644]
qcsrc/common/items/item/ammo.qc [new file with mode: 0644]
qcsrc/common/items/item/ammo.qh [new file with mode: 0644]
qcsrc/common/items/item/armor.qc [new file with mode: 0644]
qcsrc/common/items/item/armor.qh [new file with mode: 0644]
qcsrc/common/items/item/buff.qc [new file with mode: 0644]
qcsrc/common/items/item/buff.qh [new file with mode: 0644]
qcsrc/common/items/item/health.qc [new file with mode: 0644]
qcsrc/common/items/item/health.qh [new file with mode: 0644]
qcsrc/common/items/item/jetpack.qc [new file with mode: 0644]
qcsrc/common/items/item/pickup.qc [new file with mode: 0644]
qcsrc/common/items/item/pickup.qh [new file with mode: 0644]
qcsrc/common/items/item/powerup.qc [new file with mode: 0644]
qcsrc/common/items/item/powerup.qh [new file with mode: 0644]
qcsrc/common/mapinfo.qc
qcsrc/common/monsters/all.qc [new file with mode: 0644]
qcsrc/common/monsters/all.qh [new file with mode: 0644]
qcsrc/common/monsters/monsters.qc [deleted file]
qcsrc/common/monsters/monsters.qh [deleted file]
qcsrc/common/monsters/spawn.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/oo.qh [new file with mode: 0644]
qcsrc/common/playerstats.qc
qcsrc/common/util-pre.qh
qcsrc/common/weapons/all.qc [new file with mode: 0644]
qcsrc/common/weapons/all.qh [new file with mode: 0644]
qcsrc/common/weapons/config.qc
qcsrc/common/weapons/weapons.qc [deleted file]
qcsrc/common/weapons/weapons.qh [deleted file]
qcsrc/menu/_all.qh
qcsrc/menu/classes.inc
qcsrc/menu/command/all.qc [new file with mode: 0644]
qcsrc/menu/command/all.qh [new file with mode: 0644]
qcsrc/menu/command/commands.qc [deleted file]
qcsrc/menu/command/commands.qh [deleted file]
qcsrc/menu/item/container.qc
qcsrc/menu/item/dialog.qc
qcsrc/menu/item/listbox.qc
qcsrc/menu/menu.qc
qcsrc/menu/oo/base.qh
qcsrc/menu/progs.src
qcsrc/menu/skin-customizables.inc
qcsrc/menu/xonotic/campaign.qc
qcsrc/menu/xonotic/charmap.qc
qcsrc/menu/xonotic/credits.qc
qcsrc/menu/xonotic/crosshairbutton.qc [deleted file]
qcsrc/menu/xonotic/crosshairpicker.qc [new file with mode: 0644]
qcsrc/menu/xonotic/crosshairpreview.qc [new file with mode: 0644]
qcsrc/menu/xonotic/cvarlist.qc
qcsrc/menu/xonotic/demolist.qc
qcsrc/menu/xonotic/dialog_multiplayer.qc
qcsrc/menu/xonotic/dialog_multiplayer_create.qc
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc
qcsrc/menu/xonotic/dialog_multiplayer_join.qc
qcsrc/menu/xonotic/dialog_multiplayer_media.qc
qcsrc/menu/xonotic/dialog_multiplayer_media_demo.qc
qcsrc/menu/xonotic/dialog_multiplayer_media_musicplayer.qc
qcsrc/menu/xonotic/dialog_multiplayer_media_screenshot.qc
qcsrc/menu/xonotic/dialog_multiplayer_profile.qc
qcsrc/menu/xonotic/dialog_settings_audio.qc
qcsrc/menu/xonotic/dialog_settings_effects.qc
qcsrc/menu/xonotic/dialog_settings_game.qc
qcsrc/menu/xonotic/dialog_settings_game_crosshair.qc
qcsrc/menu/xonotic/dialog_settings_game_hud.qc
qcsrc/menu/xonotic/dialog_settings_game_messages.qc
qcsrc/menu/xonotic/dialog_settings_game_model.qc
qcsrc/menu/xonotic/dialog_settings_game_view.qc
qcsrc/menu/xonotic/dialog_settings_game_weapons.qc
qcsrc/menu/xonotic/dialog_settings_input.qc
qcsrc/menu/xonotic/dialog_settings_misc.qc
qcsrc/menu/xonotic/dialog_settings_user.qc
qcsrc/menu/xonotic/dialog_settings_video.qc
qcsrc/menu/xonotic/gametypelist.qc
qcsrc/menu/xonotic/keybinder.qc
qcsrc/menu/xonotic/languagelist.qc
qcsrc/menu/xonotic/mainwindow.qc
qcsrc/menu/xonotic/maplist.qc
qcsrc/menu/xonotic/picker.qc [new file with mode: 0644]
qcsrc/menu/xonotic/playerlist.qc
qcsrc/menu/xonotic/playlist.qc
qcsrc/menu/xonotic/screenshotlist.qc
qcsrc/menu/xonotic/serverlist.qc
qcsrc/menu/xonotic/skinlist.qc
qcsrc/menu/xonotic/soundlist.qc
qcsrc/menu/xonotic/statslist.qc
qcsrc/menu/xonotic/tab.qc
qcsrc/menu/xonotic/util.qc
qcsrc/menu/xonotic/util.qh
qcsrc/menu/xonotic/weaponslist.qc
qcsrc/server/_all.qh
qcsrc/server/autocvars.qh
qcsrc/server/bot/bot.qc
qcsrc/server/cheats.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/cl_physics.qc
qcsrc/server/command/all.qc [new file with mode: 0644]
qcsrc/server/command/all.qh [new file with mode: 0644]
qcsrc/server/command/cmd.qc
qcsrc/server/command/commands.qc [deleted file]
qcsrc/server/command/commands.qh [deleted file]
qcsrc/server/command/getreplies.qc
qcsrc/server/command/vote.qc
qcsrc/server/command/vote.qh
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/g_damage.qh
qcsrc/server/g_hook.qc
qcsrc/server/g_world.qc
qcsrc/server/item_key.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/gamemode.qh
qcsrc/server/mutators/gamemode_freezetag.qc
qcsrc/server/mutators/mutator.qh
qcsrc/server/mutators/mutator_buffs.qc
qcsrc/server/mutators/mutator_buffs.qh
qcsrc/server/mutators/mutator_instagib.qc
qcsrc/server/mutators/mutators_include.qc
qcsrc/server/portals.qc
qcsrc/server/progs.src
qcsrc/server/sv_main.qc
qcsrc/server/t_items.qc
qcsrc/server/t_items.qh
qcsrc/server/t_plats.qc
qcsrc/server/t_quake.qc
qcsrc/server/t_quake3.qc
qcsrc/server/t_swamp.qc
qcsrc/server/vehicles/all.qh
qcsrc/server/weapons/accuracy.qc
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/csqcprojectile.qc
qcsrc/server/weapons/hitplot.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/weaponstats.qc
qcsrc/server/weapons/weaponsystem.qc
qcsrc/warpzonelib/common.qc

index 5aa1bbfeea3203469aedb2a4b248d08951d12617..b74eff9607999b19978d0128dd466824e1167585 100644 (file)
@@ -38,6 +38,9 @@ seta hud_panel_engineinfo_framecounter_exponentialmovingaverage 1 "use an averag
 seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_new_weight 0.1 "weight of latest data point"
 seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold 0.5 "threshold for fps change when to update instantly, to make big fps changes update faster"
 
+seta hud_panel_physics_acceleration_movingaverage 1 "use an averaging method for calculating acceleration instead of the real value"
+seta hud_panel_phisics_update_interval 0.0666 "how often (in seconds) numeric values get updated on screen"
+
 // hud panel aliases
 alias hud_panel_radar_rotate "toggle hud_panel_radar_rotation 0 1 2 3 4"
 alias +hud_panel_radar_maximized "cl_cmd hud radar 1"
index 20f957029a3472151c0756d25eb444959906d57d..812e572b274b341177468f8ec99d616e4944ead0 100644 (file)
@@ -160,6 +160,7 @@ alias sentcvar             "qc_cmd_cmd    sentcvar             ${* ?}" // New sy
 alias mobedit              "qc_cmd_cmd    mobedit              ${* ?}" // Edit a monster's properties
 alias mobkill              "qc_cmd_cmd    mobkill              ${* ?}" // Kill a monster
 alias mobspawn             "qc_cmd_cmd    mobspawn             ${* ?}" // Spawn a monster infront of the player
+alias physics              "qc_cmd_cmd    physics              ${* ?}" // Change physics set
 alias spectate             "qc_cmd_cmd    spectate             ${* ?}" // Become an observer
 alias suggestmap           "qc_cmd_cmd    suggestmap           ${* ?}" // Suggest a map to the mapvote at match end
 //alias tell               "qc_cmd_cmd    tell                 ${* ?}" // Send a message directly to a player
index c37e19fb3ab614e549fedc3c3940f63869e4f08a..756ab235571eec7f27c2a40529a55591204e81c3 100644 (file)
@@ -1399,6 +1399,7 @@ exec gamemodes.cfg
 exec mutators.cfg
 exec notifications.cfg
 exec monsters.cfg
+exec physics.cfg
 
 // load console command aliases and settings
 exec commands.cfg
diff --git a/gfx/menu/luma/crosshairbutton_c.tga b/gfx/menu/luma/crosshairbutton_c.tga
deleted file mode 100644 (file)
index ecfd0a8..0000000
Binary files a/gfx/menu/luma/crosshairbutton_c.tga and /dev/null differ
diff --git a/gfx/menu/luma/crosshairbutton_d.tga b/gfx/menu/luma/crosshairbutton_d.tga
deleted file mode 100644 (file)
index 4e7901e..0000000
Binary files a/gfx/menu/luma/crosshairbutton_d.tga and /dev/null differ
diff --git a/gfx/menu/luma/crosshairbutton_f.tga b/gfx/menu/luma/crosshairbutton_f.tga
deleted file mode 100644 (file)
index 604a935..0000000
Binary files a/gfx/menu/luma/crosshairbutton_f.tga and /dev/null differ
diff --git a/gfx/menu/luma/crosshairbutton_n.tga b/gfx/menu/luma/crosshairbutton_n.tga
deleted file mode 100644 (file)
index 4e7901e..0000000
Binary files a/gfx/menu/luma/crosshairbutton_n.tga and /dev/null differ
index 1e87e8869ec5d9443c3147dde51298a675738f94..5a36d90e0722e389e135f6057c931b150dc673da 100644 (file)
@@ -33,8 +33,10 @@ 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'
+
+// crosshairpicker
+ALPHA_CROSSHAIRPICKER_CROSSHAIR 0.85
+COLOR_CROSSHAIRPICKER_CROSSHAIR '1 1 1'
 
 // checkbox
 COLOR_CHECKBOX_C              '1 1 1'
@@ -142,6 +144,9 @@ 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'
+ALPHA_LISTBOX_FOCUSED         0.8
+FADEALPHA_LISTBOX_FOCUSED     0.4
+COLOR_LISTBOX_FOCUSED         '0.09 0.42 0.69'
 
 // mainmenu
 ALPHAS_MAINMENU               '0.8 0.9 1'
diff --git a/gfx/menu/luminos/crosshairbutton_c.tga b/gfx/menu/luminos/crosshairbutton_c.tga
deleted file mode 100644 (file)
index 586f9b4..0000000
Binary files a/gfx/menu/luminos/crosshairbutton_c.tga and /dev/null differ
diff --git a/gfx/menu/luminos/crosshairbutton_d.tga b/gfx/menu/luminos/crosshairbutton_d.tga
deleted file mode 100755 (executable)
index cba9d88..0000000
Binary files a/gfx/menu/luminos/crosshairbutton_d.tga and /dev/null differ
diff --git a/gfx/menu/luminos/crosshairbutton_f.tga b/gfx/menu/luminos/crosshairbutton_f.tga
deleted file mode 100644 (file)
index 57d7d93..0000000
Binary files a/gfx/menu/luminos/crosshairbutton_f.tga and /dev/null differ
diff --git a/gfx/menu/luminos/crosshairbutton_n.tga b/gfx/menu/luminos/crosshairbutton_n.tga
deleted file mode 100755 (executable)
index ac94535..0000000
Binary files a/gfx/menu/luminos/crosshairbutton_n.tga and /dev/null differ
index 77af6c8dc0dfededc9af62be884e9eb482f55a90..b9c69802e490e28ecc7b6b6cbebf24e3eb479204 100755 (executable)
@@ -108,6 +108,9 @@ COLOR_LISTBOX_SELECTED          '1 0.4375 0'
 ALPHA_LISTBOX_SELECTED          1
 COLOR_LISTBOX_WAITING           '1 1 1'
 ALPHA_LISTBOX_WAITING           0.5
+COLOR_LISTBOX_FOCUSED           '0 0.25 0.5'
+ALPHA_LISTBOX_FOCUSED           0.7
+FADEALPHA_LISTBOX_FOCUSED       0.3
 
 // item: map list
 COLOR_MAPLIST_TITLE             '1 1 1'
@@ -170,9 +173,6 @@ COLOR_CHECKBOX_C                '1 1 1'
 COLOR_CHECKBOX_F                '1 1 1'
 COLOR_CHECKBOX_D                '1 1 1'
 
-// item: crosshair button
-//   uses "crosshairbutton" images
-
 // dialog background colors
 //   uses "border" images
 COLOR_DIALOG_MULTIPLAYER        '1 1 1'
@@ -221,8 +221,10 @@ ALPHA_KEYGRABBER_KEYS           0.7
 // item: charmap
 ALPHA_CHARMAP_CHAR              0.85
 COLOR_CHARMAP_CHAR              '1 1 1'
-ALPHA_CHARMAP_FOCUS             1
-COLOR_CHARMAP_FOCUS             '0 0.25 0.5'
+
+// item: crosshairpicker
+ALPHA_CROSSHAIRPICKER_CROSSHAIR 0.85
+COLOR_CROSSHAIRPICKER_CROSSHAIR '1 1 1'
 
 // item: radio button
 //   uses "radiobutton" images
diff --git a/gfx/menu/wickedx/crosshairbutton_c.tga b/gfx/menu/wickedx/crosshairbutton_c.tga
deleted file mode 100644 (file)
index 1c294f7..0000000
Binary files a/gfx/menu/wickedx/crosshairbutton_c.tga and /dev/null differ
diff --git a/gfx/menu/wickedx/crosshairbutton_d.tga b/gfx/menu/wickedx/crosshairbutton_d.tga
deleted file mode 100755 (executable)
index 110faa1..0000000
Binary files a/gfx/menu/wickedx/crosshairbutton_d.tga and /dev/null differ
diff --git a/gfx/menu/wickedx/crosshairbutton_f.tga b/gfx/menu/wickedx/crosshairbutton_f.tga
deleted file mode 100644 (file)
index 0031c35..0000000
Binary files a/gfx/menu/wickedx/crosshairbutton_f.tga and /dev/null differ
diff --git a/gfx/menu/wickedx/crosshairbutton_n.tga b/gfx/menu/wickedx/crosshairbutton_n.tga
deleted file mode 100755 (executable)
index ac94535..0000000
Binary files a/gfx/menu/wickedx/crosshairbutton_n.tga and /dev/null differ
index 8b56baa1f3c54a54d561f3a335017a68424fa876..09ded4b087c356d741a823ab25293da71bae7dcb 100644 (file)
@@ -108,6 +108,9 @@ COLOR_LISTBOX_SELECTED          '0.875 0.375 0'
 ALPHA_LISTBOX_SELECTED          1
 COLOR_LISTBOX_WAITING           '1 1 1'
 ALPHA_LISTBOX_WAITING           0.5
+COLOR_LISTBOX_FOCUSED           '0 0.375 0.75'
+ALPHA_LISTBOX_FOCUSED           0.35
+FADEALPHA_LISTBOX_FOCUSED       0.75
 
 // item: map list
 COLOR_MAPLIST_TITLE             '1 1 1'
@@ -170,9 +173,6 @@ COLOR_CHECKBOX_C                '0.5 0.75 1'
 COLOR_CHECKBOX_F                '0.5 0.75 1'
 COLOR_CHECKBOX_D                '1 1 1'
 
-// item: crosshair button
-//   uses "crosshairbutton" images
-
 // dialog background colors
 //   uses "border" images
 COLOR_DIALOG_MULTIPLAYER        '1 1 1'
@@ -221,8 +221,10 @@ ALPHA_KEYGRABBER_KEYS           0.7
 // item: charmap
 ALPHA_CHARMAP_CHAR              0.85
 COLOR_CHARMAP_CHAR              '1 1 1'
-ALPHA_CHARMAP_FOCUS             0.75
-COLOR_CHARMAP_FOCUS             '0 0.375 0.75'
+
+// item: crosshairpicker
+ALPHA_CROSSHAIRPICKER_CROSSHAIR 0.85
+COLOR_CROSSHAIRPICKER_CROSSHAIR '1 1 1'
 
 // item: radio button
 //   uses "radiobutton" images
diff --git a/gfx/menu/xaw/crosshairbutton_c.tga b/gfx/menu/xaw/crosshairbutton_c.tga
deleted file mode 100644 (file)
index 646c64e..0000000
Binary files a/gfx/menu/xaw/crosshairbutton_c.tga and /dev/null differ
diff --git a/gfx/menu/xaw/crosshairbutton_d.tga b/gfx/menu/xaw/crosshairbutton_d.tga
deleted file mode 100644 (file)
index 110faa1..0000000
Binary files a/gfx/menu/xaw/crosshairbutton_d.tga and /dev/null differ
diff --git a/gfx/menu/xaw/crosshairbutton_f.tga b/gfx/menu/xaw/crosshairbutton_f.tga
deleted file mode 100644 (file)
index d8f25ef..0000000
Binary files a/gfx/menu/xaw/crosshairbutton_f.tga and /dev/null differ
diff --git a/gfx/menu/xaw/crosshairbutton_n.tga b/gfx/menu/xaw/crosshairbutton_n.tga
deleted file mode 100644 (file)
index 5d678a6..0000000
Binary files a/gfx/menu/xaw/crosshairbutton_n.tga and /dev/null differ
index 57c6f2a35009163a49426aa802b167804474a6f3..00df32498ebdfdb623c9e42d3c9c0348db648a94 100644 (file)
@@ -107,9 +107,6 @@ ALPHA_CREDITS_PERSON            1
 ROWS_CREDITS                    20
 WIDTH_CREDITS                   0.5
 
-// item: crosshair button
-//   uses "crosshairbutton" images
-
 // item: cvar list
 ALPHA_CVARLIST_SAVED            1
 ALPHA_CVARLIST_TEMPORARY        0.7
@@ -152,8 +149,11 @@ COLOR_LISTBOX_SELECTED          '0 0 0'
 ALPHA_LISTBOX_SELECTED          1
 COLOR_LISTBOX_WAITING           '1 0 0'
 ALPHA_LISTBOX_WAITING           0.5
-COLOR_LISTBOX_BACKGROUND               '0 0 0'
-ALPHA_LISTBOX_BACKGROUND               0
+COLOR_LISTBOX_BACKGROUND        '0 0 0'
+ALPHA_LISTBOX_BACKGROUND        0
+COLOR_LISTBOX_FOCUSED           '0 0 0'
+ALPHA_LISTBOX_FOCUSED           0.3
+FADEALPHA_LISTBOX_FOCUSED       0.3
 
 // item: map list
 COLOR_MAPLIST_TITLE             '1 1 1'
@@ -176,8 +176,10 @@ ALPHA_MODELTITLE                1
 // item: charmap
 ALPHA_CHARMAP_CHAR              0.85
 COLOR_CHARMAP_CHAR              '1 1 1'
-ALPHA_CHARMAP_FOCUS             0.5
-COLOR_CHARMAP_FOCUS             '0 0 0'
+
+// item: crosshairpicker
+ALPHA_CROSSHAIRPICKER_CROSSHAIR 0.85
+COLOR_CROSSHAIRPICKER_CROSSHAIR '1 1 1'
 
 // item: radio button
 //   uses "radiobutton" images
diff --git a/physics.cfg b/physics.cfg
new file mode 100644 (file)
index 0000000..58d1b1f
--- /dev/null
@@ -0,0 +1,256 @@
+// ==================================================
+//  Main configuration for client selectable physics
+// ==================================================
+
+
+// ==============
+//  Main options
+// ==============
+seta cl_physics "default" "client selected physics set"
+
+set g_physics_clientselect 0 "allow clients to select their physics set"
+set g_physics_clientselect_options "xonotic nexuiz quake warsow defrag quake3 vecxis quake2 bones"
+set g_physics_clientselect_default "" "override default physics"
+
+// =========
+//  Xonotic
+// =========
+set g_physics_xonotic_airaccel_qw -0.8
+set g_physics_xonotic_airstrafeaccel_qw -0.95
+set g_physics_xonotic_airspeedlimit_nonqw 900
+set g_physics_xonotic_maxspeed 360
+set g_physics_xonotic_jumpvelocity 260
+set g_physics_xonotic_maxairstrafespeed 100
+set g_physics_xonotic_maxairspeed 360
+set g_physics_xonotic_airstrafeaccelerate 18
+set g_physics_xonotic_warsowbunny_turnaccel 0
+set g_physics_xonotic_airaccel_qw_stretchfactor 2
+set g_physics_xonotic_airaccel_sideways_friction 0
+set g_physics_xonotic_aircontrol 100
+set g_physics_xonotic_aircontrol_power 2
+set g_physics_xonotic_aircontrol_penalty 0
+set g_physics_xonotic_warsowbunny_airforwardaccel 1.00001
+set g_physics_xonotic_warsowbunny_topspeed 925
+set g_physics_xonotic_warsowbunny_accel 0.1593
+set g_physics_xonotic_warsowbunny_backtosideratio 0.8
+set g_physics_xonotic_friction 6
+set g_physics_xonotic_accelerate 15
+set g_physics_xonotic_stopspeed 100
+set g_physics_xonotic_airaccelerate 2
+set g_physics_xonotic_airstopaccelerate 3
+
+// ========
+//  Nexuiz
+// ========
+set g_physics_nexuiz_airaccel_qw 0.95
+set g_physics_nexuiz_airstrafeaccel_qw 0
+set g_physics_nexuiz_airspeedlimit_nonqw 0
+set g_physics_nexuiz_maxspeed 400
+set g_physics_nexuiz_jumpvelocity 300 "333 to match xonotic physics"
+set g_physics_nexuiz_maxairstrafespeed 0
+set g_physics_nexuiz_maxairspeed 220
+set g_physics_nexuiz_airstrafeaccelerate 0
+set g_physics_nexuiz_warsowbunny_turnaccel 0
+set g_physics_nexuiz_airaccel_qw_stretchfactor 0
+set g_physics_nexuiz_airaccel_sideways_friction 0.35
+set g_physics_nexuiz_aircontrol 0
+set g_physics_nexuiz_aircontrol_power 2
+set g_physics_nexuiz_aircontrol_penalty 0
+set g_physics_nexuiz_warsowbunny_airforwardaccel 1.00001
+set g_physics_nexuiz_warsowbunny_topspeed 925
+set g_physics_nexuiz_warsowbunny_accel 0.1593
+set g_physics_nexuiz_warsowbunny_backtosideratio 0.8
+set g_physics_nexuiz_friction 7
+set g_physics_nexuiz_accelerate 8
+set g_physics_nexuiz_stopspeed 100
+set g_physics_nexuiz_airaccelerate 5.5
+set g_physics_nexuiz_airstopaccelerate 0
+
+// =======
+//  Quake
+// =======
+set g_physics_quake_airaccel_qw 1
+set g_physics_quake_airstrafeaccel_qw 0
+set g_physics_quake_airspeedlimit_nonqw 0
+set g_physics_quake_maxspeed 320
+set g_physics_quake_jumpvelocity 270
+set g_physics_quake_maxairstrafespeed 0
+set g_physics_quake_maxairspeed 30
+set g_physics_quake_airstrafeaccelerate 0
+set g_physics_quake_warsowbunny_turnaccel 0
+set g_physics_quake_airaccel_qw_stretchfactor 0
+set g_physics_quake_airaccel_sideways_friction 0
+set g_physics_quake_aircontrol 0
+set g_physics_quake_aircontrol_power 2
+set g_physics_quake_aircontrol_penalty 0
+set g_physics_quake_warsowbunny_airforwardaccel 1.00001
+set g_physics_quake_warsowbunny_topspeed 925
+set g_physics_quake_warsowbunny_accel 0.1593
+set g_physics_quake_warsowbunny_backtosideratio 0.8
+set g_physics_quake_friction 4
+set g_physics_quake_accelerate 10
+set g_physics_quake_stopspeed 100
+set g_physics_quake_airaccelerate 106.66666666666666666666
+set g_physics_quake_airstopaccelerate 0
+
+// ========
+//  Warsow
+// ========
+set g_physics_warsow_airaccel_qw 1
+set g_physics_warsow_airstrafeaccel_qw 0
+set g_physics_warsow_airspeedlimit_nonqw 0
+set g_physics_warsow_maxspeed 320
+set g_physics_warsow_jumpvelocity 280
+set g_physics_warsow_maxairstrafespeed 30
+set g_physics_warsow_maxairspeed 320
+set g_physics_warsow_airstrafeaccelerate 70
+set g_physics_warsow_warsowbunny_turnaccel 9
+set g_physics_warsow_airaccel_qw_stretchfactor 0
+set g_physics_warsow_airaccel_sideways_friction 0
+set g_physics_warsow_aircontrol 0
+set g_physics_warsow_aircontrol_power 2
+set g_physics_warsow_aircontrol_penalty 0
+set g_physics_warsow_warsowbunny_airforwardaccel 1.00001
+set g_physics_warsow_warsowbunny_topspeed 925
+set g_physics_warsow_warsowbunny_accel 0.1593
+set g_physics_warsow_warsowbunny_backtosideratio 0.8
+set g_physics_warsow_friction 8
+set g_physics_warsow_accelerate 15
+set g_physics_warsow_stopspeed 100
+set g_physics_warsow_airaccelerate 1
+set g_physics_warsow_airstopaccelerate 2.5
+
+// ========
+//  DeFrag
+// ========
+set g_physics_defrag_airaccel_qw 0.95
+set g_physics_defrag_airstrafeaccel_qw 1
+set g_physics_defrag_airspeedlimit_nonqw 0
+set g_physics_defrag_maxspeed 320
+set g_physics_defrag_jumpvelocity 270
+set g_physics_defrag_maxairstrafespeed 30
+set g_physics_defrag_maxairspeed 320
+set g_physics_defrag_airstrafeaccelerate 70
+set g_physics_defrag_warsowbunny_turnaccel 0
+set g_physics_defrag_airaccel_qw_stretchfactor 0
+set g_physics_defrag_airaccel_sideways_friction 0
+set g_physics_defrag_aircontrol 150
+set g_physics_defrag_aircontrol_power 2
+set g_physics_defrag_aircontrol_penalty 0
+set g_physics_defrag_warsowbunny_airforwardaccel 1.00001
+set g_physics_defrag_warsowbunny_topspeed 925
+set g_physics_defrag_warsowbunny_accel 0.1593
+set g_physics_defrag_warsowbunny_backtosideratio 0.8
+set g_physics_defrag_friction 5.8
+set g_physics_defrag_accelerate 15
+set g_physics_defrag_stopspeed 100
+set g_physics_defrag_airaccelerate 1
+set g_physics_defrag_airstopaccelerate 2.5
+
+// =========
+//  Quake 3
+// =========
+set g_physics_quake3_airaccel_qw 1
+set g_physics_quake3_airstrafeaccel_qw 0
+set g_physics_quake3_airspeedlimit_nonqw 0
+set g_physics_quake3_maxspeed 320
+set g_physics_quake3_jumpvelocity 270
+set g_physics_quake3_maxairstrafespeed 0
+set g_physics_quake3_maxairspeed 320
+set g_physics_quake3_airstrafeaccelerate 0
+set g_physics_quake3_warsowbunny_turnaccel 0
+set g_physics_quake3_airaccel_qw_stretchfactor 0
+set g_physics_quake3_airaccel_sideways_friction 0
+set g_physics_quake3_aircontrol 0
+set g_physics_quake3_aircontrol_power 2
+set g_physics_quake3_aircontrol_penalty 0
+set g_physics_quake3_warsowbunny_airforwardaccel 1.00001
+set g_physics_quake3_warsowbunny_topspeed 925
+set g_physics_quake3_warsowbunny_accel 0.1593
+set g_physics_quake3_warsowbunny_backtosideratio 0.8
+set g_physics_quake3_friction 6
+set g_physics_quake3_accelerate 10
+set g_physics_quake3_stopspeed 100
+set g_physics_quake3_airaccelerate 1
+set g_physics_quake3_airstopaccelerate 0
+
+// ========
+//  Vecxis
+// ========
+set g_physics_vecxis_airaccel_qw 0.93
+set g_physics_vecxis_airstrafeaccel_qw 0
+set g_physics_vecxis_airspeedlimit_nonqw 0
+set g_physics_vecxis_maxspeed 400
+set g_physics_vecxis_jumpvelocity 300 "333 to match xonotic physics"
+set g_physics_vecxis_maxairstrafespeed 0
+set g_physics_vecxis_maxairspeed 220
+set g_physics_vecxis_airstrafeaccelerate 0
+set g_physics_vecxis_warsowbunny_turnaccel 0
+set g_physics_vecxis_airaccel_qw_stretchfactor 0
+set g_physics_vecxis_airaccel_sideways_friction 0.3
+set g_physics_vecxis_aircontrol 0
+set g_physics_vecxis_aircontrol_power 2
+set g_physics_vecxis_aircontrol_penalty 0
+set g_physics_vecxis_warsowbunny_airforwardaccel 1.00001
+set g_physics_vecxis_warsowbunny_topspeed 925
+set g_physics_vecxis_warsowbunny_accel 0.1593
+set g_physics_vecxis_warsowbunny_backtosideratio 0.8
+set g_physics_vecxis_friction 5
+set g_physics_vecxis_accelerate 5.5
+set g_physics_vecxis_stopspeed 100
+set g_physics_vecxis_airaccelerate 5.5
+set g_physics_vecxis_airstopaccelerate 0
+
+// =========
+//  Quake 2
+// =========
+set g_physics_quake2_airaccel_qw 1
+set g_physics_quake2_airstrafeaccel_qw 0
+set g_physics_quake2_airspeedlimit_nonqw 0
+set g_physics_quake2_maxspeed 300
+set g_physics_quake2_jumpvelocity 270
+set g_physics_quake2_maxairstrafespeed 0
+set g_physics_quake2_maxairspeed 300
+set g_physics_quake2_airstrafeaccelerate 0
+set g_physics_quake2_warsowbunny_turnaccel 0
+set g_physics_quake2_airaccel_qw_stretchfactor 0
+set g_physics_quake2_airaccel_sideways_friction 0
+set g_physics_quake2_aircontrol 0
+set g_physics_quake2_aircontrol_power 2
+set g_physics_quake2_aircontrol_penalty 0
+set g_physics_quake2_warsowbunny_airforwardaccel 1.00001
+set g_physics_quake2_warsowbunny_topspeed 925
+set g_physics_quake2_warsowbunny_accel 0.1593
+set g_physics_quake2_warsowbunny_backtosideratio 0.8
+set g_physics_quake2_friction 6
+set g_physics_quake2_accelerate 10
+set g_physics_quake2_stopspeed 100
+set g_physics_quake2_airaccelerate 1
+set g_physics_quake2_airstopaccelerate 0
+
+// =======
+//  Bones
+// =======
+set g_physics_bones_airaccel_qw 1
+set g_physics_bones_airstrafeaccel_qw 1
+set g_physics_bones_airspeedlimit_nonqw 0
+set g_physics_bones_maxspeed 320
+set g_physics_bones_jumpvelocity 270
+set g_physics_bones_maxairstrafespeed 30
+set g_physics_bones_maxairspeed 320
+set g_physics_bones_airstrafeaccelerate 70
+set g_physics_bones_warsowbunny_turnaccel 0
+set g_physics_bones_airaccel_qw_stretchfactor 0
+set g_physics_bones_airaccel_sideways_friction 0
+set g_physics_bones_aircontrol 150
+set g_physics_bones_aircontrol_power 2
+set g_physics_bones_aircontrol_penalty 0
+set g_physics_bones_warsowbunny_airforwardaccel 1.00001
+set g_physics_bones_warsowbunny_topspeed 925
+set g_physics_bones_warsowbunny_accel 0.1593
+set g_physics_bones_warsowbunny_backtosideratio 0.8
+set g_physics_bones_friction 5.97
+set g_physics_bones_accelerate 15
+set g_physics_bones_stopspeed 100
+set g_physics_bones_airaccelerate 1
+set g_physics_bones_airstopaccelerate 2.5
index c8ff79d58b6f142fdd47f4492258f40e2057508a..e758fdb7a7d5f211de3dc67531cc1aa2d121c506 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef CLIENT___H
-#define CLIENT___H
+#ifndef CLIENT_ALL_H
+#define CLIENT_ALL_H
 
 #include "autocvars.qh"
 #include "defs.qh"
index e35bf82dd2759122afc2cf11d46707ef5fc1177b..90faef9411e7a23bee108316cad225b3e4b5e723 100644 (file)
@@ -282,10 +282,12 @@ float autocvar_hud_panel_notify_fontsize;
 float autocvar_hud_panel_notify_time;
 float autocvar_hud_panel_notify_icon_aspect;
 bool autocvar_hud_panel_physics;
+float autocvar_hud_panel_physics_acceleration_movingaverage = 1;
 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_update_interval;
 int autocvar_hud_panel_physics_progressbar;
 bool autocvar_hud_panel_physics_acceleration_vertical;
 int autocvar_hud_panel_physics_baralign;
diff --git a/qcsrc/client/command/all.qc b/qcsrc/client/command/all.qc
new file mode 100644 (file)
index 0000000..dcace65
--- /dev/null
@@ -0,0 +1,5 @@
+#include "../_all.qh"
+
+#include "../../common/command/all.qc"
+
+#include "cl_cmd.qc"
diff --git a/qcsrc/client/command/all.qh b/qcsrc/client/command/all.qh
new file mode 100644 (file)
index 0000000..34fc423
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef CLIENT_COMMANDS_ALL_H
+#define CLIENT_COMMANDS_ALL_H
+
+#include "../../common/command/all.qh"
+
+#include "cl_cmd.qh"
+
+#endif
diff --git a/qcsrc/client/command/commands.qc b/qcsrc/client/command/commands.qc
deleted file mode 100644 (file)
index dabf8f3..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "../_all.qh"
-
-#include "../../common/command/commands.qc"
-
-#include "cl_cmd.qc"
diff --git a/qcsrc/client/command/commands.qh b/qcsrc/client/command/commands.qh
deleted file mode 100644 (file)
index 65bf3da..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef CLIENT_COMMANDS_H
-#define CLIENT_COMMANDS_H
-
-#include "../../common/command/commands.qh"
-
-#include "cl_cmd.qh"
-
-#endif
index 924162138234377af35963d04f88ec44050b4e85..39c422e1cca700cabe13953c50af3c7234bcbc40 100644 (file)
@@ -5,13 +5,13 @@
 #include "movetypes.qh"
 #include "prandom.qh"
 
-#include "vehicles/vehicles.qh"
+#include "vehicles/all.qh"
 
 #include "../common/constants.qh"
 #include "../common/deathtypes.qh"
 #include "../common/util.qh"
 
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 
 .entity tag_entity;
 
index 33e9cb5f5ff4a436eedcb519840c9e8810cd39e6..b61fe2a5da685f95d66b3a766fdaded8d63cf2ca 100644 (file)
@@ -3909,6 +3909,7 @@ void HUD_InfoMessages(void)
 //
 vector acc_prevspeed;
 float acc_prevtime, acc_avg, top_speed, top_speed_time;
+float physics_update_time, discrete_speed, discrete_acceleration;
 void HUD_Physics(void)
 {
        if(!autocvar__hud_configure)
@@ -3996,8 +3997,23 @@ void HUD_Physics(void)
                acc_prevspeed = vel;
                acc_prevtime = time;
 
-               f = bound(0, f * 10, 1);
-               acc_avg = acc_avg * (1 - f) + acceleration * f;
+               if(autocvar_hud_panel_physics_acceleration_movingaverage)
+               {
+                       f = bound(0, f * 10, 1);
+                       acc_avg = acc_avg * (1 - f) + acceleration * f;
+                       acceleration = acc_avg;
+               }
+       }
+
+       int acc_decimals = 2;
+       if(time > physics_update_time)
+       {
+               // workaround for ftos_decimals returning a negative 0
+               if(discrete_acceleration > -1 / pow(10, acc_decimals) && discrete_acceleration < 0)
+                       discrete_acceleration = 0;
+               discrete_acceleration = acceleration;
+               discrete_speed = speed;
+               physics_update_time += autocvar_hud_panel_physics_update_interval;
        }
 
        //compute layout
@@ -4051,7 +4067,7 @@ void HUD_Physics(void)
                //else
                        //tmp_offset_x = 0;
                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);
+               drawstring_aspect(panel_pos + speed_offset + tmp_offset, ftos(discrete_speed), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 
                //draw speed unit
                if (speed_baralign)
@@ -4141,7 +4157,7 @@ void HUD_Physics(void)
 
                f = acceleration/autocvar_hud_panel_physics_acceleration_max;
                if (autocvar_hud_panel_physics_acceleration_progressbar_nonlinear)
-                       f = sqrt(f);
+                       f = (f >= 0 ? sqrt(f) : -sqrt(-f));
 
                if (acceleration_progressbar_scale) // allow progressbar to go out of panel bounds
                {
@@ -4163,12 +4179,16 @@ 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;
-       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);
+
+       if(autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 3)
+       {
+               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;
+
+               drawstring_aspect(panel_pos + acceleration_offset + tmp_offset, strcat(ftos_decimals(discrete_acceleration, acc_decimals), "g"), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       }
 
        draw_endBoldFont();
 }
@@ -4296,15 +4316,23 @@ void HUD_CenterPrint (void)
                        reset_centerprint_messages();
                if (time > hud_configure_cp_generation_time)
                {
-                       float r;
-                       r = random();
-                       if (r > 0.75)
-                               centerprint_generic(floor(r*1000), strcat(sprintf("^3Countdown message at time %s", seconds_tostring(time)), ", seconds left: ^COUNT"), 1, 10);
-                       else if (r > 0.5)
-                               centerprint_generic(0, sprintf("^1Multiline message at time %s that\n^1lasts longer than normal", seconds_tostring(time)), 20, 0);
+                       if(HUD_PANEL(CENTERPRINT) == highlightedPanel)
+                       {
+                               float r;
+                               r = random();
+                               if (r > 0.8)
+                                       centerprint_generic(floor(r*1000), strcat(sprintf("^3Countdown message at time %s", seconds_tostring(time)), ", seconds left: ^COUNT"), 1, 10);
+                               else if (r > 0.55)
+                                       centerprint_generic(0, sprintf("^1Multiline message at time %s that\n^1lasts longer than normal", seconds_tostring(time)), 20, 0);
+                               else
+                                       centerprint_hud(sprintf("Message at time %s", seconds_tostring(time)));
+                               hud_configure_cp_generation_time = time + 1 + random()*4;
+                       }
                        else
-                               centerprint_hud(sprintf("Message at time %s", seconds_tostring(time)));
-                       hud_configure_cp_generation_time = time + 1 + random()*4;
+                       {
+                               centerprint_generic(0, sprintf("Centerprint message", seconds_tostring(time)), 10, 0);
+                               hud_configure_cp_generation_time = time + 10 - random()*3;
+                       }
                }
        }
 
index f880a810f6eb2c6a7dc53b797f1b3f67ea1422e1..3b61cb4539643c06b1e66dcc89b9fccbee6546f0 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef HUD_H
 #define HUD_H
 
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 
 const int HUD_PANEL_MAX = 24;
 entity hud_panel[HUD_PANEL_MAX];
@@ -292,27 +292,18 @@ HUD_PANELS(HUD_PANEL)
 } while(0)
 
 // return smoothly faded pos and size of given panel when a dialog is active
-#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;                  \
+// don't center too wide panels, it doesn't work with different resolutions
+#define HUD_Panel_UpdatePosSize_ForMenu() do { \
+       vector menu_enable_size = panel_size; \
+       float max_panel_width = 0.52 * vid_conwidth; \
+       if(panel_size.x > max_panel_width) \
+       { \
+               menu_enable_size.x = max_panel_width; \
+               menu_enable_size.y = panel_size.y * (menu_enable_size.x / panel_size.x); \
+       } \
+       vector menu_enable_pos = eX * (panel_bg_border + 0.5 * max_panel_width) + eY * 0.5 * vid_conheight - 0.5 * menu_enable_size; \
+       panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * menu_enable_pos; \
+       panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * menu_enable_size; \
 } while(0)
 
 // Scale the pos and size vectors to absolute coordinates
index 3352e643abab19f0790d382de3c794dfb5e2a6b4..4b55bb40e9850ab92c104210f6d2fb3712373c93 100644 (file)
@@ -431,8 +431,7 @@ void HUD_Panel_SetPosSize(vector mySize)
 {
        panel = highlightedPanel;
        HUD_Panel_UpdatePosSize();
-       vector resizeorigin;
-       resizeorigin = panel_click_resizeorigin;
+       vector resizeorigin = panel_click_resizeorigin;
        vector myPos;
 
        // minimum panel size cap
@@ -565,7 +564,6 @@ void HUD_Panel_Arrow_Action(float nPrimary)
 
        if (hudShiftState & S_ALT) // resize
        {
-               highlightedAction = 1;
                if(nPrimary == K_UPARROW)
                        resizeCorner = 1;
                else if(nPrimary == K_RIGHTARROW)
@@ -602,7 +600,6 @@ void HUD_Panel_Arrow_Action(float nPrimary)
        }
        else // move
        {
-               highlightedAction = 2;
                vector pos;
                pos = panel_pos;
                if(nPrimary == K_UPARROW)
@@ -744,15 +741,14 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                if (!menu_enabled)
                        cvar_set("_hud_configure", "0");
        }
-       else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // select and highlight another panel
+       else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
        {
                if (bInputType == 1 || mouseClicked)
                        return true;
 
-               //FIXME: if a panel is highlighted, has the same pos_x and lays in the same level
-               //of other panels then next consecutive ctrl-tab will select the highlighted panel too
-               //(it should only after every other panel of the hud)
-               //It's a minor bug anyway, we can live with it
+               // FIXME minor bug: if a panel is highlighted, has the same pos_x and
+               // lays in the same level of another panel then the next consecutive
+               // CTRL TAB presses will reselect once more the highlighted panel
 
                entity starting_panel;
                entity old_tab_panel = tab_panel;
@@ -897,6 +893,12 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                        highlightedPanel_backup = world;
                }
        }
+       else if(nPrimary == 's' && hudShiftState & S_CTRL) // save config
+       {
+               if (bInputType == 1 || mouseClicked)
+                       return true;
+               localcmd("hud save myconfig\n");
+       }
        else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
        {
                if (bInputType == 1)
@@ -917,7 +919,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                if (highlightedPanel)
                        HUD_Panel_EnableMenu();
        }
-       else if(hit_con_bind)
+       else if(hit_con_bind || nPrimary == K_PAUSE)
                return false;
 
        return true;
@@ -1176,6 +1178,8 @@ void HUD_Panel_Mouse()
        }
        else
        {
+               if(prevMouseClicked)
+                       highlightedAction = 0;
                if(menu_enabled == 2)
                        mouse_over_panel = 0;
                else
index 5343c180cc46c4ba4b4546e3475cc204ea21f9f3..7648b129775afa875f38ff5e16de5339c62c3a80 100644 (file)
 #include "waypointsprites.qh"
 
 #include "vehicles/bumblebee.qh"
-#include "vehicles/vehicles.qh"
+#include "vehicles/all.qh"
 
 #include "weapons/projectile.qh"
 
 #include "../common/buffs.qh"
 #include "../common/deathtypes.qh"
 #include "../common/mapinfo.qh"
-#include "../common/monsters/monsters.qh"
+#include "../common/monsters/all.qh"
 #include "../common/nades.qh"
 #include "../common/net_notice.qh"
 #include "../common/notifications.qh"
 #include "../common/stats.qh"
 #include "../common/teams.qh"
 
-#include "../common/weapons/weapons.qh"
+#include "../common/items/all.qh"
+
+#include "../common/weapons/all.qh"
 
 #include "../csqcmodellib/cl_model.qh"
 #include "../csqcmodellib/interpolate.qh"
@@ -136,6 +138,7 @@ void CSQC_Init(void)
        // needs to be done so early because of the constants they create
        CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
        CALL_ACCUMULATED_FUNCTION(RegisterMonsters);
+       CALL_ACCUMULATED_FUNCTION(RegisterItems);
        CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
        CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
        CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
@@ -856,6 +859,7 @@ void CSQC_Ent_Update(float bIsNewEntity)
                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_INVENTORY: Inventory_Read(self); 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;
index 36d159c75e4df54202d7e5c4db0533e5c614f622..8ba12b9e71d957c7260fcbd09dbf80b562c9b4ee 100644 (file)
@@ -37,10 +37,10 @@ view.qc
 wall.qc
 waypointsprites.qc
 
-command/commands.qc
+command/all.qc
 
 vehicles/bumblebee.qc
-vehicles/vehicles.qc
+vehicles/all.qc
 
 weapons/projectile.qc // TODO
 
@@ -55,9 +55,11 @@ weapons/projectile.qc // TODO
 ../common/urllib.qc
 ../common/util.qc
 
-../common/monsters/monsters.qc
+../common/items/all.qc
 
-../common/weapons/weapons.qc // TODO
+../common/monsters/all.qc
+
+../common/weapons/all.qc // TODO
 
 ../csqcmodellib/cl_model.qc
 ../csqcmodellib/cl_player.qc
index f9ebb97866a67a9ab16c28f6ed2c55be541e86b9..ca631fcbd518929531c402fd5ef1e303cdf0d176 100644 (file)
@@ -3,7 +3,7 @@
 #include "movetypes.qh"
 #include "../common/buffs.qh"
 #include "../common/util.qh"
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 #include "../csqcmodellib/cl_model.qh"
 #include "../csqcmodellib/common.qh"
 
diff --git a/qcsrc/client/vehicles/all.qc b/qcsrc/client/vehicles/all.qc
new file mode 100644 (file)
index 0000000..0af4d4b
--- /dev/null
@@ -0,0 +1,1054 @@
+#include "all.qh"
+#include "../_all.qh"
+
+#include "../movetypes.qh"
+#include "../movetypes.qh"
+#include "../prandom.qh"
+#include "../scoreboard.qh"
+#include "../t_items.qh"
+
+#include "../../common/buffs.qh"
+#include "../../common/constants.qh"
+#include "../../common/stats.qh"
+#include "../../common/util.qh"
+
+#include "../../csqcmodellib/cl_model.qh"
+
+.float cnt;
+
+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;
+float autocvar_cl_vehicles_hudscale = 0.5;
+float autocvar_cl_vehicles_hudalpha = 0.75;
+
+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;
+
+
+
+const int MAX_AXH = 4;
+entity AuxiliaryXhairs[MAX_AXH];
+
+entityclass(AuxiliaryXhair);
+class(AuxiliaryXhair) .string axh_image;
+class(AuxiliaryXhair) .float  axh_fadetime;
+class(AuxiliaryXhair) .float  axh_drawflag;
+class(AuxiliaryXhair) .float  axh_scale;
+
+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";
+
+const string bumb_gun_ico =  "gfx/vehicles/bumb_side.tga";
+const string bumb_gun_gun =  "gfx/vehicles/bumb_side_gun.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";
+
+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;
+int weapon2mode;
+
+void AuxiliaryXhair_Draw2D()
+{
+    vector loc, psize;
+
+    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))
+    {
+        loc.z = 0;
+        psize.z = 0;
+        drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
+    }
+
+    if(time - self.cnt > self.axh_fadetime)
+        self.draw2d = func_null;
+}
+
+void Net_AuXair2(bool bIsNew)
+{
+    int axh_id = bound(0, ReadByte(), MAX_AXH);
+    entity axh                 = AuxiliaryXhairs[axh_id];
+
+    if(axh == world || wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
+    {
+        axh                                    = spawn();
+               axh.draw2d                      = func_null;
+               axh.drawmask            = MASK_NORMAL;
+               axh.axh_drawflag        = DRAWFLAG_ADDITIVE;
+               axh.axh_fadetime        = 0.1;
+               axh.axh_image           = "gfx/vehicles/axh-ring.tga";
+               axh.axh_scale           = 1;
+        axh.alpha                      = 1;
+               AuxiliaryXhairs[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.cnt                    = time;
+    axh.draw2d                 = AuxiliaryXhair_Draw2D;
+}
+
+void Net_VehicleSetup()
+{
+    int hud_id = ReadByte();
+
+    // Weapon update?
+    if(hud_id > HUD_VEHICLE_LAST)
+    {
+        weapon2mode = hud_id - HUD_VEHICLE_LAST;
+        return;
+    }
+
+    // hud_id == 0 means we exited a vehicle, so stop alarm sound/s
+    if(hud_id == 0)
+    {
+        sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+        sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+        return;
+    }
+
+    hud_id  = bound(HUD_VEHICLE_FIRST, hud_id, HUD_VEHICLE_LAST);
+
+    // Init auxiliary crosshairs
+    int i;
+    for(i = 0; i < MAX_AXH; ++i)
+    {
+        entity axh = AuxiliaryXhairs[i];
+        if(axh != world && !wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
+            remove(axh);
+
+        axh                                    = spawn();
+               axh.draw2d                      = func_null;
+               axh.drawmask            = MASK_NORMAL;
+               axh.axh_drawflag        = DRAWFLAG_NORMAL;
+               axh.axh_fadetime        = 0.1;
+               axh.axh_image           = "gfx/vehicles/axh-ring.tga";
+               axh.axh_scale           = 1;
+        axh.alpha                      = 1;
+               AuxiliaryXhairs[i]      = axh;
+    }
+
+    switch(hud_id)
+    {
+        case HUD_SPIDERBOT:
+            // Minigun1
+            AuxiliaryXhairs[0].axh_image   = "gfx/vehicles/axh-ring.tga";
+            AuxiliaryXhairs[0].axh_scale   = 0.25;
+            // Minigun2
+            AuxiliaryXhairs[1].axh_image   = "gfx/vehicles/axh-ring.tga";
+            AuxiliaryXhairs[1].axh_scale   = 0.25;
+            // Rocket
+            AuxiliaryXhairs[2].axh_image   = "gfx/vehicles/axh-special1.tga";
+            AuxiliaryXhairs[2].axh_scale   = 0.5;
+            break;
+
+        case HUD_WAKIZASHI:
+            AuxiliaryXhairs[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
+            AuxiliaryXhairs[0].axh_scale   = 0.25;
+            break;
+
+        case HUD_RAPTOR:
+            AuxiliaryXhairs[0].axh_image   = "gfx/vehicles/axh-special2.tga";
+            AuxiliaryXhairs[0].axh_scale   = 0.5;
+            //AuxiliaryXhair[0].alpha       = 0.5;
+
+            AuxiliaryXhairs[1].axh_image   = "gfx/vehicles/axh-bracket.tga";
+            AuxiliaryXhairs[1].axh_scale   = 0.25;
+            //AuxiliaryXhair[1].alpha       = 0.75;
+            //AuxiliaryXhair[1].axh_drawflag  = DRAWFLAG_NORMAL;
+            break;
+
+        case HUD_BUMBLEBEE:
+            // Raygun-locked
+            AuxiliaryXhairs[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
+            AuxiliaryXhairs[0].axh_scale   = 0.5;
+
+            // Gunner1
+            AuxiliaryXhairs[1].axh_image   = "gfx/vehicles/axh-target.tga";
+            AuxiliaryXhairs[1].axh_scale   = 0.75;
+
+            // Gunner2
+            AuxiliaryXhairs[2].axh_image   = "gfx/vehicles/axh-target.tga";
+            AuxiliaryXhairs[2].axh_scale   = 0.75;
+            break;
+        case HUD_BUMBLEBEE_GUN:
+            // Plasma cannons
+            AuxiliaryXhairs[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
+            AuxiliaryXhairs[0].axh_scale   = 0.25;
+            // Raygun
+            AuxiliaryXhairs[1].axh_image   = "gfx/vehicles/axh-bracket.tga";
+            AuxiliaryXhairs[1].axh_scale   = 0.25;
+            break;
+    }
+}
+#define HUD_GETSTATS \
+    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()
+{
+/*
+    drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
+    drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0'  * (1 - health), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0'  * (1 - energy), 1, DRAWFLAG_NORMAL);
+*/
+       if(autocvar_r_letterbox)
+        return;
+
+    vector picsize, hudloc = '0 0 0', pic2size, picloc;
+
+    // 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;
+
+    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
+
+    shield  *= 0.01;
+    vh_health  *= 0.01;
+    energy  *= 0.01;
+    reload1 *= 0.01;
+
+    pic2size = draw_getimagesize(bumb_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
+    picloc = picsize * 0.5 - pic2size * 0.5;
+
+    if(vh_health < 0.25)
+        drawpic(hudloc + picloc, bumb_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, bumb_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
+
+    drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
+
+// 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);
+    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
+    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
+    if(vh_health < 0.25)
+    {
+        if(alarm1time < time)
+        {
+            alarm1time = time + 2;
+            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
+        }
+
+        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    }
+    else
+    {
+        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        if(alarm1time)
+        {
+            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+            alarm1time = 0;
+        }
+    }
+
+// 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);
+    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
+    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
+    if(shield < 0.25)
+    {
+        if(alarm2time < time)
+        {
+            alarm2time = time + 1;
+            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
+        }
+        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    }
+    else
+    {
+        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        if(alarm2time)
+        {
+            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+            alarm2time = 0;
+        }
+    }
+
+       ammo1 *= 0.01;
+       ammo2 *= 0.01;
+
+// 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);
+    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+
+// Right gunner slot occupied?
+       if(!AuxiliaryXhairs[1].draw2d)
+       {
+               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);
+       }
+
+// ..  and icon
+    picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
+    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
+    if(ammo1 < 0.2)
+        drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+
+// 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);
+    drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// Left gunner slot occupied?
+       if(!AuxiliaryXhairs[2].draw2d)
+       {
+               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);
+       }
+
+// ..  and icon
+    picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
+    picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
+    if(ammo2 < 0.2)
+        drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+
+       if (scoreboard_showscores)
+               HUD_DrawScoreboard();
+    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);
+    }
+
+}
+
+void CSQC_BUMBLE_GUN_HUD()
+{
+
+       if(autocvar_r_letterbox)
+        return;
+
+    vector picsize, hudloc = '0 0 0', pic2size, picloc;
+
+    // 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;
+
+    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
+
+    shield  *= 0.01;
+    vh_health  *= 0.01;
+    energy  *= 0.01;
+    reload1 *= 0.01;
+
+    pic2size = draw_getimagesize(bumb_gun_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
+    picloc = picsize * 0.5 - pic2size * 0.5;
+
+    if(vh_health < 0.25)
+        drawpic(hudloc + picloc, bumb_gun_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, bumb_gun_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
+
+    drawpic(hudloc + picloc, bumb_gun_gun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
+
+// 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);
+    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
+    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
+    if(vh_health < 0.25)
+    {
+        if(alarm1time < time)
+        {
+            alarm1time = time + 2;
+            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
+        }
+
+        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    }
+    else
+    {
+        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        if(alarm1time)
+        {
+            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+            alarm1time = 0;
+        }
+    }
+
+// 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);
+    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
+    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
+    if(shield < 0.25)
+    {
+        if(alarm2time < time)
+        {
+            alarm2time = time + 1;
+            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
+        }
+        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    }
+    else
+    {
+        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        if(alarm2time)
+        {
+            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+            alarm2time = 0;
+        }
+    }
+
+// 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);
+    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+
+// ..  and icon
+    picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
+    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
+    if(energy < 0.2)
+        drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+
+       if (scoreboard_showscores)
+               HUD_DrawScoreboard();
+    /*
+    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);
+    }
+    */
+}
+
+
+
+void CSQC_SPIDER_HUD()
+{
+       if(autocvar_r_letterbox)
+        return;
+
+    vector picsize, hudloc = '0 0 0', pic2size, picloc;
+    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;
+
+    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
+
+    ammo1   *= 0.01;
+    shield  *= 0.01;
+    vh_health  *= 0.01;
+    reload2 *= 0.01;
+
+    pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
+    picloc = picsize * 0.5 - pic2size * 0.5;
+    if(vh_health < 0.25)
+        drawpic(hudloc + picloc, spider_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, spider_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, spider_rkt, pic2size,  '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, spider_mgun, pic2size, '1 1 1' * ammo1   + '1 0 0' * (1 - ammo1),   1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
+
+// 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);
+    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
+    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
+    if(vh_health < 0.25)
+    {
+        if(alarm1time < time)
+        {
+            alarm1time = time + 2;
+            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
+        }
+        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    }
+    else
+    {
+        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        if(alarm1time)
+        {
+            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+            alarm1time = 0;
+        }
+    }
+// 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);
+    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
+    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
+    if(shield < 0.25)
+    {
+        if(alarm2time < time)
+        {
+            alarm2time = time + 1;
+            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
+        }
+        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    }
+    else
+    {
+        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        if(alarm2time)
+        {
+            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+            alarm2time = 0;
+        }
+    }
+
+// 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);
+    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
+    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
+    if(ammo1 < 0.2)
+        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+
+// Rocket ammo bar
+    picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
+    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);
+    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;
+    if(ammo2 == 9)
+    {
+        for(i = 1; i < 9; ++i)
+        {
+            picloc.x += ammo1;
+            drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((8 * reload2 <= i) ? '0 0 0' : '1 1 1'), 0.75, DRAWFLAG_NORMAL);
+        }
+    }
+    else
+    {
+        for(i = 1; i < 9; ++i)
+        {
+            picloc.x += ammo1;
+            drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((i >= ammo2) ? '1 1 1' : '0 0 0'), 0.75, DRAWFLAG_NORMAL);
+        }
+    }
+    pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
+    picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
+    if(ammo2 == 9)
+        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
+
+       if (scoreboard_showscores)
+               HUD_DrawScoreboard();
+    else
+    {
+        switch(weapon2mode)
+        {
+            case SBRM_VOLLY:
+                spider_xhair = "gfx/vehicles/axh-bracket.tga";
+                break;
+            case SBRM_GUIDE:
+                spider_xhair = "gfx/vehicles/axh-cross.tga";
+                break;
+            case SBRM_ARTILLERY:
+                spider_xhair = "gfx/vehicles/axh-tag.tga";
+                break;
+            default:
+                spider_xhair= "gfx/vehicles/axh-tag.tga";
+        }
+
+        picsize = draw_getimagesize(spider_xhair);
+        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);
+    }
+}
+
+void CSQC_RAPTOR_HUD()
+{
+       if(autocvar_r_letterbox)
+        return;
+
+    vector picsize, hudloc = '0 0 0', pic2size, picloc;
+
+    // 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;
+
+    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
+
+    ammo1   *= 0.01;
+    ammo2   *= 0.01;
+    shield  *= 0.01;
+    vh_health  *= 0.01;
+    energy  *= 0.01;
+    reload1 = reload2 * 0.01;
+    //reload2 *= 0.01;
+
+    pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
+    picloc = picsize * 0.5 - pic2size * 0.5;
+    if(vh_health < 0.25)
+        drawpic(hudloc + picloc, raptor_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, raptor_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, raptor_bomb, pic2size,  '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, raptor_gun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
+
+// 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);
+    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
+    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
+    if(vh_health < 0.25)
+    {
+        if(alarm1time < time)
+        {
+            alarm1time = time + 2;
+            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
+        }
+
+        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    }
+    else
+    {
+        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        if(alarm1time)
+        {
+            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+            alarm1time = 0;
+        }
+    }
+
+// 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);
+    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
+    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
+    if(shield < 0.25)
+    {
+        if(alarm2time < time)
+        {
+            alarm2time = time + 1;
+            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
+        }
+        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    }
+    else
+    {
+        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        if(alarm2time)
+        {
+            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+            alarm2time = 0;
+        }
+    }
+
+// 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);
+    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
+    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
+    if(energy < 0.2)
+        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+
+// 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);
+    drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
+    picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
+    if(reload1 != 1)
+        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
+
+    if(weapon2mode == RSM_FLARE)
+    {
+        raptor_xhair =  "gfx/vehicles/axh-bracket.tga";
+    }
+    else
+    {
+        raptor_xhair =  "gfx/vehicles/axh-ring.tga";
+
+        // Bombing crosshair
+        if(!dropmark)
+        {
+            dropmark = spawn();
+            dropmark.owner = self;
+            dropmark.gravity = 1;
+        }
+
+        if(reload2 == 100)
+        {
+            vector where;
+
+            setorigin(dropmark, pmove_org);
+            dropmark.velocity = pmove_vel;
+            tracetoss(dropmark, self);
+
+            where = project_3d_to_2d(trace_endpos);
+
+            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))
+            {
+                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;
+        }
+        else
+        {
+            vector where;
+            if(dropmark.cnt > time)
+            {
+                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))
+                {
+                    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);
+                }
+            }
+        }
+    }
+
+       if (scoreboard_showscores)
+               HUD_DrawScoreboard();
+    else
+    {
+        picsize = draw_getimagesize(raptor_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), raptor_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    }
+}
+
+void CSQC_WAKIZASHI_HUD()
+{
+/*
+    drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
+    drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0'  * (1 - health), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0'  * (1 - energy), 1, DRAWFLAG_NORMAL);
+*/
+       if(autocvar_r_letterbox)
+        return;
+
+    vector picsize, hudloc = '0 0 0', pic2size, picloc;
+
+    // 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;
+
+    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
+
+    shield  *= 0.01;
+    vh_health  *= 0.01;
+    energy  *= 0.01;
+    reload1 *= 0.01;
+
+    pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
+    picloc = picsize * 0.5 - pic2size * 0.5;
+    if(vh_health < 0.25)
+        drawpic(hudloc + picloc, waki_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, waki_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, waki_eng, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, waki_gun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, waki_rkt, pic2size,  '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
+
+// 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);
+    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
+    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
+    if(vh_health < 0.25)
+    {
+        if(alarm1time < time)
+        {
+            alarm1time = time + 2;
+            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
+        }
+
+        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    }
+    else
+    {
+        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        if(alarm1time)
+        {
+            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+            alarm1time = 0;
+        }
+    }
+
+
+// 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);
+    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
+    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
+    if(shield < 0.25)
+    {
+        if(alarm2time < time)
+        {
+            alarm2time = time + 1;
+            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
+        }
+        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    }
+    else
+    {
+        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+        if(alarm2time)
+        {
+            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
+            alarm2time = 0;
+        }
+    }
+
+// 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);
+    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
+    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
+    if(energy < 0.2)
+        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+
+// 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);
+    drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
+    drawresetcliparea();
+// ..  and icon
+    pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
+    picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
+    if(reload1 != 1)
+        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
+    else
+        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
+
+       if (scoreboard_showscores)
+               HUD_DrawScoreboard();
+    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);
+    }
+}
+
+void Vehicles_Precache()
+{
+       precache_model("models/vehicles/bomblet.md3");
+       precache_model("models/vehicles/clusterbomb.md3");
+       precache_model("models/vehicles/clusterbomb_fragment.md3");
+       precache_model("models/vehicles/rocket01.md3");
+       precache_model("models/vehicles/rocket02.md3");
+
+       precache_sound ("vehicles/alarm.wav");
+       precache_sound ("vehicles/alarm_shield.wav");
+}
+
+void RaptorCBShellfragDraw()
+{
+       if(wasfreed(self))
+               return;
+
+       Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
+       self.move_avelocity += randomvec() * 15;
+       self.renderflags = 0;
+
+       if(self.cnt < time)
+               self.alpha = bound(0, self.nextthink - time, 1);
+
+       if(self.alpha < ALPHA_MIN_VISIBLE)
+        remove(self);
+}
+
+void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
+{
+    entity sfrag;
+
+    sfrag = spawn();
+    setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
+    setorigin(sfrag, _org);
+
+       sfrag.move_movetype = MOVETYPE_BOUNCE;
+       sfrag.gravity = 0.15;
+       sfrag.solid = SOLID_CORPSE;
+
+       sfrag.draw = RaptorCBShellfragDraw;
+
+       sfrag.move_origin = sfrag.origin = _org;
+       sfrag.move_velocity = _vel;
+       sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
+       sfrag.angles = self.move_angles = _ang;
+
+       sfrag.move_time = time;
+       sfrag.damageforcescale = 4;
+
+       sfrag.nextthink = time + 3;
+       sfrag.cnt = time + 2;
+       sfrag.alpha = 1;
+    sfrag.drawmask = MASK_NORMAL;
+}
diff --git a/qcsrc/client/vehicles/all.qh b/qcsrc/client/vehicles/all.qh
new file mode 100644 (file)
index 0000000..f92ab82
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef VEHICLES_ALL_H
+#define VEHICLES_ALL_H
+
+void RaptorCBShellfragDraw();
+void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang);
+void Vehicles_Precache();
+void Net_AuXair2(bool bIsNew);
+void Net_VehicleSetup();
+
+void CSQC_WAKIZASHI_HUD();
+void CSQC_SPIDER_HUD();
+void CSQC_RAPTOR_HUD();
+void CSQC_BUMBLE_HUD();
+void CSQC_BUMBLE_GUN_HUD();
+
+#endif
diff --git a/qcsrc/client/vehicles/vehicles.qc b/qcsrc/client/vehicles/vehicles.qc
deleted file mode 100644 (file)
index 1582ecf..0000000
+++ /dev/null
@@ -1,1054 +0,0 @@
-#include "vehicles.qh"
-#include "../_all.qh"
-
-#include "../movetypes.qh"
-#include "../movetypes.qh"
-#include "../prandom.qh"
-#include "../scoreboard.qh"
-#include "../t_items.qh"
-
-#include "../../common/buffs.qh"
-#include "../../common/constants.qh"
-#include "../../common/stats.qh"
-#include "../../common/util.qh"
-
-#include "../../csqcmodellib/cl_model.qh"
-
-.float cnt;
-
-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;
-float autocvar_cl_vehicles_hudscale = 0.5;
-float autocvar_cl_vehicles_hudalpha = 0.75;
-
-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;
-
-
-
-const int MAX_AXH = 4;
-entity AuxiliaryXhairs[MAX_AXH];
-
-entityclass(AuxiliaryXhair);
-class(AuxiliaryXhair) .string axh_image;
-class(AuxiliaryXhair) .float  axh_fadetime;
-class(AuxiliaryXhair) .float  axh_drawflag;
-class(AuxiliaryXhair) .float  axh_scale;
-
-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";
-
-const string bumb_gun_ico =  "gfx/vehicles/bumb_side.tga";
-const string bumb_gun_gun =  "gfx/vehicles/bumb_side_gun.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";
-
-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;
-int weapon2mode;
-
-void AuxiliaryXhair_Draw2D()
-{
-    vector loc, psize;
-
-    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))
-    {
-        loc.z = 0;
-        psize.z = 0;
-        drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
-    }
-
-    if(time - self.cnt > self.axh_fadetime)
-        self.draw2d = func_null;
-}
-
-void Net_AuXair2(bool bIsNew)
-{
-    int axh_id = bound(0, ReadByte(), MAX_AXH);
-    entity axh                 = AuxiliaryXhairs[axh_id];
-
-    if(axh == world || wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
-    {
-        axh                                    = spawn();
-               axh.draw2d                      = func_null;
-               axh.drawmask            = MASK_NORMAL;
-               axh.axh_drawflag        = DRAWFLAG_ADDITIVE;
-               axh.axh_fadetime        = 0.1;
-               axh.axh_image           = "gfx/vehicles/axh-ring.tga";
-               axh.axh_scale           = 1;
-        axh.alpha                      = 1;
-               AuxiliaryXhairs[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.cnt                    = time;
-    axh.draw2d                 = AuxiliaryXhair_Draw2D;
-}
-
-void Net_VehicleSetup()
-{
-    int hud_id = ReadByte();
-
-    // Weapon update?
-    if(hud_id > HUD_VEHICLE_LAST)
-    {
-        weapon2mode = hud_id - HUD_VEHICLE_LAST;
-        return;
-    }
-
-    // hud_id == 0 means we exited a vehicle, so stop alarm sound/s
-    if(hud_id == 0)
-    {
-        sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-        sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-        return;
-    }
-
-    hud_id  = bound(HUD_VEHICLE_FIRST, hud_id, HUD_VEHICLE_LAST);
-
-    // Init auxiliary crosshairs
-    int i;
-    for(i = 0; i < MAX_AXH; ++i)
-    {
-        entity axh = AuxiliaryXhairs[i];
-        if(axh != world && !wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
-            remove(axh);
-
-        axh                                    = spawn();
-               axh.draw2d                      = func_null;
-               axh.drawmask            = MASK_NORMAL;
-               axh.axh_drawflag        = DRAWFLAG_NORMAL;
-               axh.axh_fadetime        = 0.1;
-               axh.axh_image           = "gfx/vehicles/axh-ring.tga";
-               axh.axh_scale           = 1;
-        axh.alpha                      = 1;
-               AuxiliaryXhairs[i]      = axh;
-    }
-
-    switch(hud_id)
-    {
-        case HUD_SPIDERBOT:
-            // Minigun1
-            AuxiliaryXhairs[0].axh_image   = "gfx/vehicles/axh-ring.tga";
-            AuxiliaryXhairs[0].axh_scale   = 0.25;
-            // Minigun2
-            AuxiliaryXhairs[1].axh_image   = "gfx/vehicles/axh-ring.tga";
-            AuxiliaryXhairs[1].axh_scale   = 0.25;
-            // Rocket
-            AuxiliaryXhairs[2].axh_image   = "gfx/vehicles/axh-special1.tga";
-            AuxiliaryXhairs[2].axh_scale   = 0.5;
-            break;
-
-        case HUD_WAKIZASHI:
-            AuxiliaryXhairs[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
-            AuxiliaryXhairs[0].axh_scale   = 0.25;
-            break;
-
-        case HUD_RAPTOR:
-            AuxiliaryXhairs[0].axh_image   = "gfx/vehicles/axh-special2.tga";
-            AuxiliaryXhairs[0].axh_scale   = 0.5;
-            //AuxiliaryXhair[0].alpha       = 0.5;
-
-            AuxiliaryXhairs[1].axh_image   = "gfx/vehicles/axh-bracket.tga";
-            AuxiliaryXhairs[1].axh_scale   = 0.25;
-            //AuxiliaryXhair[1].alpha       = 0.75;
-            //AuxiliaryXhair[1].axh_drawflag  = DRAWFLAG_NORMAL;
-            break;
-
-        case HUD_BUMBLEBEE:
-            // Raygun-locked
-            AuxiliaryXhairs[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
-            AuxiliaryXhairs[0].axh_scale   = 0.5;
-
-            // Gunner1
-            AuxiliaryXhairs[1].axh_image   = "gfx/vehicles/axh-target.tga";
-            AuxiliaryXhairs[1].axh_scale   = 0.75;
-
-            // Gunner2
-            AuxiliaryXhairs[2].axh_image   = "gfx/vehicles/axh-target.tga";
-            AuxiliaryXhairs[2].axh_scale   = 0.75;
-            break;
-        case HUD_BUMBLEBEE_GUN:
-            // Plasma cannons
-            AuxiliaryXhairs[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
-            AuxiliaryXhairs[0].axh_scale   = 0.25;
-            // Raygun
-            AuxiliaryXhairs[1].axh_image   = "gfx/vehicles/axh-bracket.tga";
-            AuxiliaryXhairs[1].axh_scale   = 0.25;
-            break;
-    }
-}
-#define HUD_GETSTATS \
-    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()
-{
-/*
-    drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0'  * (1 - health), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0'  * (1 - energy), 1, DRAWFLAG_NORMAL);
-*/
-       if(autocvar_r_letterbox)
-        return;
-
-    vector picsize, hudloc = '0 0 0', pic2size, picloc;
-
-    // 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;
-
-    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
-
-    shield  *= 0.01;
-    vh_health  *= 0.01;
-    energy  *= 0.01;
-    reload1 *= 0.01;
-
-    pic2size = draw_getimagesize(bumb_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
-    picloc = picsize * 0.5 - pic2size * 0.5;
-
-    if(vh_health < 0.25)
-        drawpic(hudloc + picloc, bumb_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, bumb_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
-
-    drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
-
-// 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);
-    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
-    if(vh_health < 0.25)
-    {
-        if(alarm1time < time)
-        {
-            alarm1time = time + 2;
-            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm1time)
-        {
-            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm1time = 0;
-        }
-    }
-
-// 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);
-    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
-    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
-    if(shield < 0.25)
-    {
-        if(alarm2time < time)
-        {
-            alarm2time = time + 1;
-            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm2time)
-        {
-            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm2time = 0;
-        }
-    }
-
-       ammo1 *= 0.01;
-       ammo2 *= 0.01;
-
-// 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);
-    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-
-// Right gunner slot occupied?
-       if(!AuxiliaryXhairs[1].draw2d)
-       {
-               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);
-       }
-
-// ..  and icon
-    picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
-    if(ammo1 < 0.2)
-        drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-// 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);
-    drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// Left gunner slot occupied?
-       if(!AuxiliaryXhairs[2].draw2d)
-       {
-               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);
-       }
-
-// ..  and icon
-    picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
-    if(ammo2 < 0.2)
-        drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-       if (scoreboard_showscores)
-               HUD_DrawScoreboard();
-    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);
-    }
-
-}
-
-void CSQC_BUMBLE_GUN_HUD()
-{
-
-       if(autocvar_r_letterbox)
-        return;
-
-    vector picsize, hudloc = '0 0 0', pic2size, picloc;
-
-    // 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;
-
-    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
-
-    shield  *= 0.01;
-    vh_health  *= 0.01;
-    energy  *= 0.01;
-    reload1 *= 0.01;
-
-    pic2size = draw_getimagesize(bumb_gun_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
-    picloc = picsize * 0.5 - pic2size * 0.5;
-
-    if(vh_health < 0.25)
-        drawpic(hudloc + picloc, bumb_gun_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, bumb_gun_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
-
-    drawpic(hudloc + picloc, bumb_gun_gun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
-
-// 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);
-    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
-    if(vh_health < 0.25)
-    {
-        if(alarm1time < time)
-        {
-            alarm1time = time + 2;
-            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm1time)
-        {
-            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm1time = 0;
-        }
-    }
-
-// 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);
-    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
-    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
-    if(shield < 0.25)
-    {
-        if(alarm2time < time)
-        {
-            alarm2time = time + 1;
-            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm2time)
-        {
-            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm2time = 0;
-        }
-    }
-
-// 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);
-    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-
-// ..  and icon
-    picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
-    if(energy < 0.2)
-        drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-       if (scoreboard_showscores)
-               HUD_DrawScoreboard();
-    /*
-    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);
-    }
-    */
-}
-
-
-
-void CSQC_SPIDER_HUD()
-{
-       if(autocvar_r_letterbox)
-        return;
-
-    vector picsize, hudloc = '0 0 0', pic2size, picloc;
-    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;
-
-    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
-
-    ammo1   *= 0.01;
-    shield  *= 0.01;
-    vh_health  *= 0.01;
-    reload2 *= 0.01;
-
-    pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
-    picloc = picsize * 0.5 - pic2size * 0.5;
-    if(vh_health < 0.25)
-        drawpic(hudloc + picloc, spider_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, spider_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, spider_rkt, pic2size,  '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, spider_mgun, pic2size, '1 1 1' * ammo1   + '1 0 0' * (1 - ammo1),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
-
-// 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);
-    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
-    if(vh_health < 0.25)
-    {
-        if(alarm1time < time)
-        {
-            alarm1time = time + 2;
-            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm1time)
-        {
-            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm1time = 0;
-        }
-    }
-// 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);
-    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
-    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
-    if(shield < 0.25)
-    {
-        if(alarm2time < time)
-        {
-            alarm2time = time + 1;
-            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm2time)
-        {
-            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm2time = 0;
-        }
-    }
-
-// 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);
-    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
-    if(ammo1 < 0.2)
-        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-// Rocket ammo bar
-    picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
-    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);
-    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;
-    if(ammo2 == 9)
-    {
-        for(i = 1; i < 9; ++i)
-        {
-            picloc.x += ammo1;
-            drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((8 * reload2 <= i) ? '0 0 0' : '1 1 1'), 0.75, DRAWFLAG_NORMAL);
-        }
-    }
-    else
-    {
-        for(i = 1; i < 9; ++i)
-        {
-            picloc.x += ammo1;
-            drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((i >= ammo2) ? '1 1 1' : '0 0 0'), 0.75, DRAWFLAG_NORMAL);
-        }
-    }
-    pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
-    if(ammo2 == 9)
-        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-       if (scoreboard_showscores)
-               HUD_DrawScoreboard();
-    else
-    {
-        switch(weapon2mode)
-        {
-            case SBRM_VOLLY:
-                spider_xhair = "gfx/vehicles/axh-bracket.tga";
-                break;
-            case SBRM_GUIDE:
-                spider_xhair = "gfx/vehicles/axh-cross.tga";
-                break;
-            case SBRM_ARTILLERY:
-                spider_xhair = "gfx/vehicles/axh-tag.tga";
-                break;
-            default:
-                spider_xhair= "gfx/vehicles/axh-tag.tga";
-        }
-
-        picsize = draw_getimagesize(spider_xhair);
-        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);
-    }
-}
-
-void CSQC_RAPTOR_HUD()
-{
-       if(autocvar_r_letterbox)
-        return;
-
-    vector picsize, hudloc = '0 0 0', pic2size, picloc;
-
-    // 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;
-
-    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
-
-    ammo1   *= 0.01;
-    ammo2   *= 0.01;
-    shield  *= 0.01;
-    vh_health  *= 0.01;
-    energy  *= 0.01;
-    reload1 = reload2 * 0.01;
-    //reload2 *= 0.01;
-
-    pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
-    picloc = picsize * 0.5 - pic2size * 0.5;
-    if(vh_health < 0.25)
-        drawpic(hudloc + picloc, raptor_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, raptor_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, raptor_bomb, pic2size,  '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, raptor_gun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
-
-// 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);
-    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
-    if(vh_health < 0.25)
-    {
-        if(alarm1time < time)
-        {
-            alarm1time = time + 2;
-            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm1time)
-        {
-            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm1time = 0;
-        }
-    }
-
-// 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);
-    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
-    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
-    if(shield < 0.25)
-    {
-        if(alarm2time < time)
-        {
-            alarm2time = time + 1;
-            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm2time)
-        {
-            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm2time = 0;
-        }
-    }
-
-// 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);
-    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
-    if(energy < 0.2)
-        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-// 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);
-    drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
-    if(reload1 != 1)
-        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-    if(weapon2mode == RSM_FLARE)
-    {
-        raptor_xhair =  "gfx/vehicles/axh-bracket.tga";
-    }
-    else
-    {
-        raptor_xhair =  "gfx/vehicles/axh-ring.tga";
-
-        // Bombing crosshair
-        if(!dropmark)
-        {
-            dropmark = spawn();
-            dropmark.owner = self;
-            dropmark.gravity = 1;
-        }
-
-        if(reload2 == 100)
-        {
-            vector where;
-
-            setorigin(dropmark, pmove_org);
-            dropmark.velocity = pmove_vel;
-            tracetoss(dropmark, self);
-
-            where = project_3d_to_2d(trace_endpos);
-
-            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))
-            {
-                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;
-        }
-        else
-        {
-            vector where;
-            if(dropmark.cnt > time)
-            {
-                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))
-                {
-                    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);
-                }
-            }
-        }
-    }
-
-       if (scoreboard_showscores)
-               HUD_DrawScoreboard();
-    else
-    {
-        picsize = draw_getimagesize(raptor_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), raptor_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    }
-}
-
-void CSQC_WAKIZASHI_HUD()
-{
-/*
-    drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0'  * (1 - health), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0'  * (1 - energy), 1, DRAWFLAG_NORMAL);
-*/
-       if(autocvar_r_letterbox)
-        return;
-
-    vector picsize, hudloc = '0 0 0', pic2size, picloc;
-
-    // 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;
-
-    drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
-
-    shield  *= 0.01;
-    vh_health  *= 0.01;
-    energy  *= 0.01;
-    reload1 *= 0.01;
-
-    pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
-    picloc = picsize * 0.5 - pic2size * 0.5;
-    if(vh_health < 0.25)
-        drawpic(hudloc + picloc, waki_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, waki_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, waki_eng, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, waki_gun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, waki_rkt, pic2size,  '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
-
-// 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);
-    drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
-    if(vh_health < 0.25)
-    {
-        if(alarm1time < time)
-        {
-            alarm1time = time + 2;
-            sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm1time)
-        {
-            sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm1time = 0;
-        }
-    }
-
-
-// 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);
-    drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
-    picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
-    if(shield < 0.25)
-    {
-        if(alarm2time < time)
-        {
-            alarm2time = time + 1;
-            sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
-        }
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    }
-    else
-    {
-        drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        if(alarm2time)
-        {
-            sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
-            alarm2time = 0;
-        }
-    }
-
-// 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);
-    drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
-    if(energy < 0.2)
-        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-// 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);
-    drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-    drawresetcliparea();
-// ..  and icon
-    pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
-    picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
-    if(reload1 != 1)
-        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
-    else
-        drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
-
-       if (scoreboard_showscores)
-               HUD_DrawScoreboard();
-    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);
-    }
-}
-
-void Vehicles_Precache()
-{
-       precache_model("models/vehicles/bomblet.md3");
-       precache_model("models/vehicles/clusterbomb.md3");
-       precache_model("models/vehicles/clusterbomb_fragment.md3");
-       precache_model("models/vehicles/rocket01.md3");
-       precache_model("models/vehicles/rocket02.md3");
-
-       precache_sound ("vehicles/alarm.wav");
-       precache_sound ("vehicles/alarm_shield.wav");
-}
-
-void RaptorCBShellfragDraw()
-{
-       if(wasfreed(self))
-               return;
-
-       Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
-       self.move_avelocity += randomvec() * 15;
-       self.renderflags = 0;
-
-       if(self.cnt < time)
-               self.alpha = bound(0, self.nextthink - time, 1);
-
-       if(self.alpha < ALPHA_MIN_VISIBLE)
-        remove(self);
-}
-
-void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
-{
-    entity sfrag;
-
-    sfrag = spawn();
-    setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
-    setorigin(sfrag, _org);
-
-       sfrag.move_movetype = MOVETYPE_BOUNCE;
-       sfrag.gravity = 0.15;
-       sfrag.solid = SOLID_CORPSE;
-
-       sfrag.draw = RaptorCBShellfragDraw;
-
-       sfrag.move_origin = sfrag.origin = _org;
-       sfrag.move_velocity = _vel;
-       sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
-       sfrag.angles = self.move_angles = _ang;
-
-       sfrag.move_time = time;
-       sfrag.damageforcescale = 4;
-
-       sfrag.nextthink = time + 3;
-       sfrag.cnt = time + 2;
-       sfrag.alpha = 1;
-    sfrag.drawmask = MASK_NORMAL;
-}
diff --git a/qcsrc/client/vehicles/vehicles.qh b/qcsrc/client/vehicles/vehicles.qh
deleted file mode 100644 (file)
index e8d3ddb..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#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();
-
-void CSQC_WAKIZASHI_HUD();
-void CSQC_SPIDER_HUD();
-void CSQC_RAPTOR_HUD();
-void CSQC_BUMBLE_HUD();
-void CSQC_BUMBLE_GUN_HUD();
-
-#endif
index 3ffb4066c5080c2850743d747af51bf07a7aed70..d3bcf92447bc928f8c26680f18a230cd60915eb9 100644 (file)
@@ -9,7 +9,7 @@
 #include "scoreboard.qh"
 #include "shownames.qh"
 #include "target_music.qh"
-#include "vehicles/vehicles.qh"
+#include "vehicles/all.qh"
 #include "waypointsprites.qh"
 
 #include "../common/constants.qh"
@@ -19,7 +19,7 @@
 #include "../common/teams.qh"
 #include "../common/util.qh"
 
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 
 #include "../csqcmodellib/cl_player.qh"
 
index dc38219b510c8442620cc27c701dec8258eb8d4d..aed0865dda1e0152b3cdc87c745a21ee9f31c0b9 100644 (file)
@@ -8,7 +8,7 @@
 #include "../common/constants.qh"
 #include "../common/teams.qh"
 
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 
 #include "../csqcmodellib/interpolate.qh"
 
diff --git a/qcsrc/common/command/all.qc b/qcsrc/common/command/all.qc
new file mode 100644 (file)
index 0000000..dc1c044
--- /dev/null
@@ -0,0 +1,3 @@
+#include "generic.qc"
+#include "markup.qc"
+#include "rpn.qc"
diff --git a/qcsrc/common/command/all.qh b/qcsrc/common/command/all.qh
new file mode 100644 (file)
index 0000000..7eeb5c3
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef COMMON_COMMANDS_ALL_H
+#define COMMON_COMMANDS_ALL_H
+
+#include "generic.qh"
+#include "markup.qh"
+#include "rpn.qh"
+
+#endif
diff --git a/qcsrc/common/command/commands.qc b/qcsrc/common/command/commands.qc
deleted file mode 100644 (file)
index dc1c044..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "generic.qc"
-#include "markup.qc"
-#include "rpn.qc"
diff --git a/qcsrc/common/command/commands.qh b/qcsrc/common/command/commands.qh
deleted file mode 100644 (file)
index d434a86..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef COMMON_COMMANDS_H
-#define COMMON_COMMANDS_H
-
-#include "generic.qh"
-#include "markup.qh"
-#include "rpn.qh"
-
-#endif
index f0b6d0de5aecf72f81231100431fbc908a0fb037..6aa93a024ed209475f9a4b5d673e4654b46312a5 100644 (file)
@@ -241,6 +241,25 @@ void GenericCommand_dumpcommands(float request)
        }
 }
 
+void GenericCommand_dumpitems(float request)
+{
+       switch(request)
+       {
+               case CMD_REQUEST_COMMAND:
+               {
+                       Dump_Items();
+                       return;
+               }
+
+               default:
+               case CMD_REQUEST_USAGE:
+               {
+                       printf("\nUsage:^3 %s dumpitems", GetProgramCommandPrefix());
+                       return;
+               }
+       }
+}
+
 void GenericCommand_dumpnotifs(float request)
 {
        switch(request)
@@ -651,6 +670,7 @@ void GenericCommand_(float request)
 #define GENERIC_COMMANDS(request,arguments,command) \
        GENERIC_COMMAND("addtolist", GenericCommand_addtolist(request, arguments), "Add a string to a cvar") \
        GENERIC_COMMAND("dumpcommands", GenericCommand_dumpcommands(request), "Dump all commands on the program to *_cmd_dump.txt") \
+       GENERIC_COMMAND("dumpitems", GenericCommand_dumpitems(request), "Dump all items to the console") \
        GENERIC_COMMAND("dumpnotifs", GenericCommand_dumpnotifs(request), "Dump all notifications into notifications_dump.txt") \
        GENERIC_COMMAND("dumpweapons", GenericCommand_dumpweapons(request), "Dump all weapons into weapons_dump.txt") \
        GENERIC_COMMAND("maplist", GenericCommand_maplist(request, arguments), "Automatic control of maplist") \
index 45a65abbe96bd904bae1c3e93007637ba5d8b581..8c7cb6b3af6c8ec46693b0bce89511f1a191c1b8 100644 (file)
@@ -64,6 +64,7 @@ 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_INVENTORY = 28;
 const int ENT_CLIENT_ARC_BEAM = 29; // WEAPONTODO: fix numbers
 const int ENT_CLIENT_ACCURACY = 30;
 const int ENT_CLIENT_SHOWNAMES = 31;
diff --git a/qcsrc/common/items/all.inc b/qcsrc/common/items/all.inc
new file mode 100644 (file)
index 0000000..2c4f1de
--- /dev/null
@@ -0,0 +1,7 @@
+#include "item/ammo.qc"
+#include "item/armor.qc"
+#include "item/buff.qc"
+#include "item/health.qc"
+#include "item/jetpack.qc"
+#include "item/pickup.qc"
+#include "item/powerup.qc"
diff --git a/qcsrc/common/items/all.qc b/qcsrc/common/items/all.qc
new file mode 100644 (file)
index 0000000..fa198bb
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef ALL_C
+#define ALL_C
+#include "all.qh"
+
+#include "all.inc"
+
+void Dump_Items()
+{
+    ITEMS_FOREACH(true, LAMBDA({
+        ITEM_HANDLE(Show, it);
+    }));
+}
+
+#endif
diff --git a/qcsrc/common/items/all.qh b/qcsrc/common/items/all.qh
new file mode 100644 (file)
index 0000000..1786b42
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef ALL_H
+#define ALL_H
+
+const int MAX_ITEMS = 24;
+entity ITEMS[MAX_ITEMS];
+
+#define ITEMS_FOREACH(pred, body) do {      \
+    for (int i = 0; i < ITEM_COUNT; i++) {  \
+        const noref entity it = ITEMS[i];   \
+        if (pred) { body }                  \
+    }                                       \
+} while(0)
+
+void RegisterItems();
+void Dump_Items();
+
+#endif
+
+#include "inventory.qh"
diff --git a/qcsrc/common/items/inventory.qh b/qcsrc/common/items/inventory.qh
new file mode 100644 (file)
index 0000000..89abc97
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef INVENTORY_H
+#define INVENTORY_H
+
+#include "all.qh"
+#include "item/pickup.qh"
+
+entityclass(Inventory);
+/** Stores counts of items, the id being the index */
+class(Inventory) .int inv_items[MAX_ITEMS];
+
+/** Player inventory; Inventories also have one inventory for storing the previous state */
+.Inventory inventory;
+
+#ifdef CSQC
+void Inventory_Read(Inventory data)
+{
+    const int bits = ReadInt24_t();
+    ITEMS_FOREACH(bits & BIT(i), LAMBDA({
+        .int fld = inv_items[i];
+        int prev = data.(fld);
+        int next = data.(fld) = ReadByte();
+        dprintf("%s: %.0f -> %.0f\n", ITEMS[i].m_name, prev, next);
+    }));
+}
+#endif
+
+#ifdef SVQC
+void Inventory_Write(Inventory data)
+{
+    int bits = 0;
+    ITEMS_FOREACH(true, LAMBDA({
+        .int fld = inv_items[i];
+        bits = BITSET(bits, BIT(i), data.inventory.(fld) != (data.inventory.(fld) = data.(fld)));
+    }));
+    WriteInt24_t(MSG_ENTITY, bits);
+    ITEMS_FOREACH(bits & BIT(i), LAMBDA({
+        WriteByte(MSG_ENTITY, data.inv_items[i]);
+    }));
+}
+#endif
+
+#ifdef SVQC
+bool Inventory_Send(entity to, int sf)
+{
+    WriteByte(MSG_ENTITY, ENT_CLIENT_INVENTORY);
+    entity e = self.owner;
+    if (IS_SPEC(e)) e = e.enemy;
+    Inventory data = e.inventory;
+    Inventory_Write(data);
+    return true;
+}
+
+void Inventory_new(entity e)
+{
+    Inventory inv = new(Inventory), bak = new(Inventory);
+    inv.classname = "inventory", bak.classname = "inventory";
+    inv.inventory = bak;
+    inv.drawonlytoclient = e;
+    Net_LinkEntity((inv.owner = e).inventory = inv, false, 0, Inventory_Send);
+}
+void Inventory_delete(entity e) { remove(e.inventory.inventory); remove(e.inventory); }
+void Inventory_update(entity e) { e.inventory.SendFlags = 0xFFFFFF; }
+#endif
+
+#endif
diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh
new file mode 100644 (file)
index 0000000..da4e7a4
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef GAMEITEM_H
+#define GAMEITEM_H
+#include "../oo.qh"
+#define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
+CLASS(GameItem, Object)
+    ATTRIB(GameItem, m_id, int, 0)
+    METHOD(GameItem, show, void(entity this))
+    void GameItem_show(entity this) { print("A game item\n"); }
+    void ITEM_HANDLE(Show, entity this) { this.show(this); }
+ENDCLASS(GameItem)
+
+
+int ITEM_COUNT;
+#define REGISTER_ITEM(id, class, body)          \
+    entity ITEM_##id;                           \
+    void RegisterItems_##id() {                 \
+        const entity this = NEW(class);         \
+        ITEM_##id = this;                       \
+        this.m_id = ITEM_COUNT;                 \
+        ITEMS[ITEM_COUNT++] = this;             \
+        body                                    \
+    }                                           \
+    ACCUMULATE_FUNCTION(RegisterItems, RegisterItems_##id)
+
+#endif
diff --git a/qcsrc/common/items/item/ammo.qc b/qcsrc/common/items/item/ammo.qc
new file mode 100644 (file)
index 0000000..032fcc3
--- /dev/null
@@ -0,0 +1,70 @@
+#include "ammo.qh"
+#ifdef SVQC
+    #include "../../../server/t_items.qh"
+#endif
+
+#define WITH(it) this.m_##it;
+#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
+#define DEFINE(id, ...)                                                 \
+    REGISTER_ITEM(id, Ammo, LAMBDA(                                     \
+        IF(SV, CONFIGURE                                                \
+        ,   respawntime         =       GET(g_pickup_respawntime_ammo)  \
+        ,   respawntimejitter   = GET(g_pickup_respawntimejitter_ammo)  \
+        )                                                               \
+        UNWORDS(__VA_ARGS__)                                            \
+    ))
+
+DEFINE(Bullets
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/a_bullets.mdl"
+    ,   name                =   "bullets"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   2000
+    ,   itemid              =   IT_NAILS
+    )
+)
+DEFINE(Cells
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/a_cells.md3"
+    ,   name                =   "cells"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   2000
+    ,   itemid              =   IT_CELLS
+    )
+)
+DEFINE(Plasma
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/a_cells.md3"
+    ,   name                =   "plasma"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   2000
+    ,   itemid              =   IT_PLASMA
+    )
+)
+DEFINE(Rockets
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/a_rockets.md3"
+    ,   name                =   "rockets"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   3000
+    ,   itemid              =   IT_ROCKETS
+    )
+)
+DEFINE(Shells
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/a_shells.md3"
+    ,   name                =   "shells"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   500
+    ,   itemid              =   IT_SHELLS
+    )
+)
+
+#undef WITH
+#undef CONFIGURE
+#undef DEFINE
diff --git a/qcsrc/common/items/item/ammo.qh b/qcsrc/common/items/item/ammo.qh
new file mode 100644 (file)
index 0000000..41e2ac8
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef AMMO_H
+#define AMMO_H
+#include "pickup.qh"
+CLASS(Ammo, Pickup)
+#ifdef SVQC
+    ATTRIB(Ammo, m_pickupevalfunc, float(entity player, entity item), commodity_pickupevalfunc)
+#endif
+ENDCLASS(Ammo)
+#endif
diff --git a/qcsrc/common/items/item/armor.qc b/qcsrc/common/items/item/armor.qc
new file mode 100644 (file)
index 0000000..8fed098
--- /dev/null
@@ -0,0 +1,68 @@
+#include "armor.qh"
+#ifdef SVQC
+    #include "../../../server/t_items.qh"
+#endif
+
+#define WITH(it) this.m_##it;
+#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
+#define DEFINE(id, ...) REGISTER_ITEM(id, Armor, UNWORDS(__VA_ARGS__))
+
+DEFINE(ArmorSmall
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/item_armor_small.md3"
+    ,   sound               =   "misc/armor1.wav"
+    ,   name                =   "5 Armor"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_LOW
+    ,   itemid              =   IT_ARMOR_SHARD
+    ,   respawntime         =         GET(g_pickup_respawntime_short)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_short)
+    )
+)
+
+DEFINE(ArmorMedium
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/item_armor_medium.md3"
+    ,   sound               =   "misc/armor10.wav"
+    ,   name                =   "25 Armor"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_MID
+    ,   itemid              =   IT_ARMOR
+    ,   respawntime         =         GET(g_pickup_respawntime_medium)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_medium)
+    )
+)
+
+DEFINE(ArmorBig
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/item_armor_big.md3"
+    ,   sound               =   "misc/armor17_5.wav"
+    ,   name                =   "50 Armor"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   20000 // FIXME: higher than BOT_PICKUP_RATING_HIGH?
+    ,   itemid              =   IT_ARMOR
+    ,   respawntime         =         GET(g_pickup_respawntime_long)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_long)
+    )
+)
+
+DEFINE(ArmorLarge
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/item_armor_large.md3"
+    ,   sound               =   "misc/armor25.wav"
+    ,   name                =   "100 Armor"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_HIGH
+    ,   itemid              =   IT_ARMOR
+    ,   respawntime         =         GET(g_pickup_respawntime_long)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_long)
+    )
+)
+
+#undef WITH
+#undef CONFIGURE
+#undef DEFINE
diff --git a/qcsrc/common/items/item/armor.qh b/qcsrc/common/items/item/armor.qh
new file mode 100644 (file)
index 0000000..48a80f8
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef ARMOR_H
+#define ARMOR_H
+#include "pickup.qh"
+CLASS(Armor, Pickup)
+#ifdef SVQC
+    ATTRIB(Armor, m_pickupevalfunc, float(entity player, entity item), commodity_pickupevalfunc)
+#endif
+ENDCLASS(Armor)
+#endif
diff --git a/qcsrc/common/items/item/buff.qc b/qcsrc/common/items/item/buff.qc
new file mode 100644 (file)
index 0000000..d9420d1
--- /dev/null
@@ -0,0 +1,3 @@
+#include "buff.qh"
+
+REGISTER_ITEM(DefaultBuff, Buff, LAMBDA())
diff --git a/qcsrc/common/items/item/buff.qh b/qcsrc/common/items/item/buff.qh
new file mode 100644 (file)
index 0000000..4ad93cb
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef BUFF_H
+#define BUFF_H
+#include "pickup.qh"
+CLASS(Buff, Pickup)
+    ATTRIB(Buff, m_name, string, "Buff")
+ENDCLASS(Buff)
+#endif
diff --git a/qcsrc/common/items/item/health.qc b/qcsrc/common/items/item/health.qc
new file mode 100644 (file)
index 0000000..08b422d
--- /dev/null
@@ -0,0 +1,68 @@
+#include "health.qh"
+#ifdef SVQC
+    #include "../../../server/t_items.qh"
+#endif
+
+#define WITH(it) this.m_##it;
+#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
+#define DEFINE(id, ...) REGISTER_ITEM(id, Health, UNWORDS(__VA_ARGS__))
+
+DEFINE(HealthSmall
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/g_h1.md3"
+    ,   sound               =   "misc/minihealth.wav"
+    ,   name                =   "5 Health"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_LOW
+    ,   itemid              =   IT_5HP
+    ,   respawntime         =         GET(g_pickup_respawntime_short)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_short)
+    )
+)
+
+DEFINE(HealthMedium
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/g_h25.md3"
+    ,   sound               =   "misc/mediumhealth.wav"
+    ,   name                =   "25 Health"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_MID
+    ,   itemid              =   IT_25HP
+    ,   respawntime         =         GET(g_pickup_respawntime_short)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_short)
+    )
+)
+
+DEFINE(HealthLarge
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/g_h50.md3"
+    ,   sound               =   "misc/mediumhealth.wav"
+    ,   name                =   "50 Health"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_MID
+    ,   itemid              =   IT_25HP
+    ,   respawntime         =         GET(g_pickup_respawntime_medium)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_medium)
+    )
+)
+
+DEFINE(HealthMega
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/g_h100.md3"
+    ,   sound               =   "misc/megahealth.wav"
+    ,   name                =   "100 Health"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_HIGH
+    ,   itemid              =   IT_HEALTH
+    ,   respawntime         =         GET(g_pickup_respawntime_long)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_long)
+    )
+)
+
+#undef WITH
+#undef CONFIGURE
+#undef DEFINE
diff --git a/qcsrc/common/items/item/health.qh b/qcsrc/common/items/item/health.qh
new file mode 100644 (file)
index 0000000..15f1f8d
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef HEALTH_H
+#define HEALTH_H
+#include "pickup.qh"
+CLASS(Health, Pickup)
+#ifdef SVQC
+    ATTRIB(Health, m_pickupevalfunc, float(entity player, entity item), commodity_pickupevalfunc)
+#endif
+ENDCLASS(Health)
+#endif
diff --git a/qcsrc/common/items/item/jetpack.qc b/qcsrc/common/items/item/jetpack.qc
new file mode 100644 (file)
index 0000000..9ff4ed0
--- /dev/null
@@ -0,0 +1,56 @@
+#ifdef SVQC
+    #include "../../../server/t_items.qh"
+    #include "../../../server/constants.qh"
+#endif
+
+#define WITH(it) this.m_##it;
+#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
+#define DEFINE(id, ...) REGISTER_ITEM(id, Pickup, UNWORDS(__VA_ARGS__))
+
+DEFINE(Jetpack
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/g_jetpack.md3"
+    ,   name                =   "Jet pack"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_LOW
+    ,   itemflags           =   FL_POWERUP
+    ,   itemid              =   IT_JETPACK
+    ,   pickupevalfunc      =   commodity_pickupevalfunc
+    ,   respawntime         =         GET(g_pickup_respawntime_powerup)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_powerup)
+    )
+)
+
+DEFINE(JetpackFuel
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/g_fuel.md3"
+    ,   name                =   "Fuel"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_LOW
+    ,   itemid              =   IT_FUEL
+    ,   pickupevalfunc      =   commodity_pickupevalfunc
+    ,   respawntime         =         GET(g_pickup_respawntime_ammo)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_ammo)
+    )
+)
+
+DEFINE(JetpackRegen
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/g_fuelregen.md3"
+    ,   name                =   "Fuel regenerator"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_LOW
+    ,   itemflags           =   FL_POWERUP
+    ,   itemid              =   IT_FUEL_REGEN
+    ,   pickupevalfunc      =   commodity_pickupevalfunc
+    ,   respawntime         =         GET(g_pickup_respawntime_powerup)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_powerup)
+    )
+)
+
+#undef WITH
+#undef CONFIGURE
+#undef DEFINE
diff --git a/qcsrc/common/items/item/pickup.qc b/qcsrc/common/items/item/pickup.qc
new file mode 100644 (file)
index 0000000..35aac2b
--- /dev/null
@@ -0,0 +1,13 @@
+#include "pickup.qh"
+
+#ifdef SVQC
+bool ITEM_HANDLE(Pickup, entity this, entity item, entity player) {
+    bool b = this.giveTo(this, item, player);
+    if (b) {
+        dprintf("entity %i picked up %s\n", player, this.m_name);
+        player.inventory.inv_items[this.m_id]++;
+        Inventory_update(player);
+    }
+    return b;
+}
+#endif
diff --git a/qcsrc/common/items/item/pickup.qh b/qcsrc/common/items/item/pickup.qh
new file mode 100644 (file)
index 0000000..1875517
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef PICKUP_H
+#define PICKUP_H
+#include "../item.qh"
+CLASS(Pickup, GameItem)
+    ATTRIB(Pickup, m_model, string, string_null)
+    ATTRIB(Pickup, m_sound, string, "misc/itempickup.wav")
+    ATTRIB(Pickup, m_name, string, string_null)
+    METHOD(Pickup, show, void(entity this))
+    void Pickup_show(entity this) { printf("%s: %s\n", etos(this), this.m_name); }
+#ifdef SVQC
+    ATTRIB(Pickup, m_botvalue, int, 0)
+    ATTRIB(Pickup, m_itemflags, int, 0)
+    ATTRIB(Pickup, m_itemid, int, 0)
+    ATTRIB(Pickup, m_pickupevalfunc, float(entity player, entity item), generic_pickupevalfunc)
+    ATTRIB(Pickup, m_respawntime, float(), func_null)
+    ATTRIB(Pickup, m_respawntimejitter, float(), func_null)
+    METHOD(Pickup, giveTo, bool(entity this, entity item, entity player))
+    bool Pickup_giveTo(entity this, entity item, entity player) { return Item_GiveTo(item, player); }
+    bool ITEM_HANDLE(Pickup, entity this, entity item, entity player);
+#endif
+ENDCLASS(Pickup)
+
+#ifdef SVQC
+// For g_pickup_respawntime
+#include "../../../server/defs.qh"
+// Getters to dynamically retrieve the values of g_pickup_respawntime*
+GETTER(float, g_pickup_respawntime_weapon)
+GETTER(float, g_pickup_respawntime_superweapon)
+GETTER(float, g_pickup_respawntime_ammo)
+GETTER(float, g_pickup_respawntime_short)
+GETTER(float, g_pickup_respawntime_medium)
+GETTER(float, g_pickup_respawntime_long)
+GETTER(float, g_pickup_respawntime_powerup)
+GETTER(float, g_pickup_respawntimejitter_weapon)
+GETTER(float, g_pickup_respawntimejitter_superweapon)
+GETTER(float, g_pickup_respawntimejitter_ammo)
+GETTER(float, g_pickup_respawntimejitter_short)
+GETTER(float, g_pickup_respawntimejitter_medium)
+GETTER(float, g_pickup_respawntimejitter_long)
+GETTER(float, g_pickup_respawntimejitter_powerup)
+
+#endif
+
+#endif
diff --git a/qcsrc/common/items/item/powerup.qc b/qcsrc/common/items/item/powerup.qc
new file mode 100644 (file)
index 0000000..f10a97e
--- /dev/null
@@ -0,0 +1,40 @@
+#include "powerup.qh"
+#include "../../../server/t_items.qh"
+
+#define WITH(it) this.m_##it;
+#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
+#define DEFINE(id, ...)                                                     \
+    REGISTER_ITEM(id, Ammo, LAMBDA(                                         \
+        IF(SV, CONFIGURE                                                    \
+        ,   botvalue            =   100000                                  \
+        ,   itemflags           =   FL_POWERUP                              \
+        ,   respawntime         =         GET(g_pickup_respawntime_powerup) \
+        ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_powerup) \
+        )                                                                   \
+        UNWORDS(__VA_ARGS__)                                          \
+    ))
+
+DEFINE(Strength
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/g_strength.md3"
+    ,   sound               =   "misc/powerup.wav"
+    ,   name                =   "Strength Powerup"
+    )
+    ,IF(SV, CONFIGURE
+    ,   itemid              =   IT_STRENGTH
+    )
+)
+DEFINE(Shield
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/g_invincible.md3"
+    ,   sound               =   "misc/powerup_shield.wav"
+    ,   name                =   "Shield"
+    )
+    ,IF(SV, CONFIGURE
+    ,   itemid              =   IT_INVINCIBLE
+    )
+)
+
+#undef WITH
+#undef CONFIGURE
+#undef DEFINE
diff --git a/qcsrc/common/items/item/powerup.qh b/qcsrc/common/items/item/powerup.qh
new file mode 100644 (file)
index 0000000..d27c1e6
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef POWERUP_H
+#define POWERUP_H
+#include "pickup.qh"
+CLASS(Powerup, Pickup)
+ENDCLASS(Powerup)
+
+#ifdef SVQC
+// For FL_POWERUP
+#include "../../../server/constants.qh"
+#endif
+
+#endif
index c3f15d1937e4963b06a1f6343c0d896c6ac44ce4..2e692d7268f9e7b55eefc8ea9c8c25d7c832825c 100644 (file)
@@ -3,7 +3,7 @@
     #include "../client/defs.qh"
     #include "util.qh"
     #include "buffs.qh"
-    #include "weapons/weapons.qh"
+    #include "weapons/all.qh"
     #include "mapinfo.qh"
 #elif defined(MENUQC)
 #elif defined(SVQC)
@@ -11,7 +11,7 @@
     #include "../dpdefs/dpextensions.qh"
     #include "util.qh"
     #include "buffs.qh"
-    #include "monsters/monsters.qh"
+    #include "monsters/all.qh"
     #include "mapinfo.qh"
 #endif
 
diff --git a/qcsrc/common/monsters/all.qc b/qcsrc/common/monsters/all.qc
new file mode 100644 (file)
index 0000000..37dbcb3
--- /dev/null
@@ -0,0 +1,47 @@
+#include "all.qh"
+
+#include "all.inc"
+
+// MONSTER PLUGIN SYSTEM
+entity monster_info[MON_MAXCOUNT];
+entity dummy_monster_info;
+
+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();
+       e.classname = "monster_info";
+       e.monsterid = id;
+       e.netname = shortname;
+       e.monster_name = mname;
+       e.monster_func = func;
+       e.mdl = modelname;
+       e.spawnflags = monsterflags;
+       e.mins = min_s;
+       e.maxs = max_s;
+       e.model = strzone(strcat("models/monsters/", modelname));
+}
+float m_null(float dummy) { return 0; }
+void register_monsters_done()
+{
+       dummy_monster_info = spawn();
+       dummy_monster_info.classname = "monster_info";
+       dummy_monster_info.monsterid = 0; // you can recognize dummies by this
+       dummy_monster_info.netname = "";
+       dummy_monster_info.monster_name = "Monster";
+       dummy_monster_info.monster_func = m_null;
+       dummy_monster_info.mdl = "";
+       dummy_monster_info.mins = '-0 -0 -0';
+       dummy_monster_info.maxs = '0 0 0';
+       dummy_monster_info.model = "";
+}
+entity get_monsterinfo(int id)
+{
+       entity m;
+       if(id < MON_FIRST || id > MON_LAST)
+               return dummy_monster_info;
+       m = monster_info[id - 1];
+       if(m)
+               return m;
+       return dummy_monster_info;
+}
diff --git a/qcsrc/common/monsters/all.qh b/qcsrc/common/monsters/all.qh
new file mode 100644 (file)
index 0000000..ce02312
--- /dev/null
@@ -0,0 +1,73 @@
+#ifndef MONSTERS_ALL_H
+#define MONSTERS_ALL_H
+
+#include "../util.qh"
+
+// monster requests
+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 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_...
+.string netname; // short name
+.string monster_name; // human readable name
+.float(float) monster_func; // m_...
+.string mdl; // currently a copy of the model
+.string model; // full name of model
+.int spawnflags;
+.vector mins, maxs; // monster hitbox size
+
+// other useful macros
+#define MON_ACTION(monstertype,mrequest) (get_monsterinfo(monstertype)).monster_func(mrequest)
+#define M_NAME(monstertype) (get_monsterinfo(monstertype)).monster_name
+
+// =====================
+//     Monster Registration
+// =====================
+
+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 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) \
+       int id; \
+       float func(float); \
+       void RegisterMonsters_##id() \
+       { \
+               MON_LAST = (id = MON_FIRST + MON_COUNT); \
+               ++MON_COUNT; \
+               register_monster(id,func,monsterflags,min_s,max_s,modelname,shortname,mname); \
+       } \
+       ACCUMULATE_FUNCTION(RegisterMonsters, RegisterMonsters_##id)
+#ifdef MENUQC
+#define REGISTER_MONSTER(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \
+       REGISTER_MONSTER_2(MON_##id,m_null,monsterflags,min_s,max_s,modelname,shortname,mname)
+#else
+#define REGISTER_MONSTER(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \
+       REGISTER_MONSTER_2(MON_##id,func,monsterflags,min_s,max_s,modelname,shortname,mname)
+#endif
+
+#include "all.inc"
+
+#undef REGISTER_MONSTER
+ACCUMULATE_FUNCTION(RegisterMonsters, register_monsters_done);
+#endif
diff --git a/qcsrc/common/monsters/monsters.qc b/qcsrc/common/monsters/monsters.qc
deleted file mode 100644 (file)
index 72c5ea8..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "monsters.qh"
-
-#include "all.inc"
-
-// MONSTER PLUGIN SYSTEM
-entity monster_info[MON_MAXCOUNT];
-entity dummy_monster_info;
-
-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();
-       e.classname = "monster_info";
-       e.monsterid = id;
-       e.netname = shortname;
-       e.monster_name = mname;
-       e.monster_func = func;
-       e.mdl = modelname;
-       e.spawnflags = monsterflags;
-       e.mins = min_s;
-       e.maxs = max_s;
-       e.model = strzone(strcat("models/monsters/", modelname));
-}
-float m_null(float dummy) { return 0; }
-void register_monsters_done()
-{
-       dummy_monster_info = spawn();
-       dummy_monster_info.classname = "monster_info";
-       dummy_monster_info.monsterid = 0; // you can recognize dummies by this
-       dummy_monster_info.netname = "";
-       dummy_monster_info.monster_name = "Monster";
-       dummy_monster_info.monster_func = m_null;
-       dummy_monster_info.mdl = "";
-       dummy_monster_info.mins = '-0 -0 -0';
-       dummy_monster_info.maxs = '0 0 0';
-       dummy_monster_info.model = "";
-}
-entity get_monsterinfo(int id)
-{
-       entity m;
-       if(id < MON_FIRST || id > MON_LAST)
-               return dummy_monster_info;
-       m = monster_info[id - 1];
-       if(m)
-               return m;
-       return dummy_monster_info;
-}
diff --git a/qcsrc/common/monsters/monsters.qh b/qcsrc/common/monsters/monsters.qh
deleted file mode 100644 (file)
index 4aa1f7e..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef MONSTERS_H
-#define MONSTERS_H
-
-#include "../util.qh"
-
-// monster requests
-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 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_...
-.string netname; // short name
-.string monster_name; // human readable name
-.float(float) monster_func; // m_...
-.string mdl; // currently a copy of the model
-.string model; // full name of model
-.int spawnflags;
-.vector mins, maxs; // monster hitbox size
-
-// other useful macros
-#define MON_ACTION(monstertype,mrequest) (get_monsterinfo(monstertype)).monster_func(mrequest)
-#define M_NAME(monstertype) (get_monsterinfo(monstertype)).monster_name
-
-// =====================
-//     Monster Registration
-// =====================
-
-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 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) \
-       int id; \
-       float func(float); \
-       void RegisterMonsters_##id() \
-       { \
-               MON_LAST = (id = MON_FIRST + MON_COUNT); \
-               ++MON_COUNT; \
-               register_monster(id,func,monsterflags,min_s,max_s,modelname,shortname,mname); \
-       } \
-       ACCUMULATE_FUNCTION(RegisterMonsters, RegisterMonsters_##id)
-#ifdef MENUQC
-#define REGISTER_MONSTER(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \
-       REGISTER_MONSTER_2(MON_##id,m_null,monsterflags,min_s,max_s,modelname,shortname,mname)
-#else
-#define REGISTER_MONSTER(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \
-       REGISTER_MONSTER_2(MON_##id,func,monsterflags,min_s,max_s,modelname,shortname,mname)
-#endif
-
-#include "all.inc"
-
-#undef REGISTER_MONSTER
-ACCUMULATE_FUNCTION(RegisterMonsters, register_monsters_done);
-#endif
index 8aee54b98084fe36279553eb5ab761f7de4046af..5bfef1b8f574ab407250f1ba0433df9346488658 100644 (file)
@@ -3,7 +3,7 @@
 #elif defined(SVQC)
        #include "../../dpdefs/progsdefs.qh"
     #include "../util.qh"
-    #include "monsters.qh"
+    #include "all.qh"
     #include "sv_monsters.qh"
     #include "spawn.qh"
     #include "../../server/autocvars.qh"
index 3ff926bf614b9ba86fb38f0907c5bd4117c838a9..ce254751bd8d83f9c519dbb229c11b15e16bcb44 100644 (file)
@@ -7,9 +7,9 @@
     #include "../constants.qh"
     #include "../teams.qh"
     #include "../util.qh"
-    #include "monsters.qh"
+    #include "all.qh"
     #include "sv_monsters.qh"
-    #include "../weapons/weapons.qh"
+    #include "../weapons/all.qh"
     #include "../../server/autocvars.qh"
     #include "../../server/defs.qh"
     #include "../deathtypes.qh"
diff --git a/qcsrc/common/oo.qh b/qcsrc/common/oo.qh
new file mode 100644 (file)
index 0000000..63b1708
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef OO_H
+#define OO_H
+
+#ifdef MENUQC
+       #define NULL (null_entity)
+#else
+       #define NULL (world)
+#endif
+
+.string classname;
+.string vtblname;
+.entity vtblbase;
+entity spawnVtbl(entity this, entity base)
+{
+       entity vtbl = spawn();
+       copyentity(this, vtbl);
+       vtbl.vtblname = vtbl.classname;
+       vtbl.classname = "vtbl";
+       vtbl.vtblbase = base ? base : vtbl; // Top level objects use vtbl as base
+       return vtbl;
+}
+
+entity Object_vtbl;
+entity spawnObject(entity this, entity)
+{
+       this = spawn();
+       this.classname = "Object";
+       if (!Object_vtbl) Object_vtbl = spawnVtbl(this, NULL);
+       return this;
+}
+
+// Classes have a `spawn##cname(entity, entity)` constructor
+// The parameters are used as locals for [[accumulate]]
+
+// Macro to hide this implementation detail
+#define NEW(cname) (spawn##cname(NULL, NULL))
+
+#define CLASS(cname, base)                                                     \
+entity spawn##cname(entity this, entity basevtbl) {                            \
+    this = NEW(base); basevtbl = base##_vtbl;                                  \
+}
+
+#define METHOD(cname, name, prototype)                                         \
+prototype cname##_##name;                                                      \
+.prototype name;                                                               \
+[[accumulate]] entity spawn##cname(entity this, entity basevtbl) {             \
+    this.name = cname##_##name;                                                \
+}
+
+#define ATTRIB(cname, name, type, val)                                         \
+.type name;                                                                    \
+[[accumulate]] entity spawn##cname(entity this, entity basevtbl) {             \
+    this.name = val;                                                           \
+}
+
+#define ATTRIBARRAY(cname, name, type, cnt)                                    \
+.type name[cnt];
+
+#define ENDCLASS(cname)                                                        \
+.bool instanceOf##cname;                                                       \
+entity cname##_vtbl;                                                           \
+[[accumulate]] [[last]] entity spawn##cname(entity this, entity basevtbl) {    \
+    this.instanceOf##cname = true;                                             \
+    this.classname = #cname;                                                   \
+    if (!cname##_vtbl) cname##_vtbl = spawnVtbl(this, basevtbl);               \
+    return this;                                                               \
+}
+
+#define SUPER(cname) (cname##_vtbl.vtblbase)
+
+#endif
index 5890fb89e17085271e6061684e3792a6bcc0a735..e46e12fa1eeb6ac7053fda8b6365599e2f18bebd 100644 (file)
@@ -6,7 +6,7 @@
     #include "constants.qh"
     #include "util.qh"
     #include "urllib.qh"
-    #include "weapons/weapons.qh"
+    #include "weapons/all.qh"
     #include "../server/weapons/accuracy.qh"
     #include "../server/defs.qh"
     #include "playerstats.qh"
index a1ac7dc7adeabd5793fd129a19e19a366431d67e..9d60ae0a9ae2797bfdaedea9632237e81554f564 100644 (file)
 [[deprecated("use true")]] [[alias("true")]] const bool TRUE;
 [[deprecated("use false")]] [[alias("false")]] const bool FALSE;
 
+#ifdef GMQCC
+    #define OVERLOAD(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
+#else
+    #define OVERLOAD_(F,_9,_8,_7,_6,_5,_4,_3,_2,_1,n,...) F##_##n
+    #define OVERLOAD(F, ...) OVERLOAD_(F,__VA_ARGS__,9,8,7,6,5,4,3,2,1)(__VA_ARGS__)
+#endif
+
+#define LAMBDA(...) { __VA_ARGS__ ; }
+
+#define MAP(f, ...) OVERLOAD(MAP, f, __VA_ARGS__)
+#define MAP_2(f, it) f(it)
+#define MAP_3(f, it, ...) f(it)MAP_2(f, __VA_ARGS__)
+#define MAP_4(f, it, ...) f(it)MAP_3(f, __VA_ARGS__)
+#define MAP_5(f, it, ...) f(it)MAP_4(f, __VA_ARGS__)
+#define MAP_6(f, it, ...) f(it)MAP_5(f, __VA_ARGS__)
+#define MAP_7(f, it, ...) f(it)MAP_6(f, __VA_ARGS__)
+#define MAP_8(f, it, ...) f(it)MAP_7(f, __VA_ARGS__)
+#define MAP_9(f, it, ...) f(it)MAP_8(f, __VA_ARGS__)
+#define MAP_10(f, it, ...) f(it)MAP_9(f, __VA_ARGS__)
+#define MAP_11(f, it, ...) f(it)MAP_10(f, __VA_ARGS__)
+#define MAP_12(f, it, ...) f(it)MAP_11(f, __VA_ARGS__)
+#define MAP_13(f, it, ...) f(it)MAP_12(f, __VA_ARGS__)
+#define MAP_14(f, it, ...) f(it)MAP_13(f, __VA_ARGS__)
+#define MAP_15(f, it, ...) f(it)MAP_14(f, __VA_ARGS__)
+#define MAP_16(f, it, ...) f(it)MAP_15(f, __VA_ARGS__)
+#define MAP_17(f, it, ...) f(it)MAP_16(f, __VA_ARGS__)
+#define MAP_18(f, it, ...) f(it)MAP_17(f, __VA_ARGS__)
+#define MAP_19(f, it, ...) f(it)MAP_18(f, __VA_ARGS__)
+#define MAP_20(f, it, ...) f(it)MAP_19(f, __VA_ARGS__)
+
+#define IDENTITY(it) it
+
+#define UNWORDS(...) MAP(IDENTITY, __VA_ARGS__)
+
+#define APPLY(f, ...) f(__VA_ARGS__)
+
+#ifdef SVQC
+    #define SV(f, ...) f(__VA_ARGS__)
+#else
+    #define SV(f, ...)
+#endif
+
+#ifdef CSQC
+    #define CL(f, ...) f(__VA_ARGS__)
+#else
+    #define CL(f, ...)
+#endif
+
+#define IF(cond, f, ...) cond(f, __VA_ARGS__)
+
+#define GET(name) name##get
+#define GETTER(type, name) type GET(name)() { return name; }
+
 #define BIT(n) (1 << (n))
-#define BITSET(var, mask, flag) (flag ? (var) | (mask) : (var) &~ (mask))
+#ifndef BRANCHLESS_BITSET
+    #define BITSET(var, mask, flag) (flag ? (var) | (mask) : (var) &~ (mask))
+#else
+    #define BITSET(var, mask, flag) ((var) ^ (-(flag) ^ (var)) & (mask))
+#endif
 
 #endif
diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc
new file mode 100644 (file)
index 0000000..847c837
--- /dev/null
@@ -0,0 +1,375 @@
+#ifndef WEAPONS_ALL_C
+#define WEAPONS_ALL_C
+
+#include "all.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/all.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
+#include "all.inc"
+
+// WEAPON PLUGIN SYSTEM
+entity weapon_info[WEP_MAXCOUNT];
+entity dummy_weapon_info;
+
+#if WEP_MAXCOUNT > 72
+# error Kein Weltraum links auf dem Gerät
+#endif
+
+WepSet WepSet_FromWeapon(int a) {
+       a -= WEP_FIRST;
+#if WEP_MAXCOUNT > 24
+       if(a >= 24) {
+               a -= 24;
+#if WEP_MAXCOUNT > 48
+               if(a >= 24) {
+                       a -= 24;
+                       return '0 0 1' * power2of(a);
+               }
+#endif
+               return '0 1 0' * power2of(a);
+       }
+#endif
+       return '1 0 0' * power2of(a);
+}
+#ifdef SVQC
+void WepSet_AddStat()
+{
+       addstat(STAT_WEAPONS, AS_INT, weapons_x);
+#if WEP_MAXCOUNT > 24
+       addstat(STAT_WEAPONS2, AS_INT, weapons_y);
+#if WEP_MAXCOUNT > 48
+       addstat(STAT_WEAPONS3, AS_INT, weapons_z);
+#endif
+#endif
+}
+void WriteWepSet(float dst, WepSet w)
+{
+#if WEP_MAXCOUNT > 48
+       WriteInt72_t(dst, w);
+#elif WEP_MAXCOUNT > 24
+       WriteInt48_t(dst, w);
+#else
+       WriteInt24_t(dst, w.x);
+#endif
+}
+#endif
+#ifdef CSQC
+WepSet WepSet_GetFromStat()
+{
+       WepSet w = '0 0 0';
+       w.x = getstati(STAT_WEAPONS);
+#if WEP_MAXCOUNT > 24
+       w.y = getstati(STAT_WEAPONS2);
+#if WEP_MAXCOUNT > 48
+       w.z = getstati(STAT_WEAPONS3);
+#endif
+#endif
+       return w;
+}
+WepSet ReadWepSet()
+{
+#if WEP_MAXCOUNT > 48
+       return ReadInt72_t();
+#elif WEP_MAXCOUNT > 24
+       return ReadInt48_t();
+#else
+       return ReadInt24_t() * '1 0 0';
+#endif
+}
+#endif
+
+void register_weapon(
+       int id,
+       WepSet bit,
+       bool(int) func,
+       .int ammotype,
+       int i,
+       int weapontype,
+       float pickupbasevalue,
+       vector clr,
+       string modelname,
+       string simplemdl,
+       string crosshair,
+       string wepimg,
+       string refname,
+       string wepname)
+{
+       entity e;
+       weapon_info[id - 1] = e = spawn();
+       e.classname = "weapon_info";
+       e.weapon = id;
+       e.weapons = bit;
+       e.weapon_func = func;
+       e.ammo_field = ammotype;
+       e.impulse = i;
+       e.spawnflags = weapontype;
+       e.bot_pickupbasevalue = pickupbasevalue;
+       e.wpcolor = clr;
+       e.wpmodel = strzone(strcat("wpn-", ftos(id)));
+       e.mdl = modelname;
+       e.model = strzone(strcat("models/weapons/g_", modelname, ".md3"));
+       e.w_simplemdl = strzone(simplemdl); // simpleitems weapon model/image
+       e.w_crosshair = strzone(car(crosshair));
+       string s = cdr(crosshair);
+       e.w_crosshair_size = ((s != "") ? stof(s) : 1); // so that we can scale the crosshair from code (for compat)
+       e.model2 = strzone(wepimg);
+       e.netname = refname;
+       e.message = wepname;
+
+       #ifdef CSQC
+       func(WR_INIT);
+       #endif
+}
+bool w_null(int dummy)
+{
+       return 0;
+}
+void register_weapons_done()
+{
+       dummy_weapon_info = spawn();
+       dummy_weapon_info.classname = "weapon_info";
+       dummy_weapon_info.weapon = 0; // you can recognize dummies by this
+       dummy_weapon_info.weapons = '0 0 0';
+       dummy_weapon_info.netname = "";
+       dummy_weapon_info.message = "AOL CD Thrower";
+       dummy_weapon_info.weapon_func = w_null;
+       dummy_weapon_info.wpmodel = "";
+       dummy_weapon_info.mdl = "";
+       dummy_weapon_info.model = "";
+       dummy_weapon_info.spawnflags = 0;
+       dummy_weapon_info.impulse = -1;
+       dummy_weapon_info.bot_pickupbasevalue = 0;
+       dummy_weapon_info.ammo_field = ammo_none;
+
+       dummy_weapon_info.w_crosshair = "gfx/crosshair1";
+       dummy_weapon_info.w_crosshair_size = 1;
+       dummy_weapon_info.model2 = "";
+
+       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(int id)
+{
+       entity w;
+       if(id < WEP_FIRST || id > WEP_LAST)
+               return dummy_weapon_info;
+       w = weapon_info[id - 1];
+       if(w)
+               return w;
+       return dummy_weapon_info;
+}
+string W_FixWeaponOrder(string order, float complete)
+{
+       return fixPriorityList(order, WEP_FIRST, WEP_LAST, 230 - WEP_FIRST, complete);
+}
+string W_NameWeaponOrder_MapFunc(string s)
+{
+       entity wi;
+       if(s == "0" || stof(s))
+       {
+               wi = get_weaponinfo(stof(s));
+               if(wi != dummy_weapon_info)
+                       return wi.netname;
+       }
+       return s;
+}
+
+string W_UndeprecateName(string s)
+{
+       switch ( s )
+       {
+               case "nex"            : return "vortex";
+               case "rocketlauncher" : return "devastator";
+               case "laser"          : return "blaster";
+               case "minstanex"      : return "vaporizer";
+               case "grenadelauncher": return "mortar";
+               case "uzi"            : return "machinegun";
+               default               : return s;
+       }
+}
+string W_NameWeaponOrder(string order)
+{
+       return mapPriorityList(order, W_NameWeaponOrder_MapFunc);
+}
+string W_NumberWeaponOrder_MapFunc(string s)
+{
+       int i;
+       if(s == "0" || stof(s))
+               return s;
+       s = W_UndeprecateName(s);
+       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+               if(s == get_weaponinfo(i).netname)
+                       return ftos(i);
+       return s;
+}
+string W_NumberWeaponOrder(string order)
+{
+       return mapPriorityList(order, W_NumberWeaponOrder_MapFunc);
+}
+
+float W_FixWeaponOrder_BuildImpulseList_buf[WEP_MAXCOUNT];
+string W_FixWeaponOrder_BuildImpulseList_order;
+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(int i, int j, entity pass)
+{
+       entity e1, e2;
+       float d;
+       e1 = get_weaponinfo(W_FixWeaponOrder_BuildImpulseList_buf[i]);
+       e2 = get_weaponinfo(W_FixWeaponOrder_BuildImpulseList_buf[j]);
+       d = (e1.impulse + 9) % 10 - (e2.impulse + 9) % 10;
+       if(d != 0)
+               return -d; // high impulse first!
+       return
+               strstrofs(strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " "), sprintf(" %d ", W_FixWeaponOrder_BuildImpulseList_buf[i]), 0)
+               -
+               strstrofs(strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " "), sprintf(" %d ", W_FixWeaponOrder_BuildImpulseList_buf[j]), 0)
+               ; // low char index first!
+}
+string W_FixWeaponOrder_BuildImpulseList(string o)
+{
+       int i;
+       W_FixWeaponOrder_BuildImpulseList_order = o;
+       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+               W_FixWeaponOrder_BuildImpulseList_buf[i - WEP_FIRST] = i;
+       heapsort(WEP_LAST - WEP_FIRST + 1, W_FixWeaponOrder_BuildImpulseList_swap, W_FixWeaponOrder_BuildImpulseList_cmp, world);
+       o = "";
+       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+               o = strcat(o, " ", ftos(W_FixWeaponOrder_BuildImpulseList_buf[i - WEP_FIRST]));
+       W_FixWeaponOrder_BuildImpulseList_order = string_null;
+       return substring(o, 1, -1);
+}
+
+string W_FixWeaponOrder_AllowIncomplete(string order)
+{
+       return W_FixWeaponOrder(order, 0);
+}
+
+string W_FixWeaponOrder_ForceComplete(string order)
+{
+       if(order == "")
+               order = W_NumberWeaponOrder(cvar_defstring("cl_weaponpriority"));
+       return W_FixWeaponOrder(order, 1);
+}
+
+void W_RandomWeapons(entity e, float n)
+{
+       int i, j;
+       WepSet remaining;
+       WepSet result;
+       remaining = e.weapons;
+       result = '0 0 0';
+       for(i = 0; i < n; ++i)
+       {
+               RandomSelection_Init();
+               for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+                       if(remaining & WepSet_FromWeapon(j))
+                               RandomSelection_Add(world, j, string_null, 1, 1);
+               result |= WepSet_FromWeapon(RandomSelection_chosen_float);
+               remaining &= ~WepSet_FromWeapon(RandomSelection_chosen_float);
+       }
+       e.weapons = result;
+}
+
+string GetAmmoPicture(.int ammotype)
+{
+       switch(ammotype)
+       {
+               case ammo_shells:  return "ammo_shells";
+               case ammo_nails:   return "ammo_bullets";
+               case ammo_rockets: return "ammo_rockets";
+               case ammo_cells:   return "ammo_cells";
+               case ammo_plasma:  return "ammo_cells";
+               case ammo_fuel:    return "ammo_fuel";
+               default: return ""; // wtf, no ammo type?
+       }
+}
+
+#ifdef CSQC
+.int GetAmmoFieldFromNum(int i)
+{
+       switch(i)
+       {
+               case 0: return ammo_shells;
+               case 1: return ammo_nails;
+               case 2: return ammo_rockets;
+               case 3: return ammo_cells;
+               case 4: return ammo_plasma;
+               case 5: return ammo_fuel;
+               default: return ammo_none;
+       }
+}
+
+int GetAmmoStat(.int ammotype)
+{
+       switch(ammotype)
+       {
+               case ammo_shells: return STAT_SHELLS;
+               case ammo_nails: return STAT_NAILS;
+               case ammo_rockets: return STAT_ROCKETS;
+               case ammo_cells: return STAT_CELLS;
+               case ammo_plasma: return STAT_PLASMA;
+               case ammo_fuel: return STAT_FUEL;
+               default: return -1;
+       }
+}
+#endif
+#endif
diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh
new file mode 100644 (file)
index 0000000..154f816
--- /dev/null
@@ -0,0 +1,217 @@
+#ifndef WEAPONS_ALL_H
+#define WEAPONS_ALL_H
+
+#ifndef MENUQC
+#include "calculations.qh"
+#endif
+
+#include "../util.qh"
+#ifdef SVQC
+#include "../../server/bot/aim.qh"
+#endif
+const int MAX_SHOT_DISTANCE = 32768;
+
+// weapon pickup ratings for bot logic
+const int BOT_PICKUP_RATING_LOW  =  2500;
+const int BOT_PICKUP_RATING_MID  =  5000;
+const int BOT_PICKUP_RATING_HIGH = 10000;
+
+// weapon flags
+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 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;
+
+// weapon sets
+typedef vector WepSet;
+WepSet WepSet_FromWeapon(int a);
+#ifdef SVQC
+void WepSet_AddStat();
+void WriteWepSet(float dest, WepSet w);
+#endif
+#ifdef CSQC
+WepSet WepSet_GetFromStat();
+WepSet ReadWepSet();
+#endif
+
+// weapon name macros
+#define WEP_FIRST 1
+#define WEP_MAXCOUNT 24 // Increase as needed. Can be up to three times as much.
+int WEP_COUNT;
+int WEP_LAST;
+WepSet WEPSET_ALL;
+WepSet WEPSET_SUPERWEAPONS;
+
+// functions:
+entity get_weaponinfo(int 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);
+string W_FixWeaponOrder_AllowIncomplete(string order);
+string W_FixWeaponOrder_ForceComplete(string order);
+void W_RandomWeapons(entity e, float n);
+
+string GetAmmoPicture(.int ammotype);
+
+#ifdef CSQC
+.int GetAmmoFieldFromNum(int i);
+int GetAmmoStat(.int ammotype);
+#endif
+
+// ammo types
+.int ammo_shells;
+.int ammo_nails;
+.int ammo_rockets;
+.int ammo_cells;
+.int ammo_plasma;
+.int ammo_fuel;
+.int ammo_none;
+
+// other useful macros
+#define WEP_ACTION(wpn,wrequest) (get_weaponinfo(wpn)).weapon_func(wrequest)
+#define WEP_AMMO(wpn) ((get_weaponinfo(WEP_##wpn)).ammo_field) // only used inside weapon files/with direct name, don't duplicate prefix
+#define WEP_NAME(wpn) ((get_weaponinfo(wpn)).message)
+
+
+// ======================
+//  Configuration Macros
+// ======================
+
+// create cvars for weapon settings
+#define WEP_ADD_CVAR_NONE(wepname,name) [[last]] float autocvar_g_balance_##wepname##_##name;
+
+#define WEP_ADD_CVAR_PRI(wepname,name) WEP_ADD_CVAR_NONE(wepname, primary_##name)
+#define WEP_ADD_CVAR_SEC(wepname,name) WEP_ADD_CVAR_NONE(wepname, secondary_##name)
+#define WEP_ADD_CVAR_BOTH(wepname,name) \
+       WEP_ADD_CVAR_PRI(wepname, name) \
+       WEP_ADD_CVAR_SEC(wepname, name)
+
+#define WEP_ADD_CVAR(wepid,wepname,mode,name) WEP_ADD_CVAR_##mode(wepname, name)
+
+// create properties for weapon settings
+#define WEP_ADD_PROP(wepid,wepname,type,prop,name) \
+       .type prop; \
+       [[last]] type autocvar_g_balance_##wepname##_##name;
+
+// read cvars from weapon settings
+#define WEP_CVAR(wepname,name) autocvar_g_balance_##wepname##_##name
+#define WEP_CVAR_PRI(wepname,name) WEP_CVAR(wepname, primary_##name)
+#define WEP_CVAR_SEC(wepname,name) WEP_CVAR(wepname, secondary_##name)
+#define WEP_CVAR_BOTH(wepname,isprimary,name) ((isprimary) ? WEP_CVAR_PRI(wepname, name) : WEP_CVAR_SEC(wepname, name))
+
+// set initialization values for weapon settings
+#define WEP_SKIP_CVAR(unuseda,unusedb,unusedc,unusedd) /* skip cvars */
+#define WEP_SET_PROP(wepid,wepname,type,prop,name) get_weaponinfo(WEP_##wepid).##prop = autocvar_g_balance_##wepname##_##name;
+
+
+// =====================
+//  Weapon Registration
+// =====================
+
+bool w_null(int dummy);
+
+void register_weapon(
+       int id,
+       WepSet bit,
+       bool(int) func,
+       .int ammotype,
+       int i,
+       int weapontype,
+       float pickupbasevalue,
+       vector clr,
+       string modelname,
+       string simplemdl,
+       string crosshair,
+       string wepimg,
+       string refname,
+       string wepname);
+
+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"
+.int weapon;                // M: WEP_id    // WEP_...
+.WepSet weapons;            // A: WEPSET_id // WEPSET_...
+.float(float) weapon_func;  // M: function  // w_...
+..int ammo_field;         // M: ammotype  // main ammo field
+.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
+.string mdl;                // M: modelname // name of model (without g_ v_ or h_ prefixes)
+.string model;              // A: modelname // full path to g_ model
+.string w_simplemdl;        // M: simplemdl // simpleitems weapon model/image
+.string w_crosshair;        // M: crosshair // per-weapon crosshair: "CrosshairImage Size"
+.float w_crosshair_size;    // A: crosshair // per-weapon crosshair size (argument two of "crosshair" field)
+.string model2;             // M: wepimg    // "weaponfoobar" side view image file of weapon // WEAPONTODO: Move out of skin files, move to common files
+.string netname;            // M: refname   // reference name name
+.string message;            // M: wepname   // human readable name
+
+
+// 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) \
+       int id; \
+       WepSet bit; \
+       bool function(int); \
+       void RegisterWeapons_##id() \
+       { \
+               WEP_LAST = (id = WEP_FIRST + WEP_COUNT); \
+               bit = WepSet_FromWeapon(id); \
+               WEPSET_ALL |= bit; \
+               if((flags) & WEP_FLAG_SUPERWEAPON) \
+                       WEPSET_SUPERWEAPONS |= bit; \
+               ++WEP_COUNT; \
+               register_weapon(id,bit,function,ammotype,impulse,flags,rating,color,modelname,simplemdl,crosshair,wepimg,refname,wepname); \
+       } \
+       ACCUMULATE_FUNCTION(RegisterWeapons, RegisterWeapons_##id)
+#ifdef MENUQC
+#define REGISTER_WEAPON(id,function,ammotype,impulse,flags,rating,color,modelname,simplemdl,crosshair,wepimg,refname,wepname) \
+       REGISTER_WEAPON_2(WEP_##id,WEPSET_##id,w_null,ammotype,impulse,flags,rating,color,modelname,simplemdl,crosshair,wepimg,refname,wepname)
+#else
+#define REGISTER_WEAPON(id,function,ammotype,impulse,flags,rating,color,modelname,simplemdl,crosshair,wepimg,refname,wepname) \
+       REGISTER_WEAPON_2(WEP_##id,WEPSET_##id,function,ammotype,impulse,flags,rating,color,modelname,simplemdl,crosshair,wepimg,refname,wepname)
+#endif
+
+#include "all.inc"
+
+#undef WEP_ADD_CVAR_MO_PRI
+#undef WEP_ADD_CVAR_MO_SEC
+#undef WEP_ADD_CVAR_MO_BOTH
+#undef WEP_ADD_CVAR_MO_NONE
+#undef WEP_ADD_CVAR
+#undef WEP_ADD_PROP
+#undef REGISTER_WEAPON
+
+ACCUMULATE_FUNCTION(RegisterWeapons, register_weapons_done);
+#endif
index a314f036b3bb853cbc1b53251df380b6879f27e4..0448f4874a26c416f08d709a376705a20be8183f 100644 (file)
@@ -5,7 +5,7 @@
     #include "../../dpdefs/dpextensions.qh"
     #include "../util.qh"
     #include "config.qh"
-    #include "weapons.qh"
+    #include "all.qh"
 #endif
 
 // ==========================
diff --git a/qcsrc/common/weapons/weapons.qc b/qcsrc/common/weapons/weapons.qc
deleted file mode 100644 (file)
index 58fdbae..0000000
+++ /dev/null
@@ -1,375 +0,0 @@
-#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
-#include "all.inc"
-
-// WEAPON PLUGIN SYSTEM
-entity weapon_info[WEP_MAXCOUNT];
-entity dummy_weapon_info;
-
-#if WEP_MAXCOUNT > 72
-# error Kein Weltraum links auf dem Gerät
-#endif
-
-WepSet WepSet_FromWeapon(int a) {
-       a -= WEP_FIRST;
-#if WEP_MAXCOUNT > 24
-       if(a >= 24) {
-               a -= 24;
-#if WEP_MAXCOUNT > 48
-               if(a >= 24) {
-                       a -= 24;
-                       return '0 0 1' * power2of(a);
-               }
-#endif
-               return '0 1 0' * power2of(a);
-       }
-#endif
-       return '1 0 0' * power2of(a);
-}
-#ifdef SVQC
-void WepSet_AddStat()
-{
-       addstat(STAT_WEAPONS, AS_INT, weapons_x);
-#if WEP_MAXCOUNT > 24
-       addstat(STAT_WEAPONS2, AS_INT, weapons_y);
-#if WEP_MAXCOUNT > 48
-       addstat(STAT_WEAPONS3, AS_INT, weapons_z);
-#endif
-#endif
-}
-void WriteWepSet(float dst, WepSet w)
-{
-#if WEP_MAXCOUNT > 48
-       WriteInt72_t(dst, w);
-#elif WEP_MAXCOUNT > 24
-       WriteInt48_t(dst, w);
-#else
-       WriteInt24_t(dst, w.x);
-#endif
-}
-#endif
-#ifdef CSQC
-WepSet WepSet_GetFromStat()
-{
-       WepSet w = '0 0 0';
-       w.x = getstati(STAT_WEAPONS);
-#if WEP_MAXCOUNT > 24
-       w.y = getstati(STAT_WEAPONS2);
-#if WEP_MAXCOUNT > 48
-       w.z = getstati(STAT_WEAPONS3);
-#endif
-#endif
-       return w;
-}
-WepSet ReadWepSet()
-{
-#if WEP_MAXCOUNT > 48
-       return ReadInt72_t();
-#elif WEP_MAXCOUNT > 24
-       return ReadInt48_t();
-#else
-       return ReadInt24_t() * '1 0 0';
-#endif
-}
-#endif
-
-void register_weapon(
-       int id,
-       WepSet bit,
-       bool(int) func,
-       .int ammotype,
-       int i,
-       int weapontype,
-       float pickupbasevalue,
-       vector clr,
-       string modelname,
-       string simplemdl,
-       string crosshair,
-       string wepimg,
-       string refname,
-       string wepname)
-{
-       entity e;
-       weapon_info[id - 1] = e = spawn();
-       e.classname = "weapon_info";
-       e.weapon = id;
-       e.weapons = bit;
-       e.weapon_func = func;
-       e.ammo_field = ammotype;
-       e.impulse = i;
-       e.spawnflags = weapontype;
-       e.bot_pickupbasevalue = pickupbasevalue;
-       e.wpcolor = clr;
-       e.wpmodel = strzone(strcat("wpn-", ftos(id)));
-       e.mdl = modelname;
-       e.model = strzone(strcat("models/weapons/g_", modelname, ".md3"));
-       e.w_simplemdl = strzone(simplemdl); // simpleitems weapon model/image
-       e.w_crosshair = strzone(car(crosshair));
-       string s = cdr(crosshair);
-       e.w_crosshair_size = ((s != "") ? stof(s) : 1); // so that we can scale the crosshair from code (for compat)
-       e.model2 = strzone(wepimg);
-       e.netname = refname;
-       e.message = wepname;
-
-       #ifdef CSQC
-       func(WR_INIT);
-       #endif
-}
-bool w_null(int dummy)
-{
-       return 0;
-}
-void register_weapons_done()
-{
-       dummy_weapon_info = spawn();
-       dummy_weapon_info.classname = "weapon_info";
-       dummy_weapon_info.weapon = 0; // you can recognize dummies by this
-       dummy_weapon_info.weapons = '0 0 0';
-       dummy_weapon_info.netname = "";
-       dummy_weapon_info.message = "AOL CD Thrower";
-       dummy_weapon_info.weapon_func = w_null;
-       dummy_weapon_info.wpmodel = "";
-       dummy_weapon_info.mdl = "";
-       dummy_weapon_info.model = "";
-       dummy_weapon_info.spawnflags = 0;
-       dummy_weapon_info.impulse = -1;
-       dummy_weapon_info.bot_pickupbasevalue = 0;
-       dummy_weapon_info.ammo_field = ammo_none;
-
-       dummy_weapon_info.w_crosshair = "gfx/crosshair1";
-       dummy_weapon_info.w_crosshair_size = 1;
-       dummy_weapon_info.model2 = "";
-
-       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(int id)
-{
-       entity w;
-       if(id < WEP_FIRST || id > WEP_LAST)
-               return dummy_weapon_info;
-       w = weapon_info[id - 1];
-       if(w)
-               return w;
-       return dummy_weapon_info;
-}
-string W_FixWeaponOrder(string order, float complete)
-{
-       return fixPriorityList(order, WEP_FIRST, WEP_LAST, 230 - WEP_FIRST, complete);
-}
-string W_NameWeaponOrder_MapFunc(string s)
-{
-       entity wi;
-       if(s == "0" || stof(s))
-       {
-               wi = get_weaponinfo(stof(s));
-               if(wi != dummy_weapon_info)
-                       return wi.netname;
-       }
-       return s;
-}
-
-string W_UndeprecateName(string s)
-{
-       switch ( s )
-       {
-               case "nex"            : return "vortex";
-               case "rocketlauncher" : return "devastator";
-               case "laser"          : return "blaster";
-               case "minstanex"      : return "vaporizer";
-               case "grenadelauncher": return "mortar";
-               case "uzi"            : return "machinegun";
-               default               : return s;
-       }
-}
-string W_NameWeaponOrder(string order)
-{
-       return mapPriorityList(order, W_NameWeaponOrder_MapFunc);
-}
-string W_NumberWeaponOrder_MapFunc(string s)
-{
-       int i;
-       if(s == "0" || stof(s))
-               return s;
-       s = W_UndeprecateName(s);
-       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
-               if(s == get_weaponinfo(i).netname)
-                       return ftos(i);
-       return s;
-}
-string W_NumberWeaponOrder(string order)
-{
-       return mapPriorityList(order, W_NumberWeaponOrder_MapFunc);
-}
-
-float W_FixWeaponOrder_BuildImpulseList_buf[WEP_MAXCOUNT];
-string W_FixWeaponOrder_BuildImpulseList_order;
-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(int i, int j, entity pass)
-{
-       entity e1, e2;
-       float d;
-       e1 = get_weaponinfo(W_FixWeaponOrder_BuildImpulseList_buf[i]);
-       e2 = get_weaponinfo(W_FixWeaponOrder_BuildImpulseList_buf[j]);
-       d = (e1.impulse + 9) % 10 - (e2.impulse + 9) % 10;
-       if(d != 0)
-               return -d; // high impulse first!
-       return
-               strstrofs(strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " "), sprintf(" %d ", W_FixWeaponOrder_BuildImpulseList_buf[i]), 0)
-               -
-               strstrofs(strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " "), sprintf(" %d ", W_FixWeaponOrder_BuildImpulseList_buf[j]), 0)
-               ; // low char index first!
-}
-string W_FixWeaponOrder_BuildImpulseList(string o)
-{
-       int i;
-       W_FixWeaponOrder_BuildImpulseList_order = o;
-       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
-               W_FixWeaponOrder_BuildImpulseList_buf[i - WEP_FIRST] = i;
-       heapsort(WEP_LAST - WEP_FIRST + 1, W_FixWeaponOrder_BuildImpulseList_swap, W_FixWeaponOrder_BuildImpulseList_cmp, world);
-       o = "";
-       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
-               o = strcat(o, " ", ftos(W_FixWeaponOrder_BuildImpulseList_buf[i - WEP_FIRST]));
-       W_FixWeaponOrder_BuildImpulseList_order = string_null;
-       return substring(o, 1, -1);
-}
-
-string W_FixWeaponOrder_AllowIncomplete(string order)
-{
-       return W_FixWeaponOrder(order, 0);
-}
-
-string W_FixWeaponOrder_ForceComplete(string order)
-{
-       if(order == "")
-               order = W_NumberWeaponOrder(cvar_defstring("cl_weaponpriority"));
-       return W_FixWeaponOrder(order, 1);
-}
-
-void W_RandomWeapons(entity e, float n)
-{
-       int i, j;
-       WepSet remaining;
-       WepSet result;
-       remaining = e.weapons;
-       result = '0 0 0';
-       for(i = 0; i < n; ++i)
-       {
-               RandomSelection_Init();
-               for(j = WEP_FIRST; j <= WEP_LAST; ++j)
-                       if(remaining & WepSet_FromWeapon(j))
-                               RandomSelection_Add(world, j, string_null, 1, 1);
-               result |= WepSet_FromWeapon(RandomSelection_chosen_float);
-               remaining &= ~WepSet_FromWeapon(RandomSelection_chosen_float);
-       }
-       e.weapons = result;
-}
-
-string GetAmmoPicture(.int ammotype)
-{
-       switch(ammotype)
-       {
-               case ammo_shells:  return "ammo_shells";
-               case ammo_nails:   return "ammo_bullets";
-               case ammo_rockets: return "ammo_rockets";
-               case ammo_cells:   return "ammo_cells";
-               case ammo_plasma:  return "ammo_cells";
-               case ammo_fuel:    return "ammo_fuel";
-               default: return ""; // wtf, no ammo type?
-       }
-}
-
-#ifdef CSQC
-.int GetAmmoFieldFromNum(int i)
-{
-       switch(i)
-       {
-               case 0: return ammo_shells;
-               case 1: return ammo_nails;
-               case 2: return ammo_rockets;
-               case 3: return ammo_cells;
-               case 4: return ammo_plasma;
-               case 5: return ammo_fuel;
-               default: return ammo_none;
-       }
-}
-
-int GetAmmoStat(.int ammotype)
-{
-       switch(ammotype)
-       {
-               case ammo_shells: return STAT_SHELLS;
-               case ammo_nails: return STAT_NAILS;
-               case ammo_rockets: return STAT_ROCKETS;
-               case ammo_cells: return STAT_CELLS;
-               case ammo_plasma: return STAT_PLASMA;
-               case ammo_fuel: return STAT_FUEL;
-               default: return -1;
-       }
-}
-#endif
-#endif
diff --git a/qcsrc/common/weapons/weapons.qh b/qcsrc/common/weapons/weapons.qh
deleted file mode 100644 (file)
index 5f17ccb..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-#ifndef WEAPONS_H
-#define WEAPONS_H
-
-#ifndef MENUQC
-#include "calculations.qh"
-#endif
-
-#include "../util.qh"
-#ifdef SVQC
-#include "../../server/bot/aim.qh"
-#endif
-const int MAX_SHOT_DISTANCE = 32768;
-
-// weapon pickup ratings for bot logic
-const int BOT_PICKUP_RATING_LOW  =  2500;
-const int BOT_PICKUP_RATING_MID  =  5000;
-const int BOT_PICKUP_RATING_HIGH = 10000;
-
-// weapon flags
-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 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;
-
-// weapon sets
-typedef vector WepSet;
-WepSet WepSet_FromWeapon(int a);
-#ifdef SVQC
-void WepSet_AddStat();
-void WriteWepSet(float dest, WepSet w);
-#endif
-#ifdef CSQC
-WepSet WepSet_GetFromStat();
-WepSet ReadWepSet();
-#endif
-
-// weapon name macros
-#define WEP_FIRST 1
-#define WEP_MAXCOUNT 24 // Increase as needed. Can be up to three times as much.
-int WEP_COUNT;
-int WEP_LAST;
-WepSet WEPSET_ALL;
-WepSet WEPSET_SUPERWEAPONS;
-
-// functions:
-entity get_weaponinfo(int 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);
-string W_FixWeaponOrder_AllowIncomplete(string order);
-string W_FixWeaponOrder_ForceComplete(string order);
-void W_RandomWeapons(entity e, float n);
-
-string GetAmmoPicture(.int ammotype);
-
-#ifdef CSQC
-.int GetAmmoFieldFromNum(int i);
-int GetAmmoStat(.int ammotype);
-#endif
-
-// ammo types
-.int ammo_shells;
-.int ammo_nails;
-.int ammo_rockets;
-.int ammo_cells;
-.int ammo_plasma;
-.int ammo_fuel;
-.int ammo_none;
-
-// other useful macros
-#define WEP_ACTION(wpn,wrequest) (get_weaponinfo(wpn)).weapon_func(wrequest)
-#define WEP_AMMO(wpn) ((get_weaponinfo(WEP_##wpn)).ammo_field) // only used inside weapon files/with direct name, don't duplicate prefix
-#define WEP_NAME(wpn) ((get_weaponinfo(wpn)).message)
-
-
-// ======================
-//  Configuration Macros
-// ======================
-
-// create cvars for weapon settings
-#define WEP_ADD_CVAR_NONE(wepname,name) [[last]] float autocvar_g_balance_##wepname##_##name;
-
-#define WEP_ADD_CVAR_PRI(wepname,name) WEP_ADD_CVAR_NONE(wepname, primary_##name)
-#define WEP_ADD_CVAR_SEC(wepname,name) WEP_ADD_CVAR_NONE(wepname, secondary_##name)
-#define WEP_ADD_CVAR_BOTH(wepname,name) \
-       WEP_ADD_CVAR_PRI(wepname, name) \
-       WEP_ADD_CVAR_SEC(wepname, name)
-
-#define WEP_ADD_CVAR(wepid,wepname,mode,name) WEP_ADD_CVAR_##mode(wepname, name)
-
-// create properties for weapon settings
-#define WEP_ADD_PROP(wepid,wepname,type,prop,name) \
-       .type prop; \
-       [[last]] type autocvar_g_balance_##wepname##_##name;
-
-// read cvars from weapon settings
-#define WEP_CVAR(wepname,name) autocvar_g_balance_##wepname##_##name
-#define WEP_CVAR_PRI(wepname,name) WEP_CVAR(wepname, primary_##name)
-#define WEP_CVAR_SEC(wepname,name) WEP_CVAR(wepname, secondary_##name)
-#define WEP_CVAR_BOTH(wepname,isprimary,name) ((isprimary) ? WEP_CVAR_PRI(wepname, name) : WEP_CVAR_SEC(wepname, name))
-
-// set initialization values for weapon settings
-#define WEP_SKIP_CVAR(unuseda,unusedb,unusedc,unusedd) /* skip cvars */
-#define WEP_SET_PROP(wepid,wepname,type,prop,name) get_weaponinfo(WEP_##wepid).##prop = autocvar_g_balance_##wepname##_##name;
-
-
-// =====================
-//  Weapon Registration
-// =====================
-
-bool w_null(int dummy);
-
-void register_weapon(
-       int id,
-       WepSet bit,
-       bool(int) func,
-       .int ammotype,
-       int i,
-       int weapontype,
-       float pickupbasevalue,
-       vector clr,
-       string modelname,
-       string simplemdl,
-       string crosshair,
-       string wepimg,
-       string refname,
-       string wepname);
-
-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"
-.int weapon;                // M: WEP_id    // WEP_...
-.WepSet weapons;            // A: WEPSET_id // WEPSET_...
-.float(float) weapon_func;  // M: function  // w_...
-..int ammo_field;         // M: ammotype  // main ammo field
-.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
-.string mdl;                // M: modelname // name of model (without g_ v_ or h_ prefixes)
-.string model;              // A: modelname // full path to g_ model
-.string w_simplemdl;        // M: simplemdl // simpleitems weapon model/image
-.string w_crosshair;        // M: crosshair // per-weapon crosshair: "CrosshairImage Size"
-.float w_crosshair_size;    // A: crosshair // per-weapon crosshair size (argument two of "crosshair" field)
-.string model2;             // M: wepimg    // "weaponfoobar" side view image file of weapon // WEAPONTODO: Move out of skin files, move to common files
-.string netname;            // M: refname   // reference name name
-.string message;            // M: wepname   // human readable name
-
-
-// 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) \
-       int id; \
-       WepSet bit; \
-       bool function(int); \
-       void RegisterWeapons_##id() \
-       { \
-               WEP_LAST = (id = WEP_FIRST + WEP_COUNT); \
-               bit = WepSet_FromWeapon(id); \
-               WEPSET_ALL |= bit; \
-               if((flags) & WEP_FLAG_SUPERWEAPON) \
-                       WEPSET_SUPERWEAPONS |= bit; \
-               ++WEP_COUNT; \
-               register_weapon(id,bit,function,ammotype,impulse,flags,rating,color,modelname,simplemdl,crosshair,wepimg,refname,wepname); \
-       } \
-       ACCUMULATE_FUNCTION(RegisterWeapons, RegisterWeapons_##id)
-#ifdef MENUQC
-#define REGISTER_WEAPON(id,function,ammotype,impulse,flags,rating,color,modelname,simplemdl,crosshair,wepimg,refname,wepname) \
-       REGISTER_WEAPON_2(WEP_##id,WEPSET_##id,w_null,ammotype,impulse,flags,rating,color,modelname,simplemdl,crosshair,wepimg,refname,wepname)
-#else
-#define REGISTER_WEAPON(id,function,ammotype,impulse,flags,rating,color,modelname,simplemdl,crosshair,wepimg,refname,wepname) \
-       REGISTER_WEAPON_2(WEP_##id,WEPSET_##id,function,ammotype,impulse,flags,rating,color,modelname,simplemdl,crosshair,wepimg,refname,wepname)
-#endif
-
-#include "all.inc"
-
-#undef WEP_ADD_CVAR_MO_PRI
-#undef WEP_ADD_CVAR_MO_SEC
-#undef WEP_ADD_CVAR_MO_BOTH
-#undef WEP_ADD_CVAR_MO_NONE
-#undef WEP_ADD_CVAR
-#undef WEP_ADD_PROP
-#undef REGISTER_WEAPON
-
-ACCUMULATE_FUNCTION(RegisterWeapons, register_weapons_done);
-#endif
index cc07017e12a09ab260d07967a029cbc5f25e0525..a6903ae3dc48dc3f293eef0327d89772455b9e68 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef CLIENT___H
-#define CLIENT___H
+#ifndef CLIENT_ALL_H
+#define CLIENT_ALL_H
 
 #include "../dpdefs/menudefs.qh"
 #include "../dpdefs/keycodes.qh"
index 68b90d586394939a459e81345903a605f7be2e75..5b0e417f94965c5c1f4899b49a904575c3366c4c 100644 (file)
@@ -34,7 +34,8 @@
 #include "xonotic/colorpicker_string.qc"
 #include "xonotic/commandbutton.qc"
 #include "xonotic/credits.qc"
-#include "xonotic/crosshairbutton.qc"
+#include "xonotic/crosshairpicker.qc"
+#include "xonotic/crosshairpreview.qc"
 #include "xonotic/cvarlist.qc"
 #include "xonotic/demolist.qc"
 #include "xonotic/dialog.qc"
 #include "xonotic/mainwindow.qc"
 #include "xonotic/maplist.qc"
 #include "xonotic/nexposee.qc"
+#include "xonotic/picker.qc"
 #include "xonotic/playerlist.qc"
 #include "xonotic/playermodel.qc"
 #include "xonotic/playlist.qc"
diff --git a/qcsrc/menu/command/all.qc b/qcsrc/menu/command/all.qc
new file mode 100644 (file)
index 0000000..711a747
--- /dev/null
@@ -0,0 +1,5 @@
+#include "../menu.qh"
+
+#include "../../common/command/all.qc"
+
+#include "menu_cmd.qc"
diff --git a/qcsrc/menu/command/all.qh b/qcsrc/menu/command/all.qh
new file mode 100644 (file)
index 0000000..7f116ae
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef MENU_COMMANDS_ALL_H
+#define MENU_COMMANDS_ALL_H
+
+#include "../../common/command/commands.qh"
+
+#include "menu_cmd.qh"
+
+#endif
diff --git a/qcsrc/menu/command/commands.qc b/qcsrc/menu/command/commands.qc
deleted file mode 100644 (file)
index 5b5911f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "../menu.qh"
-
-#include "../../common/command/commands.qc"
-
-#include "menu_cmd.qc"
diff --git a/qcsrc/menu/command/commands.qh b/qcsrc/menu/command/commands.qh
deleted file mode 100644 (file)
index 5ea3006..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef MENU_COMMANDS_H
-#define MENU_COMMANDS_H
-
-#include "../../common/command/commands.qh"
-
-#include "menu_cmd.qh"
-
-#endif
index 449bb0675f773f0e683e9133c8751005d567c99a..ac0655cfa6d1ecad35403763767ceba31d431d9c 100644 (file)
@@ -14,6 +14,7 @@ CLASS(Container, Item)
        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, addItemRightCentered, void(entity, entity, vector, float))
        METHOD(Container, moveItemAfter, void(entity, entity, entity))
        METHOD(Container, removeItem, void(entity, entity))
        METHOD(Container, setFocus, void(entity, entity))
@@ -282,6 +283,11 @@ void Container_addItemCentered(entity me, entity other, vector theSize, float th
        me.addItem(me, other, '0.5 0.5 0' - 0.5 * theSize, theSize, theAlpha);
 }
 
+void Container_addItemRightCentered(entity me, entity other, vector theSize, float theAlpha)
+{
+       me.addItem(me, other, '1 0.5 0' - 0.5 * theSize, theSize, theAlpha);
+}
+
 void Container_addItem(entity me, entity other, vector theOrigin, vector theSize, float theAlpha)
 {
        if(other.parent)
index b6048ac682219d7958cf2f3699e599ba634b0c13..77037ace61132e48fc3bf57e87f24fc7e249756a 100644 (file)
@@ -130,12 +130,15 @@ void Dialog_configureDialog(entity me)
 {
        float absWidth, absHeight;
 
-       me.frame = NEW(BorderImage);
-       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.isTabRoot)
+       {
+               me.frame = NEW(BorderImage);
+               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
@@ -155,7 +158,7 @@ void Dialog_configureDialog(entity me)
 
        me.fill(me);
 
-       if(me.closable && me.borderLines > 0)
+       if(me.isTabRoot && me.closable && me.borderLines > 0)
        {
                entity closebutton;
                closebutton = me.closeButton = me.frame.closeButton = NEW(Button);
index 044c9e34a0feb71d857d9ebb4b0f48d6cb5969c2..f7c17fa6bd888a73e580f825c81c077467d230a5 100644 (file)
@@ -6,11 +6,14 @@ CLASS(ListBox, Item)
        METHOD(ListBox, configureListBox, void(entity, float, float))
        METHOD(ListBox, draw, void(entity))
        METHOD(ListBox, keyDown, float(entity, float, float, float))
+       METHOD(ListBox, mouseMove, float(entity, vector))
        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, focusedItem, int, -1)
+       ATTRIB(ListBox, focusedItemAlpha, float, 0.3)
        ATTRIB(ListBox, allowFocusSound, float, 1)
        ATTRIB(ListBox, selectedItem, int, 0)
        ATTRIB(ListBox, size, vector, '0 0 0')
@@ -42,7 +45,7 @@ CLASS(ListBox, Item)
        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, drawListBoxItem, void(entity, int, vector, bool, bool)) // item number, width/height, isSelected, isFocused
        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))
@@ -178,6 +181,22 @@ float ListBox_keyDown(entity me, float key, float ascii, float shift)
                return 0;
        return 1;
 }
+float ListBox_mouseMove(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;
+       if(pos_x < 1 - me.controlWidth)
+       {
+               float x;
+               x = me.focusedItem;
+               me.focusedItem = me.getItemAtPos(me, me.scrollPos + pos.y);
+               if(x != me.focusedItem)
+                       me.focusedItemAlpha = SKINALPHA_LISTBOX_FOCUSED;
+       }
+       return 1;
+}
 float ListBox_mouseDrag(entity me, vector pos)
 {
        float hit;
@@ -288,6 +307,7 @@ void ListBox_focusLeave(entity me)
        // by a mouse click on an item of the list
        // for example showing a dialog on right click
        me.pressed = 0;
+       me.focusedItem = -1;
 }
 void ListBox_updateControlTopBottom(entity me)
 {
@@ -369,6 +389,7 @@ void ListBox_draw(entity me)
        draw_SetClip();
        oldshift = draw_shift;
        oldscale = draw_scale;
+
        float y;
        i = me.getItemAtPos(me, me.scrollPos);
        y = me.getItemStart(me, i) - me.scrollPos;
@@ -378,7 +399,7 @@ void ListBox_draw(entity me)
                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));
+               me.drawListBoxItem(me, i, absSize, (me.selectedItem == i), (me.focusedItem == i));
                y += relSize.y;
        }
        draw_ClearClip();
@@ -398,8 +419,8 @@ void ListBox_doubleClickListBoxItem(entity me, float i, vector where)
        // template method
 }
 
-void ListBox_drawListBoxItem(entity me, float i, vector absSize, float selected)
+void ListBox_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
-       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);
+       draw_Text('0 0 0', sprintf(_("Item %d"), i), eX * (8 / absSize.x) + eY * (8 / absSize.y), (isSelected ? '0 1 0' : '1 1 1'), 1, 0);
 }
 #endif
index 669e08fe726dbed788ad2cd7e363d4a31e4edb9f..d8a3ede2e7d8988afd29865a409af7de2defe772 100644 (file)
@@ -2,7 +2,8 @@
 #include "oo/classes.qc"
 #include "xonotic/util.qh"
 
-#include "../common/weapons/weapons.qh"
+#include "../common/items/all.qh"
+#include "../common/weapons/all.qh"
 #include "../common/mapinfo.qh"
 
 ///////////////////////////////////////////////
@@ -80,6 +81,7 @@ void m_init()
 
        // needs to be done so early because of the constants they create
        CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
+       CALL_ACCUMULATED_FUNCTION(RegisterItems);
        CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
 
        RegisterSLCategories();
index 5c74f0d6dffaca4a914b2ea2aedeceb5d7d4ef6b..28b87ab7fca7e13d74ed3c6e12b3d04049c9cb41 100644 (file)
@@ -1,71 +1,11 @@
 #ifndef BASE_H
 #define BASE_H
 
+#include "../../common/oo.qh"
+
 #include "../../common/util.qh"
 #include "../../dpdefs/keycodes.qh"
 
-#define NULL (null_entity)
 #define world NULL
 
-.string classname;
-.string vtblname;
-.entity vtblbase;
-entity spawnVtbl(entity this, entity base)
-{
-       entity vtbl = spawn();
-       copyentity(this, vtbl);
-       vtbl.vtblname = vtbl.classname;
-       vtbl.classname = "vtbl";
-       vtbl.vtblbase = base ? base : vtbl; // Top level objects use vtbl as base
-       return vtbl;
-}
-
-entity Object_vtbl;
-entity spawnObject(entity this, entity)
-{
-       this = spawn();
-       this.classname = "Object";
-       if (!Object_vtbl) Object_vtbl = spawnVtbl(this, null_entity);
-       return this;
-}
-
-// Classes have a `spawn##cname(entity, entity)` constructor
-// The parameters are used as locals for [[accumulate]]
-
-// Macro to hide this implementation detail
-#define NEW(cname) (spawn##cname(null_entity, null_entity))
-
-#define CLASS(cname, base)                                          \
-entity spawn##cname(entity this, entity basevtbl) {                 \
-    this = NEW(base); basevtbl = base##_vtbl;                       \
-}
-
-#define METHOD(cname, name, prototype)                              \
-prototype cname##_##name;                                           \
-.prototype name;                                                    \
-[[accumulate]] entity spawn##cname(entity this, entity basevtbl) {  \
-    this.name = cname##_##name;                                     \
-}
-
-#define ATTRIB(cname, name, type, val)                              \
-.type name;                                                         \
-[[accumulate]] entity spawn##cname(entity this, entity basevtbl) {  \
-    this.name = val;                                                \
-}
-
-#define ATTRIBARRAY(cname, name, type, cnt)                         \
-.type name[cnt];
-
-#define ENDCLASS(cname)                                             \
-.bool instanceOf##cname;                                            \
-entity cname##_vtbl;                                                \
-[[last]] entity spawn##cname(entity this, entity basevtbl) {        \
-    this.instanceOf##cname = true;                                  \
-    this.classname = #cname;                                        \
-    if (!cname##_vtbl) cname##_vtbl = spawnVtbl(this, basevtbl);    \
-    return this;                                                    \
-}
-
-#define SUPER(cname) (cname##_vtbl.vtblbase)
-
-#endif
\ No newline at end of file
+#endif
index abfb303dbc21487eed7174c609081f95a85ba378..2315616d1701bfc29dbdbe8cc7c6ce04e8433092 100644 (file)
@@ -9,7 +9,7 @@ oo/classes.qc
 draw.qc
 menu.qc
 
-command/commands.qc
+command/all.qc
 
 xonotic/util.qc
 
@@ -21,8 +21,10 @@ xonotic/util.qc
 ../common/urllib.qc
 ../common/util.qc
 
-../common/monsters/monsters.qc
+../common/items/all.qc
 
-../common/weapons/weapons.qc // TODO
+../common/monsters/all.qc
+
+../common/weapons/all.qc // TODO
 
 ../warpzonelib/mathlib.qc
index ee0e76f399f7efbde625505d3b2fd59db7f84dae..bf29683f6302b1bc889e68f09017a690ab0e55cd 100644 (file)
@@ -144,9 +144,6 @@ SKINBEGIN
        SKINFLOAT(ROWS_CREDITS, 20);
        SKINFLOAT(WIDTH_CREDITS, 0.5);
 
-       // item: crosshair button
-       SKINSTRING(GFX_CROSSHAIRBUTTON, "crosshairbutton");
-
        // item: cvar list
        SKINFLOAT(ALPHA_CVARLIST_SAVED, 1);
        SKINFLOAT(ALPHA_CVARLIST_TEMPORARY, 0.7);
@@ -191,6 +188,9 @@ SKINBEGIN
        SKINFLOAT(ALPHA_LISTBOX_WAITING, 0.5);
        SKINVECTOR(COLOR_LISTBOX_BACKGROUND, '0 0 0');
        SKINFLOAT(ALPHA_LISTBOX_BACKGROUND, 0.5);
+       SKINVECTOR(COLOR_LISTBOX_FOCUSED, '0 0 1');
+       SKINFLOAT(ALPHA_LISTBOX_FOCUSED, 0.7);
+       SKINFLOAT(FADEALPHA_LISTBOX_FOCUSED, 0.3);
 
        // item: map list
        SKINVECTOR(COLOR_MAPLIST_TITLE, '1 1 1');
@@ -211,11 +211,13 @@ SKINBEGIN
        SKINVECTOR(COLOR_MODELTITLE, '1 1 1');
        SKINFLOAT(ALPHA_MODELTITLE, 1);
 
-       // item: player name editor
+       // item: special character picker
        SKINVECTOR(COLOR_CHARMAP_CHAR, '1 1 1');
        SKINFLOAT(ALPHA_CHARMAP_CHAR, 1);
-       SKINVECTOR(COLOR_CHARMAP_FOCUS, '0 0 1');
-       SKINFLOAT(ALPHA_CHARMAP_FOCUS, 0.5);
+
+       // item: crosshair picker
+       SKINVECTOR(COLOR_CROSSHAIRPICKER_CROSSHAIR, '1 1 1');
+       SKINFLOAT(ALPHA_CROSSHAIRPICKER_CROSSHAIR, 1);
 
        // item: radio button
        SKINSTRING(GFX_RADIOBUTTON, "radiobutton");
index 826a0b4f2d7c6d81cf22f906f3fd7230dbc99a32..e30c038a01b5b14e2dea5e241698ca1e05b0c5fc 100644 (file)
@@ -7,7 +7,7 @@ CLASS(XonoticCampaignList, 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, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticCampaignList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticCampaignList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticCampaignList, setSelected, void(entity, float))
@@ -239,7 +239,7 @@ void XonoticCampaignList_doubleClickListBoxItem(entity me, float i, vector where
 {
        CampaignList_LoadMap(me, me);
 }
-void XonoticCampaignList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected)
+void XonoticCampaignList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s;
        vector theColor;
@@ -265,6 +265,11 @@ void XonoticCampaignList_drawListBoxItem(entity me, int i, vector absSize, bool
 
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(isFocused)
+       {
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+       }
 
        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);
index d6bc52461846995ad7f0d09f0e4f3a871a4bd3ac..747d1f03b4568a4a820bdc35cedb170b67570a19 100644 (file)
@@ -1,34 +1,27 @@
 #ifndef CHARMAP_H
 #define CHARMAP_H
-#include "../item.qc"
-CLASS(XonoticCharmap, Item)
+#include "picker.qc"
+CLASS(XonoticCharmap, XonoticPicker)
        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))
+       METHOD(XonoticCharmap, keyDown, float(entity, float, float, float))
        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')
+
+       ATTRIB(XonoticCharmap, rows, float, 10)
+       ATTRIB(XonoticCharmap, columns, float, 14)
+
+       METHOD(XonoticCharmap, cellSelect, void(entity, vector))
+       METHOD(XonoticCharmap, cellIsValid, bool(entity, vector))
+       METHOD(XonoticCharmap, cellDraw, void(entity, vector, vector))
+       METHOD(XonoticCharmap, charOffset, vector)
 ENDCLASS(XonoticCharmap)
 entity makeXonoticCharmap(entity controlledInputBox);
 #endif
 
 #ifdef IMPLEMENTATION
 
-const float CHARMAP_COLS = 14;
-const float CHARMAP_ROWS = 10;
-
 string CHARMAP =
        "★◆■▮▰▬◣◤◥◢◀▲▶▼"
        "🌍🌎🌏🚀🌌👽🔫⌖❇❈←↑→↓"
@@ -46,11 +39,11 @@ string CHARMAP =
        "\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 charmap_cellToChar(entity me, vector cell)
 {
-       string character = substring(CHARMAP, cell.y * CHARMAP_COLS + cell.x, 1);
+       string character = substring(CHARMAP, cell.y * me.columns + cell.x, 1);
 
-       if (character != " ")
+       if(character != " ")
                return character;
        else
                return "";
@@ -67,7 +60,7 @@ entity makeXonoticCharmap(entity controlledInputBox)
 void XonoticCharmap_configureXonoticCharmap(entity me, entity controlledInputBox)
 {
        me.inputBox = controlledInputBox;
-       me.realCellSize = eX / CHARMAP_COLS + eY / CHARMAP_ROWS;
+       me.configureXonoticPicker(me);
 }
 
 void XonoticCharmap_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
@@ -90,153 +83,38 @@ void XonoticCharmap_resizeNotify(entity me, vector relOrigin, vector relSize, ve
 
        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;
+       me.charOffset = eX * me.realCellSize.x / 2 + eY * ((me.realCellSize.y - me.realFontSize.y) / 2);
 }
 
-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)
+float XonoticCharmap_keyDown(entity me, float key, float ascii, float shift)
 {
-       if(!me.pressed)
-               return 0;
-
-       me.mouseMove(me, coords);
-
-       if(me.focusedCell == me.previouslyFocusedCell)
-               me.enterChar(me);
-
-       me.pressed = 0;
-       return 1;
+       if(SUPER(XonoticCharmap).keyDown(me, key, ascii, shift))
+               return 1;
+       return me.inputBox.keyDown(me.inputBox, key, ascii, shift);
 }
 
-float XonoticCharmap_keyDown(entity me, float key, float ascii, float shift)
+void XonoticCharmap_cellSelect(entity me, vector cell)
 {
-       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);
-       }
+       string character = charmap_cellToChar(me, cell);
+       if(character != "")
+               me.inputBox.enterText(me.inputBox, character);
 }
 
-void XonoticCharmap_moveFocus(entity me, vector initialCell, vector step)
+bool XonoticCharmap_cellIsValid(entity me, vector cell)
 {
-       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);
+       if(charmap_cellToChar(me, cell) == "")
+               return false;
+       return true;
 }
 
-void XonoticCharmap_enterChar(entity me)
+void XonoticCharmap_cellDraw(entity me, vector cell, vector cellPos)
 {
-       string character = charmap_cellToChar(me.focusedCell);
-       if(character != "")
-               me.inputBox.enterText(me.inputBox, character);
+       draw_CenterText(cellPos + me.charOffset, charmap_cellToChar(me, cell), me.realFontSize, SKINCOLOR_CHARMAP_CHAR, SKINALPHA_CHARMAP_CHAR, 0);
 }
 
 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
index d7e17f53296c40dc158eb4b97b62464b04e62009..57320a018240e3ac47bf8eae814280674004b705 100644 (file)
@@ -5,7 +5,7 @@ CLASS(XonoticCreditsList, 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, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticCreditsList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticCreditsList, keyDown, float(entity, float, float, float))
        METHOD(XonoticCreditsList, destroy, void(entity))
@@ -59,7 +59,7 @@ void XonoticCreditsList_resizeNotify(entity me, vector relOrigin, vector relSize
        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)
+void XonoticCreditsList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        // layout: Ping, Credits name, Map name, NP, TP, MP
        string s;
diff --git a/qcsrc/menu/xonotic/crosshairbutton.qc b/qcsrc/menu/xonotic/crosshairbutton.qc
deleted file mode 100644 (file)
index 466846f..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-#ifndef CROSSHAIRBUTTON_H
-#define CROSSHAIRBUTTON_H
-#include "../item/radiobutton.qc"
-CLASS(XonoticCrosshairButton, 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 = NEW(XonoticCrosshairButton);
-       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/crosshairpicker.qc b/qcsrc/menu/xonotic/crosshairpicker.qc
new file mode 100644 (file)
index 0000000..8922e7f
--- /dev/null
@@ -0,0 +1,79 @@
+#ifndef CROSSHAIRPICKER_H
+#define CROSSHAIRPICKER_H
+#include "picker.qc"
+CLASS(XonoticCrosshairPicker, XonoticPicker)
+       METHOD(XonoticCrosshairPicker, configureXonoticCrosshairPicker, void(entity))
+
+       ATTRIB(XonoticCrosshairPicker, rows, float, 3)
+       ATTRIB(XonoticCrosshairPicker, columns, float, 12)
+
+       METHOD(XonoticCrosshairPicker, cellSelect, void(entity, vector))
+       METHOD(XonoticCrosshairPicker, cellIsValid, bool(entity, vector))
+       METHOD(XonoticCrosshairPicker, cellDraw, void(entity, vector, vector))
+ENDCLASS(XonoticCrosshairPicker)
+entity makeXonoticCrosshairPicker();
+#endif
+
+#ifdef IMPLEMENTATION
+
+string crosshairpicker_cellToCrosshair(entity me, vector cell)
+{
+       if(cell.x < 0 || cell.x >= me.columns || cell.y < 0 || cell.y >= me.rows)
+               return "";
+       return ftos(31 + cell.y * me.columns + cell.x);
+}
+
+vector crosshairpicker_crosshairToCell(entity me, string crosshair_str)
+{
+       float crosshair = stof(crosshair_str) - 31;
+       if(crosshair - floor(crosshair) > 0)
+               return '-1 -1 0';
+       return mod(crosshair, me.columns) * eX + floor(crosshair / me.columns) * eY;
+}
+
+entity makeXonoticCrosshairPicker()
+{
+       entity me;
+       me = NEW(XonoticCrosshairPicker);
+       me.configureXonoticCrosshairPicker(me);
+       return me;
+}
+
+void XonoticCrosshairPicker_configureXonoticCrosshairPicker(entity me)
+{
+       me.configureXonoticPicker(me);
+       SUPER(XonoticCrosshairPicker).cellSelect(me, crosshairpicker_crosshairToCell(me, cvar_string("crosshair")));
+}
+
+void XonoticCrosshairPicker_cellSelect(entity me, vector cell)
+{
+       cvar_set("crosshair", crosshairpicker_cellToCrosshair(me, me.focusedCell));
+       SUPER(XonoticCrosshairPicker).cellSelect(me, me.focusedCell);
+}
+
+bool XonoticCrosshairPicker_cellIsValid(entity me, vector cell)
+{
+       if(crosshairpicker_cellToCrosshair(me, cell) == "")
+               return false;
+       return true;
+}
+
+void XonoticCrosshairPicker_cellDraw(entity me, vector cell, vector cellPos)
+{
+       vector sz;
+       string cross = strcat("/gfx/crosshair", crosshairpicker_cellToCrosshair(me, cell));
+       sz = draw_PictureSize(cross);
+       sz = globalToBoxSize(sz, me.size);
+
+       float ar = sz.x / sz.y;
+       sz.x = me.realCellSize.x;
+       sz.y = sz.x / ar;
+       sz = sz * 0.95;
+
+       vector crosshairPos = cellPos + 0.5 * me.realCellSize;
+       draw_Picture(crosshairPos - 0.5 * sz, cross, sz, SKINCOLOR_CROSSHAIRPICKER_CROSSHAIR, SKINALPHA_CROSSHAIRPICKER_CROSSHAIR);
+
+       if(cvar("crosshair_dot"))
+               draw_Picture(crosshairPos - 0.5 * sz * cvar("crosshair_dot_size"), "/gfx/crosshairdot", sz * cvar("crosshair_dot_size"), SKINCOLOR_CROSSHAIRPICKER_CROSSHAIR, SKINALPHA_CROSSHAIRPICKER_CROSSHAIR);
+}
+#endif
diff --git a/qcsrc/menu/xonotic/crosshairpreview.qc b/qcsrc/menu/xonotic/crosshairpreview.qc
new file mode 100644 (file)
index 0000000..f8de857
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef CROSSHAIRPREVIEW_H
+#define CROSSHAIRPREVIEW_H
+#include "../item.qc"
+CLASS(XonoticCrosshairPreview, Item)
+       METHOD(XonoticCrosshairPreview, configureXonoticCrosshairPreview, void(entity))
+       METHOD(XonoticCrosshairPreview, draw, void(entity))
+       ATTRIB(XonoticCrosshairPreview, src, string, string_null)
+       ATTRIB(XonoticCrosshairPreview, src2, string, string_null)
+       ATTRIB(XonoticCrosshairPreview, disabled, float, 0)
+       ATTRIB(XonoticCrosshairPreview, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticCrosshairPreview)
+entity makeXonoticCrosshairPreview();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeXonoticCrosshairPreview()
+{
+       entity me;
+       me = NEW(XonoticCrosshairPreview);
+       me.configureXonoticCrosshairPreview(me);
+       return me;
+}
+
+void XonoticCrosshairPreview_configureXonoticCrosshairPreview(entity me)
+{
+       me.src = strzone(strcat("/gfx/crosshair", cvar_string("crosshair")));
+       me.src2 = "/gfx/crosshairdot";
+}
+
+void XonoticCrosshairPreview_draw(entity me)
+{
+       float save;
+       save = draw_alpha;
+       if(me.disabled)
+               draw_alpha *= me.disabledAlpha;
+
+       vector sz, rgb;
+       float a;
+       rgb = stov(cvar_string("crosshair_color"));
+       a = cvar("crosshair_alpha");
+       if(me.src)
+               strunzone(me.src);
+       me.src = strzone(strcat("/gfx/crosshair", cvar_string("crosshair")));
+
+       sz = draw_PictureSize(me.src);
+       sz = globalToBoxSize(sz, me.size);
+       sz = sz * cvar("crosshair_size");
+
+       draw_Picture('0.5 0.5 0' - 0.5 * sz, me.src, 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.src2, sz * cvar("crosshair_dot_size"), rgb, a * cvar("crosshair_dot_alpha"));
+       }
+
+       draw_alpha = save;
+
+       SUPER(XonoticCrosshairPreview).draw(me);
+}
+#endif
index 44520c1f22f58857b72d43d71e63ae97e9556843..9a95ed163963c58607afd2a0709bd408e6d5cad6 100644 (file)
@@ -4,7 +4,7 @@
 CLASS(XonoticCvarList, XonoticListBox)
        METHOD(XonoticCvarList, configureXonoticCvarList, void(entity))
        ATTRIB(XonoticCvarList, rowsPerItem, float, 1)
-       METHOD(XonoticCvarList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticCvarList, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticCvarList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticCvarList, keyDown, float(entity, float, float, float))
 
@@ -154,7 +154,7 @@ void XonoticCvarList_resizeNotify(entity me, vector relOrigin, vector relSize, v
 
        me.setSelected(me, me.selectedItem);
 }
-void XonoticCvarList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticCvarList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string k, v, d;
        float t;
@@ -166,6 +166,11 @@ void XonoticCvarList_drawListBoxItem(entity me, float i, vector absSize, float i
 
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(isFocused)
+       {
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+       }
 
        k = bufstr_get(me.handle, i);
 
index 4f759f68ad7e6e58bd70e60c5d003014052e5dfd..f46ee407b6c82ecc8fa272df54e6eb7df379645c 100644 (file)
@@ -5,7 +5,7 @@ CLASS(XonoticDemoList, 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, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticDemoList, getDemos, void(entity))
        METHOD(XonoticDemoList, startDemo, void(entity))
        METHOD(XonoticDemoList, timeDemo, void(entity))
@@ -135,11 +135,16 @@ void XonoticDemoList_resizeNotify(entity me, vector relOrigin, vector relSize, v
        me.columnNameSize = 1 - 2 * me.realFontSize.x;
 }
 
-void XonoticDemoList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticDemoList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s;
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(isFocused)
+       {
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+       }
 
        s = me.demoName(me,i);
        s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
index 6aedde7fd0c79871109fde659c93a034ee7b9a0f..64cfbd91dd415e04198517a1d4ef991c580fd7f7 100644 (file)
@@ -19,9 +19,6 @@ void XonoticMultiplayerDialog_fill(entity me)
        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()));
 
index 13a8e3184bbc3d5c7b67a198132565e342e62895..e56f2eef3d991e447f6b5e9d09ffdbff7a30bdd1 100644 (file)
@@ -5,7 +5,6 @@ CLASS(XonoticServerCreateTab, 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
index 449445225644317321ae12b2443a15ee3332d81a..8ab5296383e97575f1c18ae106fb588bab2e061b 100644 (file)
@@ -1,4 +1,4 @@
-#include "../../common/weapons/weapons.qh"
+#include "../../common/weapons/all.qh"
 
 #ifndef DIALOG_MULTIPLAYER_CREATE_MUTATORS_H
 #define DIALOG_MULTIPLAYER_CREATE_MUTATORS_H
index 2b2354c5330f3f0c6cae2909e0b07655f3564a1b..a4e480e18ab4197e5f0fdd52b0ac27fcab1a1e8d 100644 (file)
@@ -3,7 +3,6 @@
 #include "tab.qc"
 CLASS(XonoticServerListTab, 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)
index f6b5e02ad85a3865c71d22f03ac12f7dae1dc990..03ffd0f36dc361d814707081bb8b6efd18eb9890 100644 (file)
@@ -3,7 +3,6 @@
 #include "tab.qc"
 CLASS(XonoticMediaTab, 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)
index 8ae5ae0c3a29094772ff1612c544140160f119b0..788aa5381bac5ca7c2ac8de7d1ae2d67d3dc7360 100644 (file)
@@ -3,7 +3,6 @@
 #include "tab.qc"
 CLASS(XonoticDemoBrowserTab, 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)
index 8fc33c1b865acfbda89e082daa91e8aefe510772..6c0791ff7ca66833470e02386876af59b5878774 100644 (file)
@@ -3,7 +3,6 @@
 #include "tab.qc"
 CLASS(XonoticMusicPlayerTab, 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)
index 36832a90cf2d501305a3548bbe9de8b11e5eb980..c6526f2ec8db9044663a6922081d8bb41199fd40 100644 (file)
@@ -3,7 +3,6 @@
 #include "tab.qc"
 CLASS(XonoticScreenshotBrowserTab, 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)
index f9615d21ccdde1b77b0701a7342f17f33f26649a..9faf42888e83ef6e4f84c9ea4ba8152815029a6b 100644 (file)
@@ -4,7 +4,6 @@
 CLASS(XonoticProfileTab, 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
index 528d9503893a82f1f005b99e06efd2f2fd63d03e..af8faddacecceb7a6fa9531152b26fd09a8c1bc9 100644 (file)
@@ -3,7 +3,6 @@
 #include "tab.qc"
 CLASS(XonoticAudioSettingsTab, 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
index a49e17647a1fbcac1082f4429e09ed6d7ea33ba0..d06465082b395303a4a1857c4982c7bb7f6258a2 100644 (file)
@@ -3,7 +3,6 @@
 #include "tab.qc"
 CLASS(XonoticEffectsSettingsTab, 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
index e8fd42d5d5a1bef1d097e21f76b8277c3a1b4c29..5b14b7bdb698669a8cd0531ed77d8dedbdafb7f0 100644 (file)
@@ -3,7 +3,6 @@
 #include "tab.qc"
 CLASS(XonoticGameSettingsTab, 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)
index bda4fadd7a44ba00942de5b16e46fe091dc165d0..cee4bd5c72a68a8a8c0c3fa4b77a874c069f5e66 100644 (file)
@@ -2,10 +2,8 @@
 #define DIALOG_SETTINGS_GAME_CROSSHAIR_H
 #include "tab.qc"
 CLASS(XonoticGameCrosshairSettingsTab, 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)
@@ -29,7 +27,6 @@ entity makeXonoticGameCrosshairSettingsTab()
 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?
@@ -42,26 +39,12 @@ void XonoticGameCrosshairSettingsTab_fill(entity 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
+               me.TD(me, 3, 2, e = makeXonoticCrosshairPicker());
+                       setDependentAND(e, "crosshair_per_weapon", 0, 0, "crosshair_enabled", 1, 2);
+               me.TD(me, 3, 0.9, e = makeXonoticCrosshairPreview());
                        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:")));
index 751eaa6a6f71677beaba15d3c32aeda4db0ab5e1..941daa7922ecf70ac744ba5c7ffb5f4c8c4de2e5 100644 (file)
@@ -2,10 +2,8 @@
 #define DIALOG_SETTINGS_GAME_HUD_H
 #include "tab.qc"
 CLASS(XonoticGameHUDSettingsTab, 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)
index eccd938f4f60450cec5a8f4e04aa065d504d7258..d52a102d4259f812fac042856d707e434fe0faea 100644 (file)
@@ -2,10 +2,8 @@
 #define DIALOG_SETTINGS_GAME_MESSAGES_H
 #include "tab.qc"
 CLASS(XonoticGameMessageSettingsTab, 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)
index 32955ba8f18dc6080faeedeba39d56bc917835ce..db3e4082c99a2cf5d3ec391dc933e8924cd8e55a 100644 (file)
@@ -2,10 +2,8 @@
 #define DIALOG_SETTINGS_GAME_MODEL_H
 #include "tab.qc"
 CLASS(XonoticGameModelSettingsTab, 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)
index 4daef475a7db4c0cb3cd08c02a9210eda99bd7f4..40a526d56ae863e25e25de98ea47fa27b78e994f 100644 (file)
@@ -2,10 +2,8 @@
 #define DIALOG_SETTINGS_GAME_VIEW_H
 #include "tab.qc"
 CLASS(XonoticGameViewSettingsTab, 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)
index 573f139a9adfb6fa934dedfa1c6d9e3e7778967f..c59a9620d477d7826198061fdd67190f5f70d91f 100644 (file)
@@ -2,10 +2,8 @@
 #define DIALOG_SETTINGS_GAME_WEAPONS_H
 #include "tab.qc"
 CLASS(XonoticGameWeaponsSettingsTab, 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)
index 752aade9757ee3272a54634349de99ec4ea24b28..f8e53c03a9fd069804bb0e9a37d8a4a2da6c9aef 100644 (file)
@@ -3,7 +3,6 @@
 #include "tab.qc"
 CLASS(XonoticInputSettingsTab, 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
index 95f218b0e9852e357d1a20df4b2cb2f4a2612c54..79e196170669f430519c20fe627d15c8d85fa4c9 100644 (file)
@@ -3,7 +3,6 @@
 #include "tab.qc"
 CLASS(XonoticMiscSettingsTab, 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)
index e9ad109c417c8bc7e764779b40ccf0e75ad5f8ac..35246ae1700159de66f3dc23760cf1ce93204b48 100644 (file)
@@ -3,7 +3,6 @@
 #include "tab.qc"
 CLASS(XonoticUserSettingsTab, 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)
index 9b77e40a64d7d50d062b1a26a3f174c38221aeae..61a93f62e2696c06ff047745363e45cbb69278db 100644 (file)
@@ -3,7 +3,6 @@
 #include "tab.qc"
 CLASS(XonoticVideoSettingsTab, 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
index d8dbc8838ea5bdb709931008cf7f3207a614ad9a..26845f0946430469120b374d59bfc0f0d785f7a3 100644 (file)
@@ -4,7 +4,7 @@
 CLASS(XonoticGametypeList, XonoticListBox)
        METHOD(XonoticGametypeList, configureXonoticGametypeList, void(entity))
        ATTRIB(XonoticGametypeList, rowsPerItem, float, 2)
-       METHOD(XonoticGametypeList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticGametypeList, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticGametypeList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticGametypeList, setSelected, void(entity, float))
        METHOD(XonoticGametypeList, loadCvars, void(entity))
@@ -78,12 +78,17 @@ void XonoticGametypeList_saveCvars(entity me)
                owner.gameTypeChangeNotify(owner);
        }
 }
-void XonoticGametypeList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticGametypeList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s1, s2;
 
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(isFocused)
+       {
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+       }
 
        draw_Picture(me.columnIconOrigin * eX, GameType_GetIcon(i), me.columnIconSize * eX + eY, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
        s1 = GameType_GetName(i);
index 82d3db4e5d7d5489cae3c1d9fb414a7fa1132cc7..8953b1db9b3f716e11dd0d49eb83a2566c8cf859 100644 (file)
@@ -4,7 +4,7 @@
 CLASS(XonoticKeyBinder, XonoticListBox)
        METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity))
        ATTRIB(XonoticKeyBinder, rowsPerItem, int, 1)
-       METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticKeyBinder, setSelected, void(entity, float))
@@ -302,7 +302,7 @@ float XonoticKeyBinder_keyDown(entity me, int key, bool ascii, float shift)
        }
        return r;
 }
-void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected)
+void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s;
        int j, n;
@@ -331,6 +331,12 @@ void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isS
                        else
                                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
                }
+               else if(isFocused)
+               {
+                       me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+                       draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+               }
+
                theAlpha = SKINALPHA_KEYGRABBER_KEYS;
                theColor = SKINCOLOR_KEYGRABBER_KEYS;
                extraMargin = me.realFontSize.x * 0.5;
index 367da94dfb5df0ad26d6f001866c77896da4415b..af9d75211b3987809ec4bedb3eff1e85d3813990 100644 (file)
@@ -4,7 +4,7 @@
 CLASS(XonoticLanguageList, XonoticListBox)
        METHOD(XonoticLanguageList, configureXonoticLanguageList, void(entity))
        ATTRIB(XonoticLanguageList, rowsPerItem, float, 1)
-       METHOD(XonoticLanguageList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticLanguageList, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticLanguageList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticLanguageList, setSelected, void(entity, float))
        METHOD(XonoticLanguageList, loadCvars, void(entity))
@@ -57,11 +57,16 @@ void XonoticLanguageList_configureXonoticLanguageList(entity me)
        me.loadCvars(me);
 }
 
-void XonoticLanguageList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticLanguageList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s, p;
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(isFocused)
+       {
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+       }
 
        s = me.languageParameter(me, i, LANGPARM_NAME_LOCALIZED);
 
index 76e71381d326314c75a6e0f37c141da57418021f..7af6e9363d3ce440dbc60d944a55b400c77d3475 100644 (file)
@@ -62,79 +62,75 @@ void MainWindow_configureMainWindow(entity me)
 
        i = NEW(XonoticHUDNotificationDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDAmmoDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDHealthArmorDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDChatDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDModIconsDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDPowerupsDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDPressedKeysDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDRaceTimerDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDRadarDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDScoreDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDTimerDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDVoteDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDWeaponsDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDEngineInfoDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDInfoMessagesDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDPhysicsDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
-
-       me.screenshotViewerDialog = i = NEW(XonoticScreenshotViewerDialog);
-       i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDCenterprintDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        i = NEW(XonoticHUDBuffsDialog);
        i.configureDialog(i);
-       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
 
        // dialogs used by settings
@@ -188,6 +184,13 @@ void MainWindow_configureMainWindow(entity me)
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
+
+       // dialogs used by multiplayer/media
+       me.screenshotViewerDialog = i = NEW(XonoticScreenshotViewerDialog);
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+
        // mutator dialogs
        i = NEW(XonoticSandboxToolsDialog);
        i.configureDialog(i);
index ec9aa1f4c7bc104216e3329d0d4c710e88c4e95b..f2749abb5ce17847a399e06d7f87a0fa872637b3 100644 (file)
@@ -5,7 +5,7 @@ CLASS(XonoticMapList, 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, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticMapList, clickListBoxItem, void(entity, float, vector))
        METHOD(XonoticMapList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticMapList, resizeNotify, void(entity, vector, vector, vector, vector))
@@ -161,7 +161,7 @@ void XonoticMapList_doubleClickListBoxItem(entity me, float i, vector where)
                }
 }
 
-void XonoticMapList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticMapList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        // layout: Ping, Map name, Map name, NP, TP, MP
        string s;
@@ -179,8 +179,16 @@ void XonoticMapList_drawListBoxItem(entity me, float i, vector absSize, float is
 
        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);
+       else
+       {
+               if(included)
+                       draw_Fill('0 0 0', '1 1 0', SKINCOLOR_MAPLIST_INCLUDEDBG, SKINALPHA_MAPLIST_INCLUDEDBG);
+               if(isFocused)
+               {
+                       me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+                       draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+               }
+       }
 
        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);
diff --git a/qcsrc/menu/xonotic/picker.qc b/qcsrc/menu/xonotic/picker.qc
new file mode 100644 (file)
index 0000000..dd57467
--- /dev/null
@@ -0,0 +1,207 @@
+#ifndef PICKER_H
+#define PICKER_H
+#include "../item.qc"
+CLASS(XonoticPicker, Item)
+       METHOD(XonoticPicker, configureXonoticPicker, void(entity))
+       METHOD(XonoticPicker, mousePress, float(entity, vector))
+       METHOD(XonoticPicker, mouseRelease, float(entity, vector))
+       METHOD(XonoticPicker, mouseMove, float(entity, vector))
+       METHOD(XonoticPicker, mouseDrag, float(entity, vector))
+       METHOD(XonoticPicker, keyDown, float(entity, float, float, float))
+       METHOD(XonoticPicker, draw, void(entity))
+       ATTRIB(XonoticPicker, focusable, float, 1)
+       ATTRIB(XonoticPicker, disabled, float, 0)
+       ATTRIB(XonoticPicker, alpha, float, 1)
+       ATTRIB(XonoticPicker, disabledAlpha, float, SKINALPHA_DISABLED)
+
+       ATTRIB(XonoticPicker, rows, float, 3)
+       ATTRIB(XonoticPicker, columns, float, 2)
+
+       METHOD(XonoticPicker, moveFocus, void(entity, vector, vector))
+       METHOD(XonoticPicker, cellSelect, void(entity, vector))
+       METHOD(XonoticPicker, cellDraw, void(entity, vector, vector))
+       METHOD(XonoticPicker, cellIsValid, bool(entity, vector))
+       ATTRIB(XonoticPicker, realCellSize, vector, '0 0 0')
+       ATTRIB(XonoticPicker, selectedCell, vector, '-1 -1 0')
+       ATTRIB(XonoticPicker, focusedCell, vector, '-1 -1 0')
+       ATTRIB(XonoticPicker, focusedCellAlpha, float, 0)
+       ATTRIB(XonoticPicker, focusedCellTime, float, 0)
+       ATTRIB(XonoticPicker, pressedCell, vector, '-1 -1 0')
+ENDCLASS(XonoticPicker)
+entity makeXonoticPicker();
+#endif
+
+#ifdef IMPLEMENTATION
+
+entity makeXonoticPicker()
+{
+       entity me;
+       me = NEW(XonoticPicker);
+       me.configureXonoticPicker(me);
+       return me;
+}
+
+void XonoticPicker_configureXonoticPicker(entity me)
+{
+       me.realCellSize = eX / me.columns + eY / me.rows;
+}
+
+float XonoticPicker_mouseMove(entity me, vector coords)
+{
+       vector prevFocusedCell = me.focusedCell;
+       me.focusedCell_x = floor(coords.x * me.columns);
+       me.focusedCell_y = floor(coords.y * me.rows);
+
+       if(me.focusedCell.x < 0 || me.focusedCell.y < 0 ||
+          me.focusedCell.x >= me.columns || me.focusedCell.y >= me.rows)
+       {
+               me.focusedCell = '-1 -1 0';
+               return 0;
+       }
+
+       if(me.focusedCell != prevFocusedCell)
+               me.focusedCellAlpha = SKINALPHA_LISTBOX_FOCUSED;
+
+       return 1;
+}
+
+float XonoticPicker_mouseDrag(entity me, vector coords)
+{
+       return me.mouseMove(me, coords);
+}
+
+float XonoticPicker_mousePress(entity me, vector coords)
+{
+       me.mouseMove(me, coords);
+
+       if(me.focusedCell.x >= 0)
+       {
+               me.pressed = 1;
+               me.pressedCell = me.focusedCell;
+       }
+
+       return 1;
+}
+
+float XonoticPicker_mouseRelease(entity me, vector coords)
+{
+       if(!me.pressed)
+               return 0;
+
+       me.mouseMove(me, coords);
+
+       if(me.focusedCell == me.pressedCell)
+               me.cellSelect(me, me.focusedCell);
+
+       me.pressed = 0;
+       return 1;
+}
+
+float XonoticPicker_keyDown(entity me, float key, float ascii, float shift)
+{
+       switch(key)
+       {
+               case K_END:
+               case K_KP_END:
+                       // lower left cell then left arrow to select the last valid cell
+                       me.focusedCell = eY * (me.rows - 1);
+               case K_LEFTARROW:
+               case K_KP_LEFTARROW:
+                       me.moveFocus(me, me.focusedCell, '-1 0 0');
+                       return 1;
+               case K_HOME:
+               case K_KP_HOME:
+                       // upper right cell then right arrow to select the first valid cell
+                       me.focusedCell = eX * (me.columns - 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_ENTER:
+               case K_KP_ENTER:
+               case K_INS:
+               case K_KP_INS:
+                       me.cellSelect(me, me.focusedCell);
+                       return 1;
+       }
+       return 0;
+}
+
+void XonoticPicker_moveFocus(entity me, vector initialCell, vector step)
+{
+       me.focusedCell_x = mod(me.focusedCell.x + step.x + me.columns, me.columns);
+       me.focusedCell_y = mod(me.focusedCell.y + step.y + me.rows, me.rows);
+
+       if(me.focusedCell != initialCell) // Recursion break
+               if(!me.cellIsValid(me, me.focusedCell))
+                       me.moveFocus(me, initialCell, step);
+
+       me.focusedCellAlpha = SKINALPHA_LISTBOX_FOCUSED;
+}
+
+void XonoticPicker_cellSelect(entity me, vector cell)
+{
+       me.selectedCell = cell;
+}
+
+bool XonoticPicker_cellIsValid(entity me, vector cell)
+{
+       return true;
+}
+
+void XonoticPicker_cellDraw(entity me, vector cell, vector cellPos)
+{
+}
+
+void XonoticPicker_draw(entity me)
+{
+       float save;
+
+       me.focusable = !me.disabled;
+
+       save = draw_alpha;
+       if(me.disabled)
+               draw_alpha *= me.disabledAlpha;
+
+       vector cell, cellPos;
+       cell = '0 0 0';
+       cellPos = '0 0 0';
+
+       for(cell_y = 0; cell.y < me.rows; ++cell.y)
+       {
+               cellPos_y = mod(cell.y, me.rows) / me.rows;
+               for(cell_x = 0; cell.x < me.columns; ++cell.x)
+               {
+                       if(!me.cellIsValid(me, cell))
+                               continue;
+
+                       cellPos_x = mod(cell.x, me.columns) / me.columns;
+
+                       if(cell == me.selectedCell)
+                               draw_Fill(cellPos, me.realCellSize, SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+                       else if(cell == me.focusedCell && me.focused)
+                       {
+                               if(!me.pressed || me.focusedCell == me.pressedCell)
+                               {
+                                       me.focusedCellAlpha = getFadedAlpha(me.focusedCellAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+                                       draw_Fill(cellPos, me.realCellSize, SKINCOLOR_LISTBOX_FOCUSED, me.focusedCellAlpha);
+                               }
+                       }
+
+                       me.cellDraw(me, cell, cellPos);
+               }
+       }
+
+       draw_alpha = save;
+
+       SUPER(XonoticPicker).draw(me);
+}
+#endif
index 437206b881352bbd59cff5caade6eade963125a8..db3ac8a207aae1b99524a3cc11c1aa40adfed1f1 100644 (file)
@@ -4,7 +4,7 @@
 CLASS(XonoticPlayerList, XonoticListBox)
        ATTRIB(XonoticPlayerList, rowsPerItem, float, 1)
        METHOD(XonoticPlayerList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticPlayerList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticPlayerList, drawListBoxItem, void(entity, int, vector, bool, bool))
        ATTRIB(XonoticPlayerList, allowFocusSound, float, 0)
        ATTRIB(XonoticPlayerList, realFontSize, vector, '0 0 0')
        ATTRIB(XonoticPlayerList, columnNameOrigin, float, 0)
@@ -94,7 +94,7 @@ void XonoticPlayerList_resizeNotify(entity me, vector relOrigin, vector relSize,
        me.columnScoreOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize.x;
 }
 
-void XonoticPlayerList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticPlayerList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s;
        string score;
index e912f8f081a4c2e3b45e7b0a6ff653c02c1a6ae4..5dd7b6b926d0862185524f522bd12a7513939562 100644 (file)
@@ -6,7 +6,7 @@ CLASS(XonoticPlayList, XonoticListBox)
        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, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticPlayList, stopSound, void(entity))
        METHOD(XonoticPlayList, startSound, void(entity, float))
        METHOD(XonoticPlayList, resumeSound, void(entity))
@@ -172,11 +172,16 @@ void XonoticPlayList_draw(entity me)
        SUPER(XonoticPlayList).draw(me);
 }
 
-void XonoticPlayList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticPlayList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s;
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(isFocused)
+       {
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+       }
 
        if(i == me.playingTrack)
        {
index 650b3381fd5defa893145a8841184b570bc0eeee..d6fcaf86e3d0d97b0494e823ac311df0fb2183af 100644 (file)
@@ -7,7 +7,7 @@ CLASS(XonoticScreenshotList, XonoticListBox)
        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, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticScreenshotList, getScreenshots, void(entity))
        METHOD(XonoticScreenshotList, previewScreenshot, void(entity))
        METHOD(XonoticScreenshotList, startScreenshot, void(entity))
@@ -167,11 +167,16 @@ void XonoticScreenshotList_setSelected(entity me, float i)
        }
 }
 
-void XonoticScreenshotList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticScreenshotList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s;
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(isFocused)
+       {
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+       }
 
        s = me.screenshotName(me,i);
        s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
index 3f9648be66566f57ca681862ae82e1f9d4aa4ea5..8bf70cc33307d06fe1ae5130649d602a8ef164fc 100644 (file)
@@ -5,7 +5,7 @@ CLASS(XonoticServerList, 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, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticServerList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticServerList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticServerList, keyDown, float(entity, float, float, float))
@@ -963,7 +963,7 @@ void XonoticServerList_doubleClickListBoxItem(entity me, int i, vector where)
 {
        ServerList_Connect_Click(NULL, me);
 }
-void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected)
+void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        // layout: Ping, Server name, Map name, NP, TP, MP
        float p;
@@ -1019,6 +1019,11 @@ void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool is
 
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(isFocused)
+       {
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+       }
 
        s = gethostcachestring(SLIST_FIELD_QCSTATUS, i);
        m = tokenizebyseparator(s, ":");
index 936ca7baf1125253a3698b784b2fc433721a30d0..46babc3f9517f5c9ae63c390e68e9d4bfdaa0960 100644 (file)
@@ -5,7 +5,7 @@ CLASS(XonoticSkinList, 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, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticSkinList, getSkins, void(entity))
        METHOD(XonoticSkinList, setSkin, void(entity))
        METHOD(XonoticSkinList, loadCvars, void(entity))
@@ -151,12 +151,17 @@ void XonoticSkinList_resizeNotify(entity me, vector relOrigin, vector relSize, v
        me.columnNameSize = 1 - me.columnPreviewSize - 2 * me.realFontSize.x;
 }
 
-void XonoticSkinList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticSkinList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s;
 
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(isFocused)
+       {
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+       }
 
        s = me.skinParameter(me, i, SKINPARM_PREVIEW);
        draw_Picture(me.columnPreviewOrigin * eX, s, me.columnPreviewSize * eX + eY, '1 1 1', 1);
index bba66d19d16a651f50ceb5be5ac5a4fd441e67c3..2b98c5fe52296a8f287c4294a3766019487262ea 100644 (file)
@@ -5,7 +5,7 @@ CLASS(XonoticSoundList, 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, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticSoundList, getSounds, void(entity))
        METHOD(XonoticSoundList, soundName, string(entity, float))
        METHOD(XonoticSoundList, doubleClickListBoxItem, void(entity, float, vector))
@@ -103,11 +103,16 @@ void XonoticSoundList_resizeNotify(entity me, vector relOrigin, vector relSize,
        me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize.x;
 }
 
-void XonoticSoundList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticSoundList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s;
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(isFocused)
+       {
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+       }
 
        s = me.soundName(me,i);
        if(s == cvar_string("menu_cdtrack")) // current menu track
index 1cf4a688e0b82e5ba4487bc1dc85301dfdaa9e1d..d9a22ec6e78f1a8e71aeadf9d3824f44069664c1 100644 (file)
@@ -8,7 +8,7 @@ CLASS(XonoticStatsList, 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, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticStatsList, getStats, void(entity))
        METHOD(XonoticStatsList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticStatsList, keyDown, float(entity, float, float, float))
@@ -315,10 +315,15 @@ void XonoticStatsList_resizeNotify(entity me, vector relOrigin, vector relSize,
 #endif
 }
 
-void XonoticStatsList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticStatsList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(isFocused)
+       {
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+       }
 
        string data = bufstr_get(me.listStats, i);
        string s = car(data);
index a90e2765299676d1d3724e441c512fbf9ab3ec63..0383c7aae6fd53483ebb677486efceab44584b6f 100644 (file)
@@ -17,7 +17,6 @@ CLASS(XonoticTab, Tab)
        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)
index 444292712d1a968861d673f960441bd8d7d48347..216b57585e48a4a77acf560158c59c3db09a49c7 100644 (file)
@@ -797,6 +797,15 @@ void dialog_hudpanel_common_notoggle(entity me, string panelname)
                                e.configureXonoticTextSliderValues(e);
 }
 
+float getFadedAlpha(float currentAlpha, float startAlpha, float targetAlpha)
+{
+       if(startAlpha < targetAlpha)
+               currentAlpha = min(currentAlpha + frametime * 0.5, targetAlpha);
+       else
+               currentAlpha = max(currentAlpha - frametime * 0.5, targetAlpha);
+       return currentAlpha;
+}
+
 void CheckSendCvars(entity me, string cvarnamestring)
 {
        if(me.sendCvars)
index 80803f8544df735f4363112b466441da3ad34f35..2564a86ed4b724f69640797542b083109d1fd4c5 100644 (file)
@@ -48,6 +48,8 @@ void dialog_hudpanel_common_notoggle(entity me, string panelname);
                me.TD(me, 1, 4, e = makeXonoticCheckBox(0, strzone(strcat("hud_panel_", panelname)), _("Enable panel"))); \
        DIALOG_HUDPANEL_COMMON_NOTOGGLE()
 
+float getFadedAlpha(float currentAlpha, float startAlpha, float targetAlpha);
+
 string _Nex_ExtResponseSystem_BannedServers;
 float _Nex_ExtResponseSystem_BannedServersNeedsRefresh;
 string _Nex_ExtResponseSystem_PromotedServers;
index 622505af838703e637330daa709687d61d073352..adc7fc2115bb4634dbae79b6fab9236d286fa05b 100644 (file)
@@ -6,7 +6,7 @@ CLASS(XonoticWeaponsList, XonoticListBox)
        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, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticWeaponsList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticWeaponsList, keyDown, float(entity, float, float, float))
        ATTRIB(XonoticWeaponsList, realFontSize, vector, '0 0 0')
@@ -92,11 +92,16 @@ string XonoticWeaponsList_toString(entity me)
        }
        return substring(s, 0, strlen(s) - 2);
 }
-void XonoticWeaponsList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticWeaponsList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        entity e;
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(isFocused)
+       {
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+       }
        e = get_weaponinfo(stof(argv(i)));
        string msg = e.message;
        if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
index 6438a1094a6c573f684c1f09531389b304313ea9..a331362151dbd72144862b807241d731babf0584 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef SERVER___H
-#define SERVER___H
+#ifndef SERVER_ALL_H
+#define SERVER_ALL_H
 
 #include "autocvars.qh"
 #include "constants.qh"
index f84eb008b2a7aef5f6ba26a84d6c9218fca563ed..e6bc6202e0981b75b127c4412b976d413c8b2cea 100644 (file)
@@ -585,20 +585,8 @@ float autocvar_skill_auto;
 float autocvar_snd_soundradius;
 int autocvar_spawn_debug;
 bool autocvar_speedmeter;
-float autocvar_sv_accelerate;
 float autocvar_sv_accuracy_data_share = 1;
 string autocvar_sv_adminnick;
-float autocvar_sv_airaccel_qw;
-float autocvar_sv_airaccel_qw_stretchfactor;
-float autocvar_sv_airaccel_sideways_friction;
-float autocvar_sv_airaccelerate;
-float autocvar_sv_aircontrol;
-float autocvar_sv_aircontrol_penalty;
-float autocvar_sv_aircontrol_power;
-float autocvar_sv_airspeedlimit_nonqw;
-float autocvar_sv_airstopaccelerate;
-float autocvar_sv_airstrafeaccel_qw;
-float autocvar_sv_airstrafeaccelerate;
 bool autocvar_sv_autoscreenshot;
 int autocvar_sv_cheats;
 float autocvar_sv_clientcommand_antispam_time;
@@ -632,7 +620,6 @@ int autocvar_sv_eventlog_files_counter;
 string autocvar_sv_eventlog_files_nameprefix;
 string autocvar_sv_eventlog_files_namesuffix;
 bool autocvar_sv_eventlog_files_timestamps;
-float autocvar_sv_friction;
 float autocvar_sv_friction_on_land;
 float autocvar_sv_gameplayfix_q2airaccelerate;
 int autocvar_sv_gentle;
@@ -648,7 +635,6 @@ bool autocvar_sv_logscores_file;
 string autocvar_sv_logscores_filename;
 float autocvar_sv_mapchange_delay;
 float autocvar_sv_maxairspeed;
-float autocvar_sv_maxairstrafespeed;
 float autocvar_sv_maxspeed;
 string autocvar_sv_motd;
 bool autocvar_sv_precacheplayermodels;
@@ -662,7 +648,6 @@ int autocvar_sv_spectate;
 float autocvar_sv_spectator_speed_multiplier;
 bool autocvar_sv_status_privacy;
 float autocvar_sv_stepheight;
-float autocvar_sv_stopspeed;
 float autocvar_sv_strengthsound_antispam_refire_threshold;
 float autocvar_sv_strengthsound_antispam_time;
 bool autocvar_sv_teamnagger;
@@ -696,11 +681,6 @@ float autocvar_sv_vote_stop;
 float autocvar_sv_vote_timeout;
 float autocvar_sv_vote_wait;
 bool autocvar_sv_vote_gamestart;
-float autocvar_sv_warsowbunny_accel;
-float autocvar_sv_warsowbunny_airforwardaccel;
-float autocvar_sv_warsowbunny_backtosideratio;
-float autocvar_sv_warsowbunny_topspeed;
-float autocvar_sv_warsowbunny_turnaccel;
 float autocvar_sv_waypointsprite_deadlifetime;
 float autocvar_sv_waypointsprite_deployed_lifetime;
 float autocvar_sv_waypointsprite_limitedrange;
@@ -854,6 +834,9 @@ float autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
 float autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
 int autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health;
 bool autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath;
+bool autocvar_g_physics_clientselect;
+string autocvar_g_physics_clientselect_options;
+string autocvar_g_physics_clientselect_default;
 float autocvar_g_buffs_waypoint_distance;
 bool autocvar_g_buffs_randomize;
 float autocvar_g_buffs_random_lifetime;
@@ -883,4 +866,5 @@ 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 1879b186047181f39f509e7dc059d9fdd7e706f1..e42a50f6d4a9ccb8abad44d3b3db2511a13a06a6 100644 (file)
@@ -27,7 +27,7 @@
 #include "../../common/teams.qh"
 #include "../../common/util.qh"
 
-#include "../../common/weapons/weapons.qh"
+#include "../../common/weapons/all.qh"
 
 #include "../../csqcmodellib/sv_model.qh"
 
index 75a93d267d6b05fe5026f46a28f10913874fd055..d9eb75915072bdd8d118d4dafb51804f1aba98c2 100644 (file)
@@ -13,9 +13,9 @@
 #include "../common/deathtypes.qh"
 #include "../common/util.qh"
 
-#include "../common/monsters/monsters.qh"
+#include "../common/monsters/all.qh"
 
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 
 #include "../csqcmodellib/sv_model.qh"
 
index 259b7e260c3d2025707bb6e83f5964fda5cac480..b73eebbf4a021b95d270a97fb81ae62586d44287 100644 (file)
@@ -35,6 +35,8 @@
 
 #include "../common/net_notice.qh"
 
+#include "../common/items/inventory.qh"
+
 #include "../common/monsters/sv_monsters.qh"
 
 #include "../warpzonelib/server.qh"
@@ -1096,6 +1098,7 @@ void ClientConnect (void)
        PlayerScore_Attach(self);
        ClientData_Attach();
        accuracy_init(self);
+       Inventory_new(self);
 
        bot_clientconnect();
 
@@ -1338,6 +1341,7 @@ void ClientDisconnect (void)
        bot_relinkplayerlist();
 
        accuracy_free(self);
+       Inventory_delete(self);
        ClientData_Detach();
        PlayerScore_Detach(self);
 
index a02cf40acab473d57b6854da0d29f7e72f0bf1dd..bb4c171c87272a7ce10cba28b78a3654b17e01fc 100644 (file)
@@ -13,7 +13,7 @@
 #include "vehicles/vehicle.qh"
 #include "waypointsprites.qh"
 
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 
 /*
  * Impulse map:
index bbb730d3109ea9d14c1e8df01ea97a41a4603948..8bc8660dce3e1d5aab5c5fd4c54991d85ea37f95 100644 (file)
@@ -13,7 +13,7 @@
     #include "../common/util.qh"
     #include "../common/animdecide.qh"
     #include "../common/monsters/sv_monsters.qh"
-    #include "../common/weapons/weapons.qh"
+    #include "../common/weapons/all.qh"
     #include "t_items.qh"
     #include "autocvars.qh"
     #include "defs.qh"
 .float wasFlying;
 .float spectatorspeed;
 
+// client side physics
+bool Physics_Valid(string thecvar)
+{
+       if(!autocvar_g_physics_clientselect) { return false; }
+
+       string l = strcat(" ", autocvar_g_physics_clientselect_options, " ");
+
+       if(strstrofs(l, strcat(" ", thecvar, " "), 0) >= 0)
+               return true;
+
+       return false;
+}
+
+float Physics_ClientOption(entity pl, string option)
+{
+       if(Physics_Valid(pl.cvar_cl_physics))
+       {
+               string var = sprintf("g_physics_%s_%s", pl.cvar_cl_physics, option);
+               if(cvar_type(var) & CVAR_TYPEFLAG_EXISTS)
+                       return cvar(var);
+       }
+       if(autocvar_g_physics_clientselect && autocvar_g_physics_clientselect_default)
+       {
+               string var = sprintf("g_physics_%s_%s", autocvar_g_physics_clientselect_default, option);
+               if(cvar_type(var) & CVAR_TYPEFLAG_EXISTS)
+                       return cvar(var);
+       }
+       return cvar(strcat("sv_", option));
+}
+
 /*
 =============
 PlayerJump
@@ -56,8 +86,8 @@ float PlayerJump (void)
        if(self.player_blocked)
                return true; // no jumping while blocked
 
-       float doublejump = false;
-       float mjumpheight = autocvar_sv_jumpvelocity;
+       bool doublejump = false;
+       float mjumpheight = self.stat_sv_jumpvelocity;
 
        player_multijump = doublejump;
        player_jumpheight = mjumpheight;
@@ -497,7 +527,7 @@ void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
                return;
 #endif
 
-       k *= bound(0, wishspeed / autocvar_sv_maxairspeed, 1);
+       k *= bound(0, wishspeed / self.stat_sv_maxairspeed, 1);
 
        zspeed = self.velocity.z;
        self.velocity_z = 0;
@@ -507,9 +537,9 @@ void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
 
        if(dot > 0) // we can't change direction while slowing down
        {
-               k *= pow(dot, autocvar_sv_aircontrol_power)*frametime;
-               xyspeed = max(0, xyspeed - autocvar_sv_aircontrol_penalty * sqrt(max(0, 1 - dot*dot)) * k/32);
-               k *= autocvar_sv_aircontrol;
+               k *= pow(dot, self.stat_sv_aircontrol_power)*frametime;
+               xyspeed = max(0, xyspeed - self.stat_sv_aircontrol_penalty * sqrt(max(0, 1 - dot*dot)) * k/32);
+               k *= self.stat_sv_aircontrol;
                self.velocity = normalize(self.velocity * xyspeed + wishdir * k);
        }
 
@@ -619,26 +649,26 @@ void PM_AirAccelerate(vector wishdir, float wishspeed)
 
        if(wishspeed > curspeed * 1.01)
        {
-               wishspeed = min(wishspeed, curspeed + autocvar_sv_warsowbunny_airforwardaccel * self.stat_sv_maxspeed * frametime);
+               wishspeed = min(wishspeed, curspeed + self.stat_sv_warsowbunny_airforwardaccel * self.stat_sv_maxspeed * frametime);
        }
        else
        {
-               f = max(0, (autocvar_sv_warsowbunny_topspeed - curspeed) / (autocvar_sv_warsowbunny_topspeed - self.stat_sv_maxspeed));
-               wishspeed = max(curspeed, self.stat_sv_maxspeed) + autocvar_sv_warsowbunny_accel * f * self.stat_sv_maxspeed * frametime;
+               f = max(0, (self.stat_sv_warsowbunny_topspeed - curspeed) / (self.stat_sv_warsowbunny_topspeed - self.stat_sv_maxspeed));
+               wishspeed = max(curspeed, self.stat_sv_maxspeed) + self.stat_sv_warsowbunny_accel * f * self.stat_sv_maxspeed * frametime;
        }
        wishvel = wishdir * wishspeed;
        acceldir = wishvel - curvel;
        addspeed = vlen(acceldir);
        acceldir = normalize(acceldir);
 
-       accelspeed = min(addspeed, autocvar_sv_warsowbunny_turnaccel * self.stat_sv_maxspeed * frametime);
+       accelspeed = min(addspeed, self.stat_sv_warsowbunny_turnaccel * self.stat_sv_maxspeed * frametime);
 
-       if(autocvar_sv_warsowbunny_backtosideratio < 1)
+       if(self.stat_sv_warsowbunny_backtosideratio < 1)
        {
                curdir = normalize(curvel);
                dot = acceldir * curdir;
                if(dot < 0)
-                       acceldir = acceldir - (1 - autocvar_sv_warsowbunny_backtosideratio) * dot * curdir;
+                       acceldir = acceldir - (1 - self.stat_sv_warsowbunny_backtosideratio) * dot * curdir;
        }
 
        self.velocity += accelspeed * acceldir;
@@ -686,13 +716,34 @@ void SV_PlayerPhysics()
 
        // fix physics stats for g_movement_highspeed
        // TODO maybe rather use maxairspeed? needs testing
-       self.stat_sv_airaccel_qw = AdjustAirAccelQW(autocvar_sv_airaccel_qw, maxspd_mod);
-       if(autocvar_sv_airstrafeaccel_qw)
-               self.stat_sv_airstrafeaccel_qw = AdjustAirAccelQW(autocvar_sv_airstrafeaccel_qw, maxspd_mod);
+       self.stat_sv_airaccel_qw = AdjustAirAccelQW(Physics_ClientOption(self, "airaccel_qw"), maxspd_mod);
+       if(Physics_ClientOption(self, "airstrafeaccel_qw"))
+               self.stat_sv_airstrafeaccel_qw = AdjustAirAccelQW(Physics_ClientOption(self, "airstrafeaccel_qw"), maxspd_mod);
        else
                self.stat_sv_airstrafeaccel_qw = 0;
-       self.stat_sv_airspeedlimit_nonqw = autocvar_sv_airspeedlimit_nonqw * maxspd_mod;
-       self.stat_sv_maxspeed = autocvar_sv_maxspeed * maxspd_mod; // also slow walking
+       self.stat_sv_airspeedlimit_nonqw = Physics_ClientOption(self, "airspeedlimit_nonqw") * maxspd_mod;
+       self.stat_sv_maxspeed = Physics_ClientOption(self, "maxspeed") * maxspd_mod; // also slow walking
+       
+       // fix some new settings
+       self.stat_sv_airaccel_qw_stretchfactor = Physics_ClientOption(self, "airaccel_qw_stretchfactor");
+       self.stat_sv_maxairstrafespeed = Physics_ClientOption(self, "maxairstrafespeed");
+       self.stat_sv_maxairspeed = Physics_ClientOption(self, "maxairspeed");
+       self.stat_sv_airstrafeaccelerate = Physics_ClientOption(self, "airstrafeaccelerate");
+       self.stat_sv_warsowbunny_turnaccel = Physics_ClientOption(self, "warsowbunny_turnaccel");
+       self.stat_sv_airaccel_sideways_friction = Physics_ClientOption(self, "airaccel_sideways_friction");
+       self.stat_sv_aircontrol = Physics_ClientOption(self, "aircontrol");
+       self.stat_sv_aircontrol_power = Physics_ClientOption(self, "aircontrol_power");
+       self.stat_sv_aircontrol_penalty = Physics_ClientOption(self, "aircontrol_penalty");
+       self.stat_sv_warsowbunny_airforwardaccel = Physics_ClientOption(self, "warsowbunny_airforwardaccel");
+       self.stat_sv_warsowbunny_topspeed = Physics_ClientOption(self, "warsowbunny_topspeed");
+       self.stat_sv_warsowbunny_accel = Physics_ClientOption(self, "warsowbunny_accel");
+       self.stat_sv_warsowbunny_backtosideratio = Physics_ClientOption(self, "warsowbunny_backtosideratio");
+       self.stat_sv_friction = Physics_ClientOption(self, "friction");
+       self.stat_sv_accelerate = Physics_ClientOption(self, "accelerate");
+       self.stat_sv_stopspeed = Physics_ClientOption(self, "stopspeed");
+       self.stat_sv_airaccelerate = Physics_ClientOption(self, "airaccelerate");
+       self.stat_sv_airstopaccelerate = Physics_ClientOption(self, "airstopaccelerate");
+       self.stat_sv_jumpvelocity = Physics_ClientOption(self, "jumpvelocity");
 
     if(self.PlayerPhysplug)
         if(self.PlayerPhysplug())
@@ -893,7 +944,7 @@ void SV_PlayerPhysics()
                maxspd_mod = self.spectatorspeed;
        }
 
-       spd = max(self.stat_sv_maxspeed, autocvar_sv_maxairspeed) * maxspd_mod * swampspd_mod;
+       spd = max(self.stat_sv_maxspeed, self.stat_sv_maxairspeed) * maxspd_mod * swampspd_mod;
        if(self.speed != spd)
        {
                self.speed = spd;
@@ -966,7 +1017,7 @@ void SV_PlayerPhysics()
                // noclipping or flying
                self.flags &= ~FL_ONGROUND;
 
-               self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction);
+               self.velocity = self.velocity * (1 - frametime * self.stat_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;
@@ -976,7 +1027,7 @@ void SV_PlayerPhysics()
                if (wishspeed > self.stat_sv_maxspeed*maxspd_mod)
                        wishspeed = self.stat_sv_maxspeed*maxspd_mod;
                if (time >= self.teleport_time)
-                       PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0, 0);
+                       PM_Accelerate(wishdir, wishspeed, wishspeed, self.stat_sv_accelerate*maxspd_mod, 1, 0, 0, 0);
        }
        else if (self.waterlevel >= WATERLEVEL_SWIMMING)
        {
@@ -996,10 +1047,10 @@ void SV_PlayerPhysics()
                wishspeed = wishspeed * 0.7;
 
                // water friction
-               self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction);
+               self.velocity = self.velocity * (1 - frametime * self.stat_sv_friction);
 
                // water acceleration
-               PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0, 0);
+               PM_Accelerate(wishdir, wishspeed, wishspeed, self.stat_sv_accelerate*maxspd_mod, 1, 0, 0, 0);
        }
        else if (time < self.ladder_time)
        {
@@ -1016,7 +1067,7 @@ void SV_PlayerPhysics()
                        self.velocity_z += g;
                }
 
-               self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction);
+               self.velocity = self.velocity * (1 - frametime * self.stat_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;
@@ -1049,7 +1100,7 @@ void SV_PlayerPhysics()
                if (time >= self.teleport_time)
                {
                        // water acceleration
-                       PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0, 0);
+                       PM_Accelerate(wishdir, wishspeed, wishspeed, self.stat_sv_accelerate*maxspd_mod, 1, 0, 0, 0);
                }
        }
        else if (self.items & IT_USING_JETPACK)
@@ -1058,7 +1109,7 @@ void SV_PlayerPhysics()
                makevectors(self.v_angle);
                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);
+               maxairspd = self.stat_sv_maxairspeed*max(1, maxspd_mod);
                // fix speedhacks :P
                wishvel = normalize(wishvel) * min(vlen(wishvel) / maxairspd, 1);
                // add the unused velocity as up component
@@ -1176,10 +1227,10 @@ void SV_PlayerPhysics()
                f = vlen(v);
                if(f > 0)
                {
-                       if (f < autocvar_sv_stopspeed)
-                               f = 1 - frametime * (autocvar_sv_stopspeed / f) * autocvar_sv_friction;
+                       if (f < self.stat_sv_stopspeed)
+                               f = 1 - frametime * (self.stat_sv_stopspeed / f) * self.stat_sv_friction;
                        else
-                               f = 1 - frametime * autocvar_sv_friction;
+                               f = 1 - frametime * self.stat_sv_friction;
                        if (f > 0)
                                self.velocity = self.velocity * f;
                        else
@@ -1216,7 +1267,7 @@ void SV_PlayerPhysics()
                if (self.crouch)
                        wishspeed = wishspeed * 0.5;
                if (time >= self.teleport_time)
-                       PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0, 0);
+                       PM_Accelerate(wishdir, wishspeed, wishspeed, self.stat_sv_accelerate*maxspd_mod, 1, 0, 0, 0);
        }
        else
        {
@@ -1227,13 +1278,13 @@ void SV_PlayerPhysics()
 
                if(maxspd_mod < 1)
                {
-                       maxairspd = autocvar_sv_maxairspeed*maxspd_mod;
-                       airaccel = autocvar_sv_airaccelerate*maxspd_mod;
+                       maxairspd = self.stat_sv_maxairspeed*maxspd_mod;
+                       airaccel = self.stat_sv_airaccelerate*maxspd_mod;
                }
                else
                {
-                       maxairspd = autocvar_sv_maxairspeed;
-                       airaccel = autocvar_sv_airaccelerate;
+                       maxairspd = self.stat_sv_maxairspeed;
+                       airaccel = self.stat_sv_airaccelerate;
                }
                // airborn
                makevectors(self.v_angle.y * '0 1 0');
@@ -1259,13 +1310,13 @@ void SV_PlayerPhysics()
                        wishspeed2 = wishspeed;
 
                        // CPM
-                       if(autocvar_sv_airstopaccelerate)
+                       if(self.stat_sv_airstopaccelerate)
                        {
                                vector curdir;
                                curdir = self.velocity;
                                curdir.z = 0;
                                curdir = normalize(curdir);
-                               airaccel = airaccel + (autocvar_sv_airstopaccelerate*maxspd_mod - airaccel) * max(0, -(curdir * wishdir));
+                               airaccel = airaccel + (self.stat_sv_airstopaccelerate*maxspd_mod - airaccel) * max(0, -(curdir * wishdir));
                        }
                        // note that for straight forward jumping:
                        // step = accel * frametime * wishspeed0;
@@ -1276,20 +1327,20 @@ void SV_PlayerPhysics()
                        // log dv/dt = logaccel + logmaxspeed (when slow)
                        // log dv/dt = logaccel + logmaxspeed + log(1 - accelqw) (when fast)
                        strafity = IsMoveInDirection(self.movement, -90) + IsMoveInDirection(self.movement, +90); // if one is nonzero, other is always zero
-                       if(autocvar_sv_maxairstrafespeed)
-                               wishspeed = min(wishspeed, GeomLerp(autocvar_sv_maxairspeed*maxspd_mod, strafity, autocvar_sv_maxairstrafespeed*maxspd_mod));
-                       if(autocvar_sv_airstrafeaccelerate)
-                               airaccel = GeomLerp(airaccel, strafity, autocvar_sv_airstrafeaccelerate*maxspd_mod);
+                       if(self.stat_sv_maxairstrafespeed)
+                               wishspeed = min(wishspeed, GeomLerp(self.stat_sv_maxairspeed*maxspd_mod, strafity, self.stat_sv_maxairstrafespeed*maxspd_mod));
+                       if(self.stat_sv_airstrafeaccelerate)
+                               airaccel = GeomLerp(airaccel, strafity, self.stat_sv_airstrafeaccelerate*maxspd_mod);
                        if(self.stat_sv_airstrafeaccel_qw)
                                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(self.stat_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);
+                               PM_Accelerate(wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, self.stat_sv_airaccel_qw_stretchfactor, self.stat_sv_airaccel_sideways_friction / maxairspd, self.stat_sv_airspeedlimit_nonqw);
 
-                       if(autocvar_sv_aircontrol)
+                       if(self.stat_sv_aircontrol)
                                CPM_PM_Aircontrol(wishdir, wishspeed2);
                }
        }
diff --git a/qcsrc/server/command/all.qc b/qcsrc/server/command/all.qc
new file mode 100644 (file)
index 0000000..ac37b6b
--- /dev/null
@@ -0,0 +1,10 @@
+#include "../../common/command/all.qc"
+
+#include "sv_cmd.qc"
+
+#include "banning.qc"
+#include "cmd.qc"
+#include "common.qc"
+#include "getreplies.qc"
+#include "radarmap.qc"
+#include "vote.qc"
diff --git a/qcsrc/server/command/all.qh b/qcsrc/server/command/all.qh
new file mode 100644 (file)
index 0000000..af87c24
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef SERVER_COMMANDS_ALL_H
+#define SERVER_COMMANDS_ALL_H
+
+#include "../../common/command/commands.qh"
+
+#include "sv_cmd.qh"
+
+#include "banning.qh"
+#include "cmd.qh"
+#include "common.qh"
+#include "getreplies.qh"
+#include "radarmap.qh"
+#include "vote.qh"
+
+#endif
index d9eeea19eb6c76a2262d7243e29452e1a616f5e9..beb04103628d7e52e3a0b5890e7d5fb9772fb6cb 100644 (file)
@@ -27,7 +27,7 @@
 #include "../../common/teams.qh"
 #include "../../common/util.qh"
 
-#include "../../common/monsters/monsters.qh"
+#include "../../common/monsters/all.qh"
 #include "../../common/monsters/spawn.qh"
 #include "../../common/monsters/sv_monsters.qh"
 
@@ -378,6 +378,46 @@ void ClientCommand_mobspawn(float request, float argc)
        }
 }
 
+void ClientCommand_physics(float request, float argc)
+{
+       switch(request)
+       {
+               case CMD_REQUEST_COMMAND:
+               {
+                       string command = strtolower(argv(1));
+                       
+                       if(!autocvar_g_physics_clientselect)
+                       {
+                               sprint(self, "Client physics selection is currently disabled.\n");
+                               return;
+                       }
+
+                       if(command == "list" || command == "help")
+                       {
+                               sprint(self, strcat("Available physics sets: \n\n", autocvar_g_physics_clientselect_options, " default\n"));
+                               return;
+                       }
+                       
+                       if(Physics_Valid(command) || command == "default")
+                       {
+                               stuffcmd(self, strcat("\nseta cl_physics ", command, "\nsendcvar cl_physics\n"));
+                               sprint(self, strcat("^2Physics set successfully changed to ^3", command, "\n"));
+                               return;
+                       }
+               }
+       
+               default:
+                       sprint(self, strcat("Current physics set: ^3", self.cvar_cl_physics, "\n"));
+               case CMD_REQUEST_USAGE:
+               {
+                       sprint(self, "\nUsage:^3 cmd physics <physics>\n");
+                       sprint(self, "  See 'cmd physics list' for available physics sets.\n");
+                       sprint(self, "  Argument 'default' resets to standard physics.\n");
+                       return;
+               }
+       }
+}
+
 void ClientCommand_ready(float request) // todo: anti-spam for toggling readyness
 {
        switch(request)
@@ -770,6 +810,7 @@ void ClientCommand_(float request)
        CLIENT_COMMAND("mobedit", ClientCommand_mobedit(request, arguments), "Edit your monster's properties") \
        CLIENT_COMMAND("mobkill", ClientCommand_mobkill(request), "Kills your monster") \
        CLIENT_COMMAND("mobspawn", ClientCommand_mobspawn(request, arguments), "Spawn monsters infront of yourself") \
+       CLIENT_COMMAND("physics", ClientCommand_physics(request, arguments), "Change physics set") \
        CLIENT_COMMAND("ready", ClientCommand_ready(request), "Qualify as ready to end warmup stage (or restart server if allowed)") \
        CLIENT_COMMAND("say", ClientCommand_say(request, arguments, command), "Print a message to chat to all players") \
        CLIENT_COMMAND("say_team", ClientCommand_say_team(request, arguments, command), "Print a message to chat to all team mates") \
diff --git a/qcsrc/server/command/commands.qc b/qcsrc/server/command/commands.qc
deleted file mode 100644 (file)
index 1db4db1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "../../common/command/commands.qc"
-
-#include "sv_cmd.qc"
-
-#include "banning.qc"
-#include "cmd.qc"
-#include "common.qc"
-#include "getreplies.qc"
-#include "radarmap.qc"
-#include "vote.qc"
diff --git a/qcsrc/server/command/commands.qh b/qcsrc/server/command/commands.qh
deleted file mode 100644 (file)
index d26468d..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef SERVER_COMMANDS_H
-#define SERVER_COMMANDS_H
-
-#include "../../common/command/commands.qh"
-
-#include "sv_cmd.qh"
-
-#include "banning.qh"
-#include "cmd.qh"
-#include "common.qh"
-#include "getreplies.qh"
-#include "radarmap.qh"
-#include "vote.qh"
-
-#endif
index 12a31ca653c368a761b9d5f1df66195fa7c3a728..543f1db1525a374a501a7e66e7cc50ed4461089c 100644 (file)
@@ -9,7 +9,7 @@
 #include "../../common/mapinfo.qh"
 #include "../../common/util.qh"
 
-#include "../../common/monsters/monsters.qh"
+#include "../../common/monsters/all.qh"
 
 // =========================================================
 //  Reply messages for common commands, re-worked by Samual
index 72263dc1e3051e913cb4c6b476add8d6bf6f3027..4be48e124e82b98d38fb26c41c5df7dfe18efc29 100644 (file)
@@ -115,6 +115,13 @@ void Nagger_ReadyCounted()
                nagger.SendFlags |= 1;
 }
 
+// If the vote_caller is still here, return their name, otherwise vote_caller_name
+string OriginalCallerName()
+{
+       if (IS_REAL_CLIENT(vote_caller))
+               return vote_caller.netname;
+       return vote_caller_name;
+}
 
 // =======================
 //  Game logic for voting
@@ -130,10 +137,12 @@ void VoteReset()
        {
                strunzone(vote_called_command);
                strunzone(vote_called_display);
+               strunzone(vote_caller_name);
        }
 
        vote_called = VOTE_NULL;
        vote_caller = world;
+       vote_caller_name = string_null;
        vote_endtime = 0;
 
        vote_called_command = string_null;
@@ -147,7 +156,7 @@ void VoteReset()
 
 void VoteStop(entity stopper)
 {
-       bprint("\{1}^2* ^3", GetCallerName(stopper), "^2 stopped ^3", GetCallerName(vote_caller), "^2's vote\n");
+       bprint("\{1}^2* ^3", GetCallerName(stopper), "^2 stopped ^3", OriginalCallerName(), "^2's vote\n");
        if(autocvar_sv_eventlog) { GameLogEcho(strcat(":vote:vstop:", ftos(stopper.playerid))); }
 
        // Don't force them to wait for next vote, this way they can e.g. correct their vote.
@@ -158,7 +167,7 @@ void VoteStop(entity stopper)
 
 void VoteAccept()
 {
-       bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2's vote for ^1", vote_called_display, "^2 was accepted\n");
+       bprint("\{1}^2* ^3", OriginalCallerName(), "^2's vote for ^1", vote_called_display, "^2 was accepted\n");
 
        if((vote_called == VOTE_MASTER) && vote_caller)
                vote_caller.vote_master = 1;
@@ -173,14 +182,14 @@ void VoteAccept()
 
 void VoteReject()
 {
-       bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2's vote for ", vote_called_display, "^2 was rejected\n");
+       bprint("\{1}^2* ^3", OriginalCallerName(), "^2's vote for ", vote_called_display, "^2 was rejected\n");
        VoteReset();
        Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_VOTE_FAIL);
 }
 
 void VoteTimeout()
 {
-       bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2's vote for ", vote_called_display, "^2 timed out\n");
+       bprint("\{1}^2* ^3", OriginalCallerName(), "^2's vote for ", vote_called_display, "^2 timed out\n");
        VoteReset();
        Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_VOTE_FAIL);
 }
@@ -821,6 +830,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm
                        else // everything went okay, continue with calling the vote
                        {
                                vote_caller = caller; // remember who called the vote
+                               vote_caller_name = strzone(GetCallerName(vote_caller));
                                vote_called = VOTE_NORMAL;
                                vote_called_command = strzone(vote_parsed_command);
                                vote_called_display = strzone(vote_parsed_display);
@@ -836,7 +846,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm
                                FOR_EACH_REALCLIENT(tmp_player) { ++tmp_playercount; }
                                if(tmp_playercount > 1) { Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_VOTE_CALL); } // don't announce a "vote now" sound if player is alone
 
-                               bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2 calls a vote for ", vote_called_display, "\n");
+                               bprint("\{1}^2* ^3", OriginalCallerName(), "^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
@@ -917,6 +927,7 @@ void VoteCommand_master(float request, entity caller, float argc, string vote_co
                                                else // everything went okay, continue with creating vote
                                                {
                                                        vote_caller = caller;
+                                                       vote_caller_name = strzone(GetCallerName(vote_caller));
                                                        vote_called = VOTE_MASTER;
                                                        vote_called_command = strzone("XXX");
                                                        vote_called_display = strzone("^3master");
@@ -925,7 +936,7 @@ void VoteCommand_master(float request, entity caller, float argc, string vote_co
                                                        caller.vote_selection = VOTE_SELECT_ACCEPT;
                                                        caller.vote_waittime = time + autocvar_sv_vote_wait;
 
-                                                       bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2 calls a vote to become ^3master^2.\n");
+                                                       bprint("\{1}^2* ^3", OriginalCallerName(), "^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
@@ -989,7 +1000,7 @@ void VoteCommand_status(float request, entity caller) // BOTH
                case CMD_REQUEST_COMMAND:
                {
                        if(vote_called)
-                               print_to(caller, strcat("^7Vote for ", vote_called_display, "^7 called by ^7", GetCallerName(vote_caller), "^7."));
+                               print_to(caller, strcat("^7Vote for ", vote_called_display, "^7 called by ^7", OriginalCallerName(), "^7."));
                        else
                                print_to(caller, "^1No vote called.");
 
index 3c2845451d49653dacded2e1fbb712b808ba7141..f80785e2a12f8c4935654a8e1853141fb4c5653a 100644 (file)
@@ -24,6 +24,7 @@ const float VOTE_MASTER = 2;
 
 // global vote information declarations
 entity vote_caller; // original caller of the current vote
+string vote_caller_name; // name of the vote caller
 float vote_called; // stores status of current vote (See VOTE_*)
 float vote_endtime; // time when the vote is finished
 float vote_accept_count; // total amount of players who accept the vote (counted by VoteCount() function)
index 49e340c4970edff02b39fe1d3c208e57dbee47bd..9e907e86638ca4c769fcc648958be62b29e84525 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef SERVER_DEFS_H
 #define SERVER_DEFS_H
 
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 
 #define INDEPENDENT_ATTACK_FINISHED
 
@@ -452,6 +452,29 @@ float round_starttime; //point in time when the countdown to round start is over
 .float stat_sv_airspeedlimit_nonqw;
 .float stat_sv_maxspeed;
 
+// new properties
+.float stat_sv_jumpvelocity;
+.float stat_sv_airaccel_qw_stretchfactor;
+.float stat_sv_maxairstrafespeed;
+.float stat_sv_maxairspeed;
+.float stat_sv_airstrafeaccelerate;
+.float stat_sv_warsowbunny_turnaccel;
+.float stat_sv_airaccel_sideways_friction;
+.float stat_sv_aircontrol;
+.float stat_sv_aircontrol_power;
+.float stat_sv_aircontrol_penalty;
+.float stat_sv_warsowbunny_airforwardaccel;
+.float stat_sv_warsowbunny_topspeed;
+.float stat_sv_warsowbunny_accel;
+.float stat_sv_warsowbunny_backtosideratio;
+.float stat_sv_friction;
+.float stat_sv_accelerate;
+.float stat_sv_stopspeed;
+.float stat_sv_airaccelerate;
+.float stat_sv_airstopaccelerate;
+
+.string cvar_cl_physics;
+
 void W_Porto_Remove (entity p);
 
 .int projectiledeathtype;
index 1e7e72a1254b071efed0698119456530ed5c9de0..24bce642d8c7509785f328464225ec793e34daa0 100644 (file)
@@ -18,7 +18,7 @@
 #include "../common/playerstats.qh"
 #include "../common/teams.qh"
 #include "../common/util.qh"
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 #include "../csqcmodellib/sv_model.qh"
 #include "../warpzonelib/common.qh"
 
index 49f495bc4a86dd5ed4c8a8dc19ae042aaff5de64..9dce060cc453e4fdbb98bacb60db727cf5d96694 100644 (file)
@@ -10,7 +10,7 @@
     #include "../common/constants.qh"
     #include "../common/teams.qh"
     #include "../common/util.qh"
-    #include "../common/weapons/weapons.qh"
+    #include "../common/weapons/all.qh"
     #include "weapons/accuracy.qh"
     #include "weapons/csqcprojectile.qh"
     #include "weapons/selection.qh"
index c101236f8974cbe84d497cf7f72d74eb30ea37c7..4a3f3101ac663eaf3b92c0a31f27f97ac4ae5365 100644 (file)
@@ -12,7 +12,7 @@
 #include "vehicles/vehicle.qh"
 #include "../common/constants.qh"
 #include "../common/util.qh"
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 #include "../warpzonelib/common.qh"
 #include "../warpzonelib/server.qh"
 
index 82a81776a366c5f5567c286e3ce9152c2ae6e2de..13d63dab3fd28fca0beef5f61d38b9ac7ec428aa 100644 (file)
 #include "../common/constants.qh"
 #include "../common/deathtypes.qh"
 #include "../common/mapinfo.qh"
-#include "../common/monsters/monsters.qh"
+#include "../common/monsters/all.qh"
 #include "../common/monsters/sv_monsters.qh"
 #include "../common/notifications.qh"
 #include "../common/playerstats.qh"
 #include "../common/stats.qh"
 #include "../common/teams.qh"
 #include "../common/util.qh"
-#include "../common/weapons/weapons.qh"
+#include "../common/items/all.qh"
+#include "../common/weapons/all.qh"
 
 const float LATENCY_THINKRATE = 10;
 .float latency_sum;
@@ -188,6 +189,8 @@ void cvar_changes_init()
                BADCVAR("g_configversion");
                BADCVAR("g_maplist_index");
                BADCVAR("halflifebsp");
+               BADCVAR("sv_mapformat_is_quake2");
+               BADCVAR("sv_mapformat_is_quake3");
                BADPREFIX("sv_world");
 
                // client
@@ -270,6 +273,7 @@ void cvar_changes_init()
                BADCVAR("g_domination_default_teams");
                BADCVAR("g_freezetag");
                BADCVAR("g_freezetag_teams");
+               BADCVAR("g_invasion_teams");
                BADCVAR("g_keepaway");
                BADCVAR("g_keyhunt");
                BADCVAR("g_keyhunt_teams");
@@ -373,6 +377,7 @@ void cvar_changes_init()
                BADCVAR("g_ca_teams_override");
                BADCVAR("g_ctf_ignore_frags");
                BADCVAR("g_domination_point_limit");
+               BADCVAR("g_domination_teams_override");
                BADCVAR("g_freezetag_teams_override");
                BADCVAR("g_friendlyfire");
                BADCVAR("g_fullbrightitems");
@@ -393,6 +398,7 @@ void cvar_changes_init()
                BADCVAR("g_nexball_goallimit");
                BADCVAR("g_powerups");
                BADCVAR("g_start_delay");
+               BADCVAR("g_tdm_teams_override");
                BADCVAR("g_warmup");
                BADCVAR("g_weapon_stay"); BADPRESUFFIX("g_", "_weapon_stay");
                BADCVAR("hostname");
@@ -556,6 +562,7 @@ void spawnfunc___init_dedicated_server(void)
        // needs to be done so early because of the constants they create
        CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
        CALL_ACCUMULATED_FUNCTION(RegisterMonsters);
+       CALL_ACCUMULATED_FUNCTION(RegisterItems);
        CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
        CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
        CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
@@ -604,6 +611,7 @@ void spawnfunc_worldspawn (void)
        // needs to be done so early because of the constants they create
        CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
        CALL_ACCUMULATED_FUNCTION(RegisterMonsters);
+       CALL_ACCUMULATED_FUNCTION(RegisterItems);
        CALL_ACCUMULATED_FUNCTION(RegisterGametypes);
        CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
        CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
@@ -817,6 +825,27 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw);
        addstat(STAT_MOVEVARS_AIRSTRAFEACCEL_QW, AS_FLOAT, stat_sv_airstrafeaccel_qw);
 
+       // new properties
+       addstat(STAT_MOVEVARS_JUMPVELOCITY, AS_FLOAT, stat_sv_jumpvelocity);
+       addstat(STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, AS_FLOAT, stat_sv_airaccel_qw_stretchfactor);
+       addstat(STAT_MOVEVARS_MAXAIRSTRAFESPEED, AS_FLOAT, stat_sv_maxairstrafespeed);
+       addstat(STAT_MOVEVARS_MAXAIRSPEED, AS_FLOAT, stat_sv_maxairspeed);
+       addstat(STAT_MOVEVARS_AIRSTRAFEACCELERATE, AS_FLOAT, stat_sv_airstrafeaccelerate);
+       addstat(STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL, AS_FLOAT, stat_sv_warsowbunny_turnaccel);
+       addstat(STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, AS_FLOAT, stat_sv_airaccel_sideways_friction);
+       addstat(STAT_MOVEVARS_AIRCONTROL, AS_FLOAT, stat_sv_aircontrol);
+       addstat(STAT_MOVEVARS_AIRCONTROL_POWER, AS_FLOAT, stat_sv_aircontrol_power);
+       addstat(STAT_MOVEVARS_AIRCONTROL_PENALTY, AS_FLOAT, stat_sv_aircontrol_penalty);
+       addstat(STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, AS_FLOAT, stat_sv_warsowbunny_airforwardaccel);
+       addstat(STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED, AS_FLOAT, stat_sv_warsowbunny_topspeed);
+       addstat(STAT_MOVEVARS_WARSOWBUNNY_ACCEL, AS_FLOAT, stat_sv_warsowbunny_accel);
+       addstat(STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, AS_FLOAT, stat_sv_warsowbunny_backtosideratio);
+       addstat(STAT_MOVEVARS_FRICTION, AS_FLOAT, stat_sv_friction);
+       addstat(STAT_MOVEVARS_ACCELERATE, AS_FLOAT, stat_sv_accelerate);
+       addstat(STAT_MOVEVARS_STOPSPEED, AS_FLOAT, stat_sv_stopspeed);
+       addstat(STAT_MOVEVARS_AIRACCELERATE, AS_FLOAT, stat_sv_airaccelerate);
+       addstat(STAT_MOVEVARS_AIRSTOPACCELERATE, AS_FLOAT, stat_sv_airstopaccelerate);
+
        // secrets
        addstat(STAT_SECRETS_TOTAL, AS_FLOAT, stat_secrets_total);
        addstat(STAT_SECRETS_FOUND, AS_FLOAT, stat_secrets_found);
index e0f79f1144fbc1862256e3ffdd7391fab573c1d0..1aa054d07eba3d8a722812977edb9acf330ac3ad 100644 (file)
@@ -1,7 +1,7 @@
 #include "item_key.qh"
 #include "_all.qh"
 
-#include "../common/monsters/monsters.qh"
+#include "../common/monsters/all.qh"
 #include "../common/notifications.qh"
 #include "../common/util.qh"
 #include "../warpzonelib/util_server.qh"
index 41f388ed53c15bd5c21b03836b88ea711e588e6f..556ad393a69effdae610e01137accc520346c58b 100644 (file)
@@ -21,7 +21,7 @@
 #include "../common/teams.qh"
 #include "../common/urllib.qh"
 #include "../common/util.qh"
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 #include "../csqcmodellib/sv_model.qh"
 #include "../warpzonelib/anglestransform.qh"
 #include "../warpzonelib/server.qh"
@@ -449,6 +449,7 @@ void GetCvars(float f)
        GetCvars_handleFloat(s, f, cvar_cl_autoscreenshot, "cl_autoscreenshot");
        GetCvars_handleFloat(s, f, cvar_cl_jetpack_jump, "cl_jetpack_jump");
        GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion");
+       GetCvars_handleString(s, f, cvar_cl_physics, "cl_physics");
        GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap");
        GetCvars_handleFloat(s, f, cvar_cl_clippedspectating, "cl_clippedspectating");
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
@@ -580,7 +581,7 @@ void readplayerstartcvars()
        s = cvar_string("g_weaponarena");
        if (s == "0" || s == "")
        {
-               if(g_ca)
+               if(g_ca || g_freezetag)
                        s = "most";
        }
 
@@ -709,7 +710,7 @@ void readplayerstartcvars()
                warmup_start_weapons_default = start_weapons_default;
                warmup_start_weapons_defaultmask = start_weapons_defaultmask;
 
-               if (!g_weaponarena && !g_ca)
+               if (!g_weaponarena && !g_ca && !g_freezetag)
                {
                        warmup_start_ammo_shells = cvar("g_warmup_start_ammo_shells");
                        warmup_start_ammo_nails = cvar("g_warmup_start_ammo_nails");
@@ -1270,7 +1271,7 @@ void SetCustomizer(entity e, float(void) customizer, void(void) uncustomizer)
 }
 
 
-void Net_LinkEntity(entity e, float docull, float dt, bool(entity, int) sendfunc)
+void Net_LinkEntity(entity e, bool docull, float dt, bool(entity, int) sendfunc)
 {
     vector mi, ma;
 
index a8a9117d59e07307cc6677af1086fb776b0af8e9..b9ae44be93a490619ddc01f0d505cb0352151b72 100644 (file)
@@ -15,7 +15,7 @@
 #else
 string cvar_string_normal(string n)
 {
-       if (!(cvar_type(n) & 1))
+       if (!(cvar_type(n) & CVAR_TYPEFLAG_EXISTS))
                backtrace(strcat("Attempt to access undefined cvar: ", n));
        return builtin_cvar_string(n);
 }
@@ -468,6 +468,6 @@ 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);
+void Net_LinkEntity(entity e, bool docull, float dt, bool(entity, int) sendfunc);
 
 #endif
index 38e9ad8a3b39a27530021e9e3156f2484157e140..101bdece81d943748c9be2b44e75894451601345 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "../command/vote.qh"
 
-#include "../../common/monsters/monsters.qh"
+#include "../../common/monsters/all.qh"
 
 #include "../command/common.qh"
 
index 3b251e73bd48b28487750a36cf2510b60375761c..fd3a9deb407fecfeefc7140f412428ff60ab0ceb 100644 (file)
@@ -524,6 +524,21 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerPreThink)
        return 1;
 }
 
+MUTATOR_HOOKFUNCTION(freezetag_SetStartItems)
+{
+       start_items &= ~IT_UNLIMITED_AMMO;
+       //start_health       = warmup_start_health       = cvar("g_lms_start_health");
+       //start_armorvalue   = warmup_start_armorvalue   = cvar("g_lms_start_armor");
+       start_ammo_shells  = warmup_start_ammo_shells  = cvar("g_lms_start_ammo_shells");
+       start_ammo_nails   = warmup_start_ammo_nails   = cvar("g_lms_start_ammo_nails");
+       start_ammo_rockets = warmup_start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
+       start_ammo_cells   = warmup_start_ammo_cells   = cvar("g_lms_start_ammo_cells");
+       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 0;
+}
+
 MUTATOR_HOOKFUNCTION(freezetag_BotRoles)
 {
        if (!self.deadflag)
@@ -571,6 +586,7 @@ MUTATOR_DEFINITION(gamemode_freezetag)
        MUTATOR_HOOK(reset_map_players, freezetag_reset_map_players, CBC_ORDER_ANY);
        MUTATOR_HOOK(GiveFragsForKill, freezetag_GiveFragsForKill, CBC_ORDER_FIRST);
        MUTATOR_HOOK(PlayerPreThink, freezetag_PlayerPreThink, CBC_ORDER_FIRST);
+       MUTATOR_HOOK(SetStartItems, freezetag_SetStartItems, CBC_ORDER_ANY);
        MUTATOR_HOOK(HavocBot_ChooseRole, freezetag_BotRoles, CBC_ORDER_ANY);
        MUTATOR_HOOK(GetTeamCount, freezetag_GetTeamCount, CBC_ORDER_EXCLUSIVE);
 
index 6cded536602ca0397b0d825bd5a7c43c5c8061e4..d7474fab45e3c75352109cdadc38b88426409556 100644 (file)
@@ -37,7 +37,7 @@
 #include "../../common/stats.qh"
 #include "../../common/teams.qh"
 
-#include "../../common/monsters/monsters.qh"
+#include "../../common/monsters/all.qh"
 
 #include "../../warpzonelib/anglestransform.qh"
 #include "../../warpzonelib/mathlib.qh"
index 4e8d1d6e3dfc2ee2f3f9f31cb4e5e6a925d4e539..315a12099b22bdcc1e666dd6af3b90d6e92f0e21 100644 (file)
@@ -466,7 +466,6 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerJump)
 {
        if(self.buffs & BUFF_JUMP)
                player_jumpheight = autocvar_g_buffs_jump_height;
-       self.stat_jumpheight = player_jumpheight;
 
        return false;
 }
@@ -758,7 +757,6 @@ void buffs_Initialize()
        precache_sound("keepaway/respawn.wav");
 
        addstat(STAT_BUFFS, AS_INT, buffs);
-       addstat(STAT_MOVEVARS_JUMPVELOCITY, AS_FLOAT, stat_jumpheight);
 
        InitializeEntity(world, buffs_DelayedInit, INITPRIO_FINDTARGET);
 }
index 06a76b1bba71c03d0d35e3c7a60dd511d69aff00..2d72e5b666d8ab34fa693e78bc1c9ecb29d18e1c 100644 (file)
@@ -9,9 +9,6 @@
 .float buff_invisible_prev_alpha;
 // flight
 .float buff_flight_prev_gravity;
-// jump
-.float stat_jumpheight;
-//const float STAT_MOVEVARS_JUMPVELOCITY = 250; // engine hack
 // disability
 .float buff_disability_time;
 .float buff_disability_effect_time;
index 2e6b195809da44ad840071cc7bebe7df1ef54eef..161dba90deb0c68d22f65ee5e65b96d4cf87de33 100644 (file)
@@ -5,23 +5,61 @@
 #include "../cl_client.qh"
 #include "../../common/buffs.qh"
 
+#include "../../common/items/item.qh"
+
+#define WITH(it) this.m_##it;
+#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
+
+float instagib_respawntime_ammo = 45;
+float instagib_respawntimejitter_ammo = 0;
+GETTER(float, instagib_respawntime_ammo)
+GETTER(float, instagib_respawntimejitter_ammo)
+
+REGISTER_ITEM(VaporizerCells, Pickup, APPLY(UNWORDS
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/a_cells.md3"
+    ,   sound               =   "misc/itempickup.wav"
+    ,   name                =   "Vaporizer Ammo"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   100
+    ,   itemid              =   IT_CELLS
+    ,   respawntime         =         GET(instagib_respawntime_ammo)
+    ,   respawntimejitter   =   GET(instagib_respawntimejitter_ammo)
+    )
+))
+
+REGISTER_ITEM(ExtraLife, Pickup, APPLY(UNWORDS
+    ,APPLY(CONFIGURE
+    ,   model               =   "models/items/g_h100.md3"
+    ,   sound               =   "misc/megahealth.wav"
+    ,   name                =   "Extralife"
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   BOT_PICKUP_RATING_HIGH
+    ,   itemflags           =   FL_POWERUP
+    ,   itemid              =   IT_NAILS
+    ,   respawntime         =         GET(g_pickup_respawntime_powerup)
+    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_powerup)
+    )
+))
+
+#undef WITH
+#undef CONFIGURE
+
 void spawnfunc_item_minst_cells (void)
 {
        if (!g_instagib) { remove(self); return; }
        if (!self.ammo_cells)
                self.ammo_cells = autocvar_g_instagib_ammo_drop;
 
-       StartItem ("models/items/a_cells.md3",
-                          "misc/itempickup.wav", 45, 0,
-                          "Vaporizer Ammo", IT_CELLS, 0, 0, generic_pickupevalfunc, 100);
+       StartItemA (ITEM_VaporizerCells);
 }
 
 void instagib_health_mega()
 {
        self.max_health = 1;
-       StartItem ("models/items/g_h100.md3",
-                          "misc/megahealth.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
-                          "Extralife", IT_NAILS, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
+       StartItemA (ITEM_ExtraLife);
 }
 
 .float instagib_nextthink;
index 4c591446b734ab70a252f4bf16f5a799cbdd438f..4debaa5a88e9d3891b611f30f81dd17a82976359 100644 (file)
     #include "../../common/command/command.qh"
     #include "../../common/net_notice.qh"
     #include "../../common/animdecide.qh"
-    #include "../../common/monsters/monsters.qh"
+    #include "../../common/monsters/all.qh"
     #include "../../common/monsters/sv_monsters.qh"
     #include "../../common/monsters/spawn.qh"
     #include "../../common/weapons/config.qh"
-    #include "../../common/weapons/weapons.qh"
+    #include "../../common/weapons/all.qh"
     #include "../weapons/accuracy.qh"
     #include "../weapons/common.qh"
     #include "../weapons/csqcprojectile.qh"
index b9d32e106dc61106412390ec048fcb1fd375b646..cb671ddc70fd7840b5cf0a027dadb24fc6a489f9 100644 (file)
@@ -9,7 +9,7 @@
 #include "../common/deathtypes.qh"
 #include "../common/notifications.qh"
 #include "../common/util.qh"
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 #include "../csqcmodellib/sv_model.qh"
 #include "../warpzonelib/anglestransform.qh"
 #include "../warpzonelib/util_server.qh"
index 20b28a410ddc9183295357042b5edb34de04b038..75301d592972ee3e67ade8b01a84a72c7d188f19 100644 (file)
@@ -67,7 +67,7 @@ bot/havocbot/role_keyhunt.qc
 bot/havocbot/role_onslaught.qc
 bot/havocbot/roles.qc
 
-command/commands.qc
+command/all.qc
 
 mutators/mutators_include.qc
 mutators/mutators.qc
@@ -97,7 +97,7 @@ weapons/weaponsystem.qc
 ../common/campaign_file.qc
 ../common/campaign_setup.qc
 ../common/mapinfo.qc
-../common/monsters/monsters.qc
+../common/monsters/all.qc
 ../common/monsters/spawn.qc
 ../common/monsters/sv_monsters.qc
 ../common/nades.qc
@@ -107,8 +107,11 @@ weapons/weaponsystem.qc
 ../common/test.qc
 ../common/urllib.qc
 ../common/util.qc
+
+../common/items/all.qc
+
 ../common/weapons/config.qc
-../common/weapons/weapons.qc // TODO
+../common/weapons/all.qc // TODO
 
 ../csqcmodellib/sv_model.qc
 
index 5982d20284532a23020c7dc76e95ce96523a04b8..0f7d1763b0ce2ebf184661f5ad8182f7173498b2 100644 (file)
@@ -18,7 +18,7 @@
 #include "../common/mapinfo.qh"
 #include "../common/util.qh"
 
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 
 #include "../csqcmodellib/sv_model.qh"
 
index 6839091f4a4b4f5a97af1578dc94a7da832f487c..f817957c8213d62df0ea1dd856bb446760708728 100644 (file)
@@ -1,5 +1,7 @@
 #include "t_items.qh"
 
+#include "../common/items/all.qc"
+
 #if defined(SVQC)
     #include "_all.qh"
 
@@ -20,9 +22,9 @@
     #include "../common/notifications.qh"
     #include "../common/util.qh"
 
-    #include "../common/monsters/monsters.qh"
+    #include "../common/monsters/all.qh"
 
-    #include "../common/weapons/weapons.qh"
+    #include "../common/weapons/all.qh"
 
     #include "../warpzonelib/util_server.qh"
 #endif
@@ -663,6 +665,8 @@ float Item_GiveTo(entity item, entity player)
        return 1;
 }
 
+.entity itemdef;
+
 void Item_Touch (void)
 {
        entity e, head;
@@ -702,8 +706,9 @@ void Item_Touch (void)
                self.invincible_finished = max(0, self.invincible_finished - time);
                self.superweapons_finished = max(0, self.superweapons_finished - time);
        }
-
-       if(!Item_GiveTo(self, other))
+       entity it = self.itemdef;
+       bool gave = (it && it.instanceOfPickup) ? ITEM_HANDLE(Pickup, it, self, other) : Item_GiveTo(self, other);
+       if (!gave)
        {
                if (self.classname == "droppedweapon")
                {
@@ -724,9 +729,7 @@ void Item_Touch (void)
 
        if (self.classname == "droppedweapon")
                remove (self);
-       else if (!self.spawnshieldtime)
-               return;
-       else
+       else if (self.spawnshieldtime)
        {
                if(self.team)
                {
@@ -1151,12 +1154,19 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                return;
        }
 }
+
+void StartItemA (entity a)
+{
+    self.itemdef = a;
+    StartItem(a.m_model, a.m_sound, a.m_respawntime(), a.m_respawntimejitter(), a.m_name, a.m_itemid, 0, a.m_itemflags, a.m_pickupevalfunc, a.m_botvalue);
+}
+
 void spawnfunc_item_rockets (void) {
        if(!self.ammo_rockets)
                self.ammo_rockets = g_pickup_rockets;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-       StartItem ("models/items/a_rockets.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "rockets", IT_ROCKETS, 0, 0, commodity_pickupevalfunc, 3000);
+    StartItemA (ITEM_Rockets);
 }
 
 void spawnfunc_item_bullets (void) {
@@ -1174,7 +1184,7 @@ void spawnfunc_item_bullets (void) {
                self.ammo_nails = g_pickup_nails;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-       StartItem ("models/items/a_bullets.mdl", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "bullets", IT_NAILS, 0, 0, commodity_pickupevalfunc, 2000);
+    StartItemA (ITEM_Bullets);
 }
 
 void spawnfunc_item_cells (void) {
@@ -1182,7 +1192,7 @@ void spawnfunc_item_cells (void) {
                self.ammo_cells = g_pickup_cells;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-       StartItem ("models/items/a_cells.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "cells", IT_CELLS, 0, 0, commodity_pickupevalfunc, 2000);
+       StartItemA (ITEM_Cells);
 }
 
 void spawnfunc_item_plasma()
@@ -1191,7 +1201,7 @@ void spawnfunc_item_plasma()
                self.ammo_plasma = g_pickup_plasma;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-       StartItem ("models/items/a_cells.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "plasma", IT_PLASMA, 0, 0, commodity_pickupevalfunc, 2000);
+       StartItemA (ITEM_Plasma);
 }
 
 void spawnfunc_item_shells (void) {
@@ -1209,7 +1219,7 @@ void spawnfunc_item_shells (void) {
                self.ammo_shells = g_pickup_shells;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-       StartItem ("models/items/a_shells.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "shells", IT_SHELLS, 0, 0, commodity_pickupevalfunc, 500);
+       StartItemA (ITEM_Shells);
 }
 
 void spawnfunc_item_armor_small (void) {
@@ -1219,7 +1229,7 @@ void spawnfunc_item_armor_small (void) {
                self.max_armorvalue = g_pickup_armorsmall_max;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_armorsmall_anyway;
-       StartItem ("models/items/item_armor_small.md3", "misc/armor1.wav", g_pickup_respawntime_short, g_pickup_respawntimejitter_short, "5 Armor", IT_ARMOR_SHARD, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
+       StartItemA (ITEM_ArmorSmall);
 }
 
 void spawnfunc_item_armor_medium (void) {
@@ -1229,7 +1239,7 @@ void spawnfunc_item_armor_medium (void) {
                self.max_armorvalue = g_pickup_armormedium_max;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_armormedium_anyway;
-       StartItem ("models/items/item_armor_medium.md3", "misc/armor10.wav", g_pickup_respawntime_medium, g_pickup_respawntimejitter_medium, "25 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
+       StartItemA (ITEM_ArmorMedium);
 }
 
 void spawnfunc_item_armor_big (void) {
@@ -1239,7 +1249,7 @@ void spawnfunc_item_armor_big (void) {
                self.max_armorvalue = g_pickup_armorbig_max;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_armorbig_anyway;
-       StartItem ("models/items/item_armor_big.md3", "misc/armor17_5.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "50 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, 20000);
+       StartItemA (ITEM_ArmorBig);
 }
 
 void spawnfunc_item_armor_large (void) {
@@ -1249,7 +1259,7 @@ void spawnfunc_item_armor_large (void) {
                self.max_armorvalue = g_pickup_armorlarge_max;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_armorlarge_anyway;
-       StartItem ("models/items/item_armor_large.md3", "misc/armor25.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "100 Armor", IT_ARMOR, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
+       StartItemA (ITEM_ArmorLarge);
 }
 
 void spawnfunc_item_health_small (void) {
@@ -1259,7 +1269,7 @@ void spawnfunc_item_health_small (void) {
                self.health = g_pickup_healthsmall;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_healthsmall_anyway;
-       StartItem ("models/items/g_h1.md3", "misc/minihealth.wav", g_pickup_respawntime_short, g_pickup_respawntimejitter_short, "5 Health", IT_5HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
+       StartItemA (ITEM_HealthSmall);
 }
 
 void spawnfunc_item_health_medium (void) {
@@ -1269,7 +1279,7 @@ void spawnfunc_item_health_medium (void) {
                self.health = g_pickup_healthmedium;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_healthmedium_anyway;
-       StartItem ("models/items/g_h25.md3", "misc/mediumhealth.wav", g_pickup_respawntime_short, g_pickup_respawntimejitter_short, "25 Health", IT_25HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
+    StartItemA (ITEM_HealthMedium);
 }
 
 void spawnfunc_item_health_large (void) {
@@ -1279,17 +1289,17 @@ void spawnfunc_item_health_large (void) {
                self.health = g_pickup_healthlarge;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_healthlarge_anyway;
-       StartItem ("models/items/g_h50.md3", "misc/mediumhealth.wav", g_pickup_respawntime_medium, g_pickup_respawntimejitter_medium, "50 Health", IT_25HP, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_MID);
+       StartItemA (ITEM_HealthLarge);
 }
 
 void spawnfunc_item_health_mega (void) {
-               if(!self.max_health)
-                       self.max_health = g_pickup_healthmega_max;
-               if(!self.health)
-                       self.health = g_pickup_healthmega;
-               if(!self.pickup_anyway)
-                       self.pickup_anyway = g_pickup_healthmega_anyway;
-               StartItem ("models/items/g_h100.md3", "misc/megahealth.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "100 Health", IT_HEALTH, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
+    if(!self.max_health)
+        self.max_health = g_pickup_healthmega_max;
+    if(!self.health)
+        self.health = g_pickup_healthmega;
+    if(!self.pickup_anyway)
+        self.pickup_anyway = g_pickup_healthmega_anyway;
+    StartItemA (ITEM_HealthMega);
 }
 
 // support old misnamed entities
@@ -1303,13 +1313,13 @@ void spawnfunc_item_strength (void) {
                precache_sound("weapons/strength_fire.wav");
                if(!self.strength_finished)
                        self.strength_finished = autocvar_g_balance_powerup_strength_time;
-               StartItem ("models/items/g_strength.md3", "misc/powerup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Strength Powerup", IT_STRENGTH, 0, FL_POWERUP, generic_pickupevalfunc, 100000);
+               StartItemA (ITEM_Strength);
 }
 
 void spawnfunc_item_invincible (void) {
                if(!self.invincible_finished)
                        self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
-               StartItem ("models/items/g_invincible.md3", "misc/powerup_shield.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Shield", IT_INVINCIBLE, 0, FL_POWERUP, generic_pickupevalfunc, 100000);
+               StartItemA (ITEM_Shield);
 }
 
 // compatibility:
@@ -1470,7 +1480,7 @@ void spawnfunc_item_fuel(void)
                self.ammo_fuel = g_pickup_fuel;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-       StartItem ("models/items/g_fuel.md3", "misc/itempickup.wav", g_pickup_respawntime_ammo, g_pickup_respawntimejitter_ammo, "Fuel", IT_FUEL, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
+       StartItemA (ITEM_JetpackFuel);
 }
 
 void spawnfunc_item_fuel_regen(void)
@@ -1480,7 +1490,7 @@ void spawnfunc_item_fuel_regen(void)
                spawnfunc_item_fuel();
                return;
        }
-       StartItem ("models/items/g_fuelregen.md3", "misc/itempickup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Fuel regenerator", IT_FUEL_REGEN, 0, FL_POWERUP, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
+       StartItemA (ITEM_JetpackRegen);
 }
 
 void spawnfunc_item_jetpack(void)
@@ -1492,7 +1502,7 @@ void spawnfunc_item_jetpack(void)
                spawnfunc_item_fuel();
                return;
        }
-       StartItem ("models/items/g_jetpack.md3", "misc/itempickup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Jet pack", IT_JETPACK, 0, FL_POWERUP, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW);
+       StartItemA (ITEM_Jetpack);
 }
 
 float GiveWeapon(entity e, float wpn, float op, float val)
index 7470d2f05b70feedf6a15e1a6e06095ec6c2b4c6..a33e45a82c388acbb55dd9cf59fe4c1819752803 100644 (file)
@@ -11,13 +11,13 @@ const int IT_FUEL_REGEN                     =      32; // fuel regeneration trigger
 // where is 64... ?
 const int IT_FUEL                                      =     128;
 // -Wdouble-declaration
-// const int IT_SHELLS                                 =     256;
+#define IT_SHELLS                                        256
 // -Wdouble-declaration
-// const int IT_NAILS                                  =     512;
+#define IT_NAILS                                         512
 // -Wdouble-declaration
-// const int IT_ROCKETS                                =    1024;
+#define IT_ROCKETS                                      1024
 // -Wdouble-declaration
-// const int IT_CELLS                                  =    2048;
+#define IT_CELLS                                        2048
 const int IT_SUPERWEAPON                               =    4096;
 const int IT_STRENGTH                                  =    8192;
 const int IT_INVINCIBLE                                =   16384;
index cec1a7f6bcc79765122095452bbc3d14ea6ce383..40d6a4d4365e4a18a2b09efb7a19d74f002392be 100644 (file)
@@ -13,7 +13,7 @@
 #include "../common/notifications.qh"
 #include "../common/util.qh"
 
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 
 #include "../csqcmodellib/sv_model.qh"
 
index 9e68ac8124f2d56a4743939125f9d31370166c06..517b8808225f50773e2e9b303af7ff717ac33f3c 100644 (file)
@@ -1,6 +1,6 @@
 #include "_all.qh"
 
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 
 void spawnfunc_weapon_electro();
 void spawnfunc_weapon_hagar();
index 2c5bd894ea54bd4c78c28f6ca3e33ef4d21074b2..6908b6dbf18500f2927971f6441f2cbd04602831 100644 (file)
@@ -1,6 +1,6 @@
 #include "_all.qh"
 
-#include "../common/weapons/weapons.qh"
+#include "../common/weapons/all.qh"
 #include "../common/buffs.qh"
 
 void spawnfunc_weapon_crylink();
index 1c80c3ac04c2ebcc4224b9fdae521c4dc187e62c..20b49ec6aec640d413d5b6dde4ef3d10b2e15c81 100644 (file)
@@ -4,7 +4,7 @@
        #include "_all.qh"
 
     #include "../warpzonelib/util_server.qh"
-    #include "../common/weapons/weapons.qh"
+    #include "../common/weapons/all.qh"
     #include "../common/deathtypes.qh"
 #endif
 
index c675c9cbfdc3ecb6bf88707765f9c42f36d587bc..520306223453544c1df28e24eb7b7bcaf462383e 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef VEHICLES_H
-#define VEHICLES_H
+#ifndef VEHICLES_ALL_H
+#define VEHICLES_ALL_H
 
 #if VEHICLES_ENABLED
 #   include "racer.qh"
index bfa18464f0a998790108c4d274726b2a67bcc23d..1ef81a409eaae283ed2a456deb748a7d851e24eb 100644 (file)
@@ -5,7 +5,7 @@
 #include "../../common/constants.qh"
 #include "../../common/teams.qh"
 #include "../../common/util.qh"
-#include "../../common/weapons/weapons.qh"
+#include "../../common/weapons/all.qh"
 
 float accuracy_byte(float n, float d)
 {
index a837b2e47fd5f00c917943b95883d91d56f80449..cf49b54f8b0b169e5702d4e0a010a64af51e6fc5 100644 (file)
@@ -6,7 +6,7 @@
 #include "../../common/deathtypes.qh"
 #include "../../common/notifications.qh"
 #include "../../common/util.qh"
-#include "../../common/weapons/weapons.qh"
+#include "../../common/weapons/all.qh"
 
 void W_GiveWeapon (entity e, float wep)
 {
index fef16a833b48ab9fa9add93bf1b8de5fc7e715f3..507fc4a413b792d6d5450d3591c6442c6d438036 100644 (file)
@@ -6,7 +6,7 @@
 #include "../command/common.qh"
 
 #include "../../common/constants.qh"
-#include "../../common/weapons/weapons.qh"
+#include "../../common/weapons/all.qh"
 
 .float csqcprojectile_type;
 
index c93b319530b5df6407d9453a895b3e7106d553da..76e159738fbfc02d9f900bf2dd2c5d93714cc192 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "../antilag.qh"
 #include "../g_subs.qh"
-#include "../../common/weapons/weapons.qh"
+#include "../../common/weapons/all.qh"
 
 vector W_HitPlotUnnormalizedUntransform(vector screenforward, vector screenright, vector screenup, vector v)
 {
index da9b00a184e218338bad00edef85439f52f86c4f..89c4253a13f125d6a0e4c0d97aa6920de1c2a9db 100644 (file)
@@ -6,7 +6,7 @@
 #include "../waypointsprites.qh"
 #include "../../common/constants.qh"
 #include "../../common/util.qh"
-#include "../../common/weapons/weapons.qh"
+#include "../../common/weapons/all.qh"
 
 // switch between weapons
 void Send_WeaponComplain(entity e, float wpn, float type)
index 9d46475af52c6cc4096224e8a4fb3a3c5156790d..9096b2f9c72d9ff3e54063ec33a1d0be7cbcd0bb 100644 (file)
@@ -4,7 +4,7 @@
 #include "weaponsystem.qh"
 #include "../mutators/mutators_include.qh"
 #include "../t_items.qh"
-#include "../../common/weapons/weapons.qh"
+#include "../../common/weapons/all.qh"
 
 string W_Apply_Weaponreplace(string in)
 {
index 6b549993ab1a90f999899a247cd4b00f2f2e7d9f..1fea5fb39318350f86b4ffeb13c40c5652ed9b54 100644 (file)
@@ -9,7 +9,7 @@
 #include "../../common/mapinfo.qh"
 #include "../../common/notifications.qh"
 #include "../../common/util.qh"
-#include "../../common/weapons/weapons.qh"
+#include "../../common/weapons/all.qh"
 
 void thrown_wep_think()
 {
index 2a3181d1b2d3987ccf529a964038db1039214035..0bdecfd0df376c3eebfd519d998380616c42015d 100644 (file)
@@ -12,7 +12,7 @@
 #include "../../common/constants.qh"
 #include "../../common/util.qh"
 
-#include "../../common/weapons/weapons.qh"
+#include "../../common/weapons/all.qh"
 
 #include "../../warpzonelib/common.qh"
 
index fb668ae7c52b7ce0391cae62316518580cf260a0..a84969904a300fbe57bbeba78039b967141eea25 100644 (file)
@@ -4,7 +4,7 @@
 #include "../g_world.qh"
 
 #include "../../common/urllib.qh"
-#include "../../common/weapons/weapons.qh"
+#include "../../common/weapons/all.qh"
 
 void WeaponStats_Init()
 {
index accf5b2f0fab1681c4eacdd456e5edc075e2079e..588c68acfffb5b6357b2a02fe0617046a6b1b555 100644 (file)
@@ -9,10 +9,10 @@
 #include "../t_items.qh"
 #include "../../common/animdecide.qh"
 #include "../../common/constants.qh"
-#include "../../common/monsters/monsters.qh"
+#include "../../common/monsters/all.qh"
 #include "../../common/notifications.qh"
 #include "../../common/util.qh"
-#include "../../common/weapons/weapons.qh"
+#include "../../common/weapons/all.qh"
 #include "../../csqcmodellib/sv_model.qh"
 
 /*
index 0734811c181108981470782c4fe31fd929c15188..028724afba3a69e2c1a61f7991660b7eb7ea1e49 100644 (file)
@@ -5,7 +5,7 @@
     #include "../server/t_items.qh"
 #elif defined(MENUQC)
 #elif defined(SVQC)
-    #include "../common/weapons/weapons.qh"
+    #include "../common/weapons/all.qh"
     #include "../dpdefs/dpextensions.qh"
        #include "../dpdefs/progsdefs.qh"
 #endif